本文整理汇总了PHP中get_theme_root函数的典型用法代码示例。如果您正苦于以下问题:PHP get_theme_root函数的具体用法?PHP get_theme_root怎么用?PHP get_theme_root使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_theme_root函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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: 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;
}
示例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';
}
}
示例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();
}
示例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;
}
示例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']);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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');
}
示例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>';
} }
示例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;
}