本文整理汇总了PHP中get_theme_root_uri函数的典型用法代码示例。如果您正苦于以下问题:PHP get_theme_root_uri函数的具体用法?PHP get_theme_root_uri怎么用?PHP get_theme_root_uri使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_theme_root_uri函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: computeTargetPath
/**
* Returns the computed path for a given dependency
*
* @author oncletom
* @since 1.0
* @version 1.0
* @return string
*/
public function computeTargetPath()
{
$target_path = preg_replace('#^' . get_theme_root_uri() . '#U', '', $this->stylesheet->src);
$target_path = preg_replace('/.less$/U', '', $target_path);
$target_path .= '-%s.css';
return apply_filters('wp-less_stylesheet_compute_target_path', $target_path);
}
示例2: presscore_load_theme_modules
function presscore_load_theme_modules()
{
/**
* Icons Bar.
*/
if (is_admin() && current_theme_supports('presscore_admin_icons_bar')) {
include_once PRESSCORE_ADMIN_MODS_DIR . '/mod-admin-icons-bar/icons-bar.class.php';
$icons_bar = new Presscore_Admin_Icons_Bar(array('fontello_css_url' => str_replace(get_theme_root(), get_theme_root_uri(), locate_template('css/fontello/css/fontello.css', false)), 'fontello_json_path' => locate_template("/css/fontello/config.json", false), 'textdomain' => LANGUAGE_ZONE));
}
/**
* TGM Plugin Activation.
*/
if (is_admin() && current_theme_supports('presscore_admin_tgm_plugins_setup')) {
require_once PRESSCORE_ADMIN_MODS_DIR . '/mod-tgm-plugin-activation/tgm-plugin-setup.php';
}
/**
* Theme Update.
*/
if (!is_child_theme() && is_admin() && current_theme_supports('presscore_theme_update')) {
require_once PRESSCORE_ADMIN_MODS_DIR . '/mod-theme-update/mod-theme-update.php';
}
/**
* Presscore Mega Menu.
*/
if (current_theme_supports('presscore_mega_menu')) {
require_once PRESSCORE_MODS_DIR . '/mod-theme-mega-menu/mod-theme-mega-menu.php';
}
/**
* The7 adapter.
*/
if (current_theme_supports('presscore_the7_adapter')) {
require_once PRESSCORE_MODS_DIR . '/mod-the7-compatibility/mod-the7-compatibility.php';
}
}
示例3: bp_gallery_get_template_cssjs_dir_url
function bp_gallery_get_template_cssjs_dir_url(){
$theme_dir="";
$stylesheet_dir="";
global $bp,$current_blog;
if(is_multisite()&&$current_blog->blog_id!=BP_ROOT_BLOG){
//find the stylesheet path and
$stylesheet = get_blog_option(BP_ROOT_BLOG,'stylesheet');
$theme_root = get_theme_root( $stylesheet );
$stylesheet_dir = "$theme_root/$stylesheet";
$template=get_blog_option(BP_ROOT_BLOG,'template');
$theme_root = get_theme_root( $template );
$template_dir = "$theme_root/$template";
$theme_root_uri = get_theme_root_uri( $stylesheet );
$stylesheet_dir_uri = "$theme_root_uri/$stylesheet";
$theme_root_uri = get_theme_root_uri( $template );
$template_dir_uri = "$theme_root_uri/$template";
}
else{
$stylesheet_dir=STYLESHEETPATH;
$template_dir=TEMPLATEPATH;
$stylesheet_dir_uri=get_stylesheet_directory_uri();
$template_dir_uri=get_template_directory_uri();
}
if ( file_exists( $stylesheet_dir. '/gallery/inc'))
$theme_uri=$stylesheet_dir_uri;//child theme
else if ( file_exists( $template_dir. '/gallery/inc') )
$theme_uri=$template_dir_uri;//parent theme
if($theme_uri)
return $theme_uri."/gallery";
return false;////template is not present in the active theme/child theme
}
示例4: bluerockre_scripts
function bluerockre_scripts()
{
wp_deregister_script('wpex-sticky');
wp_deregister_script('wpex-hoverintent');
wp_deregister_script('wpex-animsition');
wp_deregister_script('wpex-tipsy');
wp_deregister_script('wpex-images-loaded');
wp_deregister_script('wpex-isotope');
wp_deregister_script('wpex-leanner-modal');
wp_deregister_script('wpex-sliderpro-customthumbnails');
wp_deregister_script('wpex-touch-swipe');
wp_deregister_script('wpex-owl-carousel');
wp_deregister_script('wpex-count-to');
wp_deregister_script('wpex-appear');
wp_deregister_script('wpex-custom-select');
wp_deregister_script('wpex-mousewheel');
wp_deregister_script('wpex-match-height');
wp_deregister_script('wpex-scrolly');
wp_deregister_script('wpex-ilightbox');
wp_dequeue_style('wpa-css');
// Dequeue admin stylesheet from WP-Attachment Plugin
wp_dequeue_style('wpex-style');
wp_dequeue_style('wpex-responsive');
wp_enqueue_style('style', get_theme_root_uri() . '/brg/style.css');
wp_enqueue_style('brg', get_theme_root_uri() . '/brg/css/brg.css');
wp_enqueue_style('responsive', get_theme_root_uri() . '/brg/css/responsive.css');
}
示例5: wppa_add_style
function wppa_add_style()
{
global $wppa_api_version;
// Are we allowed to look in theme?
if (wppa_switch('wppa_use_custom_style_file')) {
// In child theme?
$userstyle = get_theme_root() . '/' . get_option('stylesheet') . '/wppa-style.css';
if (is_file($userstyle)) {
wp_register_style('wppa_style', get_theme_root_uri() . '/' . get_option('stylesheet') . '/wppa-style.css', array(), $wppa_api_version);
wp_enqueue_style('wppa_style');
return;
}
// In theme?
$userstyle = get_theme_root() . '/' . get_option('template') . '/wppa-style.css';
if (is_file($userstyle)) {
wp_register_style('wppa_style', get_theme_root_uri() . '/' . get_option('template') . '/wppa-style.css', array(), $wppa_api_version);
wp_enqueue_style('wppa_style');
return;
}
}
// Use standard
wp_register_style('wppa_style', WPPA_URL . '/theme/wppa-style.css', array(), $wppa_api_version);
wp_enqueue_style('wppa_style');
// Dynamic css
if (!wppa_switch('wppa_inline_css')) {
if (!file_exists(WPPA_PATH . '/wppa-dynamic.css')) {
wppa_create_wppa_dynamic_css();
update_option('wppa_dynamic_css_version', get_option('wppa_dynamic_css_version', '0') + '1');
}
if (file_exists(WPPA_PATH . '/wppa-dynamic.css')) {
wp_enqueue_style('wppa-dynamic', WPPA_URL . '/wppa-dynamic.css', array('wppa_style'), get_option('wppa_dynamic_css_version'));
}
}
}
示例6: pugpig_get_theme_manifest
function pugpig_get_theme_manifest()
{
$theme_name = get_option("pugpig_opt_theme_switch");
if (!isset($theme_name) || $theme_name == '') {
$theme_name = get_template();
}
$theme_dir = get_theme_root();
$theme_url = get_theme_root_uri();
if (!is_dir($theme_dir . "/{$theme_name}") && $theme_name != '') {
echo "ERROR: Invalid theme name: {$theme_name}";
exit;
}
$theme_path = pugpig_strip_domain($theme_url . "/" . $theme_name);
$theme_dir = $theme_dir . "/" . $theme_name . "/";
$output = pugpig_theme_manifest_string($theme_path, $theme_dir, $theme_name);
if (is_child_theme()) {
$output .= "\n# Child Theme Assets\n";
$theme_name = get_stylesheet();
$theme_dir = get_theme_root();
if (!is_dir($theme_dir . "/{$theme_name}") && $theme_name != '') {
echo "ERROR: Invalid child theme name: {$theme_name}";
exit;
}
$theme_path = pugpig_strip_domain($theme_url . "/" . $theme_name);
$theme_dir = $theme_dir . "/" . $theme_name . "/";
$output .= pugpig_theme_manifest_string($theme_path, $theme_dir, $theme_name);
}
return $output;
}
示例7: __construct
/**
* Initialize the plugin
*
*/
private function __construct()
{
$settings = self::get_option('settings');
$validate = $settings['validation'];
// check the package version and upgrade if needed
if (version_compare($settings['version'], self::VERSION) < 0) {
$settings = self::activate();
}
// the action hook which will be fired by cron job
if ($settings['update']['auto'] && !has_action(self::CRON_NAME)) {
add_action(self::CRON_NAME, array(__CLASS__, 'download_database'), 10, 1);
}
if ($validate['comment']) {
// message text on comment form
if ($settings['comment']['pos']) {
$pos = 'comment_form' . ($settings['comment']['pos'] == 1 ? '_top' : '');
add_action($pos, array($this, 'comment_form_message'));
}
// wp-comments-post.php @since 2.8.0, wp-trackback.php @since 1.5.0
add_action('pre_comment_on_post', array($this, 'validate_comment'));
add_filter('preprocess_comment', array($this, 'validate_comment'));
// bbPress: prevent creating topic/relpy and rendering form
add_action('bbp_post_request_bbp-new-topic', array($this, 'validate_comment'));
add_action('bbp_post_request_bbp-new-reply', array($this, 'validate_comment'));
add_filter('bbp_current_user_can_access_create_topic_form', array($this, 'validate_front'));
add_filter('bbp_current_user_can_access_create_reply_form', array($this, 'validate_front'));
}
// xmlrpc.php @since 3.1.0, wp-includes/class-wp-xmlrpc-server.php @since 3.5.0
if ($validate['xmlrpc']) {
add_filter('wp_xmlrpc_server_class', array($this, 'validate_xmlrpc'));
add_filter('xmlrpc_login_error', array($this, 'auth_fail'));
}
// wp-login.php @since 2.1.0, wp-includes/pluggable.php @since 2.5.0
if ($validate['login']) {
add_action('login_init', array($this, 'validate_login'));
add_action('wp_login_failed', array($this, 'auth_fail'));
// BuddyPress: prevent registration and rendering form
add_action('bp_core_screen_signup', array($this, 'validate_login'));
add_action('bp_signup_pre_validate', array($this, 'validate_login'));
}
// get content folders (with/without trailing slash)
self::$content_dir = array('root' => untrailingslashit(parse_url($uri = home_url(), PHP_URL_PATH)), 'admin' => trailingslashit(str_replace($uri, '', admin_url())), 'plugins' => trailingslashit(str_replace($uri, '', plugins_url())), 'themes' => trailingslashit(str_replace($uri, '', get_theme_root_uri())));
// wp-admin/(admin.php|admin-apax.php|admin-post.php) @since 2.5.0
if (is_admin() && ($validate['admin'] || $validate['ajax'] || $settings['signature'])) {
add_action('init', array($this, 'validate_admin'), $settings['priority']);
} else {
$uri = preg_replace('!(//+|/\\.+/)!', '/', $_SERVER['REQUEST_URI']);
$pos = FALSE !== strpos($uri, self::$content_dir['plugins']) || FALSE !== strpos($uri, self::$content_dir['themes']);
if ($pos && ($validate['plugins'] || $validate['themes'] || $settings['signature'])) {
add_action('init', array($this, 'validate_direct'), $settings['priority']);
}
}
// force to change the redirect URL at logout to remove nonce, embed a nonce into pages
add_filter('wp_redirect', array($this, 'logout_redirect'), 20, 2);
// logout_redirect @4.2
add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_nonce'), $settings['priority']);
}
示例8: cocorico_enqueue
function cocorico_enqueue()
{
//Cocorico is supposed to be dropped in a plugin or a theme-get the url either way
if (strpos(COCORICO_PATH, str_replace('\\', '/', get_theme_root())) === 0) {
$rootlessPath = substr(COCORICO_PATH, strlen(get_theme_root()));
$coco_path = get_theme_root_uri() . str_replace('\\', '/', $rootlessPath);
} else {
$url = plugin_dir_url(__FILE__);
$coco_path = substr($url, 0, strlen($url) - 1);
}
wp_register_script('cocorico', $coco_path . '/frontend/cocorico.js', array('jquery'), '1', true);
wp_enqueue_script('cocorico');
wp_enqueue_style('wp-color-picker');
wp_enqueue_script('wp-color-picker');
wp_enqueue_media();
}
示例9: __construct
function __construct($name, $dir = null, $uri = null)
{
$this->theme = wp_get_theme($name);
if (!$this->theme->exists()) {
$this->theme = wp_get_theme();
}
if ($dir) {
$this->dir = $dir;
} else {
$this->dir = get_theme_root();
}
if ($uri) {
$this->uri = $uri;
} else {
$this->uri = get_theme_root_uri();
}
}
示例10: test_switch_theme
/**
* @expectedDeprecated get_themes
* @expectedDeprecated get_current_theme
*/
function test_switch_theme()
{
$themes = get_themes();
// Switch to each theme in sequence.
// Do it twice to make sure we switch to the first theme, even if it's our starting theme.
// Do it a third time to ensure switch_theme() works with one argument.
for ($i = 0; $i < 3; $i++) {
foreach ($themes as $name => $theme) {
// switch to this theme
if ($i === 2) {
switch_theme($theme['Template'], $theme['Stylesheet']);
} else {
switch_theme($theme['Stylesheet']);
}
$this->assertEquals($name, get_current_theme());
// make sure the various get_* functions return the correct values
$this->assertEquals($theme['Template'], get_template());
$this->assertEquals($theme['Stylesheet'], get_stylesheet());
$root_fs = get_theme_root();
$this->assertTrue(is_dir($root_fs));
$root_uri = get_theme_root_uri();
$this->assertTrue(!empty($root_uri));
$this->assertEquals($root_fs . '/' . get_stylesheet(), get_stylesheet_directory());
$this->assertEquals($root_uri . '/' . get_stylesheet(), get_stylesheet_directory_uri());
$this->assertEquals($root_uri . '/' . get_stylesheet() . '/style.css', get_stylesheet_uri());
# $this->assertEquals($root_uri . '/' . get_stylesheet(), get_locale_stylesheet_uri());
$this->assertEquals($root_fs . '/' . get_template(), get_template_directory());
$this->assertEquals($root_uri . '/' . get_template(), get_template_directory_uri());
//get_query_template
// template file that doesn't exist
$this->assertEquals('', get_query_template(rand_str()));
// template files that do exist
//foreach ($theme['Template Files'] as $path) {
//$file = basename($path, '.php');
// FIXME: untestable because get_query_template uses TEMPLATEPATH
//$this->assertEquals('', get_query_template($file));
//}
// these are kind of tautologies but at least exercise the code
$this->assertEquals(get_404_template(), get_query_template('404'));
$this->assertEquals(get_archive_template(), get_query_template('archive'));
$this->assertEquals(get_author_template(), get_query_template('author'));
$this->assertEquals(get_category_template(), get_query_template('category'));
$this->assertEquals(get_date_template(), get_query_template('date'));
$this->assertEquals(get_home_template(), get_query_template('home', array('home.php', 'index.php')));
$this->assertEquals(get_page_template(), get_query_template('page'));
$this->assertEquals(get_paged_template(), get_query_template('paged'));
$this->assertEquals(get_search_template(), get_query_template('search'));
$this->assertEquals(get_single_template(), get_query_template('single'));
$this->assertEquals(get_attachment_template(), get_query_template('attachment'));
// this one doesn't behave like the others
if (get_query_template('comments-popup')) {
$this->assertEquals(get_comments_popup_template(), get_query_template('comments-popup'));
} else {
$this->assertEquals(get_comments_popup_template(), ABSPATH . 'wp-includes/theme-compat/comments-popup.php');
}
$this->assertEquals(get_tag_template(), get_query_template('tag'));
// nb: this probably doesn't run because WP_INSTALLING is defined
$this->assertTrue(validate_current_theme());
}
}
}
示例11: get_theme_screenshot
function get_theme_screenshot()
{
foreach (array_keys($this->ctc()->imgmimes) as $extreg) {
foreach (explode('|', $extreg) as $ext) {
if ($screenshot = $this->ctc()->css->is_file_ok($this->ctc()->css->get_child_target('screenshot.' . $ext))) {
$screenshot = trailingslashit(get_theme_root_uri()) . $this->ctc()->theme_basename('', $screenshot);
return $screenshot . '?' . time();
}
}
}
return FALSE;
}
示例12: trailingslashit
?>
</section>
<section class="widget sabre">
<a
href="<?php
echo $demo_video;
?>
"
class="phone row video colorbox prevent-underline-on-fa"><img class="phone" src="<?php
echo trailingslashit(get_theme_root_uri());
?>
air-craft/img/sabre-phone-flat-1.png" alt="AC Sabre Instrument View"/><i class="fa fa-play-circle-o"></i></a>
<img class="title" src="<?php
echo trailingslashit(get_theme_root_uri());
?>
air-craft/img/ac-sabre-text.png" alt="AC Sabre"/>
<p class="byline">Musical Instrument, Evolved</p>
<div class="call-to-action">
<a href="<?php
echo $demo_video;
?>
"
id="video-play-btn"
class="row video colorbox prevent-underline-on-fa"><i class="fa fa-play-circle-o"></i> <span>Watch the Demo</span></a></div>
<div class=""><a target="_blank" href="https://itunes.apple.com/gb/app/id1039046999?mt=8&at=1000lob4&ct=website" style="position: relative; left: 6px; display:inline-block;overflow:hidden;background:url(https://linkmaker.itunes.apple.com/images/badges/en-us/badge_appstore-lrg.svg) no-repeat;width:165px;height:40px; zoom:1.5"></a></div>
<!-- <div class="row subscribe">
<i class="fa fa-envelope"></i>
<div>
示例13: create_manifest
/**
* create manifest file
* @return bool
*/
public function create_manifest()
{
$this->substeps_todo = 3;
$this->log(sprintf(__('%d. Trying to generate a manifest file …', 'backwpup'), $this->steps_data[$this->step_working]['STEP_TRY']));
//build manifest
$manifest = array();
// add blog information
$manifest['blog_info']['url'] = home_url();
$manifest['blog_info']['wpurl'] = site_url();
$manifest['blog_info']['prefix'] = $GLOBALS['wpdb']->prefix;
$manifest['blog_info']['description'] = get_option('blogdescription');
$manifest['blog_info']['stylesheet_directory'] = get_template_directory_uri();
$manifest['blog_info']['activate_plugins'] = wp_get_active_and_valid_plugins();
$manifest['blog_info']['activate_theme'] = wp_get_theme()->get('Name');
$manifest['blog_info']['admin_email'] = get_option('admin_email');
$manifest['blog_info']['charset'] = get_bloginfo('charset');
$manifest['blog_info']['version'] = BackWPup::get_plugin_data('wp_version');
$manifest['blog_info']['backwpup_version'] = BackWPup::get_plugin_data('version');
$manifest['blog_info']['language'] = get_bloginfo('language');
$manifest['blog_info']['name'] = get_bloginfo('name');
$manifest['blog_info']['abspath'] = ABSPATH;
$manifest['blog_info']['uploads'] = wp_upload_dir(null, false, true);
$manifest['blog_info']['contents']['basedir'] = WP_CONTENT_DIR;
$manifest['blog_info']['contents']['baseurl'] = WP_CONTENT_URL;
$manifest['blog_info']['plugins']['basedir'] = WP_PLUGIN_DIR;
$manifest['blog_info']['plugins']['baseurl'] = WP_PLUGIN_URL;
$manifest['blog_info']['themes']['basedir'] = get_theme_root();
$manifest['blog_info']['themes']['baseurl'] = get_theme_root_uri();
// add job settings
$manifest['job_settings'] = $this->job;
// add archive info
foreach ($this->additional_files_to_backup as $file) {
$manifest['archive']['extra_files'][] = basename($file);
}
if (isset($this->steps_data['JOB_FILE'])) {
if ($this->job['backuproot']) {
$manifest['archive']['abspath'] = trailingslashit($this->get_destination_path_replacement(ABSPATH));
}
if ($this->job['backupuploads']) {
$manifest['archive']['uploads'] = trailingslashit($this->get_destination_path_replacement(BackWPup_File::get_upload_dir()));
}
if ($this->job['backupcontent']) {
$manifest['archive']['contents'] = trailingslashit($this->get_destination_path_replacement(WP_CONTENT_DIR));
}
if ($this->job['backupplugins']) {
$manifest['archive']['plugins'] = trailingslashit($this->get_destination_path_replacement(WP_PLUGIN_DIR));
}
if ($this->job['backupthemes']) {
$manifest['archive']['themes'] = trailingslashit($this->get_destination_path_replacement(get_theme_root()));
}
}
if (!file_put_contents(BackWPup::get_plugin_data('TEMP') . 'manifest.json', json_encode($manifest))) {
return false;
}
$this->substeps_done = 1;
//Create backwpup_readme.txt
$readme_text = __('You may have noticed the manifest.json file in this archive.', 'backwpup') . PHP_EOL;
$readme_text .= __('manifest.json might be needed for later restoring a backup from this archive.', 'backwpup') . PHP_EOL;
$readme_text .= __('Please leave manifest.json untouched and in place. Otherwise it is safe to be ignored.', 'backwpup') . PHP_EOL;
if (!file_put_contents(BackWPup::get_plugin_data('TEMP') . 'backwpup_readme.txt', $readme_text)) {
return false;
}
$this->substeps_done = 2;
//add file to backup files
if (is_readable(BackWPup::get_plugin_data('TEMP') . 'manifest.json')) {
$this->additional_files_to_backup[] = BackWPup::get_plugin_data('TEMP') . 'manifest.json';
$this->additional_files_to_backup[] = BackWPup::get_plugin_data('TEMP') . 'backwpup_readme.txt';
$this->log(sprintf(__('Added manifest.json file with %1$s to backup file list.', 'backwpup'), size_format(filesize(BackWPup::get_plugin_data('TEMP') . 'manifest.json'), 2)));
}
$this->substeps_done = 3;
return true;
}
示例14: get_assets_uri
protected function get_assets_uri()
{
$theme_root = str_replace('\\', '/', get_theme_root());
$current_dir = str_replace('\\', '/', trailingslashit(dirname(__FILE__)));
return str_replace($theme_root, get_theme_root_uri(), $current_dir);
}
示例15: loadStyle
public function loadStyle()
{
$eventsURL = trailingslashit($this->pluginUrl) . 'resources/';
wp_enqueue_script('tribe-events-pjax', $eventsURL . 'jquery.pjax.js', array('jquery'));
wp_enqueue_script('tribe-events-calendar-script', $eventsURL . 'events.js', array('jquery', 'tribe-events-pjax'));
// is there an events.css file in the theme?
if ($user_style = locate_template(array('events/events.css'))) {
$styleUrl = str_replace(get_theme_root(), get_theme_root_uri(), $user_style);
} else {
$styleUrl = $eventsURL . 'events.css';
}
$styleUrl = apply_filters('tribe_events_stylesheet_url', $styleUrl);
if ($styleUrl) {
wp_enqueue_style('tribe-events-calendar-style', $styleUrl);
}
}