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


PHP SucomUtil::restore_checkboxes方法代码示例

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


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

示例1: save_site_options

 public function save_site_options()
 {
     $page = empty($_POST['page']) ? key($this->p->cf['*']['lib']['sitesubmenu']) : $_POST['page'];
     if (empty($_POST[NGFB_NONCE])) {
         $this->p->debug->log('Nonce token validation post field missing.');
         wp_redirect($this->p->util->get_admin_url($page));
         exit;
     } elseif (!wp_verify_nonce($_POST[NGFB_NONCE], $this->get_nonce())) {
         $this->p->notice->err(__('Nonce token validation failed for network options (update ignored).', NGFB_TEXTDOM), true);
         wp_redirect($this->p->util->get_admin_url($page));
         exit;
     } elseif (!current_user_can('manage_network_options')) {
         $this->p->notice->err(__('Insufficient privileges to modify network options.', NGFB_TEXTDOM), true);
         wp_redirect($this->p->util->get_admin_url($page));
         exit;
     }
     $def_opts = $this->p->opt->get_site_defaults();
     $opts = empty($_POST[NGFB_SITE_OPTIONS_NAME]) ? $def_opts : SucomUtil::restore_checkboxes($_POST[NGFB_SITE_OPTIONS_NAME]);
     $opts = array_merge($this->p->site_options, $opts);
     $opts = $this->p->opt->sanitize($opts, $def_opts);
     // cleanup excess options and sanitize
     $opts = apply_filters($this->p->cf['lca'] . '_save_site_options', $opts);
     update_site_option(NGFB_SITE_OPTIONS_NAME, $opts);
     // store message in user options table
     $this->p->notice->inf(__('Plugin settings have been updated.', NGFB_TEXTDOM), true);
     wp_redirect($this->p->util->get_admin_url($page) . '&settings-updated=true');
     exit;
     // stop here
 }
开发者ID:coollog,项目名称:theboola,代码行数:29,代码来源:admin.php

示例2: get_submit_opts

 protected function get_submit_opts($id, $mod = false)
 {
     $defs = $this->get_defaults(false, $mod);
     unset($defs['options_filtered']);
     unset($defs['options_version']);
     $prev = $this->get_options($id);
     unset($prev['options_filtered']);
     unset($prev['options_version']);
     $opts = empty($_POST[NGFB_META_NAME]) ? array() : $_POST[NGFB_META_NAME];
     $opts = SucomUtil::restore_checkboxes($opts);
     $opts = array_merge($prev, $opts);
     $opts = $this->p->opt->sanitize($opts, $defs, false, $mod);
     // network is false
     if ($mod !== false) {
         $opts = apply_filters($this->p->cf['lca'] . '_save_meta_options', $opts, $mod, $id);
     }
     foreach ($defs as $key => $def_val) {
         if (array_key_exists($key, $opts)) {
             if ($opts[$key] == -1 || $opts[$key] === '') {
                 unset($opts[$key]);
             }
         }
     }
     if (empty($opts['buttons_disabled'])) {
         unset($opts['buttons_disabled']);
     }
     foreach (array('rp', 'og') as $meta_pre) {
         if (empty($opts[$meta_pre . '_img_id'])) {
             unset($opts[$meta_pre . '_img_id_pre']);
         }
         $force_regen = false;
         foreach (array('width', 'height', 'crop', 'crop_x', 'crop_y') as $key) {
             // if option is the same as the default, then unset it
             if (isset($opts[$meta_pre . '_img_' . $key]) && isset($defs[$meta_pre . '_img_' . $key]) && $opts[$meta_pre . '_img_' . $key] === $defs[$meta_pre . '_img_' . $key]) {
                 unset($opts[$meta_pre . '_img_' . $key]);
             }
             if ($mod !== false) {
                 if (!empty($this->p->options['plugin_auto_img_resize'])) {
                     $check_current = isset($opts[$meta_pre . '_img_' . $key]) ? $opts[$meta_pre . '_img_' . $key] : '';
                     $check_previous = isset($prev[$meta_pre . '_img_' . $key]) ? $prev[$meta_pre . '_img_' . $key] : '';
                     if ($check_current !== $check_previous) {
                         $force_regen = true;
                     }
                 }
             }
         }
         if ($force_regen === true) {
             set_transient($this->p->cf['lca'] . '_' . $mod . '_' . $id . '_regen_' . $meta_pre, true);
         }
     }
     return $opts;
 }
开发者ID:jamesvillarrubia,项目名称:uniken-web,代码行数:52,代码来源:meta.php


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