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


PHP add_rewrite_endpoint函数代码示例

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


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

示例1: add_endpoint

 /**
  * add_endpoint function.
  *
  * @since 4.1
  * @return void
  */
 public function add_endpoint()
 {
     // REST API
     add_rewrite_rule('^fue-api/v1/?$', 'index.php?fue-api-version=1&fue-api-route=/', 'top');
     add_rewrite_rule('^fue-api/v1(.*)?', 'index.php?fue-api-version=1&fue-api-route=$matches[1]', 'top');
     add_rewrite_endpoint('fue-api', EP_ALL);
 }
开发者ID:bself,项目名称:nuimage-wp,代码行数:13,代码来源:class-fue-api.php

示例2: register_rule

 /**
  * Register the rewrite rule
  *
  * @return void
  */
 function register_rule()
 {
     foreach ($this->query_vars as $var) {
         add_rewrite_endpoint($var, EP_PAGES);
     }
     $permalinks = get_option('woocommerce_permalinks', array());
     if (isset($permalinks['product_base'])) {
         $base = substr($permalinks['product_base'], 1);
     }
     if (!empty($base)) {
         // special treatment for product cat
         if (stripos($base, 'product_cat')) {
             // get the category base. usually: shop
             $base_array = explode('/', ltrim($base, '/'));
             // remove first '/' and explode
             $cat_base = isset($base_array[0]) ? $base_array[0] : 'shop';
             add_rewrite_rule($cat_base . '/(.+?)/([^/]+)(/[0-9]+)?/edit?$', 'index.php?product_cat=$matches[1]&product=$matches[2]&page=$matches[3]&edit=true', 'top');
         } else {
             add_rewrite_rule($base . '/([^/]+)(/[0-9]+)?/edit/?$', 'index.php?product=$matches[1]&page=$matches[2]&edit=true', 'top');
         }
     }
     add_rewrite_rule('store/([^/]+)/?$', 'index.php?store=$matches[1]', 'top');
     add_rewrite_rule('store/([^/]+)/page/?([0-9]{1,})/?$', 'index.php?store=$matches[1]&paged=$matches[2]', 'top');
     add_rewrite_rule('store/([^/]+)/section/?([0-9]{1,})/?$', 'index.php?store=$matches[1]&term=$matches[2]&term_section=true', 'top');
     add_rewrite_rule('store/([^/]+)/section/?([0-9]{1,})/page/?([0-9]{1,})/?$', 'index.php?store=$matches[1]&term=$matches[2]&paged=$matches[3]&term_section=true', 'top');
 }
开发者ID:nuwe1,项目名称:dokan-lite,代码行数:31,代码来源:rewrites.php

示例3: add_endpoint

 /**
  * Registers a new rewrite endpoint for accessing the API
  *
  * @access public
  * @author Andrew Norcross
  * @param array $rewrite_rules WordPress Rewrite Rules
  * @since 0.0.1
  */
 public function add_endpoint($rewrite_rules)
 {
     // run the endpoint filter with sanitization
     $endpoint = apply_filters('rkv_remote_repo_endpoint', 'update');
     $endpoint = sanitize_key($endpoint, 'update');
     add_rewrite_endpoint($endpoint, EP_ALL);
 }
开发者ID:AGDesignStudio,项目名称:reaktiv-remote-repo,代码行数:15,代码来源:reaktiv-remote-repo.php

示例4: register_rule

 /**
  * Register the rewrite rule
  *
  * @return void
  */
 function register_rule()
 {
     $this->query_vars = apply_filters('dokan_query_var_filter', array('products', 'new-product', 'orders', 'coupons', 'reports', 'reviews', 'withdraw', 'announcement', 'single-announcement', 'settings', 'account-migration'));
     foreach ($this->query_vars as $var) {
         add_rewrite_endpoint($var, EP_PAGES);
     }
     $permalinks = get_option('woocommerce_permalinks', array());
     if (isset($permalinks['product_base'])) {
         $base = substr($permalinks['product_base'], 1);
     }
     if (!empty($base)) {
         // special treatment for product cat
         if (stripos($base, 'product_cat')) {
             // get the category base. usually: shop
             $base_array = explode('/', ltrim($base, '/'));
             // remove first '/' and explode
             $cat_base = isset($base_array[0]) ? $base_array[0] : 'shop';
             add_rewrite_rule($cat_base . '/(.+?)/([^/]+)(/[0-9]+)?/edit?$', 'index.php?product_cat=$matches[1]&product=$matches[2]&page=$matches[3]&edit=true', 'top');
         } else {
             add_rewrite_rule($base . '/([^/]+)(/[0-9]+)?/edit/?$', 'index.php?product=$matches[1]&page=$matches[2]&edit=true', 'top');
         }
     }
     add_rewrite_rule($this->custom_store_url . '/([^/]+)/?$', 'index.php?' . $this->custom_store_url . '=$matches[1]', 'top');
     add_rewrite_rule($this->custom_store_url . '/([^/]+)/page/?([0-9]{1,})/?$', 'index.php?' . $this->custom_store_url . '=$matches[1]&paged=$matches[2]', 'top');
     add_rewrite_rule($this->custom_store_url . '/([^/]+)/reviews?$', 'index.php?' . $this->custom_store_url . '=$matches[1]&store_review=true', 'top');
     add_rewrite_rule($this->custom_store_url . '/([^/]+)/reviews/page/?([0-9]{1,})/?$', 'index.php?' . $this->custom_store_url . '=$matches[1]&paged=$matches[2]&store_review=true', 'top');
     add_rewrite_rule($this->custom_store_url . '/([^/]+)/section/?([0-9]{1,})/?$', 'index.php?' . $this->custom_store_url . '=$matches[1]&term=$matches[2]&term_section=true', 'top');
     add_rewrite_rule($this->custom_store_url . '/([^/]+)/section/?([0-9]{1,})/page/?([0-9]{1,})/?$', 'index.php?' . $this->custom_store_url . '=$matches[1]&term=$matches[2]&paged=$matches[3]&term_section=true', 'top');
     add_rewrite_rule($this->custom_store_url . '/([^/]+)/toc?$', 'index.php?' . $this->custom_store_url . '=$matches[1]&toc=true', 'top');
     add_rewrite_rule($this->custom_store_url . '/([^/]+)/toc/page/?([0-9]{1,})/?$', 'index.php?' . $this->custom_store_url . '=$matches[1]&paged=$matches[2]&toc=true', 'top');
     do_action('dokan_rewrite_rules_loaded');
 }
开发者ID:CPHollister,项目名称:shyftmodels,代码行数:37,代码来源:rewrites.php

示例5: post_register

 /**
  * Registers Custom Post, Custom Taxonomy
  */
 public static function post_register()
 {
     WC_QD_Post_Types::register_donation_posttype();
     WC_QD_Post_Types::register_donation_category();
     WC_QD_Post_Types::register_donation_tags();
     add_rewrite_endpoint('donate-now', EP_ROOT);
     flush_rewrite_rules();
 }
开发者ID:bestmazzo,项目名称:woocomerce-quick-donation,代码行数:11,代码来源:class-install.php

示例6: add_endpoint

 /**
  * add_endpoint function.
  *
  * @access public
  * @since 2.0
  * @return void
  */
 public function add_endpoint()
 {
     // REST API
     add_rewrite_rule('^wc-api\\/v' . self::VERSION . '/?$', 'index.php?wc-api-route=/', 'top');
     add_rewrite_rule('^wc-api\\/v' . self::VERSION . '(.*)?', 'index.php?wc-api-route=$matches[1]', 'top');
     // legacy API for payment gateway IPNs
     add_rewrite_endpoint('wc-api', EP_ALL);
 }
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:15,代码来源:class-wc-api.php

示例7: add_endpoint

 /**
  * add_endpoint function.
  *
  * @access public
  * @since 2.0
  * @return void
  */
 public static function add_endpoint()
 {
     // REST API
     add_rewrite_rule('^wc-api/v([1-2]{1})/?$', 'index.php?wc-api-version=$matches[1]&wc-api-route=/', 'top');
     add_rewrite_rule('^wc-api/v([1-2]{1})(.*)?', 'index.php?wc-api-version=$matches[1]&wc-api-route=$matches[2]', 'top');
     // WC API for payment gateway IPNs, etc
     add_rewrite_endpoint('wc-api', EP_ALL);
 }
开发者ID:nathanielks,项目名称:woocommerce,代码行数:15,代码来源:class-wc-api.php

示例8: add_query_vars_endpoints

 public function add_query_vars_endpoints()
 {
     foreach ($this->_query_vars as $key => $var) {
         if (array_key_exists('end_point', $var) && true === $var['end_point']) {
             add_rewrite_endpoint($var['name'], EP_ALL);
         }
     }
 }
开发者ID:wizzaro,项目名称:wordpress-framework-v1,代码行数:8,代码来源:QueryVars.php

示例9: wp_pubarch_init

/**
 * Default initialization routine for the plugin.
 * - Registers the default textdomain.
 * - Loads a rewrite endpoint for processing file downloads.
 */
function wp_pubarch_init()
{
    load_plugin_textdomain('wp_pubarch_translate', false, dirname(dirname(plugin_basename(__FILE__))) . '/lang/');
    WP_Publication_Archive::register_author();
    WP_Publication_Archive::register_publication();
    add_rewrite_endpoint('wppa_download', EP_ALL);
    add_rewrite_endpoint('wppa_open', EP_ALL);
}
开发者ID:jimlongo56,项目名称:bhouse,代码行数:13,代码来源:wp-publication-archive.php

示例10: amp_init

function amp_init()
{
    add_rewrite_endpoint(AMP_QUERY_VAR, EP_PERMALINK);
    add_post_type_support('post', AMP_QUERY_VAR);
    add_action('wp', 'amp_maybe_add_actions');
    if (class_exists('Jetpack')) {
        require_once dirname(__FILE__) . '/jetpack-helper.php';
    }
}
开发者ID:joedooley,项目名称:amp-wp,代码行数:9,代码来源:amp.php

示例11: add_end_points

 public function add_end_points()
 {
     global $wp_rewrite;
     add_rewrite_endpoint('api', EP_ROOT);
     if (!get_option('aw-stepify-flused', false)) {
         $wp_rewrite->flush_rules(true);
         add_option('aw-stepify-flused', true);
     }
 }
开发者ID:Tmeister,项目名称:stepify-integrations,代码行数:9,代码来源:class-aw-stepity-public.php

示例12: wp_memento_add_rewrites

function wp_memento_add_rewrites()
{
    // 1. The timemap list page
    add_rewrite_rule('^timemap/(.*)', 'index.php?timemap_url=$matches[1]', 'top');
    // 2. The timegate request portal
    add_rewrite_rule('^timegate/?(.*)', 'index.php?timegate_url=$matches[1]', 'top');
    // 3. The post revision detail page
    add_rewrite_endpoint('revision', EP_PERMALINK);
}
开发者ID:pastpages,项目名称:wordpress-memento-plugin,代码行数:9,代码来源:memento.php

示例13: rewrites

 /**
  * Registers the rewrite rules for pretty affiliate links
  *
  * This was in Affiliate_WP_Tracking until 1.7.8
  *
  * @since 1.3
  */
 public function rewrites()
 {
     $taxonomies = get_taxonomies(array('public' => true, '_builtin' => false), 'objects');
     foreach ($taxonomies as $tax_id => $tax) {
         $ref = affiliate_wp()->tracking->get_referral_var();
         add_rewrite_rule($tax->rewrite['slug'] . '/(.+?)/' . $ref . '(/(.*))?/?$', 'index.php?' . $tax_id . '=$matches[1]&' . $ref . '=$matches[3]', 'top');
     }
     add_rewrite_endpoint(affiliate_wp()->tracking->get_referral_var(), EP_ALL);
 }
开发者ID:companyjuice,项目名称:AffiliateWP,代码行数:16,代码来源:class-rewrites.php

示例14: lg_hub_endpoints

function lg_hub_endpoints()
{
    foreach (lg_hub_tab_list() as $key => $tab) {
        if ($key === 0) {
            continue;
        }
        add_rewrite_endpoint($tab, EP_PAGES);
    }
}
开发者ID:rd4k1,项目名称:Lewdism,代码行数:9,代码来源:functions.php

示例15: rewrite

 function rewrite()
 {
     add_rewrite_endpoint('dump', EP_PERMALINK);
     add_rewrite_rule('^the-page$', 'index.php?vptutorial=1', 'top');
     if (get_transient('vpt_flush')) {
         delete_transient('vpt_flush');
         flush_rewrite_rules();
     }
 }
开发者ID:Nabesaka,项目名称:wp-virtual-page-tutorial,代码行数:9,代码来源:virtual-page-tutorial.php


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