예제 #1
0
    public function execute() {
        $task  = new Pap_Install_CreateAccountTask();
        $task->setupDefaultBannerWrappers();

        $row = new Pap_Db_BannerWrapper();
        $row->setId('script');
        $row->setName('##Script##');
        $row->setCode('<script type="text/javascript" src="{$'.Pap_Merchants_Config_BannerWrapperService::CONST_HTMLJSURL.'}"></script>');
        $row->save();

        $update = new Gpf_SqlBuilder_UpdateBuilder();
        $update->from->add(Pap_Db_Table_Banners::getName());
        $update->set->add(Pap_Db_Table_Banners::WRAPPER_ID, 'plain');
        $update->execute();
        
        $this->updateWrapper(
        array(Pap_Common_Banner_Factory::BannerTypeHtml), 
        Pap_Db_Table_Banners::DATA1);

        $this->updateWrapper(
        array(Pap_Common_Banner_Factory::BannerTypeImage, Pap_Common_Banner_Factory::BannerTypeText), 
        Pap_Db_Table_Banners::DATA3);
        
        $this->updateWrapper(
        array(Pap_Common_Banner_Factory::BannerTypeFlash, Pap_Features_HoverBanner_Hover::TYPE_HOVER), 
        Pap_Db_Table_Banners::DATA4);
    }
    public function setupDefaultBannerWrappers(){
        $row = new Pap_Db_BannerWrapper();
        $row->setId('plain');
        $row->setName(Gpf_Lang::_runtime('Plain'));
        $row->setCode('{$'. Pap_Merchants_Config_BannerWrapperService::CONST_HTML.'}');
        $row->save();

        $row = new Pap_Db_BannerWrapper();
        $row->setId('iframe');
        $row->setName(Gpf_Lang::_runtime('Iframe'));
        $row->setCode('<script type="text/javascript">'.
                      'document.write("<iframe name=\'banner\' src=\'{$'.Pap_Merchants_Config_BannerWrapperService::CONST_HTMLCOMPL.'}\''.
                      ' framespacing=\'0\' frameborder=\'no\' scrolling=\'no\' width=\'{$'.Pap_Merchants_Config_BannerWrapperService::CONST_WIDTH.'}\''.
                      ' height=\'{$'.Pap_Merchants_Config_BannerWrapperService::CONST_HEIGHT.'}\' allowtransparency=\'true\'>'.
                      '<a href=\'{$'.Pap_Merchants_Config_BannerWrapperService::CONST_CLICKURL.'}\' target=\'_top\'>{$'.Pap_Merchants_Config_BannerWrapperService::CONST_NAME.'}</a></iframe>");'."\n".
                      '</script>'."\n".
                      '<noscript>'."\n".
                      '<h2><a href="{$'.Pap_Merchants_Config_BannerWrapperService::CONST_TARGETURL.'}">{$'.Pap_Merchants_Config_BannerWrapperService::CONST_NAME.'}</a></h2>'."\n".
                      '</noscript>');
        $row->save();

        $row = new Pap_Db_BannerWrapper();
        $row->setId('popunder');
        $row->setName(Gpf_Lang::_runtime('PopUnder'));
        $row->setCode('<script type="text/javascript">
if (typeof pap_o == "undefined") {var pap_o  = document.onmouseup;if (typeof pap_o == "undefined")pap_o = function(){return true;};function papSetC($Name,$Value,$EndH){var exdate=new Date();$EndH=exdate.getHours()+$EndH;exdate.setHours($EndH);document.cookie=$Name+ "=" +escape($Value)+(($EndH==null) ? "" : ";expires="+exdate.toGMTString()+";path=/;");}function papGetC($Name){if (document.cookie.length>0){$Start=document.cookie.indexOf($Name + "=");if($Start!=-1){$Start=$Start + $Name.length+1;$End=document.cookie.indexOf(";",$Start);if ($End==-1)$End=document.cookie.length;return unescape(document.cookie.substring($Start,$End));}}return "";}}if (navigator.cookieEnabled && !papGetC("pap{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}")){papSetC("pap{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}", 1, 12);var pap_o_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '} = document.onmouseup;if (typeof pap_o_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}  =="undefined")pap_o_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}  = function(){return true;};document.onmouseup=function(){$puw_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}=window.open("{$htmlcompleteurl}","_blank","height={$height}, width={$width}, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no");if($puw_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '})$puw_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}.blur();pap_o_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}();document.onmouseup="pap_o();";}}
</script>');
        $row->save();

        $row = new Pap_Db_BannerWrapper();
        $row->setId('popup');
        $row->setName(Gpf_Lang::_runtime('PopUp'));
        $row->setCode('<script type="text/javascript">
if (typeof pap_o == "undefined") {var pap_o  = document.onmouseup;if (typeof pap_o == "undefined") pap_o = function(){return true;};function papSetC($Name,$Value,$EndH){var exdate=new Date();$EndH=exdate.getHours()+$EndH;exdate.setHours($EndH);document.cookie=$Name+ "=" +escape($Value)+(($EndH==null) ? "" : ";expires="+exdate.toGMTString()+";path=/;");}function papGetC($Name) {if (document.cookie.length>0){$Start=document.cookie.indexOf($Name + "=");if ($Start!=-1) {$Start=$Start + $Name.length+1;$End=document.cookie.indexOf(";",$Start);if ($End==-1) $End=document.cookie.length;return unescape(document.cookie.substring($Start,$End));}}return "";}}if (navigator.cookieEnabled && !papGetC("pap{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}")) {papSetC("pap{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}", 1, 12);var pap_o_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '} = document.onmouseup;if (typeof pap_o_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}  =="undefined") pap_o_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}  = function(){return true;};document.onmouseup=function(){$puw_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}=window.open("{$htmlcompleteurl}","_blank","height={$height}, width={$width}, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no");pap_o_{$' . 
        Pap_Merchants_Config_BannerWrapperService::CONST_BANNERID . '}();document.onmouseup="pap_o();";};}
</script>');
        $row->save();

    }
 /**
  *  @service banner_format_setting write
  */
 public function addWrapper(Gpf_Rpc_Params $params) {
     $action = new Gpf_Rpc_Action($params);
     try {
         foreach ($action->getIds() as $name) {
             $row = new Pap_Db_BannerWrapper();
             $row->setName($name);
             $row->insert();
         }
     } catch (Exception $e) {
         $action->setErrorMessage($e->getMessage());
         $action->addError();
     }
     return $action;
 }