• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_settings_errors函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_settings_errors函数的典型用法代码示例。如果您正苦于以下问题:PHP get_settings_errors函数的具体用法?PHP get_settings_errors怎么用?PHP get_settings_errors使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: update_license

 public function update_license($value = null)
 {
     $license = $this->get_license();
     if ($license === $value) {
         return $value;
     }
     $deactivate_license = false;
     if ($this->valid_hash($value)) {
         $this->set_license($value);
         $value = $this->activate_license();
         $this->set_license($value);
     } else {
         $this->deactivate_license();
         $this->delete_license();
         $deactivate_license = true;
         $value = '';
     }
     if ($this->valid_license()) {
         $text = esc_html__('%s license saved.');
         $text = sprintf($text, $this->item_name);
         add_settings_error(static::$settings_id, 'license_saved', $text, 'updated');
     } elseif (empty($deactivate_license)) {
         $text = esc_html__('%s license not saved.');
         $text = sprintf($text, $this->item_name);
         add_settings_error(static::$settings_id, 'license_not_saved', $text, 'error');
     }
     if (empty(self::$settings_saved)) {
         self::$settings_saved = true;
         set_transient('settings_errors', get_settings_errors(), 30);
     }
     return $value;
 }
开发者ID:bchamberlain88,项目名称:pavati,代码行数:32,代码来源:class-aihrus-licensing.php


示例2: presscore_ubermenu_generate_less_css_file_after_options_save

 function presscore_ubermenu_generate_less_css_file_after_options_save()
 {
     $set = get_settings_errors('options-framework');
     if (!empty($set)) {
         presscore_generate_less_css_file('the7-ubermenu.less', PRESSCORE_THEME_URI . '/css/the7-uber-menu.less');
     }
 }
开发者ID:noman90rauf,项目名称:wp-content,代码行数:7,代码来源:mod-ubermenu.php


示例3: init_settings

 /**
  * Callback for the 'admin_init' action; used to initialize settings APIs
  */
 public function init_settings()
 {
     if (isset($_GET['settings-updated'])) {
         $err = get_settings_errors();
         $errors = array();
         foreach ($err as $msg) {
             if ('general' !== $msg['setting'] && 'settings_updated' !== $msg['code']) {
                 $errors[] = $msg;
             }
         }
         $this->_errors = $errors;
         global $wp_settings_errors;
         $wp_settings_errors = array();
         if (0 == count($this->_errors)) {
             add_action('admin_notices', array(&$this, 'saved_notice'));
         } else {
             add_action('admin_notices', array($this, 'error_notice'));
         }
     }
     register_setting($this->get_group(), $this->get_option(), array(&$this, 'validate_options'));
     foreach ($this->_args['sections'] as $section_id => $section) {
         add_settings_section($section_id, $section['title'], array(&$this, 'section_callback'), $this->get_page());
         // page
         // add all the fields
         foreach ($section['fields'] as $field_id => $field) {
             $label = '<label for="' . $field_id . '"' . (isset($field['tooltip']) ? ' title="' . esc_attr($field['tooltip']) . '" ' : '') . '>' . esc_html($field['title']) . ($this->_is_required($field) ? '<span class="required">*</span>' : '') . '</label>';
             add_settings_field($field_id, $label, array(&$this, 'display_field'), $this->get_page(), $section_id, array($section_id, $field_id));
         }
     }
 }
开发者ID:heidarmostafa,项目名称:store-cpt,代码行数:33,代码来源:class.spectromsettings.php


示例4: add_settings

 /**
  * Add settings for the RSS feed
  * + also regenerates the secret if requested
  */
 public function add_settings()
 {
     //we register a setting to keep track of the RSS feed status (enabled/disabled)
     register_setting('simple_history_settings_group', 'simple_history_enable_rss_feed', array($this, 'update_rss_status'));
     /**
      * Start new section for RSS feed
      */
     $settings_section_rss_id = "simple_history_settings_section_rss";
     add_settings_section($settings_section_rss_id, _x("RSS feed", "rss settings headline", "simple-history"), array($this, "settings_section_output"), SimpleHistory::SETTINGS_MENU_SLUG);
     // Enable/Disabled RSS feed
     add_settings_field("simple_history_enable_rss_feed", __("Enable", "simple-history"), array($this, "settings_field_rss_enable"), SimpleHistory::SETTINGS_MENU_SLUG, $settings_section_rss_id);
     //if RSS is activated we display other fields
     if ($this->is_rss_enabled()) {
         // RSS address
         add_settings_field("simple_history_rss_feed", __("Address", "simple-history"), array($this, "settings_field_rss"), SimpleHistory::SETTINGS_MENU_SLUG, $settings_section_rss_id);
         // Regnerate address
         add_settings_field("simple_history_rss_feed_regenerate_secret", __("Regenerate", "simple-history"), array($this, "settings_field_rss_regenerate"), SimpleHistory::SETTINGS_MENU_SLUG, $settings_section_rss_id);
     }
     // Create new RSS secret
     $create_new_secret = false;
     $create_secret_nonce_name = "simple_history_rss_secret_regenerate_nonce";
     if (isset($_GET[$create_secret_nonce_name]) && wp_verify_nonce($_GET[$create_secret_nonce_name], 'simple_history_rss_update_secret')) {
         $create_new_secret = true;
         $this->update_rss_secret();
         // Add updated-message and store in transient and then redirect
         // This is the way options.php does it.
         $msg = __("Created new secret RSS address", 'simple-history');
         add_settings_error("simple_history_rss_feed_regenerate_secret", "simple_history_rss_feed_regenerate_secret", $msg, "updated");
         set_transient('settings_errors', get_settings_errors(), 30);
         $goback = esc_url_raw(add_query_arg('settings-updated', 'true', wp_get_referer()));
         wp_redirect($goback);
         exit;
     }
 }
开发者ID:HarvardChanSchool,项目名称:WordPress-Simple-History,代码行数:38,代码来源:SimpleHistoryRSSDropin.php


示例5: redirect_to_settings

 function redirect_to_settings()
 {
     //First preserve all errors that have been generated
     set_transient('settings_errors', get_settings_errors(), 30);
     //Call settings url
     wp_redirect($this->get_redirect_url() . '&settings-updated=true');
 }
开发者ID:philgutowski,项目名称:photo-express-for-google,代码行数:7,代码来源:class-google-photo-access.php


示例6: post_restore

 public function post_restore()
 {
     if (isset($_POST['job_id']) && isset($_POST['backup_uniqid']) && isset($_POST['_wpnonce']) && isset($_POST['method'])) {
         $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
         if (!wp_verify_nonce($nonce, 'my-wp-backup-restore-backup')) {
             wp_die(esc_html__('Nope! Security check failed!', 'my-wp-backup'));
         }
         $id = absint($_POST['job_id']);
         $uniqid = sanitize_key($_POST['backup_uniqid']);
         $method = filter_input(INPUT_POST, 'method', FILTER_SANITIZE_STRING);
         $backup = self::get($id, $uniqid);
         if (!isset($backup['duration'])) {
             add_settings_error('', '', __('Invalid backup id/uniqid.', 'my-wp-backup'));
             set_transient('settings_errors', get_settings_errors());
             wp_safe_redirect($this->admin->get_page_url('backup', array('settings-updated' => 1)));
         }
         if (!$backup->has_archives()) {
             // No local copy and no remote copy === DEAD END.
             if (empty($backup['destinations'])) {
                 add_settings_error('', '', __('Backup files missing.', 'my-wp-backup'));
                 set_transient('settings_errors', get_settings_errors());
                 wp_safe_redirect($this->admin->get_page_url('backup', array('settings-updated' => 1)));
             }
             if (!isset($backup['destinations'][$method])) {
                 add_settings_error('', '', sprintf(__('No backup files from %s.', 'my-wp-backup'), Job::$destinations[$method]));
                 set_transient('settings_errors', get_settings_errors());
                 wp_safe_redirect($this->admin->get_page_url('backup', array('settings-updated' => 1)));
             }
         }
         wp_schedule_single_event(time(), 'wp_backup_restore_backup', array(array($id, $uniqid, $method)));
         wp_safe_redirect($this->admin->get_page_url('backup', array('uniqid' => $uniqid, 'action' => 'viewprogress', 'id' => $id)));
     }
 }
开发者ID:guysyml,项目名称:software,代码行数:33,代码来源:Backup.php


示例7: ubermenu_migration_check

function ubermenu_migration_check()
{
    if (isset($_GET['page']) && $_GET['page'] == 'ubermenu-settings') {
        if (isset($_GET['do'])) {
            if ($_GET['do'] == 'migration-check' || $_GET['do'] == 'migrate' || $_GET['do'] == 'reset-styles') {
                //If we're doing the migration check now, don't show this message
                return;
            } else {
                if ($_GET['do'] == 'no-migrate') {
                    update_option(UBERMENU_PREFIX . 'migration_status', 'do-not-migrate');
                } else {
                    if ($_GET['do'] == 'reset-migration-check') {
                        update_option(UBERMENU_PREFIX . 'migration_status', false);
                    }
                }
            }
        }
    }
    $migration_status = get_option(UBERMENU_PREFIX . 'migration_status', false);
    //Have we already migrated, or determined we don't need to?
    if ($migration_status == 'complete' || $migration_status == 'n/a' || $migration_status == 'do-not-migrate') {
        return;
    }
    //We may need to migrate - do the old setting exist?
    $old_ops = get_option('wp-mega-menu-settings', false);
    // 'sparkops_ubermenu' );
    //There are some old setting, offer migration
    if (is_array($old_ops)) {
        if ($migration_status == false) {
            $notice = __('Looks like you\'ve updated to UberMenu 3.  Awesome!  Would you like to migrate your settings?', 'ubermenu');
            $notice .= ' <a class="button button-primary" href="' . admin_url('themes.php?page=ubermenu-settings&do=migration-check') . '">' . __('Begin Migration') . '</a>';
            $notice .= ' <a class="button ubermenu-migrate-dismiss" href="' . admin_url('themes.php?page=ubermenu-settings&do=no-migrate') . '">' . __('No, thanks', 'ubermenu') . '</a>';
            $add = true;
            //Avoid duplication
            $errors = get_settings_errors();
            if (is_array($errors)) {
                foreach ($errors as $er) {
                    if (is_array($er)) {
                        if ($er['code'] == 'migration-notice') {
                            $add = false;
                            break;
                        }
                    }
                }
            }
            if ($add) {
                add_settings_error('menu-migration', 'migration-notice', $notice, 'updated');
                add_action('admin_footer', 'ubermenu_migrate_nag_js');
            }
        } else {
            if ($migration_status == 'in_progress') {
                $notice = __('Migration did not complete successfully', 'ubermenu');
                add_settings_error('menu-migration', 'migration-notice-incomplete', $notice, 'error');
                update_option(UBERMENU_PREFIX . 'migration_status', false);
            }
        }
    } else {
        update_option(UBERMENU_PREFIX . 'migration_status', 'n/a');
    }
}
开发者ID:WackoMako,项目名称:stonedape,代码行数:60,代码来源:migration.php


示例8: compiler_add_error

    function compiler_add_error()
    {
        if (get_settings_errors('options-framework')) {
            return;
        }
        add_settings_error('options-framework', 'lessc_error', _x('Attention! Theme Options will not be saved, because one of your plugins conflicts with the theme.<br />
	How to make it work:<br />
	1. Deactivate all plugins.<br />
	2. Make required changes. Save Theme Options.<br />
	3. Activate the plugins back.', 'backend', LANGUAGE_ZONE), 'error');
    }
开发者ID:scottnkerr,项目名称:eeco,代码行数:11,代码来源:Compiler.class.php


示例9: presscore_generate_less_css_file_after_options_save

 /**
  * Update custom.less stylesheet.
  *
  */
 function presscore_generate_less_css_file_after_options_save()
 {
     $css_is_writable = apply_filters('presscore_less_cache_writable', true);
     $set = get_settings_errors('options-framework');
     if (!empty($set)) {
         $dynamic_stylesheets = presscore_get_dynamic_stylesheets_list();
         foreach ($dynamic_stylesheets as $stylesheet_handle => $stylesheet) {
             presscore_generate_less_css_file($stylesheet_handle, $stylesheet['src']);
         }
         if ($css_is_writable) {
             add_settings_error('presscore-wp-less', 'save_stylesheet', _x('Stylesheet saved.', 'backend', 'the7mk2'), 'updated fade');
         }
     }
 }
开发者ID:10asfar,项目名称:WordPress-the7-theme-demo-,代码行数:18,代码来源:dynamic-stylesheets-functions.php


示例10: handle_settings_save

 function handle_settings_save()
 {
     if (!isset($_REQUEST[$this->name()])) {
         wp_die(__('Settings could not be parsed — this may be caused by a plugin conflict.'));
     }
     $to_be_saved = $_REQUEST[$this->name()];
     $option_page = $_REQUEST['option_page'];
     $is_network_wide = isset($_REQUEST['network_wide']) && $_REQUEST['network_wide'];
     if (!wp_verify_nonce($_REQUEST['_wpnonce'], $option_page . "-options")) {
         wp_die(__('Cheatin&#8217; uh?'));
     }
     // if it's network request, we want to check that the current user is
     // a network admin
     if ($is_network_wide && !is_super_admin()) {
         wp_die(__('Cheatin&#8217; uh?'));
     }
     // verify that the user has the permissions to edit the clef page
     $capability = 'manage_options';
     $capability = apply_filters("option_page_capability_{$option_page}", $capability);
     if (!current_user_can($capability)) {
         wp_die(__('Cheatin&#8217; uh?'));
     }
     $whitelist_options = apply_filters('whitelist_options', array());
     $options = $whitelist_options[$option_page];
     if (empty($options[0]) || $options[0] != $this->name()) {
         wp_die("You can't do that!");
     }
     $to_be_saved = apply_filters('ajax_settings_pre_save', $to_be_saved);
     if ($is_network_wide) {
         update_site_option($this->name(), $to_be_saved);
     } else {
         update_option($this->name(), $to_be_saved);
     }
     $errors = get_settings_errors();
     $response = array();
     if (!empty($errors)) {
         $error_messages = array();
         foreach ($errors as &$error) {
             $error_messages[$error['code']] = $error['message'];
         }
         $response['errors'] = $error_messages;
         header('HTTP/1.0 400');
         wp_send_json_error($response);
     } else {
         $response['success'] = true;
         wp_send_json($response);
     }
 }
开发者ID:blueyedQT,项目名称:Arizona-Team-One.com,代码行数:48,代码来源:ajax-settings.php


示例11: test_sanitize_permalink_structure

 /**
  * @dataProvider permalink_structure_provider
  */
 public function test_sanitize_permalink_structure($provided, $expected, $valid)
 {
     global $wp_settings_errors;
     $old_wp_settings_errors = (array) $wp_settings_errors;
     $actual = sanitize_option('permalink_structure', $provided);
     $errors = get_settings_errors('permalink_structure');
     // Clear errors.
     $wp_settings_errors = $old_wp_settings_errors;
     if ($valid) {
         $this->assertEmpty($errors);
     } else {
         $this->assertNotEmpty($errors);
         $this->assertEquals('invalid_permalink_structure', $errors[0]['code']);
     }
     $this->assertEquals($expected, $actual);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:19,代码来源:sanitize-option.php


示例12: graphene_ajax_update_preset_handler

/**
 * Process the AJAX call to save/delete colour preset
 */
function graphene_ajax_update_preset_handler()
{
    global $wpdb;
    check_ajax_referer('graphene_options-options', '_wpnonce');
    if (!current_user_can('edit_theme_options')) {
        echo '<div class="error fade"><p>' . __("Sorry, but you don't have the necessary permission to modify theme options.", 'graphene') . '</p></div>';
        die;
    }
    $action = $_POST['colour_preset_action'];
    $preset = $action == 'delete' ? trim($_POST['colour_preset_name']) : sanitize_title($_POST['colour_preset_name']);
    $data = $_POST['graphene_settings'];
    if ($action == 'delete') {
        unset($data['colour_presets'][$preset]);
    }
    if ($action == 'save') {
        $count = $dash = '';
        while (array_key_exists($preset . $dash . $count, $data['colour_presets'])) {
            if (!$count) {
                $count = 0;
                $dash = '-';
            }
            $count++;
        }
        if ($count) {
            $preset .= '-' . $count;
        }
        $colour_settings = $data;
        unset($colour_settings['colour_preset']);
        unset($colour_settings['colour_presets']);
        $colour_settings = json_encode($colour_settings);
        $data['colour_presets'][$preset]['name'] = trim($_POST['colour_preset_name']);
        $data['colour_presets'][$preset]['code'] = $colour_settings;
        $data['colour_preset'] = $preset;
    }
    $data = graphene_settings_validator($data);
    if (get_settings_errors('graphene_options')) {
        settings_errors('graphene_options');
    } else {
        if ($data) {
            update_option('graphene_settings', stripslashes_deep($data));
        }
        $message = $action == 'delete' ? __('Colour preset deleted.', 'graphene') : __('Colour preset saved.', 'graphene');
        echo '<div class="updated fade"><p>' . $message . '</p></div>';
    }
    die;
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:49,代码来源:ajax-handler.php


示例13: presscore_generate_less_css_file_after_options_save

 /**
  * Update custom.less stylesheet.
  *
  */
 function presscore_generate_less_css_file_after_options_save()
 {
     $css_is_writable = get_option('presscore_less_css_is_writable');
     if (isset($_GET['page']) && 'options-framework' == $_GET['page'] && !$css_is_writable) {
         return;
     }
     $set = get_settings_errors('options-framework');
     if (!empty($set)) {
         $dynamic_stylesheets = presscore_get_dynamic_stylesheets_list();
         foreach ($dynamic_stylesheets as $stylesheet_handle => $stylesheet) {
             presscore_generate_less_css_file($stylesheet_handle, $stylesheet['src']);
         }
         if ($css_is_writable) {
             add_settings_error('presscore-wp-less', 'save_stylesheet', _x('Stylesheet saved.', 'backend', 'the7mk2'), 'updated fade');
         }
     }
 }
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:21,代码来源:dynamic-stylesheets-functions.php


示例14: lbmn_required_plugins_install_check

/**
 * ----------------------------------------------------------------------
 * Check if required plugins were manually installed
 */
function lbmn_required_plugins_install_check()
{
    if (!get_option(LBMN_THEME_NAME . '_required_plugins_installed')) {
        // Proceed only if '_required_plugins_installed' not already market as true
        $current_tgmpa_message = '';
        $current_tgmpa_messages = get_settings_errors('tgmpa');
        foreach ($current_tgmpa_messages as $message) {
            $current_tgmpa_message = $message['message'];
        }
        // If message has no link to install-required-plugins page then all
        // required plugins has been installed
        if (!stristr($current_tgmpa_message, 'install-required-plugins')) {
            // Update theme option '_required_plugins_installed'
            update_option(LBMN_THEME_NAME . '_required_plugins_installed', true);
        }
    }
}
开发者ID:shimion,项目名称:localinsurance-theme,代码行数:21,代码来源:functions-themeinstall.php


示例15: franz_ajax_update_handler

/**
 * Process the AJAX call to save the theme's settings
 */
function franz_ajax_update_handler()
{
    global $wpdb;
    check_ajax_referer('franz_options-options', '_wpnonce');
    if (!current_user_can('edit_theme_options')) {
        echo '<div class="error fade"><p>' . __("Sorry, but you don't have the necessary permission to modify theme options.", 'franz-josef') . '</p></div>';
        die;
    }
    $data = $_POST['franz_settings'];
    $data = franz_settings_validator($data);
    if (get_settings_errors('franz_options')) {
        settings_errors('franz_options');
    } else {
        if ($data) {
            update_option('franz_settings', stripslashes_deep($data));
        }
        echo '<div class="updated fade"><p>' . __('Options saved.', 'franz-josef') . '</p></div>';
    }
    die;
}
开发者ID:samuel657677,项目名称:flipbook,代码行数:23,代码来源:ajax-handler.php


示例16: update_network_option

 /**
  * Updates network options for a network settings page.
  *
  * This method relies on the settings page to use the `settings_fields()` function, similarly
  * to regular WordPress settings pages.
  *
  * @since 1.0.0
  * @access public
  */
 public function update_network_option()
 {
     if (!isset($_POST['option_page']) || !isset($_POST['action']) || 'update' !== $_POST['action']) {
         return;
     }
     $option_page = $_POST['option_page'];
     if ('wp_encrypt_settings' !== $option_page) {
         return;
     }
     check_admin_referer('wp_encrypt_settings-options');
     if (isset($_POST['wp_encrypt_settings'])) {
         update_site_option('wp_encrypt_settings', wp_unslash($_POST['wp_encrypt_settings']));
     }
     if (0 === count(get_settings_errors())) {
         add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
     }
     set_site_transient('settings_errors', get_settings_errors(), 30);
     wp_redirect(add_query_arg('updated', 'true', network_admin_url('settings.php?page=wp_encrypt')));
     exit;
 }
开发者ID:felixarntz,项目名称:wp-encrypt,代码行数:29,代码来源:NetworkSettingsAPI.php


示例17: adminNotices

function adminNotices()
{
    $settings = Settings\getSettings();
    $errors = get_settings_errors();
    foreach ($errors as $error) {
        if ($error["type"] != "error" && $error["type"] != "updated") {
            continue;
        } elseif ($error["code"] === $settings[Settings\S_PAGE_NAME]) {
            ?>
            <div class="<?php 
            echo $error["type"];
            ?>
"><p><?php 
            echo $error["message"];
            ?>
</p></div>
            <?php 
        }
    }
}
开发者ID:k1sul1,项目名称:custom-admin-notices,代码行数:20,代码来源:admin-actions.php


示例18: _cp_enable_permalink_settings

/**
 * Temporary workaround for wordpress bug #9296 http://core.trac.wordpress.org/ticket/9296
 * Although there is a hook in the options-permalink.php to insert custom settings,
 * it does not actually save any custom setting which is added to that page.
 */
function _cp_enable_permalink_settings()
{
    global $new_whitelist_options;
    // save hook for permalinks page
    if (isset($_POST['permalink_structure']) || isset($_POST['category_base'])) {
        check_admin_referer('update-permalink');
        $option_page = 'permalink';
        $capability = 'manage_options';
        $capability = apply_filters("option_page_capability_{$option_page}", $capability);
        if (!current_user_can($capability)) {
            wp_die(__('Cheatin&#8217; uh?', APP_TD));
        }
        // get extra permalink options
        $options = $new_whitelist_options[$option_page];
        if ($options) {
            foreach ($options as $option) {
                $option = trim($option);
                $value = null;
                if (isset($_POST[$option])) {
                    $value = $_POST[$option];
                }
                if (!is_array($value)) {
                    $value = trim($value);
                }
                $value = stripslashes_deep($value);
                // get the old values to merge
                $db_option = get_option($option);
                if (is_array($db_option)) {
                    update_option($option, array_merge($db_option, $value));
                } else {
                    update_option($option, $value);
                }
            }
        }
        /**
         *  Handle settings errors
         */
        set_transient('settings_errors', get_settings_errors(), 30);
    }
}
开发者ID:kalushta,项目名称:darom,代码行数:45,代码来源:utils.php


示例19: admin_page

 /**
  * Admin page html
  *
  * @since 0.1
  */
 function admin_page()
 {
     $files = new WP_Parser_JSON_File();
     // abort if we cannot access the WP_Filesystem API
     if ($files->generate_files() === true) {
         return;
     }
     echo '<div class="wrap">';
     echo '<h2>' . __('WP Parser JSON', 'wp-parser-json') . '</h2>';
     echo '<p>' . __('Generate json files from all functions, hooks, filters, actions and classes', 'wp-parser-json') . '</p>';
     settings_errors();
     // don't show the form if the post types from WP Parser don't exist
     if (!$files->post_types_exists()) {
         return;
     }
     echo '<form method="post" action="">';
     wp_nonce_field('wp-parser-json_nonce');
     echo get_submit_button(esc_html__('Generate json files!', 'wp-parser-json'));
     echo '</form>';
     $errors = get_settings_errors();
     $settings_updated = true;
     // Check if new files were generated.
     if (!(isset($errors[0]['code']) && 'wp_parser_json_updated' === $errors[0]['code'])) {
         // Offer download link to old zip file if it exists.
         $zip_dir = plugin_dir_path(__FILE__) . 'json-files/wp-parser-json.zip';
         $version = plugin_dir_path(__FILE__) . 'json-files/version.json';
         if (file_exists($zip_dir) && file_exists($version)) {
             $version = json_decode(file_get_contents($version));
             $version = isset($version->version) ? '(WP ' . $version->version . ')' : '';
             echo '<a href="' . plugins_url('wp-parser-json') . '/json-files/wp-parser-json.zip">';
             printf(__('download %s files', 'wp-parser-json'), $version) . '</a>';
         }
         $settings_updated = false;
     }
     if ($settings_updated) {
         do_action('wp_parser_json_afer_form');
     }
     echo '</div>';
 }
开发者ID:keesiemeijer,项目名称:wp-parser-json,代码行数:44,代码来源:class-wp-parser-json-admin.php


示例20: bfox_ms_admin_page_save

function bfox_ms_admin_page_save()
{
    if ('bfox-ms' == $_GET['action']) {
        check_admin_referer('bfox-ms-admin-settings-options');
        update_site_option('bfox-ms-allow-blog-options', $_POST['bfox-ms-allow-blog-options']);
        update_site_option('bfox-blog-options', $_POST['bfox-blog-options']);
        /**
         *  Handle settings errors and return to options page
         */
        // If no settings errors were registered add a general 'updated' message.
        if (!count(get_settings_errors())) {
            add_settings_error('general', 'settings_updated', __('Settings saved.', 'bfox'), 'updated');
        }
        set_transient('settings_errors', get_settings_errors(), 30);
        /**
         * Redirect back to the settings page that was submitted
         */
        $goback = add_query_arg('updated', 'true', wp_get_referer());
        wp_redirect($goback);
        exit;
    }
}
开发者ID:jeffryevans,项目名称:biblefox-wp,代码行数:22,代码来源:ms-admin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_shipping_object函数代码示例发布时间:2022-05-15
下一篇:
PHP get_settings函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap