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


PHP MS_Plugin::flush_rewrite_rules方法代码示例

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


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

示例1: process_admin_page


//.........这里部分代码省略.........
     $step = $this->get_step();
     $goto_url = null;
     $membership = $this->load_membership();
     $membership_id = $membership->id;
     $completed = false;
     $is_wizard = MS_Plugin::is_wizard();
     $save_data = array();
     // Check if user came from WPMU Dashboard plugin
     if (!$is_wizard && isset($_SERVER['HTTP_REFERER'])) {
         $referer = $_SERVER['HTTP_REFERER'];
         $params = parse_url($referer, PHP_URL_QUERY);
         $fields = array();
         parse_str($params, $fields);
         if (isset($fields['page']) && 'wpmudev-plugins' == $fields['page']) {
             $url = MS_Controller_Plugin::get_admin_url('settings');
             wp_safe_redirect($url);
             exit;
         }
     }
     // MS_Controller_Rule is executed using this action.
     do_action('ms_controller_membership_admin_page_process_' . $step);
     // Only accessible to admin users
     if (!$this->is_admin_user()) {
         return false;
     }
     if ($this->verify_nonce(null, 'any')) {
         // Take next actions based in current step.
         // Check if we are editing a membership.
         $save_membership = $this->verify_nonce(self::ACTION_SAVE);
         if ($save_membership) {
             // Save the current Setup-Process.
             $save_data = $_POST;
             unset($save_data['_wpnonce']);
             unset($save_data['action']);
             if (isset($_POST['set_private_flag'])) {
                 lib3()->array->equip_post('public');
                 $save_data['public'] = !lib3()->is_true($_POST['public']);
             }
             if (isset($_POST['set_paid_flag'])) {
                 lib3()->array->equip_post('paid');
                 $save_data['is_free'] = !lib3()->is_true($_POST['paid']);
             }
             $msg = $this->save_membership($save_data);
             // Refresh the $membership variable.
             $membership = $this->load_membership();
             $membership_id = $membership->id;
         }
         switch ($step) {
             case self::STEP_MS_LIST:
                 // Display a list of all memberships
                 $fields = array('action', 'membership_id');
                 if (self::validate_required($fields, 'GET')) {
                     $msg = $this->membership_list_do_action($_GET['action'], array(absint($_GET['membership_id'])));
                     $next_step = self::STEP_MS_LIST;
                 }
                 break;
             case self::STEP_ADD_NEW:
                 // Create Membership: Select the Membership-Type
                 $paid = isset($_POST['set_paid_flag']) && isset($_POST['paid']) && lib3()->is_true($_POST['paid']);
                 if ($paid) {
                     $next_step = self::STEP_PAYMENT;
                 } else {
                     $next_step = self::STEP_MS_LIST;
                 }
                 $msg = $this->mark_setup_completed();
                 $completed = true;
                 break;
             case self::STEP_PAYMENT:
                 // Setup payment options
                 $next_step = self::STEP_MS_LIST;
                 break;
             case self::STEP_EDIT:
                 $this->process_edit_page();
                 break;
         }
         if (!empty($next_step)) {
             $args = array('step' => $next_step, 'membership_id' => $membership_id);
             if (!empty($msg)) {
                 $args['msg'] = $msg;
             }
             /*
              * Param 'MENU_SLUG' forces the admin-URL to use the top-level
              * menu slug instead of the current base_slug.
              * During Setup-wizard the base_slug ends in '-setup', but when
              * we reach this point the wizard is completed.
              */
             $slug = 'MENU_SLUG';
             $goto_url = esc_url_raw(add_query_arg($args, MS_Controller_Plugin::get_admin_url($slug)));
             $goto_url = apply_filters('ms_controller_membership_membership_admin_page_process_goto_url', $goto_url, $next_step);
             if ($completed) {
                 MS_Plugin::flush_rewrite_rules($goto_url);
             } else {
                 wp_safe_redirect($goto_url);
             }
             exit;
         }
     } else {
         // No action request found.
     }
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:101,代码来源:class-ms-controller-membership.php

示例2: update

 /**
  * Upgrade database.
  *
  * @since  1.0.0
  * @param  bool $force Also execute update logic when version did not change.
  */
 public static function update($force = false)
 {
     static $Done = false;
     if ($Done && !$force) {
         return;
     }
     // Migration handler has its own valid_user check.
     self::check_migration_handler();
     // Updates are only triggered from Admin-Side by an Admin user.
     if (!self::valid_user()) {
         return;
     }
     // Check for correct network-wide protection setup.
     self::check_settings();
     $settings = MS_Factory::load('MS_Model_Settings');
     $old_version = $settings->version;
     // Old: The version in DB.
     $new_version = MS_Plugin::instance()->version;
     // New: Version in file.
     $is_new_setup = empty($old_version);
     // Compare current src version to DB version:
     // We only do UP-grades but no DOWN-grades!
     if ($old_version) {
         $version_changed = version_compare($old_version, $new_version, 'lt');
     } else {
         $version_changed = true;
     }
     if ($force || $version_changed) {
         $Done = true;
         $msg = array();
         /*
          * ----- General update logic, executed on every update ------------
          */
         do_action('ms_model_upgrade_before_update', $settings, $old_version, $new_version, $force);
         // Prepare the Update message.
         if (!$version_changed) {
             $msg[] = sprintf(__('<strong>Membership 2</strong> is set up for version %1$s!', 'membership2'), $new_version);
         } else {
             $msg[] = sprintf(__('<strong>Membership 2</strong> was updated to version %1$s!', 'membership2'), $new_version);
         }
         // Every time the plugin is updated we clear the cache.
         MS_Factory::clear();
         // Create missing Membership pages.
         $new_pages = MS_Model_Pages::create_missing_pages();
         if (!empty($new_pages)) {
             $msg[] = sprintf(__('New Membership pages created: "%1$s".', 'membership2'), implode('", "', $new_pages));
         }
         // Remove an old version of Protected Content
         // TODO: REMOVE THIS BLOCK/FUNCTION END OF 2015
         if ($version_changed) {
             self::remove_old_copy();
         }
         // Note: We do not create menu items on upgrade! Users might have
         // intentionally removed the items from the menu...
         /*
          * ----- Version-Specific update logic -----------------------------
          */
         // Upgrade from a 1.0.0.x version to 1.0.1.0 or higher
         if (version_compare($old_version, '1.0.1.0', 'lt')) {
             self::_upgrade_1_0_1_0();
         }
         // Upgrade from 1.0.1.0 version to 1.0.1.1 or higher
         if (version_compare($old_version, '1.0.1.1', 'lt')) {
             self::_upgrade_1_0_1_1();
         }
         // Upgrade from 1.0.1.x version to 1.0.2.0 or higher
         if (version_compare($old_version, '1.0.2.0', 'lt')) {
             self::_upgrade_1_0_2_0();
         }
         // Upgrade from 1.0.2.x version to 1.0.2.4 or higher
         if (version_compare($old_version, '1.0.2.4', 'lt')) {
             self::_upgrade_1_0_2_4();
         }
         /*
          * ----- General update logic, executed on every update ------------
          */
         $settings->version = $new_version;
         $settings->save();
         // Display a message after the page is reloaded.
         if (!$is_new_setup) {
             lib3()->ui->admin_message(implode('<br>', $msg), '', '', 'ms-update');
         }
         do_action('ms_model_upgrade_after_update', $settings, $old_version, $new_version, $force);
         $addons = MS_Factory::load('MS_Model_Addon');
         $addons->flush_list();
         // This will reload the current page.
         MS_Plugin::flush_rewrite_rules();
     }
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:95,代码来源:class-ms-model-upgrade.php


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