?
Path : /home/admin/public_html/old/administrator/components/com_jpopup/models/ |
Current File : /home/admin/public_html/old/administrator/components/com_jpopup/models/jpopup.php |
<?php // No direct access defined( '_JEXEC' ) or die( 'Restricted access' ); jimport( 'joomla.application.component.model' ); class JPopupModelJPopup extends JModel { var $_count=''; var $_js_function_name=''; var $_params; var $params; function getDecode($encode) { jimport('joomla.plugin.helper'); $plugin = JPluginHelper::getPlugin('content','jpopup'); $this->params = new JParameter($plugin->params); $GLOBALS['jpopup_code'] = <<<END <!--Starting the jpopup code--> <script language="javascript" type="text/javascript" src='[mosConfig_live_site]plugins/content/jpopup/script/external.js'></script> <script src="[mosConfig_live_site]plugins/content/jpopup/script/prototype.js" type="text/javascript"></script> <script src="[mosConfig_live_site]plugins/content/jpopup/script/effects.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> function startPopUp[count](){ new Effect.[jpopup_weffect_start]('pWinConfg[count]', {duration:[jpopup_weffect_start_duration], delay:[jpopup_wdelay]}); } function endPopUp[count](){ new Effect.[jpopup_weffect_close]('pWinConfg[count]', {duration:[jpopup_weffect_close_duration]}); } </script> <div class="jpopup" style="font-family:[jpopup_wfont]; display:none; font-size:[jpopup_wfontsize]; position:absolute; width:[jpopup_width]; height:[jpopup_height]; background-color:[jpopup_bgcolor]; top:[jpopup_top]; left:[jpopup_left]; border-style:[jpopup_borderstyle]; border-width:[jpopup_bwidth]; border-color:[jpopup_bcolor]; padding:[jpopup_padding]; filter: progid:DXImageTransform.Microsoft.Shadow(color=[jpopup_wshadow],direction=135);" id="pWinConfg[count]"> <span id='jpopup_close' style="[jpopup_wclose_css]"> <a href="javascript:endPopUp[count]();" >[jpopup_Close]</a> <small><a href='http://www.joomlaplug.com'>JPopup!</a></small> </span><br /> [jpopup_CODE] </div> <script language="javascript" type="text/javascript"> if('[jpopup_onclick]' != 'yes') startPopUp[count](); </script> <!--Ending the jpopup code--> END; $GLOBALS['jpopup_variables'] = array( 'jpopup_wfont'=>'Arial, Verdana, Sans-Serif', 'jpopup_wfontsize'=>'11px', 'jpopup_width'=>'240', 'jpopup_height'=>'200', 'jpopup_centered'=>'1', 'jpopup_bgcolor'=>'#FFFFFF', 'jpopup_padding'=>'8', 'jpopup_top'=>'20', 'jpopup_left'=>'100', 'jpopup_borderstyle'=>'solid', 'jpopup_bwidth'=>'1', 'jpopup_bcolor'=>'#FEF688', 'jpopup_wdelay'=>'1', 'jpopup_wshadow'=>'#666666', 'jpopup_wclose'=>'Close!', 'jpopup_wclose_css'=>'', 'margin_left'=>'', 'margin_top'=>'', 'jpopup_weffect_start_duration'=>'3', 'jpopup_weffect_close_duration'=>'3', 'jpopup_weffect_start'=>'Appear', 'jpopup_weffect_close'=>'Fade', 'jpopup_onclick'=>'no', 'jpopup_onclick_text'=>'', 'jpopup_onclick_text_style'=>'' ); if( strpos( $encode, 'jpopup' ) === false || strpos( $encode, '/jpopup' ) === false || trim($encode)=='' ) { return -1; } // define the regular expression for the bot $regex = "#{jpopup(.*?)}(.*?){/jpopup}#s"; // perform the replacement $encode = preg_replace_callback( $regex, array(get_class($this), '_botjpopup_replacer'), $encode); return $encode; } function _botjpopup_replacer( $matches ) { $this->_params = array(); $mosConfig_live_site = JURI::root(); $this->_count++; $this->_js_function_name = $this->_count.'_'.mktime(); foreach($GLOBALS['jpopup_variables'] as $var=>$value) $this->_params[$var] = $this->params->get($var); $options = explode("|",$matches[1]); foreach($options as $option) if($option!=""){ list($key, $value) = explode("=", $option); $key = trim($key); if($key!="") $this->_params[$key]=trim($value); } $code = $GLOBALS['jpopup_code']; $text = $matches[2]; if($this->_params['jpopup_centered']==1){ $this->_params['jpopup_top'] = '40%'; $this->_params['jpopup_left'] = '60%'; $this->_params['margin_left'] = '-320'; $this->_params['margin_top'] = '-205'; }else{ $this->_params['margin_left']='0'; $this->_params['margin_top']='0'; } foreach($GLOBALS['jpopup_variables'] as $var=>$value){ $add_pixels = ''; switch($var){ case 'jpopup_width': case 'jpopup_height': case 'jpopup_padding': case 'jpopup_top': case 'jpopup_left': case 'margin_left': case 'margin_top': if(trim($this->_params[$var]) != "" && ctype_digit($this->_params[$var])) $add_pixels = 'px'; break; } if($this->_params[$var] == "") $this->_params[$var]=$this->params->get($var); $code = str_replace("[$var]", $this->_params[$var].$add_pixels, $code); } $code = str_replace("[mosConfig_live_site]", $mosConfig_live_site, $code); $code = str_replace("[jpopup_Close]", $this->_params['jpopup_wclose'], $code); $code = str_replace("[count]", $this->_js_function_name, $code); $text2 = str_replace( "[jpopup_CODE]", $text , $code); if($this->_params['jpopup_onclick'] == 'yes') $text2 .= '<a href="javascript:startPopUp'.($this->_js_function_name).'()" style="'.$this->_params['jpopup_onclick_text_style'].'">'.$this->_params['jpopup_onclick_text'].'</a>'; return $text2; } }