本文整理汇总了PHP中untrailingslashit函数的典型用法代码示例。如果您正苦于以下问题:PHP untrailingslashit函数的具体用法?PHP untrailingslashit怎么用?PHP untrailingslashit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了untrailingslashit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cpm_calculate_document_root
/**
* Calculate the document root where comics are stored.
*/
function cpm_calculate_document_root()
{
global $wpmu_version;
$document_root = "";
if (cpm_option('cpm-use-old-subdirectory-method')) {
$parsed_url = parse_url(get_option('home'));
$translated_script_filename = str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']);
foreach (array('SCRIPT_NAME', 'SCRIPT_URL') as $var_to_try) {
$root_to_try = substr($translated_script_filename, 0, -strlen($_SERVER[$var_to_try])) . $parsed_url['path'];
if (file_exists($root_to_try . '/index.php')) {
$document_root = $root_to_try;
break;
}
}
if (is_null($document_root)) {
$document_root = $_SERVER['DOCUMENT_ROOT'] . $parsed_url['path'];
}
} else {
// a base document root to try and use
if (isset($_SERVER['SCRIPT_FILENAME'])) {
$document_root = dirname($_SERVER['SCRIPT_FILENAME']);
}
$cwd = getcwd();
if ($cwd !== false) {
// Strip the wp-admin part and just get to the root.
$document_root = preg_replace('#[\\\\/]wp-(admin|content).*#', '', $cwd);
}
if (isset($wpmu_version)) {
$document_root = cpm_wpmu_modify_path($document_root);
}
}
return untrailingslashit($document_root);
}
示例2: admin_plugin_dir
public function admin_plugin_dir()
{
if ($this->admin_plugin_dir) {
return $this->admin_plugin_dir;
}
return $this->admin_plugin_dir = untrailingslashit(plugin_dir_path(__FILE__));
}
示例3: __construct
/**
* Constructor - get the plugin hooked in and ready
*/
public function __construct()
{
// Define constants
define('JOB_MANAGER_VERSION', '1.23.9');
define('JOB_MANAGER_PLUGIN_DIR', untrailingslashit(plugin_dir_path(__FILE__)));
define('JOB_MANAGER_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
// Includes
include 'includes/class-wp-job-manager-install.php';
include 'includes/class-wp-job-manager-post-types.php';
include 'includes/class-wp-job-manager-ajax.php';
include 'includes/class-wp-job-manager-shortcodes.php';
include 'includes/class-wp-job-manager-api.php';
include 'includes/class-wp-job-manager-forms.php';
include 'includes/class-wp-job-manager-geocode.php';
include 'includes/class-wp-job-manager-cache-helper.php';
if (is_admin()) {
include 'includes/admin/class-wp-job-manager-admin.php';
}
// Init classes
$this->forms = new WP_Job_Manager_Forms();
$this->post_types = new WP_Job_Manager_Post_Types();
// Activation - works with symlinks
register_activation_hook(basename(dirname(__FILE__)) . '/' . basename(__FILE__), array($this, 'activate'));
// Switch theme
add_action('after_switch_theme', array('WP_Job_Manager_Ajax', 'add_endpoint'), 10);
add_action('after_switch_theme', array($this->post_types, 'register_post_types'), 11);
add_action('after_switch_theme', 'flush_rewrite_rules', 15);
// Actions
add_action('after_setup_theme', array($this, 'load_plugin_textdomain'));
add_action('after_setup_theme', array($this, 'include_template_functions'), 11);
add_action('widgets_init', array($this, 'widgets_init'));
add_action('wp_enqueue_scripts', array($this, 'frontend_scripts'));
add_action('admin_init', array($this, 'updater'));
}
示例4: __construct
/**
*
*/
function __construct()
{
parent::__construct(array('plural' => 'logs', 'singular' => 'log', 'ajax' => TRUE));
$this->log_folder = get_site_option('backwpup_cfg_logfolder');
$this->log_folder = BackWPup_File::get_absolute_path($this->log_folder);
$this->log_folder = untrailingslashit($this->log_folder);
}
示例5: get_vendor_store_url
public static function get_vendor_store_url($user = false)
{
if (!is_object($user)) {
if ($user === false) {
$user = get_current_user_id();
}
$user = new WP_User($user);
}
if (!$user || !is_object($user)) {
$user = new WP_User(get_current_user_id());
}
$archive_page = EDD_FES()->vendors->use_author_archives();
$name = get_userdata($user->ID);
$user_nicename = apply_filters('fes_user_nicename_to_lower', strtolower($name->user_nicename), $user);
if (empty($archive_page)) {
$vendor_url = get_permalink(EDD_FES()->helper->get_option('fes-vendor-page', ''));
$permalink = apply_filters('fes_adjust_vendor_url', untrailingslashit('vendor/'));
$vendor_url = str_replace('fes-vendor/', $permalink, $vendor_url);
$vendor_url = str_replace('vendor/', $permalink, $vendor_url);
if (get_option('permalink_structure')) {
$vendor_url = trailingslashit($vendor_url) . $user_nicename;
} else {
$vendor_url = add_query_arg('vendor', $user_nicename, $vendor_url);
}
} else {
$vendor_url = get_author_posts_url($user->ID, $user_nicename);
}
return $vendor_url;
}
示例6: plugin_url
function plugin_url()
{
if ($this->plugin_url) {
return $this->plugin_url;
}
return $this->plugin_url = untrailingslashit(plugins_url('/', __FILE__));
}
示例7: init
/**
* @wp-hook wp_loaded
*/
function init()
{
$autoload = __DIR__ . '/vendor/autoload.php';
if (file_exists($autoload) && is_readable($autoload)) {
require_once $autoload;
}
$log_dir = defined('IAC_DEBUGGER_LOG_DIR') ? IAC_DEBUGGER_LOG_DIR : WP_CONTENT_DIR . '/log';
/**
* @param string $log_dir
*
* @return string (Log directory)
*/
$log_dir = untrailingslashit(apply_filters('iac_debugger_log_dir', $log_dir));
try {
$log_env = new WpLogEnvironment();
$log_env->create_log_directory($log_dir);
$log_env->add_htaccess_file($log_dir);
$logger = build_logger($log_dir . '/iac-debug.log');
$recipient_filter = new WpFilterRecipientFilter();
$email_recorder = new PsrEmailRecorder($logger, $recipient_filter);
$queue_recorder = new PsrQueueRecorder($logger, $recipient_filter);
add_filter('iac_comment_headers', [$email_recorder, 'add_header_flag'], 10, 3);
add_filter('iac_post_headers', [$email_recorder, 'add_header_flag'], 10, 3);
add_filter('wp_mail', [$email_recorder, 'record_send_mail']);
add_action('wp_mail_failed', [$email_recorder, 'record_mail_error']);
add_filter('iac_email_address_chunk', [$queue_recorder, 'record_email_chunk'], 10, 3);
add_filter('schedule_event', [$queue_recorder, 'record_schedule_event']);
add_action('iac_schedule_send_chunks', [$queue_recorder, 'record_scheduled_event_call'], 1, 3);
} catch (Exception $e) {
add_action('admin_notices', function () use($e) {
echo "<div class='notice notice-error'><p>[Informer Debugger] {$e->getMessage()}</p>" . "<p style='display: none'>{$e->getTraceAsString()}</p></div>";
});
}
}
示例8: get_link
/**
* @return string
*/
public function get_link()
{
if (!$this->_link) {
$this->_link = untrailingslashit(get_author_posts_url($this->ID));
}
return $this->_link;
}
示例9: dtheme_startup
function dtheme_startup()
{
global $dt_revealData, $krypton_Scripts, $krypton_config;
$dt_revealData = array();
$krypton_Scripts = array();
$theme_name = get_template();
$locale = get_locale();
$localelanguage = get_template_directory() . '/languages';
if (is_child_theme() && !load_textdomain('Krypton', untrailingslashit(get_stylesheet_directory()) . "/{$locale}.mo") || !is_child_theme() && !load_theme_textdomain('Krypton', get_template_directory())) {
$aaa = load_theme_textdomain('Krypton', $localelanguage);
}
// Add post thumbnail supports. http://codex.wordpress.org/Post_Thumbnails
add_theme_support('post-thumbnails');
add_theme_support('automatic-feed-links');
add_theme_support('menus');
add_theme_support('woocommerce');
add_theme_support('title-tag');
register_nav_menus(array('primary' => __('Top Navigation', 'Krypton'), 'footer_navigation' => __('Footer Navigation', 'Krypton')));
// sidebar widget
register_sidebar(array('name' => 'Sidebar', 'id' => 'krypton-sidebar', 'description' => __('Sidebar Widget Area', 'Krypton'), 'before_widget' => '<div class="widget %s %s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget_title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Bottom Widget', 'id' => 'krypton-bottom', 'description' => __('Bottom Widget Area. Recomended 3 widgets', 'Krypton'), 'before_widget' => '<div class="col-lg-4 col-md-4 col-sm-4 clearfix"><div class="widget %s %s">', 'after_widget' => '</div></div>', 'before_title' => '<div class="row"><div class="section-head"><header class="col col-sm-12 centered"><h2>', 'after_title' => '</h2><hr></header></div></div>'));
register_sidebar(array('name' => 'Contact Page Sidebar', 'id' => 'krypton-contact-sidebar', 'description' => __('Widget area for contact page', 'Krypton'), 'before_widget' => '<div class="widget %s %s">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
if (is_plugin_active('woocommerce/woocommerce.php')) {
register_sidebar(array('name' => 'Shop Sidebar', 'id' => 'shop-sidebar', 'description' => __('Sidebar Widget Area', 'Krypton'), 'before_widget' => '<div class="widget %s %s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget_title">', 'after_title' => '</h3>'));
register_sidebar(array('name' => 'Shop Bottom ', 'id' => 'shop-bottom', 'description' => __('Shop Bottom Widget Area. Displayed at shop pages', 'Krypton'), 'before_widget' => '<div class="col-md-3 col-sm-6"><div class="widget %s %s">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget_title">', 'after_title' => '</h3>'));
}
add_action('wp_enqueue_scripts', 'dt_enqueue_color_scheme');
add_action('wp_enqueue_scripts', 'dtheme_scripts', 999);
add_action('wp_print_scripts', 'dtheme_register_var', 998);
add_action('wp_print_scripts', 'detheme_print_inline_style');
add_action('wp_footer', 'dtheme_register_mainmenu', 997);
add_action('wp_enqueue_scripts', 'dtheme_css_style', 999);
add_action('wp_footer', create_function('', 'global $krypton_Scripts;if(count($krypton_Scripts)) print "<script type=\\"text/javascript\\">\\n".@implode("\\n",$krypton_Scripts)."\\n</script>\\n";'), 99998);
}
示例10: post_type_link
static function post_type_link($link, $post)
{
if ($post->post_type !== 'glossary') {
return $link;
}
return untrailingslashit(str_replace('/glossary/', '/glossary/#', $link));
}
示例11: __construct
/**
* Constructor
*/
public function __construct()
{
define('WC_BOOKINGS_VERSION', '1.7.12');
define('WC_BOOKINGS_TEMPLATE_PATH', untrailingslashit(plugin_dir_path(__FILE__)) . '/templates/');
define('WC_BOOKINGS_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
define('WC_BOOKINGS_MAIN_FILE', __FILE__);
add_action('init', array($this, 'load_plugin_textdomain'));
add_action('woocommerce_loaded', array($this, 'includes'));
add_action('plugins_loaded', array($this, 'init'));
add_action('init', array($this, 'init_post_types'));
add_action('wp_enqueue_scripts', array($this, 'booking_form_styles'));
add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
if (is_admin()) {
$this->admin_includes();
}
// Install
register_activation_hook(__FILE__, array($this, 'install'));
if (get_option('wc_bookings_version') !== WC_BOOKINGS_VERSION) {
add_action('shutdown', array($this, 'delayed_install'));
}
// Load payment gateway name.
add_filter('woocommerce_payment_gateways', array($this, 'include_gateway'));
// Load integration.
add_filter('woocommerce_integrations', array($this, 'include_integration'));
}
示例12: vip_dashboard_page
/**
* Output the dashboard page, an empty div for React to initialise against
*
* @return void
*/
function vip_dashboard_page()
{
$current_user = wp_get_current_user();
$name = $current_user->display_name;
$email = $current_user->user_email;
$ajaxurl = add_query_arg(array('_wpnonce' => wp_create_nonce('vip-dashboard')), untrailingslashit(admin_url('admin-ajax.php')));
?>
<div id="app"
data-ajaxurl="<?php
echo esc_url($ajaxurl);
?>
"
data-asseturl="<?php
echo esc_attr(plugins_url('/assets/', __FILE__));
?>
"
data-email="<?php
echo esc_attr($email);
?>
"
data-name="<?php
echo esc_attr($name);
?>
"
data-adminurl="<?php
echo esc_url(admin_url('admin.php'));
?>
"
></div>
<?php
}
示例13: init
/**
* Initialize the plugin and register hooks
*/
public function init()
{
// Common strings
define('GRFWP_TEXTDOMAIN', 'good-reviews-wp');
// keep for back compat
define('GRFWP_PLUGIN_DIR', untrailingslashit(plugin_dir_path(__FILE__)));
define('GRFWP_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
define('GRFWP_PLUGIN_FNAME', plugin_basename(__FILE__));
define('GRFWP_REVIEW_POST_TYPE', 'grfwp-review');
define('GRFWP_REVIEW_CATEGORY', 'grfwp-category');
// Initialize the plugin
add_action('init', array($this, 'load_textdomain'));
// Load custom post types
require_once GRFWP_PLUGIN_DIR . '/includes/CustomPostTypes.class.php';
$this->cpts = new grfwpCustomPostTypes();
// Load template functions
require_once GRFWP_PLUGIN_DIR . '/includes/template-functions.php';
// Load code to integrate with other plugins
require_once GRFWP_PLUGIN_DIR . '/includes/Integrations.class.php';
new grfwpIntegrations();
// Register assets
add_action('wp_enqueue_scripts', array($this, 'register_assets'));
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_assets'));
// Reword the title placeholder text for a review post type
add_filter('enter_title_here', array($this, 'rename_review_title'));
// Order review posts in admin screen by menu order
add_filter('pre_get_posts', array($this, 'admin_order_posts'));
// Transform review $content variable to output review
add_filter('the_content', array($this, 'append_to_content'));
// Register the widget
add_action('widgets_init', array($this, 'register_widgets'));
// Add links to plugin listing
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
}
示例14: __construct
function __construct()
{
$this->url = untrailingslashit(plugins_url('', dirname(__FILE__)));
$this->dir = untrailingslashit(plugin_dir_path(dirname(__FILE__)));
$this->cacheUrl = $this->url . '/cache';
$this->cacheDir = $this->dir . '/cache';
}
示例15: _2ch_plugin_dir_url
/**
* Get plugin dir URL
*
* @package 2ch
* @param string $path
* @return string
*/
function _2ch_plugin_dir_url($path = '')
{
if ($path) {
$path = '/' . ltrim($path, '/');
}
return untrailingslashit(plugin_dir_url(__FILE__)) . $path;
}