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

PHP got_url_rewrite函数代码示例

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

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP gotoLocation函数代码示例发布时间:2022-05-15
下一篇:
PHP got_mod_rewrite函数代码示例发布时间: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