Exemple #1
0
 public function init()
 {
     $isAdminPlugPage = frameCsp::_()->isAdminPlugPage();
     $isPluginsPage = utilsCsp::isPluginsPage();
     if (is_admin()) {
         if ($isAdminPlugPage || $isPluginsPage) {
             frameCsp::_()->addScript('jquery');
             frameCsp::_()->addScript('jquery-ui-tabs', '', array('jquery'));
             frameCsp::_()->addScript('jquery-ui-dialog', '', array('jquery'));
             frameCsp::_()->addScript('jquery-ui-button', '', array('jquery'));
             frameCsp::_()->addScript('farbtastic');
             frameCsp::_()->addScript('commonCsp', CSP_JS_PATH . 'common.js');
             frameCsp::_()->addScript('coreCsp', CSP_JS_PATH . 'core.js');
             frameCsp::_()->addScript('adminOptionsCsp', CSP_JS_PATH . 'admin.options.js');
             frameCsp::_()->addScript('ajaxupload', CSP_JS_PATH . 'ajaxupload.js');
             frameCsp::_()->addScript('postbox', get_bloginfo('wpurl') . '/wp-admin/js/postbox.js');
             add_thickbox();
             $ajaxurl = admin_url('admin-ajax.php');
             if (frameCsp::_()->getModule('options')->get('ssl_on_ajax')) {
                 $ajaxurl = uriCsp::makeHttps($ajaxurl);
             }
             $jsData = array('siteUrl' => CSP_SITE_URL, 'imgPath' => CSP_IMG_PATH, 'cssPath' => CSP_CSS_PATH, 'loader' => CSP_LOADER_IMG, 'close' => CSP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameCsp::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langCsp::getData(), 'options' => frameCsp::_()->getModule('options')->getAllowedPublicOptions(), 'CSP_CODE' => CSP_CODE, 'ball_loader' => CSP_IMG_PATH . 'ajax-loader-ball.gif', 'ok_icon' => CSP_IMG_PATH . 'ok-icon.png');
             $jsData['allCheckRegPlugs'] = modInstallerCsp::getCheckRegPlugs();
             $jsData = dispatcherCsp::applyFilters('jsInitVariables', $jsData);
             frameCsp::_()->addJSVar('coreCsp', 'CSP_DATA', $jsData);
             $this->_styles = array('styleCsp' => array('path' => CSP_CSS_PATH . 'style.css'), 'adminStylesCsp' => array('path' => CSP_CSS_PATH . 'adminStyles.css'), 'jquery-tabs' => array('path' => CSP_CSS_PATH . 'jquery-tabs.css'), 'jquery-buttons' => array('path' => CSP_CSS_PATH . 'jquery-buttons.css'), 'wp-jquery-ui-dialog' => array(), 'farbtastic' => array(), 'jquery-dialog' => array('path' => CSP_CSS_PATH . 'jquery-dialog.css'));
             $defaultPlugTheme = frameCsp::_()->getModule('options')->get('default_theme');
             foreach ($this->_styles as $s => $sInfo) {
                 if (isset($sInfo['for'])) {
                     if ($sInfo['for'] == 'frontend' && is_admin() || $sInfo['for'] == 'admin' && !is_admin()) {
                         continue;
                     }
                 }
                 $canBeSubstituted = true;
                 if (isset($sInfo['substituteFor'])) {
                     switch ($sInfo['substituteFor']) {
                         case 'frontend':
                             $canBeSubstituted = !is_admin();
                             break;
                         case 'admin':
                             $canBeSubstituted = is_admin();
                             break;
                     }
                 }
                 if ($canBeSubstituted && file_exists(CSP_TEMPLATES_DIR . $defaultPlugTheme . DS . $s . '.css')) {
                     frameCsp::_()->addStyle($s, CSP_TEMPLATES_PATH . $defaultPlugTheme . '/' . $s . '.css');
                 } elseif ($canBeSubstituted && file_exists(utilsCsp::getCurrentWPThemeDir() . 'csp' . DS . $s . '.css')) {
                     frameCsp::_()->addStyle($s, utilsCsp::getCurrentWPThemePath() . '/toe/' . $s . '.css');
                 } elseif (!empty($sInfo['path'])) {
                     frameCsp::_()->addStyle($s, $sInfo['path']);
                 } else {
                     frameCsp::_()->addStyle($s);
                 }
             }
         }
     }
     parent::init();
 }
    public function initJsVars()
    {
        $ajaxurl = admin_url('admin-ajax.php');
        if (frameCsp::_()->getModule('options')->get('ssl_on_ajax')) {
            $ajaxurl = uriCsp::makeHttps($ajaxurl);
        }
        $jsData = array('siteUrl' => CSP_SITE_URL, 'imgPath' => CSP_IMG_PATH, 'loader' => CSP_LOADER_IMG, 'close' => CSP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameCsp::_()->getModule('options')->get('js_animation_speed'), 'CSP_CODE' => CSP_CODE);
        return '<script type="text/javascript">
		// <!--
			var CSP_DATA = ' . utilsCsp::jsonEncode($jsData) . ';
		// -->
		</script>';
    }
Exemple #3
0
 public function overwriteProtocol($link, $id, $sample)
 {
     static $pagesCache;
     $makeHttpsReplace = false;
     if (frameCsp::_()->getModule('options')->get('ssl_on_checkout') || frameCsp::_()->getModule('options')->get('ssl_on_account')) {
         if (!isset($pagesCache[$id])) {
             $pageParams = $this->getByID($id);
             if ($pageParams == NULL) {
                 $pagesCache[$id] = false;
             } else {
                 $pagesCache[$id] = $pageParams;
             }
         }
         if ($pagesCache[$id] && is_object($pagesCache[$id])) {
             if (frameCsp::_()->getModule('options')->get('ssl_on_checkout') && ($pagesCache[$id]->mod == 'checkout' || $pagesCache[$id]->mod == 'user' && in_array($pagesCache[$id]->action, array('getShoppingCart'))) || frameCsp::_()->getModule('options')->get('ssl_on_account') && ($pagesCache[$id]->mod == 'user' && in_array($pagesCache[$id]->action, array('getLoginForm', 'getRegisterForm', 'getAccountSummaryHtml', 'getProfileHtml', 'getOrdersList')) || $pagesCache[$id]->mod == 'digital_product' && in_array($pagesCache[$id]->action, array('getDownloadsList')))) {
                 $makeHttpsReplace = true;
             }
         }
     }
     if ($makeHttpsReplace) {
         $link = uriCsp::makeHttps($link);
     }
     return $link;
 }