示例#1
0
function add_paginate($source, &$smarty)
{
    $oDir = new PDirCategory(dirname(__FILE__));
    $strUrl = $oDir->getUrl();
    $strNewHead = '<!-- add by plugin search engine to paginates the results -->
		<script type="text/javascript" src="' . $strUrl . 'include/jquery.paginate.js" ></script>
	';
    return str_replace('</head>', $strNewHead . "\n</head>", $source);
}
示例#2
0
function images_tools_addjs_fancyzoom_and_ifixpng($source, &$smarty)
{
    global $configFile;
    //to get the body id
    $oPlugin = new PPluginDir(dirname(__FILE__));
    $oConfigFile =& $oPlugin->oConfig;
    $oDir = new PDirCategory(dirname(__FILE__));
    $strUrl = $oDir->getUrl();
    //FANCYZOOM EFFECT
    $bFZEffect = $oConfigFile->getDirectParam("FANCYZOOM_EFFECT") === "true" ? true : false;
    if ($bFZEffect) {
        if (!($strFZParamFind = $oConfigFile->getDirectParam("FANCY_ZOOM_FIND"))) {
            $bFZEffect = false;
        }
        if ($bFZEffect && $strFZParamFind == 'auto') {
            if (!($strFckId = $configFile->getDirectParam('FCK_BODYID'))) {
                $bFZEffect = false;
            }
            $strFZParamFind = '$("img","#' . $strFckId . '")';
        } else {
            if ($bFZEffect && !preg_match('/^\\$/', $strFZParamFind)) {
                $strFZParamFind = '$("' . $strFZParamFind . '")';
            }
        }
        //$strFZParamFind = str_replace("\'",'"',$strFZParamFind);
        if (!($strFZOptions = $oConfigFile->getDirectParam("FANCY_ZOOM_OPTIONS"))) {
            $strFZOptions = '{}';
        }
        $strFZDefaultOptions = 'imgDir:\'' . $strUrl . 'js/ressources/\'';
        if ($oConfigFile->getDirectParam("SERVER_RESIZE") === "true") {
            $strFZDefaultOptions .= ', imgResizeScript:\'' . SITE_URL . 'imagestoolsresize.php\'';
        }
    }
    //IFIX PNG
    $bFPNGEffect = $oConfigFile->getDirectParam("IFIXPNG_EFFECT") === "true" ? true : false;
    if ($bFPNGEffect) {
        if (!($strFPNGParamFind = $oConfigFile->getDirectParam("IFIXPNG_FIND"))) {
            $bFPNGEffect = false;
        }
        if ($bFPNGEffect && $strFPNGParamFind == 'auto') {
            if (!($strFckId = $configFile->getDirectParam('FCK_BODYID'))) {
                $bFPNGEffect = false;
            }
            $strFPNGParamFind = "\$('img[src\$=\".png\"]','#" . $strFckId . "')";
        } else {
            if ($bFPNGEffect && !preg_match('/^\\$/', $strFPNGParamFind)) {
                $strFPNGParamFind = '$("' . $strFPNGParamFind . '")';
            }
        }
        //$strFPNGParamFind = str_replace("\'",'"',$strFPNGParamFind);
        $strImgBlankUrl = $strUrl . 'js/ressources/blank.gif';
    }
    if ($bFZEffect || $bFPNGEffect) {
        $strNewHead = '
		<!--// added by images_tools plugin -->
		<script language="JavaScript">
				$(function(){
					var tabScriptsToLoad = new Array();
					(!$.fn.ifixpng) && tabScriptsToLoad.push("' . $strUrl . 'js/jquery.ifixpng.js");
		';
        if ($bFZEffect) {
            $strNewHead .= '
					(!$.fn.fancyzoom) && tabScriptsToLoad.push("' . $strUrl . 'js/jquery.fancyzoom.js");
					(!$.fn.shadow) && tabScriptsToLoad.push("' . $strUrl . 'js/jquery.shadow.js");
			
					var fzeffect = function(){
						var fzoptions = $.extend({' . $strFZDefaultOptions . '},' . $strFZOptions . ');
						' . $strFZParamFind . '.fancyzoom(fzoptions);
					};
			';
        }
        if ($bFPNGEffect) {
            $strNewHead .= '
				var pngeffect = function(){
					$.ifixpng("' . $strImgBlankUrl . '");
					' . $strFPNGParamFind . '.ifixpng();
				}
			';
        }
        $strNewHead .= '
					var imagestoolseffects = function(){
		';
        $strNewHead .= $bFZEffect ? '				fzeffect();' . "\n" : '';
        $strNewHead .= $bFPNGEffect ? '				pngeffect();' . "\n" : '';
        $strNewHead .= '						
					};
		';
        $strNewHead .= '
					(tabScriptsToLoad.length > 0) && loadJS(tabScriptsToLoad, imagestoolseffects);
					(tabScriptsToLoad.length == 0) && imagestoolseffects();
				});
		</script>
		<!--// end added by images_tools plugin -->
		';
        return str_ireplace('</head>', $strNewHead . "\n</head>", $source);
    }
    return $source;
}