Пример #1
0
 /**
  * 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);
 }
Пример #2
0
 /**
  * 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');
 }
 /**
  * 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);
 }
Пример #4
0
 /**
  * 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');
 }
 /**
  * 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();
 }
Пример #6
0
 /**
  * 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);
 }
Пример #7
0
 /**
  * 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);
 }
Пример #8
0
 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);
         }
     }
 }
Пример #9
0
/**
 * 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);
}
Пример #10
0
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';
    }
}
 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);
     }
 }
Пример #12
0
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);
}
Пример #13
0
 /**
  * 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);
 }
Пример #14
0
function lg_hub_endpoints()
{
    foreach (lg_hub_tab_list() as $key => $tab) {
        if ($key === 0) {
            continue;
        }
        add_rewrite_endpoint($tab, EP_PAGES);
    }
}
 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();
     }
 }
Пример #16
0
 /**
  * Add endpoints for the API
  *
  * @uses 0.0.6
  *
  * @uses "init" action
  */
 public function add_endpoints()
 {
     //add "action" as a rewrite tag
     add_rewrite_tag('%action%', '^[a-z0-9_\\-]+$');
     //add the endpoint
     $endpoint = vars::$endpoint;
     add_rewrite_rule("{$endpoint}/^[a-z0-9_\\-]+\$/?", 'index.php?action=$matches[1]', 'top');
     // add template endpoint
     add_rewrite_endpoint('epoch', EP_PERMALINK | EP_PAGES);
 }
 function static_list_endpoints()
 {
     global $rhc_plugin;
     if ('1' == $rhc_plugin->get_option('enable_static_list_endpoint', '1', true)) {
         $upcoming = $rhc_plugin->get_option('enable_static_list_upcoming_slug', 'rhc-upcoming-events', true);
         $past = $rhc_plugin->get_option('enable_static_list_past_slug', 'rhc-past-events', true);
         add_rewrite_endpoint($upcoming, EP_ALL);
         add_rewrite_endpoint($past, EP_ALL);
     }
 }
Пример #18
0
 public function setUp()
 {
     parent::setUp();
     $this->post_id = self::factory()->post->create(array('post_title' => 'Foo Bar', 'post_name' => 'foo-bar'));
     add_filter('old_slug_redirect_url', array($this, 'filter_old_slug_redirect_url'), 10, 1);
     $this->set_permalink_structure('/%postname%/');
     add_rewrite_endpoint('custom-endpoint', EP_PERMALINK);
     add_rewrite_endpoint('second-endpoint', EP_PERMALINK, 'custom');
     flush_rewrite_rules();
 }
Пример #19
0
function makeplugins_endpoints_add_endpoint()
{
    // register a "boards" endpoint to be applied to authors
    add_rewrite_endpoint('quotes', EP_AUTHORS | EP_PERMALINK);
    add_rewrite_endpoint('boards', EP_AUTHORS);
    add_rewrite_endpoint('faves', EP_AUTHORS);
    add_rewrite_endpoint('members', EP_PERMALINK);
    add_rewrite_endpoint('followers', EP_AUTHORS | EP_PERMALINK);
    add_rewrite_endpoint('following', EP_AUTHORS | EP_PERMALINK);
    add_rewrite_endpoint('profile', EP_AUTHORS | EP_PERMALINK);
}
 public function test_page_endpoint_only_applies_on_page()
 {
     add_rewrite_endpoint('page_endpoint', EP_PAGES);
     flush_rewrite_rules();
     $this->go_to(get_permalink(self::$test_page_id) . 'page_endpoint/foo/');
     $this->assertTrue(is_page(self::$test_page_id));
     $this->assertSame('foo', get_query_var('page_endpoint'));
     $this->go_to(home_url('page_endpoint/foo/'));
     $this->assertTrue(is_404());
     $this->assertSame('', get_query_var('page_endpoint'));
 }
Пример #21
0
function amp_init()
{
    if (false === apply_filters('amp_is_enabled', true)) {
        return;
    }
    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';
    }
}
Пример #22
0
 /**
  * Add endpoints for query vars.
  * the endpoint is used in the front-end to
  * generate the print template and link.
  */
 public function add_endpoints()
 {
     foreach ($this->api_endpoints as $var) {
         add_rewrite_endpoint($var, EP_PAGES);
     }
     // Flush the rules when the transient is set.
     // This is important to make the endpoint work.
     if (get_transient(WooCommerce_Delivery_Notes::$plugin_prefix . 'flush_rewrite_rules') == true) {
         delete_transient(WooCommerce_Delivery_Notes::$plugin_prefix . 'flush_rewrite_rules');
         flush_rewrite_rules();
     }
 }
 function add_endpoints()
 {
     global $wpdb;
     //add endpoints and flush rules
     foreach ($this->endpoints_strings as $string_id) {
         $strings = $wpdb->get_results($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s AND status = 1", $string_id));
         foreach ($strings as $string) {
             add_rewrite_endpoint($string->value, EP_PAGES);
         }
     }
     flush_rewrite_rules();
 }
 /**
  * Add endpoints for query vars.
  * the endpoint is used in the front-end to
  * generate the print template and link.
  */
 public function add_endpoints()
 {
     foreach ($this->api_endpoints as $var) {
         add_rewrite_endpoint($var, EP_PAGES);
     }
     // Flush the rules when the transient is set.
     // This is important to make the endpoint work.
     if (get_transient('wcdn_flush_rewrite_rules') == true) {
         delete_transient('wcdn_flush_rewrite_rules');
         flush_rewrite_rules();
     }
 }
 function add_endpoints()
 {
     // We add this to the end of the HTML files so we can save them
     // We use query string name if we have draft posts or no peramalinks
     add_rewrite_endpoint('pugpig_index.html', EP_PERMALINK | EP_ROOT | EP_SEARCH | EP_PAGES, false);
     // Adds pugpig.html as default document to permalinks
     add_rewrite_endpoint('pugpig.manifest', EP_PERMALINK | EP_ROOT | EP_SEARCH | EP_PAGES);
     // Adds manifest to permalinks
     add_rewrite_endpoint('pugpig_package_contents.manifest', EP_PERMALINK | EP_ROOT | EP_SEARCH | EP_PAGES);
     // Adds package files
     add_rewrite_endpoint('pugpig_index.html', EP_PERMALINK | EP_ROOT | EP_SEARCH | EP_PAGES);
     // Adds ATOM XML files
 }
Пример #26
0
 function __construct()
 {
     add_filter('jeo_settings_tabs', array($this, 'admin_settings_tab'));
     add_filter('jeo_settings_form_sections', array($this, 'admin_settings_form_section'), 10, 2);
     if ($this->is_enabled()) {
         add_rewrite_endpoint('geojson', EP_ALL);
         add_filter('query_vars', array($this, 'query_var'));
         add_filter('jeo_markers_geojson', array($this, 'jsonp_callback'));
         add_filter('jeo_geojson_content_type', array($this, 'content_type'));
         add_action('jeo_markers_before_print', array($this, 'headers'));
         add_action('template_redirect', array($this, 'template_redirect'));
     }
 }
Пример #27
0
 function add_endpoints()
 {
     if (!isset($this->endpoints_strings)) {
         return;
     }
     global $wpdb;
     //add endpoints and flush rules
     foreach ($this->endpoints_strings as $string_id) {
         $strings = $wpdb->get_results($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s AND status = %s", $string_id, ICL_STRING_TRANSLATION_COMPLETE));
         foreach ($strings as $string) {
             add_rewrite_endpoint($string->value, EP_ROOT | EP_PAGES);
         }
     }
 }
Пример #28
0
 function add_endpoints()
 {
     if (!isset($this->endpoints_strings)) {
         return;
     }
     global $wpdb;
     //add endpoints and flush rules
     foreach ($this->endpoints_strings as $string_id) {
         $string_translations = icl_get_string_translations_by_id($string_id);
         foreach ($string_translations as $string) {
             add_rewrite_endpoint($string['value'], EP_ROOT | EP_PAGES);
         }
     }
 }
Пример #29
0
function amp_init()
{
    if (false === apply_filters('amp_is_enabled', true)) {
        return;
    }
    do_action('amp_init');
    load_plugin_textdomain('amp', false, plugin_basename(AMP__DIR__) . '/languages');
    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 AMP__DIR__ . '/jetpack-helper.php';
    }
}
Пример #30
0
 private function register_post_types()
 {
     $label = _x('Gallery', 'The Gallery Post Type Name', 'mediapress');
     $label_plural = _x('Galleries', 'The Gallery Post Type Plural Name', 'mediapress');
     $_labels = array('name' => $label_plural, 'singular_name' => $label, 'menu_name' => _x('MediaPress', 'MediaPress Admin menu name', 'mediapress'), 'name_admin_bar' => _x('MediaPress', 'MediaPress admin bar menu name', 'mediapress'), 'all_items' => _x('All Galleries', 'MediaPress All galleries label', 'mediapress'), 'add_new' => _x('Add Gallery', 'admin add new gallery menu label', 'mediapress'), 'add_new_item' => _x('Add Gallery', 'admin add gallery label', 'mediapress'), 'edit_item' => _x('Edit Gallery', 'admin edit gallery', 'mediapress'), 'new_item' => _x('Add Gallery', 'admin add new item label', 'mediapress'), 'view_item' => _x('View Gallery', 'admin view galery label', 'mediapress'), 'search_items' => _x('Search Galleries', 'admin search galleries lable', 'mediapress'), 'not_found' => _x('No Galleries found!', 'admin no galleries text', 'mediapress'), 'not_found_in_trash' => _x('No Galleries found in trash!', 'admin no galleries text', 'mediapress'), 'parent_item_colon' => _x('Parent Gallery', 'admin gallery parent label', 'mediapress'));
     // $this->_get_labels( $label, $label_plural );
     $has_archive = false;
     if (mpp_get_option('enable_gallery_archive')) {
         $has_archive = mpp_get_option('gallery_archive_slug');
     }
     $args = array('public' => true, 'publicly_queryable' => true, 'exclude_from_search' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'menu_position' => 10, 'menu_icon' => 'dashicons-format-gallery', 'show_in_admin_bar' => true, 'capability_type' => 'post', 'has_archive' => $has_archive, 'rewrite' => array('with_front' => false, 'slug' => mpp_get_gallery_post_type_rewrite_slug()), 'supports' => array('title', 'comments', 'custom-fields'));
     $args['labels'] = $_labels;
     register_post_type(mpp_get_gallery_post_type(), $args);
     add_rewrite_endpoint('edit', EP_PAGES);
 }