| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/eadsa/plugins/content/ |
Upload File : |
<?php
/**
* @package Auto ShadowBox for Joomla! 1.5
* @version $Id: autoshadowbox.php 599 2010-11-09 00:00:05Z Tsanas Dimitrios $
* @author Tsanas Dimitrios
* @copyright (C) 2010 Tsanas Dimitrios
* @Website: http://www.tsanas.gr
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
**/
defined( '_JEXEC' ) or die( 'Restricted access' );
$mainframe->registerEvent( 'onPrepareContent', 'plgAutoShadowbox' );
function plgAutoShadowBox( &$row, &$params, $page=0 )
{
$db =& JFactory::getDBO();
// Simple performance check to determine whether bot should process further
if ( JString::strpos( $row->text, '{sb}' ) === false ) {
return true;
}
if ( JString::strpos( $row->text, '{/sb}' ) === false ) {
return true;
}
// Get plugin info
$plugin =& JPluginHelper::getPlugin( 'content', 'autoshadowbox' );
// Expression to search for
$regex = '#{sb}(.*?){/sb}#s';
$pluginParams = new JParameter( $plugin->params );
// Check whether plugin has been unpublished
if ( !$pluginParams->get( 'enabled', 1 ) ) {
$row->text = preg_replace( $regex, '', $row->text );
return true;
}
// find all instances of plugin and put in $matches
preg_match_all( $regex, $row->text, $matches );
// Number of matches
$count = count( $matches[0] );
// Plugin proceeds only if matches are found
if ( $count ) {
// Get plugin parameters
$style = $pluginParams->def( 'style', -2 );
plgAutoShadowBoxProcess( $row, $matches[0], $count, $regex, $style );
}
}
function plgAutoShadowBoxProcess ( &$row, &$matches, $count, $regex, $style )
{
jimport('domit.xml_saxy_shared');
for ( $i=0; $i < $count; $i++ ) {
$load = trim( $matches[$i] );
// Remove "{terminal}" from match
$load = str_replace("{sb}", "", $load);
// Remove "{/terminal}" from match
$load = str_replace("{/sb}", "", $load);
// Remove any spaces at the beggining or the end of the match
$load = trim( $load );
$xml = simplexml_load_string( $load );
// Create the terminal-like <div>
$outputs = '<a href="'. str_replace("_thumb", "", $xml["src"]) .'" rel="shadowbox" title="'. $xml["title"] .'">'. $load .'</a>';
// Replace match with the div
$row->text = str_replace( $matches[$i], $outputs, $row->text );
}
}