本文整理汇总了PHP中get_theme_root函数的典型用法代码示例。如果您正苦于以下问题:PHP get_theme_root函数的具体用法?PHP get_theme_root怎么用?PHP get_theme_root使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_theme_root函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpd_download
function wpd_download()
{
if (!class_exists('PclZip')) {
include ABSPATH . 'wp-admin/includes/class-pclzip.php';
}
$what = $_GET['wpd'];
$object = $_GET['object'];
switch ($what) {
case 'plugin':
if (strpos($object, '/')) {
$object = dirname($object);
}
$root = WP_PLUGIN_DIR;
break;
case 'theme':
$root = get_theme_root($object);
break;
}
$path = $root . '/' . $object;
$fileName = $object . '.zip';
$archive = new PclZip($fileName);
$archive->add($path, PCLZIP_OPT_REMOVE_PATH, $root);
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
readfile($fileName);
// remove tmp zip file
unlink($fileName);
exit;
}
开发者ID:vrkansagara,项目名称:wordpress-plugin-construction,代码行数:29,代码来源:wp-downloader-3.7.php
示例2: analyze_file
}
/**
* Analyzes this file.
*/
protected function analyze_file()
{
// Load the contents of the file
if (is_null($this->filecontents) || !$this->filecontents) {
$this->filecontents = file_get_contents($this->filepath);
}
if (false === $this->filecontents) {
return;
}
// Strip strings and comments from the file. Preserve line numbers
$stripped = $this->strip_strings_and_comments($this->filecontents);
// Do the php check hierarchy
$this->processed_file_contents = $this->do_check_hierarchy('', $this->check_hierarchy, $stripped, 0);
// Only continue if this file is a style.css file.
if ($this->get_filename() !== 'style.css') {
return;
}
// Check if this file is the main stylesheet for a theme
$path = pathinfo($this->get_filepath(), PATHINFO_DIRNAME);
$theme_root = get_theme_root($this->get_filepath());
if (0 === strpos($path, $theme_root)) {
$path = substr($path, strlen($theme_root));
}
$theme = wp_get_theme($path);
if (!empty($theme) && is_a($theme, 'WP_Theme')) {
$this->is_main_stylesheet = true;
$this->theme = $theme;
}
开发者ID:grappler,项目名称:vip-scanner,代码行数:32,代码来源:class-analyzed-css-file.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
}
开发者ID:r-chopra17,项目名称:p2bp,代码行数:32,代码来源:functions.php
示例4: does_theme_include_idx_tag
public function does_theme_include_idx_tag()
{
// default page content
//the empty div is for any content they add to the visual editor so it displays
$post_content = '<div></div><div id="idxStart" style="display: none;"></div><div id="idxStop" style="display: none;"></div>';
// get theme to check start/stop tag
$does_theme_include_idx_tag = false;
$template_root = get_theme_root() . DIRECTORY_SEPARATOR . get_stylesheet();
$files = scandir($template_root);
foreach ($files as $file) {
$path = $template_root . DIRECTORY_SEPARATOR . $file;
if (is_file($path) && preg_match('/.*\\.php/', $file)) {
$content = file_get_contents($template_root . DIRECTORY_SEPARATOR . $file);
if (preg_match('/<div[^>\\n]+?id=[\'"]idxstart[\'"].*?(\\/>|><\\/div>)/i', $content)) {
if (preg_match('/<div[^>\\n]+?id=[\'"]idxstop[\'"].*?(\\/>|><\\/div>)/i', $content)) {
$does_theme_include_idx_tag = true;
break;
}
}
}
}
if ($does_theme_include_idx_tag || function_exists('equity')) {
$post_content = '';
}
return $post_content;
}
开发者ID:jdelia,项目名称:wordpress-plugin,代码行数:26,代码来源:wrappers.php
示例5: 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';
}
}
开发者ID:noman90rauf,项目名称:wp-content,代码行数:34,代码来源:theme-setup.php
示例6: Include_my_php
function Include_my_php($params = array())
{
extract(shortcode_atts(array('file' => 'default'), $params));
ob_start();
include get_theme_root() . '/' . get_template() . "/{$file}.php";
return ob_get_clean();
}
开发者ID:shota-co,项目名称:cebutern,代码行数:7,代码来源:functions.php
示例7: cltvo_wpURL_2_path
function cltvo_wpURL_2_path($url)
{
$path = get_theme_root();
$path = str_replace('wp-content/themes', '', $path);
$path = str_replace(home_url('/'), $path, $url);
return $path;
}
开发者ID:spairo,项目名称:cgm-1,代码行数:7,代码来源:index.php
示例8: init_listingDirectories
private static function init_listingDirectories()
{
if (null === MainWP_Security::$listingDirectories) {
$wp_upload_dir = wp_upload_dir();
MainWP_Security::$listingDirectories = array(WP_CONTENT_DIR, WP_PLUGIN_DIR, get_theme_root(), $wp_upload_dir['basedir']);
}
}
开发者ID:jexmex,项目名称:mainwp-child,代码行数:7,代码来源:class-mainwp-security.php
示例9: create_zip
function create_zip($themeName)
{
$exclude_files = array('.', '..', '.svn', 'thumbs.db', '!sources', 'style.less.cache', 'bootstrap.less.cache', '.gitignore', '.git');
$all_themes_dir = str_replace('\\', '/', get_theme_root());
$backup_dir = str_replace('\\', '/', WP_CONTENT_DIR) . '/themes_backup';
$zip_name = $backup_dir . "/" . $themeName . '.zip';
$backup_date = date("F d Y");
if (is_dir($all_themes_dir . "/" . $themeName)) {
$file_string = scan_dir($all_themes_dir . "/" . $themeName, $exclude_files);
}
if (function_exists('wp_get_theme')) {
$backup_version = wp_get_theme($themeName)->Version;
} else {
$backup_version = get_current_theme($themeName)->Version;
}
if (!is_dir($backup_dir)) {
if (mkdir($backup_dir, 0700)) {
$htaccess_file = fopen($backup_dir . '/.htaccess', 'a');
$htaccess_text = 'deny from all';
fwrite($htaccess_file, $htaccess_text);
fclose($htaccess_file);
}
}
$zip = new PclZip($zip_name);
if ($zip->create($file_string, PCLZIP_OPT_REMOVE_PATH, $all_themes_dir . "/" . $themeName) == 0) {
die("Error : " . $zip->errorInfo(true));
}
update_option($themeName . "_date_backup", $backup_date, '', 'yes');
update_option($themeName . "_version_backup", $backup_version, '', 'yes');
echo $backup_date . "," . $backup_version;
}
开发者ID:hoangluanlee,项目名称:dlbh,代码行数:31,代码来源:backup.php
示例10: generate
public function generate($filepath)
{
$template_dir = str_replace(array(':', '/', '\\'), '_', trim(get_theme_root(), '/\\'));
$filepath = str_replace(array(':', '/', '\\'), '_', ltrim($filepath, '/\\'));
$id = trim(str_replace($template_dir, '', $filepath), '_');
return $id;
}
开发者ID:svallory,项目名称:wp-haml,代码行数:7,代码来源:wp-hamlphp.php
示例11: rollback
public function rollback($theme, $args = array())
{
$defaults = array('clear_update_cache' => true);
$parsed_args = wp_parse_args($args, $defaults);
$this->init();
$this->upgrade_strings();
if (0) {
$this->skin->before();
$this->skin->set_result(false);
$this->skin->error('up_to_date');
$this->skin->after();
return false;
}
$theme_slug = $this->skin->theme;
$theme_version = $this->skin->options['version'];
$download_endpoint = 'https://downloads.wordpress.org/theme/';
$url = $download_endpoint . $theme_slug . '.' . $theme_version . '.zip';
add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
//'source_selection' => array($this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.
$this->run(array('package' => $url, 'destination' => get_theme_root(), 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array('theme' => $theme, 'type' => 'theme', 'action' => 'update')));
remove_filter('upgrader_pre_install', array($this, 'current_before'));
remove_filter('upgrader_post_install', array($this, 'current_after'));
remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
if (!$this->result || is_wp_error($this->result)) {
return $this->result;
}
// Force refresh of theme update information
wp_clean_themes_cache($parsed_args['clear_update_cache']);
return true;
}
开发者ID:CoachBirgit,项目名称:WP-Rollback,代码行数:32,代码来源:class-rollback-theme-upgrader.php
示例12: get_cat_imgs
function get_cat_imgs($partial)
{
global $baseUrl;
global $isMobile;
$isMobile = false;
$grid = '';
$partial = trim($partial);
$dir = get_theme_root() . '/atlasdesigns.com';
$targetDir = $dir . '/img/work/' . $partial;
if (!is_dir($targetDir)) {
return "Oops there was a problem loading images. Please try another section! :)";
}
chdir($targetDir);
$gallery_items = scandir($targetDir);
foreach ($gallery_items as $idx => $file) {
if ($isMobile && $idx > 6) {
continue;
}
if (strpos($file, '.') == 0) {
continue;
}
$grid .= <<<EOL
<li>
\t<a class="thumb" rel="group" href="{$baseUrl}/wp-content/themes/atlasdesigns.com/img/work/{$partial}/{$file}">
\t\t<img src="{$baseUrl}/wp-content/themes/atlasdesigns.com/img/work/{$partial}/{$file}" alt="" />
\t</a>
</li>
EOL;
}
echo $grid;
}
开发者ID:peb7268,项目名称:dfa-stone-works,代码行数:31,代码来源:gallery.php
示例13: nice_constants
function nice_constants()
{
define('NICE_TPL_DIR', get_template_directory_uri());
define('NICE_TPL_PATH', get_theme_root() . '/' . get_template());
define('NICE_PREFIX', 'nice');
define('NICE_FRAMEWORK_VERSION', '1.1.5');
define('NICE_UPDATES_URL', 'http://updates.nicethemes.com');
}
开发者ID:supahseppe,项目名称:path-of-gaming,代码行数:8,代码来源:init.php
示例14: correct_path
function correct_path() {
if( file_exists(get_theme_root().'/express_store/style.css' ) ) {
// do nothing
} else {
echo '<div id="message" class="error" style="width: 97%; font-size:11px; line-height:1.6em;"> ERROR : You have successfully activated this theme but you may have problems. <br/> It looks like that the theme path of the Express Store theme is wrong! Currently this is your theme path : '. TEMPLATEPATH .', but it <br/><strong>MUST BE '.get_theme_root().'/express_store/'.'</strong>, having the express_store theme folder inside another folder will cause problems, make sure that the express_store folder is inside the wp-content/themes/ folder and not in any other subfolder</div>';
} }
开发者ID:robbiespire,项目名称:paQui,代码行数:8,代码来源:library.functions.php
示例15: get_theme_data
/**
* Return theme data for active theme
*
* @param string $theme_slug
* @return array
*/
private function get_theme_data($theme_slug)
{
if (null === $this->theme_data) {
$stylesheet = get_theme_root($theme_slug) . '/' . $theme_slug . '/style.css';
$this->theme_data = get_theme_data($stylesheet);
}
return $this->theme_data;
}
开发者ID:nathan929,项目名称:infinity,代码行数:14,代码来源:nicepkg.php
示例16: wpestate_cron_generate_pins
function wpestate_cron_generate_pins()
{
if (get_option('wp_estate_readsys', '') == 'yes') {
$path = get_theme_root() . '/wprentals/pins.txt';
if (file_exists($path) && is_writable($path)) {
wpestate_listing_pins();
}
}
}
开发者ID:riddya85,项目名称:rentail_upwrk,代码行数:9,代码来源:events.php
示例17: registerPageTemplate
public function registerPageTemplate($atts)
{
$cache_key = 'page_templates-' . md5(get_theme_root() . '/' . get_stylesheet());
$templates = empty(wp_get_theme()->get_page_templates()) ? [] : wp_get_theme()->get_page_templates();
wp_cache_delete($cache_key, 'themes');
$templates = array_merge($templates, $this->templates);
wp_cache_add($cache_key, $templates, 'themes', 1800);
return $atts;
}
开发者ID:alpipego,项目名称:wp-nownownow,代码行数:9,代码来源:Plugin.php
示例18: _map_file_to_relative_origin
private function _map_file_to_relative_origin($file)
{
$file = wp_normalize_path(realpath($file));
$plugin_path_rx = preg_quote(wp_normalize_path(WP_PLUGIN_DIR), '/');
$muplugin_path_rx = preg_quote(wp_normalize_path(WPMU_PLUGIN_DIR), '/');
$theme_path_rx = preg_quote(wp_normalize_path(get_theme_root()), '/');
$path_prefix = false;
if (preg_match('/^' . $plugin_path_rx . '/', $file)) {
$path_prefix = $plugin_path_rx;
} else {
if (preg_match('/^' . $muplugin_path_rx . '/', $file)) {
$path_prefix = $muplugin_path_rx;
} else {
if (preg_match('/^' . $theme_path_rx . '/', $file)) {
$path_prefix = $theme_path_rx;
}
}
}
if (empty($path_prefix)) {
return $this->_get_l10n(self::ORIGIN_INTERNAL);
}
// Not a pugin, mu-plugin or a theme
$clean_path = explode('/', ltrim(preg_replace('/^' . $path_prefix . '/', '', $file), '/'));
$basename = !empty($clean_path[0]) ? $clean_path[0] : false;
if (empty($basename)) {
return $this->_get_l10n(self::ORIGIN_INTERNAL);
}
// We had an issue along the way and can't figure it out further
if (!function_exists('get_plugin_data')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$all_plugins = get_plugins();
if ($path_prefix === $plugin_path_rx || $path_prefix === $muplugin_path_rx) {
// It's a plugin, get the name
$info = false;
foreach ($all_plugins as $plugin => $pinfo) {
if (!preg_match('/^' . preg_quote(trailingslashit($basename), '/') . '/', $plugin)) {
continue;
}
$info = $pinfo;
break;
}
if (empty($info)) {
// Let's give it one last go for mu-plugins
$info = get_plugin_data($file);
}
return !empty($info['Name']) ? $info['Name'] : $this->_get_l10n(self::ORIGIN_PLUGIN);
} else {
if ($theme_path_rx === $path_prefix) {
$info = wp_get_theme($basename);
$name = is_object($info) && method_exists($info, 'get') ? $info->get('Name') : false;
return !empty($name) ? $name : $this->_get_l10n(self::ORIGIN_THEME);
}
}
return $this->_get_l10n(self::ORIGIN_INTERNAL);
}
开发者ID:sedici,项目名称:wpmu-istec,代码行数:56,代码来源:class_upfront_markup_server.php
示例19: addOptions
function addOptions()
{
if (isset($_POST['gi_subtle_reset'])) {
themeGluedIdeas_Subtle::initOptions(true);
}
if (isset($_POST['gi_subtle_save'])) {
$aOptions = themeGluedIdeas_Subtle::initOptions(false);
$aOptions['errors'] = array();
$aOptions['style'] = $_POST['gi_subtle_style'];
$aOptions['description'] = stripslashes($_POST['gi_subtle_description']);
$aOptions['lead_count'] = $_POST['gi_subtle_lead_count'];
$aOptions['lead_cats'] = $_POST['gi_subtle_lead_cats'];
$aOptions['feedburner'] = $_POST['gi_subtle_feedburner'];
$aOptions['feedburner_id'] = $_POST['gi_subtle_feedburner_id'];
if ($_POST['gi_subtle_show_archives'] == 'true') {
$aOptions['show_archives'] = true;
} else {
$aOptions['show_archives'] = false;
}
if ($_POST['gi_subtle_show_metalinks'] == 'true') {
$aOptions['show_metalinks'] = true;
} else {
$aOptions['show_metalinks'] = false;
}
$aOptions['archives_cat'] = $_POST['gi_subtle_archives_cat'];
if ($_POST['gi_subtle_show_subpages'] == 'true') {
$aOptions['show_subpages'] = true;
} else {
$aOptions['show_subpages'] = false;
}
if ($_POST['gi_subtle_show_feedflare'] == 'true') {
$aOptions['show_feedflare'] = true;
} else {
$aOptions['show_feedflare'] = false;
}
if ($_POST['gi_subtle_show_gravatar'] == 'true') {
$aOptions['show_gravatar'] = true;
} else {
$aOptions['show_gravatar'] = false;
}
$aOptions['gravatar_rating'] = $_POST['gi_subtle_gravatar_rating'];
$aOptions['gravatar_default'] = $_POST['gi_subtle_gravatar_default'];
// Handle header creation if a valid JPG was sent
$sStyleFolder = get_theme_root() . '/' . get_template() . '/styles/' . $aOptions['style'] . '/';
if (is_uploaded_file($_FILES['gi_subtle_header']['tmp_name']) || $_POST['gi_subtle_reset_header'] == 'true') {
if (file_exists($sStyleFolder . 'generator.php')) {
include_once $sStyleFolder . 'generator.php';
$aOptions['errors'] = generateHeader($sStyleFolder, $_POST['gi_subtle_reset_header']);
} else {
$aOptions['errors'][] = __('This theme style does not support uploadable headers', 'gluedideas_subtle');
}
}
update_option('gi_subtle_theme', $aOptions);
}
add_theme_page("Glued Ideas 'Subtle' Theme Options", "Current Theme Options", 'edit_themes', basename(__FILE__), array('themeGluedIdeas_Subtle', 'displayOptions'));
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:56,代码来源:functions.php
示例20: Ultimatum_Exporter
function Ultimatum_Exporter(){
$task = '';
if(isset($_GET['task'])){
$task = $_GET['task'];
}
switch ($task){
default:
break;
case 'template':
ultimatum_exportTemplate($_GET['template_id'],true);
break;
case 'theme':
// Create utinstall folder
$dir = THEME_DIR.DS.'ultinstall';
if(is_dir($dir)){
deleteDirectory($dir);
}
mkdir($dir);
if(is_dir($dir)){
global $wpdb;
$table = $wpdb->prefix.ULTIMATUM_PREFIX.'_templates';
$sql = 'SELECT * FROM `'.$table.'` WHERE `theme`=\''.THEME_SLUG.'\'';
$templates = $wpdb->get_results($sql,ARRAY_A);
if($templates){
foreach ($templates as $template){
ultimatum_exportTemplate($template['id'],false);
}
}
// Create the zip and show download link ;)
$backuplister[]= THEME_DIR;
$fontsoption = get_option(THEME_SLUG.'_fonts');
if(count($fontsoption)!=0){
$fontsoption = serialize($fontsoption);
$file = $dir.'/'.THEME_SLUG.'.fonts';
if(file_exists($file)){
unlink($file);
}
$fhandle = @fopen($file, 'w+');
if ($fhandle) fwrite($fhandle, $fontsoption, strlen($fontsoption));
}
require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
$archive = new PclZip(THEME_CACHE_DIR.'/'.THEME_NAME.'.zip');
$v_list = $archive->add($backuplister,PCLZIP_OPT_REMOVE_PATH, get_theme_root());
?>
<h2>Your File...</h2>
<p>You have successfully Created your Export file you can download it via below link</p>
<a href="<?php echo THEME_CACHE_URL; ?>/<?php echo THEME_NAME;?>.zip">Download File</a>
<?php
} else {
echo 'Could not create folder needed in child teme directory.';
}
break;
}
}
开发者ID:polaris610,项目名称:medicalhound,代码行数:56,代码来源:template_export.php
注:本文中的get_theme_root函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论