From d393fd0a3da2c1182bd1050d96b80df9e27be21b Mon Sep 17 00:00:00 2001 From: Ander Juaristi Date: Sat, 25 Jan 2014 21:47:28 +0100 Subject: [PATCH 1/4] Defined author and version --- plugin_component.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugin_component.php b/plugin_component.php index f2bed1b..24e6eef 100644 --- a/plugin_component.php +++ b/plugin_component.php @@ -3,7 +3,7 @@ # plugin_component.php - Include component plugin # ------------------------------------------------------------------------ # author Ander Juaristi -# copyright Copyright (C) 2013-2014 Ander Juaristi. All Rights Reserved. +# copyright Copyright (C) 2014 Ander Juaristi. All Rights Reserved. # @license - http://www.gnu.org/copyleft/gpl.html GNU/GPL # Websites: http://www.burgersoftware.es # Technical Support: http://www.burgersoftware.es @@ -13,6 +13,9 @@ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); +define('IC_AUTHOR', 'Ander Juaristi'); +define('IC_VERSION', 1.14.2); + jimport( 'joomla.plugin.plugin' ); jimport( 'joomla.html.parameter' ); @@ -520,7 +523,7 @@ function _process( $url ) { } } - $content = "\n"; $content .= "\n".$response; $content .= "\n"; @@ -632,4 +635,4 @@ function _addStyleSheet($style) { } } -?> \ No newline at end of file +?> From d8a5def8d258800119c116e70dc31fc81f1b6ad2 Mon Sep 17 00:00:00 2001 From: Ander Juaristi Date: Sun, 26 Jan 2014 14:18:51 +0100 Subject: [PATCH 2/4] Avoid copying the same code twice. --- plugin_component.php | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/plugin_component.php b/plugin_component.php index 24e6eef..7ebc3d7 100644 --- a/plugin_component.php +++ b/plugin_component.php @@ -102,26 +102,7 @@ public function onAfterInitialise() */ public function onContentPrepare($context, &$article, &$params, $limitstart=0) { - $app = JFactory::getApplication(); - if($app->isAdmin()) { - return; - } - - // get document types - $this->_getdoc(); - - $text = &$article->text; - $introtext = &$article->introtext; - - // check whether plugin has been unpublished - if ( !$this->params->get( 'enabled', 1 ) ) { - $text = preg_replace( $this->regex, '', $text ); - return true; - } - - // perform the replacement - $this->_replace( $text ); - $this->_replace( $introtext ); + return onPrepareContent($article); } /** From 834d668132fc2a8509c68df4e3f350ced30c80df Mon Sep 17 00:00:00 2001 From: Makushime Date: Mon, 18 Dec 2017 09:29:36 -0500 Subject: [PATCH 3/4] Add CURLOPT_FAILONERROR Add CURLOPT_FAILONERROR option to check if there is a 400+ HTTP error. --- plugin_component.php | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin_component.php b/plugin_component.php index 7ebc3d7..2a79134 100644 --- a/plugin_component.php +++ b/plugin_component.php @@ -539,6 +539,7 @@ function _getURL($url, $sef) { if (function_exists('curl_init')) { $ch = curl_init( $url ); // Set curl options, see: http://www.php.net/manual/en/function.curl-setopt.php + curl_setopt ($ch, CURLOPT_FAILONERROR, true); // check if there is a 400+ error curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); // to return the transfer as a string curl_setopt ($ch, CURLOPT_USERAGENT, 'spider'); // The contents of the "User-Agent: " header curl_setopt ($ch, CURLOPT_AUTOREFERER, true); // set referer on redirect From 1ea20870582e0ea24cd9c49d54b0d1b0935cb28c Mon Sep 17 00:00:00 2001 From: Makushime Date: Mon, 18 Dec 2017 09:40:24 -0500 Subject: [PATCH 4/4] Correction of PHP errors Correction for the call of the function "onPrepareContent" and to the version number --- plugin_component.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin_component.php b/plugin_component.php index 2a79134..b896a5c 100644 --- a/plugin_component.php +++ b/plugin_component.php @@ -14,7 +14,7 @@ defined( '_JEXEC' ) or die( 'Restricted access' ); define('IC_AUTHOR', 'Ander Juaristi'); -define('IC_VERSION', 1.14.2); +define('IC_VERSION', 1.15); jimport( 'joomla.plugin.plugin' ); jimport( 'joomla.html.parameter' ); @@ -102,7 +102,7 @@ public function onAfterInitialise() */ public function onContentPrepare($context, &$article, &$params, $limitstart=0) { - return onPrepareContent($article); + return $this->onPrepareContent($article); } /**