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


PHP got_url_rewrite函数代码示例

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


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

示例1: __construct

 public function __construct()
 {
     global $stt2extat_settings, $stt2extat_sanitize;
     $this->plugin_data = stt2extat_get_plugin_data();
     $this->data = $stt2extat_sanitize->data();
     $this->set = $stt2extat_settings;
     $this->prefix = $this->blog_prefix = '';
     if (function_exists('got_url_rewrite')) {
         if (!got_url_rewrite()) {
             $this->prefix = '/index.php';
         }
     }
     if (is_multisite() && !is_subdomain_install() && is_main_site()) {
         $this->blog_prefix = '/blog';
     }
     add_action('admin_init', array($this, 'page_init'));
     add_filter('admin_head', array($this, 'options_permalink_add_js'));
     add_filter('set-screen-option', array($this, 'term_stats_set_screen_option'), 10, 3);
     add_action('admin_menu', array($this, 'plugin_page'));
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     add_action('wp_ajax_stt2extat_ajax_table', array($this, 'ajax_table'));
     add_action('wp_ajax_stt2extat_delete_all_terms', array($this, 'delete_all_terms'));
     add_action('wp_ajax_stt2extat_migrate_stt2_terms', array($this, 'migrate_stt2_terms'));
     add_action('wp_ajax_stt2extat_check_relevant_terms', array($this, 'check_relevant_terms'));
 }
开发者ID:Jevuska,项目名称:stt2-extension-add-terms,代码行数:25,代码来源:class-stt2extat-admin.php

示例2: permalink_structure_field

 /**
  * Display an input field customize object's permalink.
  */
 public function permalink_structure_field()
 {
     global $wp_rewrite;
     $obj_tag = '%' . $this->obj_type . '%';
     $setting = $this->obj_name . '_structure';
     $options = get_option('boilerplate', []);
     $value = isset($options[$setting]) ? $options[$setting] : '/' . $obj_tag . '/';
     $object = get_post_type_object($this->obj_type);
     $object_prefix = $object->rewrite['slug'];
     $front = class_exists('Polylang') ? pll_get_rewrite_front() : $wp_rewrite->front;
     if ($front and $object->rewrite['with_front']) {
         $slug = $front . $object_prefix;
     }
     echo '<code>' . home_url() . '/' . $object_prefix . (got_url_rewrite() ? '' : '?post_type=' . $this->obj_type . '&p=123') . '</code>';
     if (got_url_rewrite()) {
         echo '<input name="' . 'boilerplate-' . $setting . '" id="' . 'boilerplate-' . $setting . '" type="text" value="' . esc_attr($value) . '" class="regular-text code" />';
     }
 }
开发者ID:locomotivemtl,项目名称:wordpress-boilerplate,代码行数:21,代码来源:object.trait.permalink.php

示例3: dirname

/** WordPress Administration Bootstrap */
require_once dirname(__FILE__) . '/admin.php';
if (!current_user_can('manage_options')) {
    wp_die(__('You do not have sufficient permissions to manage options for this site.'));
}
$title = __('Permalink Settings');
$parent_file = 'options-general.php';
get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.') . '</p>' . '<p>' . __('This screen allows you to choose your default permalink structure. You can choose from common settings or create custom URL structures.') . '</p>' . '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>'));
get_current_screen()->add_help_tab(array('id' => 'common-settings', 'title' => __('Common Settings'), 'content' => '<p>' . __('Many people choose to use &#8220;pretty permalinks,&#8221; URLs that contain useful information such as the post title rather than generic post ID numbers. You can choose from any of the permalink formats under Common Settings, or can craft your own if you select Custom Structure.') . '</p>' . '<p>' . __('If you pick an option other than Default, your general URL path with structure tags, terms surrounded by <code>%</code>, will also appear in the custom structure field and your path can be further modified there.') . '</p>' . '<p>' . __('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes <code>%category%</code> or <code>%tag%</code>.') . '</p>' . '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>'));
get_current_screen()->add_help_tab(array('id' => 'custom-structures', 'title' => __('Custom Structures'), 'content' => '<p>' . __('The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.') . '</p>' . '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>'));
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="https://codex.wordpress.org/Settings_Permalinks_Screen" target="_blank">Documentation on Permalinks Settings</a>') . '</p>' . '<p>' . __('<a href="https://codex.wordpress.org/Using_Permalinks" target="_blank">Documentation on Using Permalinks</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>');
add_filter('admin_head', 'options_permalink_add_js');
$home_path = get_home_path();
$iis7_permalinks = iis7_supports_permalinks();
$prefix = $blog_prefix = '';
if (!got_url_rewrite()) {
    $prefix = '/index.php';
}
if (is_multisite() && !is_subdomain_install() && is_main_site()) {
    $blog_prefix = '/blog';
}
if (isset($_POST['permalink_structure']) || isset($_POST['category_base'])) {
    check_admin_referer('update-permalink');
    if (isset($_POST['permalink_structure'])) {
        if (isset($_POST['selection']) && 'custom' != $_POST['selection']) {
            $permalink_structure = $_POST['selection'];
        } else {
            $permalink_structure = $_POST['permalink_structure'];
        }
        if (!empty($permalink_structure)) {
            $permalink_structure = preg_replace('#/+#', '/', '/' . str_replace('#', '', $permalink_structure));
开发者ID:nmeiser,项目名称:WordPress,代码行数:31,代码来源:options-permalink.php

示例4: regenerate_htaccess_file

 public static function regenerate_htaccess_file()
 {
     if (!function_exists('save_mod_rewrite_rules')) {
         if (!function_exists('mysql2date')) {
             require ABSPATH . '/wp-includes/functions.php';
         }
         if (!function_exists('get_home_path')) {
             require ABSPATH . '/wp-admin/includes/file.php';
         }
         require ABSPATH . '/wp-admin/includes/misc.php';
     }
     global $is_nginx, $wp_rewrite;
     $home_path = get_home_path();
     $htaccess_file = $home_path . '.htaccess';
     if (file_exists($htaccess_file)) {
         unlink($htaccess_file);
     }
     $home_path = get_home_path();
     $iis7_permalinks = iis7_supports_permalinks();
     $prefix = $blog_prefix = '';
     if (!got_url_rewrite()) {
         $prefix = '/index.php';
     }
     if (is_multisite() && !is_subdomain_install() && is_main_site()) {
         $blog_prefix = '/blog';
     }
     $permalink_structure = get_option('permalink_structure');
     $category_base = get_option('category_base');
     $tag_base = get_option('tag_base');
     $update_required = false;
     if ($iis7_permalinks) {
         if (!file_exists($home_path . 'web.config') && win_is_writable($home_path) || win_is_writable($home_path . 'web.config')) {
             $writable = true;
         } else {
             $writable = false;
         }
     } elseif ($is_nginx) {
         $writable = false;
     } else {
         if (!file_exists($home_path . '.htaccess') && is_writable($home_path) || is_writable($home_path . '.htaccess')) {
             $writable = true;
         } else {
             $writable = false;
             $existing_rules = array_filter(extract_from_markers($home_path . '.htaccess', 'WordPress'));
             $new_rules = array_filter(explode("\n", $wp_rewrite->mod_rewrite_rules()));
             $update_required = $new_rules !== $existing_rules;
         }
     }
     if ($wp_rewrite->using_index_permalinks()) {
         $usingpi = true;
     } else {
         $usingpi = false;
     }
     flush_rewrite_rules();
     save_mod_rewrite_rules();
 }
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:56,代码来源:class-sb-core.php


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