当前位置: 首页>>代码示例>>PHP>>正文


PHP BackendModel::setModuleSetting方法代码示例

本文整理汇总了PHP中BackendModel::setModuleSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendModel::setModuleSetting方法的具体用法?PHP BackendModel::setModuleSetting怎么用?PHP BackendModel::setModuleSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BackendModel的用法示例。


在下文中一共展示了BackendModel::setModuleSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createClient

 /**
  * Creates a new client
  *
  * @param string $companyName The client company name.
  * @param string $contactName The personal name of the principle contact for this client.
  * @param string $email An email address to which this client will be sent application-related emails.
  * @param string[optional] $country This client’s country.
  * @param string[optional] $timezone Client timezone for tracking and reporting data.
  */
 public static function createClient($companyName, $contactName, $email, $country = 'Belgium', $timezone = '(GMT+01:00) Brussels, Copenhagen, Madrid, Paris')
 {
     // create client
     $clientId = self::getCM()->createClient($companyName, $contactName, $email, $country, $timezone);
     // add client ID as a module setting for mailmotor
     BackendModel::setModuleSetting('mailmotor', 'cm_client_id', $clientId);
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:16,代码来源:helper.php

示例2: validateForm

 /**
  * Validates the settings form
  *
  * @return	void
  */
 private function validateForm()
 {
     // form is submitted
     if ($this->frm->isSubmitted()) {
         // cleanup the submitted fields, ignore fields that were added by hackers
         $this->frm->cleanupFields();
         // form is validated
         if ($this->frm->isCorrect()) {
             // set our settings (overview map)
             BackendModel::setModuleSetting($this->URL->getModule(), 'zoom_level', (string) $this->frm->getField('zoom_level')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'width', (int) $this->frm->getField('width')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'height', (int) $this->frm->getField('height')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'map_type', (string) $this->frm->getField('map_type')->getValue());
             // set our settings (widgets)
             BackendModel::setModuleSetting($this->URL->getModule(), 'zoom_level_widget', (string) $this->frm->getField('zoom_level_widget')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'width_widget', (int) $this->frm->getField('width_widget')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'height_widget', (int) $this->frm->getField('height_widget')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'map_type_widget', (string) $this->frm->getField('map_type_widget')->getValue());
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_saved_settings');
             // redirect to the settings page
             $this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
         }
     }
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:30,代码来源:settings.php

示例3: execute

 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     parent::execute();
     // fork is no longer authorized to collect analytics data
     if (BackendAnalyticsHelper::getStatus() == 'UNAUTHORIZED') {
         // remove all parameters from the module settings
         BackendModel::setModuleSetting($this->getModule(), 'session_token', null);
         BackendModel::setModuleSetting($this->getModule(), 'account_name', null);
         BackendModel::setModuleSetting($this->getModule(), 'table_id', null);
         BackendModel::setModuleSetting($this->getModule(), 'profile_title', null);
         // remove cache files
         BackendAnalyticsModel::removeCacheFiles();
         // clear tables
         BackendAnalyticsModel::clearTables();
         // return status
         $this->output(self::OK, array('status' => 'unauthorized', 'message' => BL::msg('Redirecting')), 'No longer authorized.');
     }
     // get data
     $this->getData();
     // get html
     $referrersHtml = $this->parseReferrers();
     $keywordsHtml = $this->parseKeywords();
     // return status
     $this->output(self::OK, array('status' => 'success', 'referrersHtml' => $referrersHtml, 'keywordsHtml' => $keywordsHtml, 'date' => BL::lbl('Today'), 'message' => BL::msg('RefreshedTrafficSources')), 'Data has been retrieved.');
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:31,代码来源:refresh_traffic_sources.php

示例4: validateForm

 /**
  * Validates the settings form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         if ($this->frm->isCorrect()) {
             // set the base values
             $width = (int) $this->frm->getField('width_widget')->getValue();
             $height = (int) $this->frm->getField('height_widget')->getValue();
             if ($width > 800) {
                 $width = 800;
             } elseif ($width < 300) {
                 $width = BackendModel::getModuleSetting('location', 'width_widget');
             }
             if ($height < 150) {
                 $height = BackendModel::getModuleSetting('location', 'height_widget');
             }
             // set our settings (widgets)
             BackendModel::setModuleSetting($this->URL->getModule(), 'zoom_level_widget', (string) $this->frm->getField('zoom_level_widget')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'width_widget', $width);
             BackendModel::setModuleSetting($this->URL->getModule(), 'height_widget', $height);
             BackendModel::setModuleSetting($this->URL->getModule(), 'map_type_widget', (string) $this->frm->getField('map_type_widget')->getValue());
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_saved_settings');
             // redirect to the settings page
             $this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
         }
     }
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:31,代码来源:settings.php

示例5: execute

 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     // get parameters
     $url = SpoonFilter::getPostValue('url', null, '');
     $username = SpoonFilter::getPostValue('username', null, '');
     $password = SpoonFilter::getPostValue('password', null, '');
     // filter out the 'http://' from the URL
     if (strpos($url, 'http://') !== false) {
         $url = str_replace('http://', '', $url);
     }
     if (strpos($url, 'https://') !== false) {
         $url = str_replace('https://', '', $url);
     }
     // check input
     if (empty($url)) {
         $this->output(self::BAD_REQUEST, array('field' => 'url'), BL::err('NoCMAccountCredentials'));
     }
     if (empty($username)) {
         $this->output(self::BAD_REQUEST, array('field' => 'username'), BL::err('NoCMAccountCredentials'));
     }
     if (empty($password)) {
         $this->output(self::BAD_REQUEST, array('field' => 'password'), BL::err('NoCMAccountCredentials'));
     }
     try {
         // check if the CampaignMonitor class exists
         if (!SpoonFile::exists(PATH_LIBRARY . '/external/campaignmonitor.php')) {
             // the class doesn't exist, so stop here
             $this->output(self::BAD_REQUEST, null, BL::err('ClassDoesNotExist', $this->getModule()));
         }
         // require CampaignMonitor class
         require_once 'external/campaignmonitor.php';
         // init CampaignMonitor object
         new CampaignMonitor($url, $username, $password, 10);
         // save the new data
         BackendModel::setModuleSetting($this->getModule(), 'cm_url', $url);
         BackendModel::setModuleSetting($this->getModule(), 'cm_username', $username);
         BackendModel::setModuleSetting($this->getModule(), 'cm_password', $password);
         // account was linked
         BackendModel::setModuleSetting($this->getModule(), 'cm_account', true);
     } catch (Exception $e) {
         // timeout occured
         if ($e->getMessage() == 'Error Fetching http headers') {
             $this->output(self::BAD_REQUEST, null, BL::err('CmTimeout', $this->getModule()));
         }
         // other error
         $this->output(self::ERROR, array('field' => 'url'), sprintf(BL::err('CampaignMonitorError', $this->getModule()), $e->getMessage()));
     }
     // trigger event
     BackendModel::triggerEvent($this->getModule(), 'after_account_linked');
     // CM was successfully initialized
     $this->output(self::OK, array('message' => 'account-linked'), BL::msg('AccountLinked', $this->getModule()));
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:56,代码来源:link_account.php

示例6: validateForm

 /**
  * Validates the settings form
  *
  * @return	void
  */
 private function validateForm()
 {
     // form is submitted
     if ($this->frm->isSubmitted()) {
         // form is validated
         if ($this->frm->isCorrect()) {
             // set our settings
             BackendModel::setModuleSetting($this->getModule(), 'meta_navigation', (bool) $this->frm->getField('meta_navigation')->getValue());
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_saved_settings');
             // redirect to the settings page
             $this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
         }
     }
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:20,代码来源:settings.php

示例7: execute

 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     // fork is no longer authorized to collect analytics data
     if (BackendAnalyticsHelper::getStatus() == 'UNAUTHORIZED') {
         // remove all parameters from the module settings
         BackendModel::setModuleSetting('analytics', 'session_token', null);
         BackendModel::setModuleSetting('analytics', 'account_name', null);
         BackendModel::setModuleSetting('analytics', 'table_id', null);
         BackendModel::setModuleSetting('analytics', 'profile_title', null);
         BackendAnalyticsModel::removeCacheFiles();
         BackendAnalyticsModel::clearTables();
         return;
     }
     $this->getData();
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:19,代码来源:get_traffic_sources.php

示例8: validateForm

 /**
  * Validates the form
  *
  * @return	void
  */
 private function validateForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         // no errors ?
         if ($this->frm->isCorrect()) {
             // smtp settings
             BackendModel::setModuleSetting('core', 'seo_noodp', $this->frm->getField('seo_noodp')->getValue());
             BackendModel::setModuleSetting('core', 'seo_noydir', $this->frm->getField('seo_noydir')->getValue());
             BackendModel::setModuleSetting('core', 'seo_nofollow_in_comments', $this->frm->getField('seo_nofollow_in_comments')->getValue());
             // assign report
             $this->tpl->assign('report', true);
             $this->tpl->assign('reportMessage', BL::msg('Saved'));
         }
     }
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:21,代码来源:seo.php

示例9: __construct

 public function __construct()
 {
     // because some cronjobs will be run on the command line we should pass parameters
     if (isset($_SERVER['argv'])) {
         // init var
         $first = true;
         // loop all passes arguments
         foreach ($_SERVER['argv'] as $parameter) {
             // ignore first, because this is the scripts name.
             if ($first) {
                 // reset
                 $first = false;
                 // skip
                 continue;
             }
             // split into chunks
             $chunks = explode('=', $parameter, 2);
             // valid paramters?
             if (count($chunks) == 2) {
                 // build key and value
                 $key = trim($chunks[0], '--');
                 $value = $chunks[1];
                 // set in GET
                 if ($key != '' && $value != '') {
                     $_GET[$key] = $value;
                 }
             }
         }
     }
     // define the Named Application
     if (!defined('NAMED_APPLICATION')) {
         define('NAMED_APPLICATION', 'backend');
     }
     // set the module
     $this->setModule(SpoonFilter::getGetValue('module', null, ''));
     // set the requested file
     $this->setAction(SpoonFilter::getGetValue('action', null, ''));
     // set the language
     $this->setLanguage(SpoonFilter::getGetValue('language', FrontendLanguage::getActiveLanguages(), SITE_DEFAULT_LANGUAGE));
     // mark cronjob as run
     $cronjobs = (array) BackendModel::getModuleSetting('core', 'cronjobs');
     $cronjobs[] = $this->getModule() . '.' . $this->getAction();
     BackendModel::setModuleSetting('core', 'cronjobs', array_unique($cronjobs));
     // create new action
     $action = new BackendCronjobAction($this->getAction(), $this->getModule());
     $action->execute();
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:47,代码来源:cronjob.php

示例10: checkDefaultGroups

 /**
  * Returns true if every working language has a default group set, false if at least one is missing.
  *
  * @return bool
  */
 public static function checkDefaultGroups()
 {
     // check if the defaults were set already, and return true if they were
     if (BackendModel::getModuleSetting('mailmotor', 'cm_groups_defaults_set')) {
         return true;
     }
     // get all default groups
     $defaults = self::getDefaultGroups();
     // if the total amount of working languages do not add up to the total amount of default groups not all default groups were set.
     if (count(BL::getWorkingLanguages()) === count($defaults)) {
         // cm_groups_defaults_set status is now true
         BackendModel::setModuleSetting('mailmotor', 'cm_groups_defaults_set', true);
         // return true
         return true;
     }
     // if we made it here, not all default groups were set; return false
     return false;
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:23,代码来源:model.php

示例11: validateForm

 /**
  * Validates the settings form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         if ($this->frm->isCorrect()) {
             // set our settings
             BackendModel::setModuleSetting($this->URL->getModule(), 'overview_num_items_per_category', (int) $this->frm->getField('overview_number_of_items_per_category')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'most_read_num_items', (int) $this->frm->getField('most_read_number_of_items')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'related_num_items', (int) $this->frm->getField('related_number_of_items')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'spamfilter', (bool) $this->frm->getField('spamfilter')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'allow_feedback', (bool) $this->frm->getField('allow_feedback')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'allow_own_question', (bool) $this->frm->getField('allow_own_question')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'send_email_on_new_feedback', (bool) $this->frm->getField('send_email_on_new_feedback')->getValue());
             if (BackendModel::getModuleSetting('core', 'akismet_key') === null) {
                 BackendModel::setModuleSetting($this->URL->getModule(), 'spamfilter', false);
             }
             // redirect to the settings page
             $this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
         }
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:23,代码来源:settings.php

示例12: execute

 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     parent::execute();
     // fork is no longer authorized to collect analytics data
     if (BackendAnalyticsHelper::getStatus() == 'UNAUTHORIZED') {
         // remove all parameters from the module settings
         BackendModel::setModuleSetting('analytics', 'session_token', null);
         BackendModel::setModuleSetting('analytics', 'account_name', null);
         BackendModel::setModuleSetting('analytics', 'table_id', null);
         BackendModel::setModuleSetting('analytics', 'profile_title', null);
         // remove cache files
         BackendAnalyticsModel::removeCacheFiles();
         // clear tables
         BackendAnalyticsModel::clearTables();
         // stop here
         return;
     }
     // get data
     $this->getData();
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:26,代码来源:get_traffic_sources.php

示例13: setMaximumBlocks

    /**
     * Calculate the maximum number of blocks for all active templates and store into a module-settings
     *
     * @return	void
     */
    public static function setMaximumBlocks()
    {
        // get maximum number of blocks for active templates
        $maximumNumberOfBlocks = (int) BackendModel::getDB()->getVar('SELECT MAX(i.num_blocks) AS max_num_blocks
																		FROM pages_templates AS i
																		WHERE i.active = ? AND i.theme = ?', array('Y', BackendModel::getModuleSetting('core', 'theme', 'core')));
        // store
        BackendModel::setModuleSetting('pages', 'template_max_blocks', $maximumNumberOfBlocks);
    }
开发者ID:netconstructor,项目名称:forkcms,代码行数:14,代码来源:model.php

示例14: validateForm

 /**
  * Validates the settings form
  */
 private function validateForm()
 {
     // form is submitted
     if ($this->frm->isSubmitted()) {
         // validate module weights
         foreach ($this->modules as $i => $module) {
             // only if this module is enabled
             if ($this->frm->getField('search_' . $module['module'])->getChecked()) {
                 // valid weight?
                 $this->frm->getField('search_' . $module['module'] . '_weight')->isDigital(BL::err('WeightNotNumeric'));
                 $this->modules[$i]['txtError'] = $this->frm->getField('search_' . $module['module'] . '_weight')->getErrors();
             }
         }
         // form is validated
         if ($this->frm->isCorrect()) {
             // set our settings
             BackendModel::setModuleSetting($this->URL->getModule(), 'overview_num_items', $this->frm->getField('overview_num_items')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'autocomplete_num_items', $this->frm->getField('autocomplete_num_items')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'autosuggest_num_items', $this->frm->getField('autosuggest_num_items')->getValue());
             // module search
             foreach ((array) $this->modules as $module) {
                 $searchable = $this->frm->getField('search_' . $module['module'])->getChecked() ? 'Y' : 'N';
                 $weight = $this->frm->getField('search_' . $module['module'] . '_weight')->getValue();
                 // insert, or update
                 BackendSearchModel::insertModuleSettings($module, $searchable, $weight);
             }
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_changed_settings');
             // redirect to the settings page
             $this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
         }
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:36,代码来源:settings.php

示例15: validateForm

 /**
  * Validate the form
  *
  * @return	void
  */
 private function validateForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         // cleanup the submitted fields, ignore fields that were added by hackers
         $this->frm->cleanupFields();
         // no errors?
         if ($this->frm->isCorrect()) {
             // the total amount of subscribers
             $subscribersTotal = 0;
             // loop all groups
             foreach ($this->externalGroups as $group) {
                 // insert them in our database
                 $groupID = BackendModel::getDB(true)->insert('mailmotor_groups', array('name' => $group['name'], 'custom_fields' => $group['custom_fields'], 'created_on' => BackendModel::getUTCDate()));
                 // insert the CM ID
                 BackendMailmotorCMHelper::insertCampaignMonitorID('list', $group['id'], $groupID);
                 // continue looping if this group has no subscribers
                 if (empty($group['subscribers'])) {
                     continue;
                 }
                 // add this groups subscribers amount to the total
                 $subscribersTotal += $group['subscribers_amount'];
                 // loop the subscribers for this group, and import them
                 foreach ($group['subscribers'] as $subscriber) {
                     // build new subscriber record
                     $item = array();
                     $item['email'] = $subscriber['email'];
                     $item['source'] = 'import';
                     $item['created_on'] = $subscriber['date'];
                     // add an additional custom field 'name', if it was set in the subscriber record
                     if (!empty($subscriber['name'])) {
                         $subscriber['custom_fields']['Name'] = $subscriber['name'];
                     }
                     // save the subscriber in our database, and subscribe it to this group
                     BackendMailmotorModel::saveAddress($item, $groupID, !empty($subscriber['custom_fields']) ? $subscriber['custom_fields'] : null);
                 }
             }
             // at this point, groups are set
             BackendModel::setModuleSetting($this->getModule(), 'cm_groups_set', true);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_import_groups');
             // redirect to the index
             $this->redirect(BackendModel::createURLForAction('index', $this->getModule()) . '&report=groups-imported&var[]=' . count($this->externalGroups) . '&var[]=' . $subscribersTotal);
         }
     }
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:51,代码来源:import_groups.php


注:本文中的BackendModel::setModuleSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。