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


PHP Model_Config::set_value方法代码示例

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


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

示例1: ocacu

 /**
  * [ocacu description]
  * @return void
  */
 public static function ocacu()
 {
     //first time install notify of installation to ocacu once month
     if (Core::config('general.ocacu') < strtotime('-1 second')) {
         $url = Kohana::$environment !== Kohana::DEVELOPMENT ? 'ocacu.com' : 'ocacu.lo';
         $url = 'http://' . $url . '/api/new/?siteUrl=' . URL::base();
         if (Core::curl_get_contents($url, 5)) {
             Model_Config::set_value('general', 'ocacu', time());
         }
     }
 }
开发者ID:azorpax,项目名称:common,代码行数:15,代码来源:core.php

示例2: action_status

 public function action_status()
 {
     $status = (bool) $this->request->param('id');
     Model_Config::set_value('general', 'cron', $status);
     Alert::set(Alert::SUCCESS, __('General Configuration updated'));
     $this->redirect(Route::url('oc-panel', array('controller' => 'crontab')));
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:7,代码来源:crontab.php

示例3: before

 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     //we need this option enabled for this plugin to work
     if (Core::config('i18n.allow_query_language') == 0) {
         Model_Config::set_value('i18n', 'allow_query_language', 1);
     }
     if ($this->languages == '') {
         $this->languages = i18n::get_languages();
     } else {
         $this->languages = array_map('trim', explode(',', $this->languages));
     }
 }
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:18,代码来源:languages.php

示例4: action_index

 public function action_index()
 {
     // validation active
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('List')));
     $this->template->title = __('Translations');
     //scan project files and generate .po
     if (core::get('parse') !== NULL) {
         //scan script
         require_once Kohana::find_file('vendor', 'POTCreator/POTCreator', 'php');
         $obj = new POTCreator();
         $obj->set_root(DOCROOT);
         $obj->set_exts('php');
         $obj->set_regular('/_[_|e]\\([\\"|\']([^\\"|\']+)[\\"|\']\\)/i');
         $obj->set_base_path('..');
         $obj->set_read_subdir(true);
         $obj->write_pot(i18n::get_language_path());
         Alert::set(Alert::SUCCESS, 'File regenerated');
     }
     //change default site language
     if (($locale = $this->request->param('id')) != NULL and array_key_exists($locale, i18n::get_languages())) {
         //save language
         Model_Config::set_value('i18n', 'locale', $locale);
         //change the cookie if not he will not see the changes
         if (Core::config('i18n.allow_query_language') == 1) {
             Cookie::set('user_language', $locale, Core::config('auth.lifetime'));
         }
         Alert::set(Alert::SUCCESS, __('Language') . ' ' . $locale);
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'translations')));
     }
     //create language
     if (Core::post('locale')) {
         $language = $this->request->post('locale');
         $folder = DOCROOT . 'languages/' . $language . '/LC_MESSAGES/';
         // if folder does not exist, try to make it
         if (!file_exists($folder) and !@mkdir($folder, 0775, true)) {
             // mkdir not successful ?
             Alert::set(Alert::ERROR, __('Language folder cannot be created with mkdir. Please correct to be able to create new translation.'));
             HTTP::redirect(Route::url('oc-panel', array('controller' => 'translations')));
         }
         // write an empty .po file for $language
         $out = 'msgid ""' . PHP_EOL;
         $out .= 'msgstr ""' . PHP_EOL;
         File::write($folder . 'messages.po', $out);
         Alert::set(Alert::SUCCESS, $this->request->param('id') . ' ' . __('Language saved'));
     }
     $this->template->content = View::factory('oc-panel/pages/translations/index', array('languages' => i18n::get_languages(), 'current_language' => core::config('i18n.locale')));
 }
开发者ID:ThomWensink,项目名称:common,代码行数:47,代码来源:translations.php

示例5: action_index

 public function action_index()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Interactive map')));
     $this->template->title = __('Interactive map');
     $this->template->styles = array('css/map-generator.css' => 'screen');
     $this->template->scripts['footer'][] = '//www.google.com/jsapi';
     $this->template->scripts['footer'][] = '//maps.google.com/maps/api/js?sensor=false';
     $this->template->scripts['footer'][] = 'js/oc-panel/map/jscolor.js';
     $this->template->scripts['footer'][] = 'js/oc-panel/map/map-generator.js';
     $map_active = Core::post('map_active', Core::Config('appearance.map_active'));
     $map_settings = Core::post('current_settings', Core::Config('appearance.map_settings'));
     // change map
     if (Theme::get('premium') == 1 and Core::post('jscode')) {
         Model_Config::set_value('appearance', 'map_active', Core::post('map_active'));
         Model_Config::set_value('appearance', 'map_settings', Core::post('current_settings'));
         Model_Config::set_value('appearance', 'map_jscode', Kohana::$_POST_ORIG['jscode']);
         Core::delete_cache();
         Alert::set(Alert::SUCCESS, __('Map saved.'));
     }
     $this->template->content = View::factory('oc-panel/pages/map', array('map_active' => $map_active, 'map_settings' => $map_settings));
 }
开发者ID:nick-catanchin-ie,项目名称:openclassifieds2,代码行数:21,代码来源:map.php

示例6: set_featured_plan

 /**
  * sets/creates a new plan
  * @param integer $days  
  * @param integer $price
  * @param integer $days_key key to be deleted...
  */
 public static function set_featured_plan($days, $price, $days_key = NULL)
 {
     $plans = self::get_featured_plans();
     //this deletes the previous key in case is a set. we do it here since calling delete_featured was cached...ugly as hell.
     if (is_numeric($days_key) and isset($plans[$days_key])) {
         unset($plans[$days_key]);
     }
     //this updates a current plan
     $plans[$days] = $price;
     //order from lowest to highest number of days
     ksort($plans);
     Model_Config::set_value('payment', 'featured_plans', json_encode($plans));
 }
开发者ID:zhangkom,项目名称:openclassifieds2,代码行数:19,代码来源:order.php

示例7: action_217

 /**
  * This function will upgrade DB that didn't existed in versions prior to 2.1.7
  */
 public function action_217()
 {
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "posts` ADD  `id_post_parent` INT NULL DEFAULT NULL AFTER  `id_user`")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "posts` ADD  `ip_address` FLOAT NULL DEFAULT NULL AFTER  `created`")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "posts` ADD  `id_forum` INT NULL DEFAULT NULL AFTER  `id_post_parent`")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE  `" . self::$db_prefix . "posts` ENGINE = MYISAM ")->execute();
     } catch (exception $e) {
     }
     DB::query(Database::UPDATE, "CREATE TABLE IF NOT EXISTS  `" . self::$db_prefix . "forums` (\n                      `id_forum` int(10) unsigned NOT NULL AUTO_INCREMENT,\n                      `name` varchar(145) NOT NULL,\n                      `order` int(2) unsigned NOT NULL DEFAULT '0',\n                      `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n                      `id_forum_parent` int(10) unsigned NOT NULL DEFAULT '0',\n                      `parent_deep` int(2) unsigned NOT NULL DEFAULT '0',\n                      `seoname` varchar(145) NOT NULL,\n                      `description` varchar(255) NULL,\n                      PRIMARY KEY (`id_forum`) USING BTREE,\n                      UNIQUE KEY `" . self::$db_prefix . "forums_IK_seo_name` (`seoname`)\n                    ) ENGINE=MyISAM")->execute();
     // build array with new (missing) configs
     //set sitemap to 0
     Model_Config::set_value('sitemap', 'on_post', 0);
     $configs = array(array('config_key' => 'forums', 'group_name' => 'general', 'config_value' => '0'), array('config_key' => 'ocacu', 'group_name' => 'general', 'config_value' => '0'));
     // returns TRUE if some config is saved
     $return_conf = Model_Config::config_array($configs);
 }
开发者ID:johnulist,项目名称:openclassifieds2,代码行数:29,代码来源:update.php

示例8: action_subscribe

 public function action_subscribe()
 {
     $this->auto_render = FALSE;
     // Update subscribe config action
     Model_Config::set_value('general', 'subscribe', 1);
     Core::delete_cache();
     die('OK');
 }
开发者ID:akram,项目名称:openclassifieds2-jetski,代码行数:8,代码来源:home.php

示例9: action_plugins

 /**
  * Plugins configuration 
  * @return [view] Renders view with form inputs
  */
 public function action_plugins()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Plugins')));
     $this->template->title = __('Plugins');
     // all form config values
     $generalconfig = new Model_Config();
     $config = $generalconfig->where('group_name', '=', 'general')->or_where('group_name', '=', 'i18n')->find_all();
     // config general array
     foreach ($config as $c) {
         $forms[$c->config_key] = $forms[$c->config_key] = array('key' => $c->group_name . '[' . $c->config_key . '][]', 'id' => $c->config_key, 'value' => $c->config_value);
     }
     // save only changed values
     if ($this->request->post()) {
         //d($this->request->post());
         foreach ($this->request->post('general') as $k => $v) {
             $this->request->post('general_' . $k, $v[0]);
         }
         $validation = Validation::factory($this->request->post());
         if ($validation->check()) {
             //save general
             foreach ($config as $c) {
                 $config_res = $this->request->post();
                 if (isset($config_res[$c->group_name][$c->config_key][0]) and $config_res[$c->group_name][$c->config_key][0] != $c->config_value) {
                     $c->config_value = $config_res[$c->group_name][$c->config_key][0];
                     Model_Config::set_value($c->group_name, $c->config_key, $c->config_value);
                 }
             }
         } else {
             $errors = $validation->errors('config');
             foreach ($errors as $error) {
                 Alert::set(Alert::ALERT, $error);
             }
             $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'plugins')));
         }
         Alert::set(Alert::SUCCESS, __('Plugins configuration updated'));
         $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'plugins')));
     }
     $this->template->content = View::factory('oc-panel/pages/settings/plugins', array('forms' => $forms));
 }
开发者ID:johnulist,项目名称:openclassifieds2,代码行数:43,代码来源:settings.php

示例10: action_image

 /**
  * Image configuration 
  * @return [view] Renders view with form inputs
  */
 public function action_image()
 {
     $this->template->scripts['footer'][] = 'js/jquery.validate.min.js';
     $this->template->scripts['footer'][] = '/js/oc-panel/settings.js';
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Image')));
     $this->template->title = __('Image');
     // all form config values
     $imageconf = new Model_Config();
     $config = $imageconf->where('group_name', '=', 'image')->find_all();
     // save only changed values
     if ($this->request->post()) {
         foreach ($this->request->post('image') as $k => $v) {
             $this->request->post('image_' . $k, $v[0]);
         }
         $validation = Validation::factory($this->request->post())->rule('image_max_image_size', 'not_empty')->rule('image_max_image_size', 'digit')->rule('image_height', 'digit')->rule('image_width', 'not_empty')->rule('image_width', 'digit')->rule('image_height_thumb', 'not_empty')->rule('image_height_thumb', 'digit')->rule('image_width_thumb', 'not_empty')->rule('image_width_thumb', 'digit')->rule('image_quality', 'not_empty')->rule('image_quality', 'digit')->rule('image_quality', 'range', array(':value', 1, 100))->rule('image_watermark', 'range', array(':value', 0, 1))->rule('image_watermark_position', 'not_empty')->rule('image_watermark_position', 'digit')->rule('image_watermark_position', 'range', array(':value', 0, 2))->rule('image_disallow_nudes', 'range', array(':value', 0, 1))->rule('image_aws_s3_active', 'range', array(':value', 0, 1));
         if ($validation->check()) {
             foreach ($config as $c) {
                 $config_res = $this->request->post();
                 if (!array_key_exists('allowed_formats', $config_res[$c->group_name])) {
                     Alert::set(Alert::ERROR, __('At least one image format should be allowed.'));
                     $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'image')));
                 }
                 if ($config_res[$c->group_name][$c->config_key][0] != $c->config_value) {
                     if ($c->config_key == 'allowed_formats') {
                         $allowed_formats = '';
                         foreach ($config_res[$c->group_name][$c->config_key] as $key => $value) {
                             $allowed_formats .= $value . ",";
                         }
                         $config_res[$c->group_name][$c->config_key][0] = $allowed_formats;
                     }
                     if ($c->config_key == 'aws_s3_domain') {
                         switch ($config_res[$c->group_name]['aws_s3_domain'][0]) {
                             case 'bn-s3':
                                 $s3_domain = $config_res[$c->group_name]['aws_s3_bucket'][0] . '.s3.amazonaws.com';
                                 break;
                             case 'bn':
                                 $s3_domain = $config_res[$c->group_name]['aws_s3_bucket'][0];
                                 break;
                             default:
                                 $s3_domain = 's3.amazonaws.com/' . $config_res[$c->group_name]['aws_s3_bucket'][0];
                                 break;
                         }
                         $config_res[$c->group_name][$c->config_key][0] = $s3_domain . '/';
                     }
                     $c->config_value = $config_res[$c->group_name][$c->config_key][0];
                     Model_Config::set_value($c->group_name, $c->config_key, $c->config_value);
                 }
             }
         } else {
             $errors = $validation->errors('config');
             foreach ($errors as $error) {
                 Alert::set(Alert::ALERT, $error);
             }
             $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'image')));
         }
         Alert::set(Alert::SUCCESS, __('Image Configuration updated'));
         $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'image')));
     }
     $this->template->content = View::factory('oc-panel/pages/settings/image', array('config' => $config));
 }
开发者ID:nick-catanchin-ie,项目名称:openclassifieds2,代码行数:64,代码来源:settings.php

示例11: action_css

 /**
  * custom css for default theme
  * @return [view] 
  */
 public function action_css()
 {
     // validation active
     //$this->template->scripts['footer'][]= '/js/oc-panel/settings.js';
     $this->template->title = __('Custom CSS');
     Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title));
     $css_active = Core::post('css_active', Core::Config('appearance.custom_css'));
     $css_content = Core::curl_get_contents(Theme::get_custom_css());
     if ($css_content === NULL) {
         Alert::set(Alert::ERROR, sprintf(__('We can not read file %s'), Theme::get_custom_css()));
     }
     // change the CSS
     if (($new_css = Core::post('css')) !== NULL) {
         //save css file
         $file = Theme::theme_folder('default') . '/css/web-custom.css';
         if (File::write($file, $new_css)) {
             Core::S3_upload($file, 'css/web-custom.css');
             //active or not? switch
             $css_active = Core::post('css_active');
             Model_Config::set_value('appearance', 'custom_css', $css_active);
             //increase version number
             Model_Config::set_value('appearance', 'custom_css_version', Core::Config('appearance.custom_css_version') + 1);
             $css_content = $new_css;
             Alert::set(Alert::SUCCESS, __('CSS file saved'));
         } else {
             Alert::set(Alert::ERROR, __('CSS file not saved'));
         }
     }
     $this->template->content = View::factory('oc-panel/pages/themes/css', array('css_content' => $css_content, 'css_version' => Core::Config('appearance.custom_css_version'), 'css_active' => $css_active));
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:34,代码来源:theme.php

示例12: action_15

 /**
  * This function will upgrade configs  
  */
 public function action_15()
 {
     try {
         DB::query(Database::UPDATE, "ALTER TABLE " . self::$db_prefix . "config DROP INDEX " . self::$db_prefix . "config_IK_group_name_AND_config_key")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "ALTER TABLE " . self::$db_prefix . "config ADD PRIMARY KEY (config_key)")->execute();
     } catch (exception $e) {
     }
     try {
         DB::query(Database::UPDATE, "CREATE UNIQUE INDEX " . self::$db_prefix . "config_UK_group_name_AND_config_key ON " . self::$db_prefix . "config(`group_name` ,`config_key`)")->execute();
     } catch (exception $e) {
     }
     //set sitemap to 0
     Model_Config::set_value('sitemap', 'on_post', 0);
     $configs = array(array('config_key' => 'ocacu', 'group_name' => 'general', 'config_value' => '0'));
     // returns TRUE if some config is saved
     $return_conf = Model_Config::config_array($configs);
 }
开发者ID:Ryanker,项目名称:open-eshop,代码行数:23,代码来源:update.php

示例13: action_hide_homepage_categories

 /**
  * Updates general.hide_homepage_categories config
  * @return void
  */
 public function action_hide_homepage_categories()
 {
     if ($hide_homepage_categories = $this->request->post('hide_homepage_categories') and is_array($hide_homepage_categories)) {
         $hide_homepage_categories = json_encode($hide_homepage_categories);
         Model_Config::set_value('general', 'hide_homepage_categories', $hide_homepage_categories);
         Alert::set(Alert::SUCCESS, __('Updated hidden categories from homepage'));
     }
     HTTP::redirect(Route::url('oc-panel', array('controller' => 'category', 'action' => 'index')));
 }
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:13,代码来源:category.php

示例14: action_themes

 /**
  * STEP 4 and last
  * updates all themes to latest version from API license
  * @return void 
  */
 public function action_themes()
 {
     $licenses = array();
     //getting the licenses unique. to avoid downloading twice
     $themes = core::config('theme');
     foreach ($themes as $theme) {
         $settings = json_decode($theme, TRUE);
         if (isset($settings['license'])) {
             if (!in_array($settings['license'], $licenses)) {
                 $licenses[] = $settings['license'];
             }
         }
     }
     //only if theres work to do ;)
     if (count($licenses) > 0) {
         //activate maintenance mode
         Model_Config::set_value('general', 'maintenance', 1);
         //for each unique license then download!
         foreach ($licenses as $license) {
             Theme::download($license);
         }
         Alert::set(Alert::SUCCESS, __('Themes Updated'));
         //deactivate maintenance mode
         Model_Config::set_value('general', 'maintenance', 0);
         //clean cache
         Core::delete_cache();
     }
     //finished the entire update process
     $this->redirect(Route::url('oc-panel', array('controller' => 'update', 'action' => 'index')));
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:35,代码来源:update.php


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