Форум русской поддержки Joomla!® CMS
11.12.2016, 02:18:31 *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

Войти
   
   Начало   Поиск Joomla 3.0 FAQ Joomla 2.5 FAQ Joomla 1.5 FAQ Правила форума Новости Joomla Реклама Войти Регистрация Помощь  
Страниц: [1]   Вниз
  Добавить закладку  |  Печать  
Автор

Ошибки php в плагине jautometa для Joomla

 (Прочитано 85 раз)
0 Пользователей и 1 Гость смотрят эту тему.
1-F7
Давно я тут
****

Репутация: +0/-0
Offline Offline

Пол: Мужской
Сообщений: 219



« : 31.07.2016, 16:30:48 »

Помогите исправить ошибки 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
Давно я тут
****

Репутация: +0/-0
Offline Offline

Пол: Мужской
Сообщений: 219



« Ответ #1 : 31.07.2016, 17:52:17 »

Решил вопрос.
Записан
Страниц: [1]   Вверх
  Добавить закладку  |  Печать  
 
Перейти в:  

Powered by SMF 1.1.21 | SMF © 2006, Simple Machines

Joomlaforum.ru is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters
the trademark holder in the United States and other countries.

LiveInternet