0 Пользователей и 1 Гость просматривают эту тему.
  • 1 Ответов
  • 670 Просмотров
*

1-F7

  • Захожу иногда
  • 197
  • 0 / 0
Помогите исправить ошибки php в плагине jautometa для joomla:

Strict Standards: Only variables should be assigned by reference in /kunden/112919_55497/kuehn/plugins/content/jautometa/jautometa.php on line 25:

Код
$app =& JFactory::getApplication();

Strict Standards: Only variables should be assigned by reference in /kunden/112919_55497/kuehn/plugins/content/jautometa/jautometa.php on line 71

Код
$document =& JFactory::getDocument();

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /kunden/112919_55497/kuehn/plugins/content/jautometa/jautometa.php on line 101

Код
content = preg_replace($regex, '', $content);

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /kunden/112919_55497/kuehn/plugins/content/jautometa/jautometa.php on line 141

Код
$keyw = preg_replace($regex, '', $keyw);


Вот весь файл jautometa.php:

Код
<?php
/**
* @version 2.2 jAutoMeta.php 2013-08-01
* @package Joomla
* @subpackage jAutoMeta
* @author VMLab
* @link http://www.vmlab.it/
* @copyright Copyright (C) 2012 - 2013 VMLab. All rights reserved.
* @license GNU/GPL
* This plugin will automatically generate Meta Tags from your articles content.
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.plugin.plugin' );

class  plgContentJautometa extends JPlugin {

public function __construct(&$subject, $config){
parent::__construct($subject, $config);
}

public function onContentPrepare($context, &$article, &$params, $page=0 ){
$app =& JFactory::getApplication();
        /* @var $app JApplication */

        if($app->isAdmin()) {
            return;
        }
       
        $doc     = JFactory::getDocument();
        /* @var $doc JDocumentHtml */
        $docType = $doc->getType();
       
        // Check document type
        if(strcmp("html", $docType)!= 0){
            return;
        }

$currentOption = JRequest::getCmd("option");
        $currentView = JRequest::getCmd("view");
       
        if( $currentOption != "com_content" || $currentView != "article" || !isset($this->params)) {
            return;           
        }

if($article->id==""){return;}

if ($context = 'com_content.article') {
$catsID = $this->params->get("category");
if($catsID){
$catsID = '@,'.str_replace(' ','',$catsID).',';
$artcatID = ','.$article->catid.',';
$selectedcategory = strpos($catsID,$artcatID);
if($selectedcategory > 0){
$replacemeta = true;
}else{
$replacemeta = false;
}
}else{
$replacemeta = true;
}

if($replacemeta){

$charset = $this->params->get("charset");
$length = $this->params->get("length");
$minlength = $this->params->get("minlength");
$count = $this->params->get("count");
$document =& JFactory::getDocument();

$description = $this->generateDescription($article->text,$charset);

$toKey = $description;

$description = rtrim(substr($description,0,$length));

$document->setMetaData('description', $description);

if($this->params->get("keywords") == "title")$generateKey = $article->title;
if($this->params->get("keywords") == "content")$generateKey = $toKey;
if($this->params->get("keywords") == "both")$generateKey = $article->title.' '.$toKey;

$keywords = $this->generateKeywords($generateKey,$minlength,$count,$charset);
$document->setMetaData('keywords', $keywords);
}
}
}

public function generateDescription($content,$charset){
$content = preg_replace( "'<script[^>]*>.*?</script>'si", '', $content );
$content = preg_replace( '/<!--.+?-->/', '', $content );
$content = preg_replace( '/{.+?}/', '', $content );
$content = strip_tags( $content );
$content = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $content );
$content = preg_replace('/<[^>]*>/', ' ', $content);

// Remove any email addresses
$regex = '/(([_A-Za-z0-9-]+)(\\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-]+)(\\.[A-Za-z0-9-]+)*)/iex';
$content = preg_replace($regex, '', $content);

// convert HTML entities to chars
$content = html_entity_decode($content,ENT_QUOTES,$charset);


$content = str_replace('"', '\'', $content); //Make sure all quotes play nice with meta.
$content = str_replace(array("\r\n", "\r", "\n", "\t"), " ", $content); //Change spaces to spaces

// remove any extra spaces
while (strchr($content,"  ")) {
$content = str_replace("  ", " ",$content);
}

// general sentence tidyup
for ($cnt = 1; $cnt < JString::strlen($content)-1; $cnt++) {
// add a space after any full stops or comma's for readability
// added as strip_tags was often leaving no spaces
if ( ($content{$cnt} == '.') || (($content{$cnt} == ',') && !(is_numeric($content{$cnt+1})))) {
if ($content{$cnt+1} != ' ') {
$content = JString::substr_replace($content, ' ', $cnt + 1, 0);
}
}
}

return trim($content);

}

public function generateKeywords($keyw,$minlength,$count,$charset){
$keyw = str_replace(array(",",".",";",":","!","(",")","?")," ",$keyw);
$keyw = preg_replace( "'<script[^>]*>.*?</script>'si", '', $keyw );
$keyw = preg_replace( '/<!--.+?-->/', '', $keyw );
$keyw = preg_replace( '/{.+?}/', '', $keyw );
//$keyw = strip_tags( $keyw );
$keyw = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $keyw );
$keyw = preg_replace('/<[^>]*>/', ' ', $keyw);

// Remove any email addresses
$regex = '/(([_A-Za-z0-9-]+)(\\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-]+)(\\.[A-Za-z0-9-]+)*)/iex';
$keyw = preg_replace($regex, '', $keyw);

// convert HTML entities to chars
$keyw = html_entity_decode($keyw,ENT_QUOTES,$charset);


$keyw = str_replace('"', '\'', $keyw); //Make sure all quotes play nice with meta.
$keyw = str_replace(array("\r\n", "\r", "\n", "\t"), " ", $keyw); //Change spaces to spaces

// remove any extra spaces
while (strchr($keyw,"  ")) {
$keyw = str_replace("  ", " ",$keyw);
}

// general sentence tidyup
for ($cnt = 1; $cnt < JString::strlen($keyw)-1; $cnt++) {
// add a space after any full stops or comma's for readability
// added as strip_tags was often leaving no spaces
if ( ($keyw{$cnt} == '.') || (($keyw{$cnt} == ',') && !(is_numeric($keyw{$cnt+1})))) {
if ($keyw{$cnt+1} != ' ') {
$keyw = JString::substr_replace($keyw, ' ', $cnt + 1, 0);
}
}
}

$keyw = str_replace(" ", ",", trim($keyw));

$stickArray = explode(",", $keyw);

$keysArray = array_count_values($stickArray);

arsort($keysArray);
$i = 1;
$keywords = "";
$gkeywords = "";

if (JString::strlen($keyw)>0) {
foreach($keysArray as $word => $instances){
if(JString::strlen(trim($word)) >= $minlength && is_string($word)){
if($i > $count)
break;
if(in_array($word,$stickArray)) {
$gkeywords .= $word . ",";
$i++;
}
}
}
}
$keywords = $gkeywords;
$keywords = JString::rtrim($keywords, ",");
return $keywords;
}
}
?>

Заранее благодарен за помощь.
*

1-F7

  • Захожу иногда
  • 197
  • 0 / 0
Re: Ошибки php в плагине jautometa для Joomla
« Ответ #1 : 31.07.2016, 16:52:17 »
Решил вопрос.
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Что хранится в таблице overrider Joomla 3?

Автор web1

Ответов: 2
Просмотров: 196
Последний ответ 04.04.2024, 22:10:48
от web1
Сохранить не удалось из-за ошибки: Содержимое превышает допустимые лимиты

Автор R31rus

Ответов: 21
Просмотров: 3347
Последний ответ 27.03.2024, 16:46:13
от Gorilla
reCAPTCHA V2 Google - Для Joomla 3

Автор Alex GOOD

Ответов: 35
Просмотров: 8335
Последний ответ 10.01.2024, 21:41:38
от Vastriet
Joomla 3.10.12 и MySQL 8

Автор designer71

Ответов: 0
Просмотров: 396
Последний ответ 19.10.2023, 11:25:18
от designer71
Почему Joomla не поддерживает формат webp?

Автор Sensession

Ответов: 74
Просмотров: 10621
Последний ответ 03.10.2023, 19:44:42
от fsv