[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Помогите исправить ошибки php в плагине jautometa
Espey
Помогите исправить ошибки 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 © 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;
}
}

?>


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

_____________
www.godbook.cc.ua — Новый Завет!
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2025 Invision Power Services, Inc.