示例#1
0
文件: mod.php 项目: carlyns/RESUSblog
 public function getLink($params = array('id' => 0, 'mod' => '', 'action' => '', 'data' => array()))
 {
     if ($page = $this->getPage($params)) {
         $urlParams = array('page_id' => $page->page_id);
         if (!empty($params['data']) && is_array($params['data'])) {
             $urlParams = array_merge($urlParams, $params['data']);
         }
         return uriBup::_($urlParams);
     }
     return '';
 }
示例#2
0
    public function initJsVars()
    {
        $ajaxurl = admin_url('admin-ajax.php');
        if (frameBup::_()->getModule('options')->get('ssl_on_ajax')) {
            $ajaxurl = uriBup::makeHttps($ajaxurl);
        }
        $jsData = array('siteUrl' => BUP_SITE_URL, 'imgPath' => BUP_IMG_PATH, 'loader' => BUP_LOADER_IMG, 'close' => BUP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameBup::_()->getModule('options')->get('js_animation_speed'), 'BUP_CODE' => BUP_CODE);
        return '<script type="text/javascript">
		// <!--
			var BUP_DATA = ' . utilsBup::jsonEncode($jsData) . ';
		// -->
		</script>';
    }
示例#3
0
 public function addStyle($handle, $src = false, $deps = array(), $ver = false, $media = 'all')
 {
     $src = empty($src) ? $src : uriBup::_($src);
     if ($this->_stylesInitialized) {
         wp_enqueue_style($handle, $src, $deps, $ver, $media);
     } else {
         $this->_styles[] = array('handle' => $handle, 'src' => $src, 'deps' => $deps, 'ver' => $ver, 'media' => $media);
     }
 }
示例#4
0
文件: mod.php 项目: carlyns/RESUSblog
 public function getMainLink()
 {
     return uriBup::_(array('baseUrl' => admin_url('admin.php'), 'page' => $this->getView()->getFile()));
 }
示例#5
0
文件: mod.php 项目: VSVS/vs_wp_4.0
 public function overwriteProtocol($link, $id, $sample)
 {
     static $pagesCache;
     $makeHttpsReplace = false;
     if (frameBup::_()->getModule('options')->get('ssl_on_checkout') || frameBup::_()->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 (frameBup::_()->getModule('options')->get('ssl_on_checkout') && ($pagesCache[$id]->mod == 'checkout' || $pagesCache[$id]->mod == 'user' && in_array($pagesCache[$id]->action, array('getShoppingCart'))) || frameBup::_()->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 = uriBup::makeHttps($link);
     }
     return $link;
 }
示例#6
0
<div class="wrap">
    <div class="supsystic-plugin">
        <section class="supsystic-content">
            <nav class="supsystic-navigation supsystic-sticky">
                <ul>
                    <?php 
foreach ($this->tabsData as $tabKey => $tab) {
    if (!empty($tab['faIcon'])) {
        ?>
                                <li class="<?php 
        echo $this->activeTabForCssClass == $tabKey ? 'active' : '';
        ?>
">
                                    <a href="<?php 
        echo uriBup::_(array('baseUrl' => get_admin_url(0, 'admin.php?page=' . $this->page . '&tab=' . $tabKey)));
        ?>
">
                                        <i class="fa <?php 
        echo $tab['faIcon'];
        ?>
"></i>
                                        <?php 
        echo $tab['title'];
        ?>
                                    </a>
                                </li>
                      <?php 
    }
    ?>
                    <?php 
}
<div class="cspLeftCol">
<?php 
echo htmlBup::ajaxfile('logo_image', array('url' => uriBup::_(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') ? '' : frameBup::_()->getModule('options')->getLogoImgFullPath();
?>
" 
style="max-width: 200px;" />
</div>
<div class="cspRightCol">
    <div class="cspTip cspTipArrowLeft nomargin">
        <?php 
langBup::_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 
langBup::_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 htmlBup::button(array('value' => langBup::_('Remove image'), 'attrs' => 'id="cspLogoRemove" class="button button-large" style="width:100%;"'));
?>
示例#8
0
 /**
  * Create Action
  * Create new backup
  */
 public function createAction()
 {
     $request = reqBup::get('post');
     $response = new responseBup();
     /** @var optionsModelBup $optionsModel */
     $optionsModel = frameBup::_()->getModule('options')->getModel();
     /** @var backupLogTxtModelBup $logTxt */
     $logTxt = $this->getModel('backupLogTxt');
     /** @var backupTechLogModelBup $techLog */
     $techLog = $this->getModel('backupTechLog');
     /** @var warehouseBup $bupFolder */
     $bupFolder = frameBup::_()->getModule('warehouse');
     $uploadingList = array();
     $backupComplete = false;
     if (!empty($request['opt_values'])) {
         do_action('bupBeforeSaveBackupSettings', $request['opt_values']);
         $optionsModel->saveMainFromDestGroup($request);
         $optionsModel->saveGroup($request);
         $optionsModel->refreshOptions();
         // if warehouse changed - create necessary dir
         $bupFolder = frameBup::_()->getModule('warehouse');
         if (!$bupFolder->getFolder()->exists()) {
             $bupFolder->getFolder()->create();
         }
     }
     $destination = $this->getModel()->getConfig('dest');
     if ($destination !== 'ftp') {
         $isAuthorized = $this->getModel()->checkCloudServiceRemoteServerIsAuth($destination);
         if (!$isAuthorized) {
             $response->addError($this->getModel()->getErrors());
             return $response->ajaxExec();
         }
     }
     // We are need to check "warehouse" directory (usually: wp-content/upsupsystic)
     if (!$this->getModel()->checkWarehouse()) {
         $response->addError($this->getModel()->getWarehouseError());
         return $response->ajaxExec();
     }
     if ($this->getModel()->isFilesystemRequired() && !$this->checkExtensions($response)) {
         return $response->ajaxExec();
     }
     $currentBackupPath = $this->getModel()->generateFilename(array('zip', 'sql', 'txt'));
     $logTxt->setLogName(basename($currentBackupPath['folder']));
     $logTxt->writeBackupSettings($request['opt_values']);
     $logTxt->add(__('Clear temporary directory', BUP_LANG_CODE));
     $techLog->deleteOldLogs();
     $techLog->setLogName(basename($currentBackupPath['folder']));
     if ($this->getModel()->isDatabaseRequired()) {
         $tablesForBackup = $this->getModel()->getDatabase()->getStackTablesName();
         $techLog->set('tablesStack', $tablesForBackup);
         $techLog->set('totalTablesStacksCount', count($tablesForBackup));
         $techLog->set('dbBackupRequired', true);
         $uploadingList[] = $currentBackupPath['sql'];
     }
     if ($this->getModel()->isFilesystemRequired()) {
         if (!file_exists($currentBackupPath['folder'])) {
             $bupFolder->getController()->getModel('warehouse')->create($currentBackupPath['folder'] . DS);
         }
         $techLog->set('filesBackupRequired', true);
         $uploadingList[] = $currentBackupPath['folder'];
         $backupComplete = false;
     }
     //if need create filesystem backup or send DB backup on cloud - backup not complete
     if ($destination !== 'ftp') {
         $backupComplete = false;
         $techInfoArray = array('destination' => $destination, 'uploadingList' => $uploadingList, 'emailNotifications' => frameBup::_()->getModule('options')->get('email_ch') == 1 ? true : false);
         $techLog->set($techInfoArray);
     }
     if ($this->getModel()->isFilesystemRequired() || $this->getModel()->isDatabaseRequired()) {
         $data = array('page' => 'backup', 'action' => 'createBackupAction', 'backupId' => $currentBackupPath['folder']);
         $logTxt->add(__('Send request to create backup', BUP_LANG_CODE));
         $this->getModel('backup')->sendSelfRequest($data);
     }
     $response->addData(array('backupLog' => $logTxt->getContent(), 'backupId' => basename($currentBackupPath['folder']), 'backupComplete' => $backupComplete));
     if ($backupComplete) {
         $response->addMessage(__(sprintf('Backup complete. You can restore backup <a href="%s">here</a>.', uriBup::_(array('baseUrl' => get_admin_url(0, 'admin.php?page=' . BUP_PLUGIN_PAGE_URL_SUFFIX . '&tab=' . 'bupLog')))), BUP_LANG_CODE));
     }
     return $response->ajaxExec();
 }
示例#9
0
            <?php 
langBup::_e('Select Color:');
?>
			<?php 
echo htmlBup::colorpicker('opt_values[bg_color]', array('value' => $this->optModel->get('bg_color')));
?>
			<br />
			<?php 
echo htmlBup::button(array('value' => langBup::_('Set default'), 'attrs' => 'id="cspColorBgSetDefault"'));
?>
			<div id="cspAdminOptColorDefaultMsg"></div>
		</td>
		<td id="cspBgTypeImage-selection" colspan="2">
            <div class="cspLeftCol">
                <?php 
echo htmlBup::ajaxfile('bg_image', array('url' => uriBup::_(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') ? '' : frameBup::_()->getModule('options')->getBgImgFullPath();
?>
" style="max-width: 200px;" />
			</div>
            <div class="cspRightCol">
                <div class="cspBgImgShowTypeWrapper">
                    <?php 
echo htmlBup::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 
langBup::_e('Stretch');
示例#10
0
文件: uri.php 项目: carlyns/RESUSblog
 /**
  * Replace symbols to special html caracters in one output
  */
 public static function oneHtmlEnc()
 {
     self::$_oneHtmlEnc = true;
 }
示例#11
0
 public function createBackup(array $post)
 {
     $this->techLog->setLogName(basename($post['backupId']));
     $this->logTxt->setLogName(basename($post['backupId']));
     $filesBackupRequired = $this->techLog->get('filesBackupRequired');
     $dbBackupRequired = $this->techLog->get('dbBackupRequired');
     // start backup files
     if ($filesBackupRequired) {
         $stacks = $this->techLog->get('stacks');
         if (empty($stacks)) {
             $this->logTxt->add(__('Scanning files.', BUP_LANG_CODE));
             $files = $this->getFilesList();
             $this->logTxt->add(sprintf('%s files scanned.', count($files, true) - count($files)));
             $this->logTxt->add(__('Total stacks: ' . count($files), BUP_LANG_CODE));
             $this->techLog->set('filesBackupRequired', true);
             $this->techLog->set('stacks', $files);
             $this->techLog->set('totalStacksCount', count($files));
         }
         $stacksCreatedCount = $this->techLog->get('stacksCreatedCount') ? $this->techLog->get('stacksCreatedCount') : 0;
         $totalStacks = $this->techLog->get('totalStacksCount');
         if ($totalStacks > 0) {
             if (!$stacksCreatedCount) {
                 $this->logTxt->add(__(sprintf('Create backup filesystem in folder: %s', $post['backupId']), BUP_LANG_CODE));
             }
             $this->techLog->set('backupMessage', __('Creating filesystem backup 0%', BUP_LANG_CODE));
         }
         while (!$this->isTimeOver() && ($stack = $this->getNextFilesStack(basename($post['backupId'])))) {
             $createdStack = $this->filesystem->getTemporaryArchive($stack, $post['backupId']);
             $this->logTxt->add(__(sprintf('Successful created stack: %s', $createdStack), BUP_LANG_CODE));
             $stacksCreatedCount++;
             $backupCreatedPercent = (int) ($stacksCreatedCount / $totalStacks * 100);
             $this->techLog->set(array('backupProcessPercent' => $backupCreatedPercent, 'backupMessage' => __(sprintf('Creating filesystem backup %s %s', $backupCreatedPercent, '%'), BUP_LANG_CODE), 'stacksCreatedCount' => $stacksCreatedCount));
             //            sleep(10); // for test backup process percent on front-end
         }
         // get files stack again, because it will be changed after call method $this->getNextFilesStack($backupId);
         $stacks = $this->techLog->get('stacks');
         if (!empty($stacks)) {
             $data = array('page' => 'backup', 'action' => 'createBackupAction', 'backupId' => $post['backupId']);
             $this->sendSelfRequest($data);
             exit;
         }
         if ($stacksCreatedCount > 0) {
             $this->techLog->set('backupMessage', __('Filesystem backup complete', BUP_LANG_CODE));
         }
         $backupProcessPercent = $this->techLog->get('backupProcessPercent');
         $this->techLog->set(array('filesystemBackupComplete' => true, 'backupProcessPercent' => $backupProcessPercent == 100 ? null : $backupProcessPercent, 'backupFolderSize' => $this->getBackupFolderSize($post['backupId'])));
         if ($backupProcessPercent == 100) {
             $this->logTxt->add(__('Filesystem backup complete', BUP_DB_PREF));
         }
         $this->techLog->set('filesBackupRequired', false);
     }
     // start backup db
     if ($dbBackupRequired) {
         $stacksCreatedCount = $this->techLog->get('tableStacksCreatedCount') ? $this->techLog->get('tableStacksCreatedCount') : 0;
         $totalStacks = $this->techLog->get('totalTablesStacksCount');
         if ($totalStacks > 0) {
             if (!$stacksCreatedCount) {
                 $this->logTxt->add(__(sprintf('Create database backup : %s', $post['backupId'] . '.sql'), BUP_LANG_CODE));
             }
             $this->techLog->set('backupMessage', __('Creating database backup 0%', BUP_LANG_CODE));
         }
         while (!$this->isTimeOver() && ($stack = $this->getNextTablesStack(basename($post['backupId'])))) {
             $res = $this->database->create($post['backupId'] . '.sql', $stack, !$stacksCreatedCount ? true : false);
             $dbErrors = $this->database->getErrors();
             if (!empty($dbErrors)) {
                 $this->logTxt->add(__(sprintf('Errors during creation of database backup, errors count %d', count($dbErrors)), BUP_LANG_CODE));
                 $this->techLog->set('dbBackupRequired', false);
                 break;
             }
             $stacksCreatedCount++;
             $backupCreatedPercent = (int) ($stacksCreatedCount / $totalStacks * 100);
             $this->techLog->set(array('backupProcessPercent' => $backupCreatedPercent, 'backupMessage' => __(sprintf('Creating database backup %s %s', $backupCreatedPercent, '%'), BUP_LANG_CODE), 'tableStacksCreatedCount' => $stacksCreatedCount));
             //                sleep(3); // for test backup process percent on front-end
         }
         $stacks = $this->techLog->get('tablesStack');
         if (!empty($stacks)) {
             $data = array('page' => 'backup', 'action' => 'createBackupAction', 'backupId' => $post['backupId']);
             $this->sendSelfRequest($data);
             exit;
         }
         if ($backupCreatedPercent == 100) {
             $this->techLog->set('dbBackupRequired', false);
             $this->logTxt->add(__('Database backup complete', BUP_DB_PREF));
         }
     }
     $uploadingList = $this->techLog->get('uploadingList');
     $destination = $this->techLog->get('destination');
     $backupCreatedPercent = 0;
     //        file_put_contents(frameBup::_()->getModule('warehouse')->getPath() . DS . 'testLog.txt', var_export($uploadingList, true));
     if ($destination !== 'ftp' && !empty($uploadingList)) {
         $handlers = $this->getDestinationHandlers();
         if (array_key_exists($destination, $handlers)) {
             $handler = $handlers[$destination];
             if (!$this->techLog->get('addedCloudHeader')) {
                 $this->logTxt->add(__(sprintf('Upload to the "%s" required', ucfirst($destination)), BUP_LANG_CODE));
                 $filesToCloud = array();
                 foreach ($uploadingList as $key => $file) {
                     if (is_dir($file)) {
                         $files = glob($file . DS . 'BUP*.zip');
                         if (!empty($files)) {
                             foreach ($files as $file) {
                                 $filesToCloud[] = $file;
                             }
                         }
                     } elseif (is_file($file)) {
                         $filesToCloud[] = $file;
                     }
                 }
                 $uploadingList = $filesToCloud;
                 $techInfoArray = array('uploadingList' => $uploadingList, 'filesToCloudCount' => count($uploadingList), 'addedCloudHeader' => 1);
                 $this->techLog->set($techInfoArray);
             }
             $filesToCloudCount = $this->techLog->get('filesToCloudCount');
             $this->techLog->set('backupMessage', __(sprintf('Uploading to "%s"', ucfirst($destination)), BUP_LANG_CODE));
             $tryUploadToCloud = 0;
             while (!$this->isTimeOver() && !empty($uploadingList) && count($uploadingList) > 0 && $tryUploadToCloud < 3) {
                 foreach ($uploadingList as $key => $fileToCloud) {
                     if (!$this->isTimeOver() && is_file($fileToCloud)) {
                         $extension = pathinfo($fileToCloud, PATHINFO_EXTENSION);
                         $stackFolder = $extension === 'zip' ? basename($post['backupId']) . '/' : '';
                         $result = call_user_func_array($handler, array(array($fileToCloud), $stackFolder));
                         if ($result === true || $result == 200 || $result == 201) {
                             $tryUploadToCloud = 0;
                             $this->logTxt->add(__(sprintf('Successfully uploaded to the "%s": %s', ucfirst($destination), $fileToCloud), BUP_LANG_CODE));
                             unset($uploadingList[$key]);
                             $uploadedPercent = (int) abs((count($uploadingList) - $filesToCloudCount) / $filesToCloudCount * 100);
                             $techInfoArray = array('uploadingList' => $uploadingList, 'uploadedFilesCount' => abs($filesToCloudCount - count($uploadingList)), 'backupProcessPercent' => $uploadedPercent, 'backupMessage' => __(sprintf('Uploading to "%s" %s %s', ucfirst($destination), $uploadedPercent, "%"), BUP_LANG_CODE));
                             $this->techLog->set($techInfoArray);
                         } else {
                             switch ($result) {
                                 case 401:
                                     $error = __('Authentication required.', BUP_LANG_CODE);
                                     break;
                                 case 404:
                                     $error = __('File not found', BUP_LANG_CODE);
                                     break;
                                 case 500:
                                     $error = is_object($handler[0]) ? $handler[0]->getErrors() : __('Unexpected error (500)', BUP_LANG_CODE);
                                     break;
                                 default:
                                     $error = __('Unexpected error', BUP_LANG_CODE);
                             }
                             //todo:if error occurred -  need call method, which will be delete uploaded files from cloud, because backup data is not full. or try to upload file again
                             $this->logTxt->add(__(sprintf('%s - Cannot upload to the "%s": %s', $fileToCloud, ucfirst($destination), is_array($error) ? array_pop($error) : $error), BUP_LANG_CODE));
                         }
                     } else {
                         break 2;
                     }
                 }
                 $tryUploadToCloud++;
             }
             if (!empty($uploadingList)) {
                 $data = array('page' => 'backup', 'action' => 'createBackupAction', 'backupId' => $post['backupId']);
                 $this->sendSelfRequest($data);
                 exit;
             }
             if (!empty($uploadedPercent) && $uploadedPercent == 100) {
                 $this->remove(basename($post['backupId']));
                 $this->remove(basename($post['backupId']) . '.sql');
             }
         }
     }
     $this->techLog->set(array('complete' => true, 'backupMessage' => __(sprintf('Backup complete. You can restore backup <a href="%s">here</a>.', uriBup::_(array('baseUrl' => get_admin_url(0, 'admin.php?page=' . BUP_PLUGIN_PAGE_URL_SUFFIX . '&tab=' . 'bupLog')))), BUP_LANG_CODE)));
     $this->logTxt->add(__('Backup successful complete!', BUP_LANG_CODE));
     if (frameBup::_()->getModule('options')->get('email_ch') == 1) {
         $email = frameBup::_()->getModule('options')->get('email');
         $subject = __('Backup by Supsystic Notifications', BUP_LANG_CODE);
         $this->logTxt->add(__('Email notification required.', BUP_LANG_CODE));
         $this->logTxt->add(sprintf(__('Sending to ', BUP_LANG_CODE) . '%s', $email));
         $message = $this->logTxt->getContent(false);
         wp_mail($email, $subject, $message);
     }
     $this->logTxt->saveBackupDirSetting(array('backupFolderSize' => $this->techLog->get('backupFolderSize')));
 }
示例#12
0
文件: mod.php 项目: VSVS/vs_wp_4.0
 public function init()
 {
     if (is_admin() && frameBup::_()->isPluginAdminPage()) {
         $this->_styles = array('styleBup' => array('path' => BUP_CSS_PATH . 'style.css'), 'adminStylesBup' => array('path' => BUP_CSS_PATH . 'adminStyles.css'), 'jquery-tabs' => array('path' => BUP_CSS_PATH . 'jquery-tabs.css'), 'jquery-buttons' => array('path' => BUP_CSS_PATH . 'jquery-buttons.css'), 'wp-jquery-ui-dialog' => array(), 'farbtastic' => array(), 'jquery-dialog' => array('path' => BUP_CSS_PATH . 'jquery-dialog.css'), 'jquery-progress' => array('path' => BUP_CSS_PATH . 'jquery-progress.css'));
         $defaultPlugTheme = frameBup::_()->getModule('options')->get('default_theme');
         $ajaxurl = admin_url('admin-ajax.php');
         if (frameBup::_()->getModule('options')->get('ssl_on_ajax')) {
             $ajaxurl = uriBup::makeHttps($ajaxurl);
         }
         $jsData = array('siteUrl' => BUP_SITE_URL, 'imgPath' => BUP_IMG_PATH, 'loader' => BUP_LOADER_IMG, 'close' => BUP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameBup::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langBup::getData(), 'options' => frameBup::_()->getModule('options')->getByCode(), 'BUP_CODE' => BUP_CODE);
         $jsData = dispatcherBup::applyFilters('jsInitVariables', $jsData);
         frameBup::_()->addScript('jquery');
         frameBup::_()->addScript('jquery-ui-tabs', '', array('jquery'));
         frameBup::_()->addScript('jquery-ui-dialog', '', array('jquery'));
         frameBup::_()->addScript('jquery-ui-button', '', array('jquery'));
         frameBup::_()->addScript('farbtastic');
         frameBup::_()->addScript('commonBup', BUP_JS_PATH . 'common.js');
         frameBup::_()->addScript('coreBup', BUP_JS_PATH . 'core.js');
         //installerBup::isUsed() ? frameBup::_()->addScript('adminOptionsBup', BUP_JS_PATH. 'admin.options.js') : false;
         frameBup::_()->addScript('adminOptionsBup', BUP_JS_PATH . 'admin.options.js');
         frameBup::_()->addScript('ajaxupload', BUP_JS_PATH . 'ajaxupload.js');
         frameBup::_()->addScript('postbox', get_bloginfo('wpurl') . '/wp-admin/js/postbox.js');
         frameBup::_()->addJSVar('coreBup', 'BUP_DATA', $jsData);
         /*$desktop = true;
         		if(utilsBup::isTablet()) {
         			$this->_styles['style-tablet'] = array();
         			$desktop = false;
         		} elseif(utilsBup::isMobile()) {
         			$this->_styles['style-mobile'] = array();
         			$desktop = false;
         		}
         		if($desktop) {
         			$this->_styles['style-desctop'] = array();
         		}*/
         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(BUP_TEMPLATES_DIR . $defaultPlugTheme . DS . $s . '.css')) {
                 frameBup::_()->addStyle($s, BUP_TEMPLATES_PATH . $defaultPlugTheme . '/' . $s . '.css');
             } elseif ($canBeSubstituted && file_exists(utilsBup::getCurrentWPThemeDir() . 'csp' . DS . $s . '.css')) {
                 frameBup::_()->addStyle($s, utilsBup::getCurrentWPThemePath() . '/toe/' . $s . '.css');
             } elseif (!empty($sInfo['path'])) {
                 frameBup::_()->addStyle($s, $sInfo['path']);
             } else {
                 frameBup::_()->addStyle($s);
             }
         }
         add_action('wp_head', array($this, 'addInitJsVars'));
     }
     parent::init();
 }
示例#13
0
文件: mod.php 项目: VSVS/vs_wp_4.0
 public function addSettingsLinkForPlug($links)
 {
     array_unshift($links, '<a href="' . uriBup::_(array('baseUrl' => admin_url('admin.php'), 'page' => plugin_basename(frameBup::_()->getModule('adminmenu')->getView()->getFile()))) . '">' . langBup::_('Settings') . '</a>');
     return $links;
 }
示例#14
0
 public static function ajaxfile($name, $params = array('url' => '', 'value' => '', 'fid' => '', 'buttonName' => ''))
 {
     $out = '';
     if (strpos($params['url'], 'pl=' . BUP_CODE) === false) {
         $params['url'] = uriBup::_(array('baseUrl' => $params['url'], 'pl' => BUP_CODE));
     }
     $out .= self::button(array('value' => __(empty($params['buttonName']) ? 'Upload' : $params['buttonName'], BUP_LANG_CODE), 'attrs' => 'id="toeUploadbut_' . $name . '" class="button button-large"'));
     $display = empty($params['value']) ? 'style="display: none;"' : '';
     if ($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;
 }