示例#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();
 }
示例#2
0
    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>';
    }
示例#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;
 }
<div class="cspLeftCol">
<?php 
echo htmlCsp::ajaxfile('logo_image', array('url' => uriCsp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'options', 'action' => 'saveLogoImg', 'reqType' => 'ajax')), 'buttonName' => 'Select Logo image', 'responseType' => 'json', 'onSubmit' => 'toeOptLogoImgOnSubmitNewFile', 'onComplete' => 'toeOptLogoImgCompleteSubmitNewFile'));
?>
<div id="cspOptLogoImgkMsg"></div>
<br />
<img id="cspOptLogoImgPrev" 
		src="<?php 
echo $this->optModel->isEmpty('logo_image') ? '' : frameCsp::_()->getModule('options')->getLogoImgFullPath();
?>
" 
style="max-width: 200px;" />
</div>
<div class="cspRightCol">
    <div class="cspTip cspTipArrowLeft nomargin">
        <?php 
langCsp::_e('Choose your logo, you can use png, jpg or gif image file.');
?>
        <span class="cspTipCorner"></span>
    </div>
    <br />
    <div class="cspTip cspTipArrowDown nomargin">
        <?php 
langCsp::_e('You can use default logo, your own or disable it. To disable logo on Coming Soon page click "Remove image" button bellow.');
?>
        <span class="cspTipCorner"></span>
    </div> <br /> 
    
    <?php 
echo htmlCsp::button(array('value' => langCsp::_('Remove image'), 'attrs' => 'id="cspLogoRemove" class="button button-large" style="width:100%;"'));
?>
<script type="text/javascript">
// <!--
jQuery(document).ready(function(){
	postboxes.add_postbox_toggles(pagenow);
});
// -->
</script>
<form id="cspAdminTemplateOptionsForm">
	<div>
		<?php 
echo htmlCsp::inputButton(array('value' => langCsp::_('Сhoose Preset template'), 'attrs' => 'class="cspSetTemplateOptionButton button button-primary button-large"'));
?>
		<a href="<?php 
echo uriCsp::_(array('mod' => 'coming_soon'));
?>
" target="_blank" class="cspPreviewSiteTemplateOptionButton button button-primary button-large"><?php 
langCsp::_e('Show Preview');
//echo htmlCsp::inputButton(array('value' => langCsp::_('Сhoose Preset template'), 'attrs' => 'class="cspSetTemplateOptionButton button button-primary button-large"'));
?>
</a>
	</div>
	<div class="wrap">
		<div id="dashboard-widgets" class="metabox-holder">
			<div id="postbox-container-1" class="postbox-container" style="width: auto;">
				<div id="normal-sortables" class="meta-box-sortables ui-sortable">
				<?php 
if (!empty($this->tplOptsData)) {
    ?>
					<?php 
    $i = 1;
    ?>
示例#6
0
 public function getSocImgPath($imgName)
 {
     $template = frameCsp::_()->getModule('options')->get('template');
     if (!empty($template) && frameCsp::_()->getModule($template)) {
         if (utilsCsp::fileExists(frameCsp::_()->getModule($template)->getModDir() . 'img' . DS . $imgName)) {
             return frameCsp::_()->getModule($template)->getModPath() . 'img/' . $imgName;
         }
     }
     return uriCsp::_(CSP_IMG_PATH . $imgName);
 }
示例#7
0
 public function addSettingsLinkForPlug($links)
 {
     array_unshift($links, '<a href="' . uriCsp::_(array('baseUrl' => admin_url('admin.php'), 'page' => frameCsp::_()->getModule('adminmenu')->getView()->getMainSlug())) . '">' . langCsp::_('Settings') . '</a>');
     return $links;
 }
示例#8
0
 public function getConfirmLink($email)
 {
     $token = frameCsp::_()->getTable('subscribers')->get('token', array('email' => $email), '', 'one');
     return uriCsp::_(array('pl' => CSP_CODE, 'mod' => 'subscribe', 'action' => 'confirm', 'email' => $email, 'token' => $token));
 }
示例#9
0
 public function addAdminBarNotice($wp_admin_bar)
 {
     $wp_admin_bar->add_menu(array('id' => 'comingsoon', 'parent' => 'top-secondary', 'title' => langCsp::_('Coming Soon Mode is Enabled'), 'href' => uriCsp::_(array('baseUrl' => admin_url('admin.php'), 'page' => frameCsp::_()->getModule('adminmenu')->getView()->getMainSlug())), 'meta' => array('title' => langCsp::_('Coming Soon Mode is Enabled'), 'class' => frameCsp::_()->getModule('options')->get('mode') == 'disable' ? 'cspHidden' : '')));
 }
示例#10
0
 public static function ajaxfile($name, $params = array('url' => '', 'value' => '', 'fid' => '', 'buttonName' => ''))
 {
     $out = '';
     if (strpos($params['url'], 'pl=' . CSP_CODE) === false) {
         $params['url'] = uriCsp::_(array('baseUrl' => $params['url'], 'pl' => CSP_CODE));
     }
     $out .= self::button(array('value' => langCsp::_(empty($params['buttonName']) ? 'Upload' : $params['buttonName']), 'attrs' => 'id="toeUploadbut_' . $name . '" class="button button-large"'));
     $display = empty($params['value']) ? 'style="display: none;"' : '';
     if (isset($params['preview']) && $params['preview']) {
         $out .= self::img($params['value'], 0, array('attrs' => 'id="prev_' . $name . '" ' . $display . ' class="previewpicture"'));
     }
     $out .= '<span class="delete_option" id="delete_' . $name . '" ' . $display . '></span>';
     $out .= '<script type="text/javascript">// <!--
             jQuery(document).ready(function(){
                 new AjaxUpload("#toeUploadbut_' . $name . '", { 
                     action: "' . $params['url'] . '", 
                     name: "' . $name . '" ' . (empty($params['data']) ? '' : ',  data: ' . $params['data'] . '') . (empty($params['autoSubmit']) ? '' : ',  autoSubmit: "' . $params['autoSubmit'] . '"') . (empty($params['responseType']) ? '' : ',  responseType: "' . $params['responseType'] . '"') . (empty($params['onChange']) ? '' : ',  onChange: ' . $params['onChange'] . '') . (empty($params['onSubmit']) ? '' : ',  onSubmit: ' . $params['onSubmit'] . '') . (empty($params['onComplete']) ? '' : ',  onComplete: ' . $params['onComplete'] . '') . '});
             });
         // --></script>';
     return $out;
 }
示例#11
0
 /**
  * Replace symbols to special html caracters in one output
  */
 public static function oneHtmlEnc()
 {
     self::$_oneHtmlEnc = true;
 }
示例#12
0
 public function addStyle($handle, $src = false, $deps = array(), $ver = false, $media = 'all')
 {
     $src = empty($src) ? $src : uriCsp::_($src);
     $this->_styles[] = array('handle' => $handle, 'src' => $src, 'deps' => $deps, 'ver' => $ver, 'media' => $media);
 }
示例#13
0
<table width="100%">
    <tr class="cspBodyCells">
        <td>
            <div class="cspLeftCol">
			<?php 
echo htmlCsp::hidden('opt_values[favico]', array('value' => $this->optsModel->get('favico'), 'attrs' => 'id="favico_value_input"'));
?>
                <?php 
langCsp::_e('Favico for site');
?>
:
                <?php 
echo htmlCsp::ajaxfile('favico', array('url' => uriCsp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'options', 'action' => 'saveFavico', 'reqType' => 'ajax')), 'value' => $this->optsModel->get('favico'), 'onSubmit' => 'favicoPreLoading', 'onComplete' => 'favicoUploadComplete'));
?>
            </div>
        </td>
		<td>
		<a id='removeFavicoImage'>Remove</a>
			<div class='showUploadedFavico'>
				
				<img src='<?php 
echo frameCsp::_()->getModule('options')->getFavicoFullPath();
?>
'/>
				<div class='loader'>
					
				</div>
				<div id="cspAdminMetaOptionsMsg" class="cspSuccessMsg"></div>
			</div>
			
		</td>
            <?php 
langCsp::_e('Select Color:');
?>
			<?php 
echo htmlCsp::colorpicker('opt_values[bg_color]', array('value' => $this->optModel->get('bg_color')));
?>
			<br />
			<?php 
echo htmlCsp::button(array('value' => langCsp::_('Set default'), 'attrs' => 'id="cspColorBgSetDefault"'));
?>
			<div id="cspAdminOptColorDefaultMsg"></div>
		</td>
		<td id="cspBgTypeImage-selection" colspan="2">
            <div class="cspLeftCol">
                <?php 
echo htmlCsp::ajaxfile('bg_image', array('url' => uriCsp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'options', 'action' => 'saveBgImg', 'reqType' => 'ajax')), 'buttonName' => 'Select Background image', 'responseType' => 'json', 'attrs' => 'class="button button-large"', 'onSubmit' => 'toeOptImgOnSubmitNewFile', 'onComplete' => 'toeOptImgCompleteSubmitNewFile'));
?>
                <div id="cspOptImgkMsg"></div>            
                <br />
                <img id="cspOptBgImgPrev" src="<?php 
echo $this->optModel->isEmpty('bg_image') ? '' : frameCsp::_()->getModule('options')->getBgImgFullPath();
?>
" style="max-width: 200px;" />
			</div>
            <div class="cspRightCol">
                <div class="cspBgImgShowTypeWrapper">
                    <?php 
echo htmlCsp::radiobutton('opt_values[bg_img_show_type]', array('value' => 'stretch', 'attrs' => 'id="cspBgImgShowType-stretch"', 'checked' => $this->optModel->get('bg_img_show_type') == 'stretch'));
?>
                    <label for="cspBgImgShowType-stretch" class="button button-large"><?php 
langCsp::_e('Stretch');