Current Path : /var/www/html/clients/kampol.e-nk.ru/plugins/content/ |
Current File : /var/www/html/clients/kampol.e-nk.ru/plugins/content/photogalleryfx.php |
<?php /** * @package Plugin Photo Gallery FX for Joomla! 1.5 * @version $Id: mod_photogalleryfx.php 28 April 2011 $ * @author FlashXML.net * @copyright (C) 2010 FlashXML.net * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html **/ defined('_JEXEC') or die('Restricted access'); $photogalleryfx_params = null; $mainframe->registerEvent('onPrepareContent', 'plgcontentphotogalleryfx'); function plgcontentphotogalleryfx(&$row, &$params, $page=0) { if (is_object($row)) { return plgphotogalleryfx($row->text, $params); } return plgphotogalleryfx($row, $params); } function plgphotogalleryfx(&$text, &$params) { if (JString::strpos($text, '{photogalleryfx') === false) { return true; } global $photogalleryfx_params; $photogalleryfx_params = array( 'embed_codes_count' => 0, 'swfobject_embedded' => false, 'wmode_values' => array( 'allowed' => array('transparent', 'window'), 'default' => 'transparent', ), 'regexp_match_keys' => array( 'width' => 1, 'height' => 2, 'settings' => 4, 'wmode' => 6, 'alternative_text' => 7, ), ); $text = preg_replace_callback('|{photogalleryfx\s+width=(\d+)\s+height=(\d+)(\s+settings=([^ ]+))?(\s+wmode=([a-z]+))?\s*}(.*){/photogalleryfx}|i', 'plgphotogalleryfxembedcode', $text); return true; } function plgphotogalleryfxembedcode($params) { global $photogalleryfx_params; $photogalleryfx_plugin_helper = JPluginHelper::getPlugin('content', 'photogalleryfx'); $pluginParams = new JParameter($photogalleryfx_plugin_helper->params); $photogallery_path = $pluginParams->get('photogalleryfx_path'); if (strpos($photogallery_path, '/') !== 0) { $photogallery_path = '/' . $photogallery_path; $pluginParams->def('photogalleryfx_path', $photogallery_path); } if (empty($photogalleryfx_params['swfobject_embedded'])) { global $mainframe; $mainframe->addCustomHeadTag('<script type="text/javascript" src="http'.(!empty($_SERVER['HTTPS']) ? 's' : '').'://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>'); $photogalleryfx_params['swfobject_embedded'] = true; } $photogalleryfx_width = (int)$params[$photogalleryfx_params['regexp_match_keys']['width']]; $photogalleryfx_height = (int)$params[$photogalleryfx_params['regexp_match_keys']['height']]; if ($photogalleryfx_width > 0 && $photogalleryfx_height > 0) { $photogalleryfx_params['embed_codes_count']++; $joomla_install_dir_in_url = rtrim(JURI::root(true), '/'); if (!empty($joomla_install_dir_in_url) && strpos($joomla_install_dir_in_url, '/') !== 0) { $joomla_install_dir_in_url = '/' . $joomla_install_dir_in_url; } if (empty($params[$photogalleryfx_params['regexp_match_keys']['wmode']])) { $photogallery_wmode = $pluginParams->get('photogalleryfx_wmode'); if (empty($photogallery_wmode)) { $photogallery_wmode = $photogalleryfx_params['wmode_values']['default']; } } else { $photogallery_wmode = in_array($params[$photogalleryfx_params['regexp_match_keys']['wmode']], $photogalleryfx_params['wmode_values']['allowed']) ? $params[$photogalleryfx_params['regexp_match_keys']['wmode']] : $photogalleryfx_params['wmode_values']['default']; } $settings_file_name = !empty($params[$photogalleryfx_params['regexp_match_keys']['settings']]) ? $params[$photogalleryfx_params['regexp_match_keys']['settings']] : 'settings.xml'; return '<div id="flashxmlphotogallery'.$photogalleryfx_params['embed_codes_count'].'">'.$params[$photogalleryfx_params['regexp_match_keys']['alternative_text']].'<a href="http://www.webmasters.by/articles/joomla/347-photo-gallery-for-joomla.html">download here</a></div><script type="text/javascript">'."swfobject.embedSWF('{$joomla_install_dir_in_url}{$photogallery_path}PhotoGalleryFX.swf', 'flashxmlphotogallery{$photogalleryfx_params['embed_codes_count']}', '{$photogalleryfx_width}', '{$photogalleryfx_height}', '9.0.0.0', '', { folderPath: '{$joomla_install_dir_in_url}{$photogallery_path}', settingsXML: '{$settings_file_name}', navigationSettingsXML: 'ImageScrollerFX/{$settings_file_name}', gallerySettingsXML: 'holder/{$settings_file_name}' }, { scale: 'noscale', salign: 'tl', wmode: '{$photogallery_wmode}', allowScriptAccess: 'sameDomain', allowFullScreen: true }, {});</script>"; } else { return '<!-- invalid Photo Gallery FX width and / or height -->'; } }