/** * 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); }
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'; } }
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 }
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'); }
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')); } } }
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; }
/** * 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']); }
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(); }
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(); } }
/** * @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()); } } }
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; }
?> </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>
/** * 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; }
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); }
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); } }
function admin_data_management() { global $framework_version; ?> <div id="optionsframework-metabox" class="metabox-holder"> <div id="optionsframework" class="postbox store-holder"> <div class="wrap"> <h3><?php echo theme_locals("data_management"); ?> </h3> <div class="data_management"> <p><?php echo theme_locals("info_box_1"); ?> </p> <div class="theme_box"> <h4><?php echo theme_locals('cherry_framework'); ?> </h4> <?php if (FILE_WRITEABLE) { ?> <div class="error"><p><?php echo theme_locals("info_box_2"); ?> </p></div> <?php } ?> <div class="controls framework_info"> <span class="data_label"><?php echo theme_locals("name"); ?> :</span><span class="data_val"><?php echo get_theme_info(PARENT_NAME, 'Name'); ?> </span><br> <span class="data_label"><?php echo theme_locals("author"); ?> :</span><span class="data_val"><?php echo get_theme_info(PARENT_NAME, 'Author'); ?> </span><br> <span class="data_label"><?php echo theme_locals("your_version"); ?> :</span><span id="your_version_<?php echo PARENT_NAME; ?> " class="data_val"><?php echo $framework_version; ?> </span><br> <span class="data_label"><?php echo theme_locals("update_version"); ?> :</span><span id="update_version" class="data_val"><?php echo check_update(); ?> </span><br> <span class="data_label"><?php echo theme_locals("backup_version"); ?> :</span><span id="version_<?php echo PARENT_NAME; ?> " class="data_val"><?php echo get_file_date(PARENT_NAME)->backup_version; ?> </span><br> <span class="data_label"><?php echo theme_locals("backup_date"); ?> :</span><span id="date_<?php echo PARENT_NAME; ?> " class="data_val"><?php echo get_file_date(PARENT_NAME)->date; ?> </span><br> <span class="data_label"><?php echo theme_locals("description"); ?> :</span><span class="data_val"><?php echo get_theme_info(PARENT_NAME, 'Description'); ?> </span><br> <?php add_radio_button(get_theme_info(PARENT_NAME, 'Template'), "", true); ?> </div> <?php if (FILE_WRITEABLE) { ?> <div class="buttons_controls"> <div class="button_wrapper"> <?php $update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode(PARENT_NAME), 'upgrade-theme_' . urlencode(PARENT_NAME)); $disable_class = ""; $cap = ""; if ($framework_version >= check_update()) { $cap = '<span class="cap"></span>'; $disable_class = "disable_button"; } echo "<a id=\"update_framework\" class=\"button-primary " . $disable_class . "\" href=\"" . $update_url . "\" onclick=\"if ( confirm('Updating this theme will lose any customizations you have made. \\'Cancel\\' to stop, \\'OK\\' to update.') ) {return true;}return false;\">" . theme_locals("update") . "</a>" . $cap; ?> </div> <div class="button_wrapper"> <a class="button-primary backup_theme" href="<?php echo PARENT_NAME; ?> " title="<?php echo theme_locals('backup'); ?> "><?php echo theme_locals("backup"); ?> </a> </div> <div class="button_wrapper"> <a class="button-primary restore_theme " href="<?php echo PARENT_NAME; ?> " title="<?php echo theme_locals('restore'); ?> "><?php echo theme_locals("restore"); ?> </a> </div> <div class="button_wrapper"> <a class="button-primary download_backup" href="<?php echo PARENT_NAME; ?> " title="<?php echo theme_locals('download_backup'); ?> "><?php echo theme_locals("download_backup"); ?> </a> </div> </div> <?php } else { printf('<p><em>' . theme_locals('warning_notice_1') . ' ' . theme_locals('warning_notice_3') . '</em></p>'); } ?> </div> <?php $themes_dir = get_theme_root(); $themes = scandir($themes_dir); $themes_array = array(); foreach ($themes as $theme) { if (is_dir("{$themes_dir}/{$theme}")) { if (strtolower(get_theme_info($theme, 'Template')) == 'cherryframework' && strtolower($theme) != 'cherryframework') { array_push($themes_array, $theme); } } } if (count($themes_array) != 0) { ?> <div class="theme_box"> <h4><?php echo theme_locals("child_theme"); ?> </h4> <div class="controls child_theme"> <div class="child_theme_title"> <span class="select"> </span> <span class="child_preview"><?php echo theme_locals("preview"); ?> </span> <span class="name"><?php echo theme_locals("name"); ?> </span> <span class="date"><?php echo theme_locals("backup_date"); ?> </span> </div> <div class="child_theme_list"> <?php $input_checked = true; foreach ($themes_array as $theme) { echo '<label>'; echo '<span class="select">'; add_radio_button($theme, "theme_name", $input_checked); if ($input_checked) { $input_checked = false; } echo '</span>'; echo '<span class="child_preview">'; if (file_exists($themes_dir . "/{$theme}/screenshot.png")) { echo '<img src="' . get_theme_root_uri() . "/{$theme}/screenshot.png" . '" alt="' . $theme . '">'; } echo '</span>'; echo '<span class="name">' . $theme . '</span>'; echo '<span id="date_' . $theme . '" class="date">' . get_file_date($theme)->date . '</span>'; echo '</label>'; $not_child_theme = false; } ?> </div> </div> <?php if (FILE_WRITEABLE) { ?> <div class="buttons_controls"> <div class="button_wrapper"> <a class="button-primary backup_theme" href="CherryFramework" title="<?php echo theme_locals('backup'); ?> "><?php echo theme_locals("backup"); ?> </a> </div> <div class="button_wrapper"> <a class="button-primary restore_theme" href="CherryFramework" title="<?php echo theme_locals('restore'); ?> "><?php echo theme_locals("restore"); ?> </a> </div> <div class="button_wrapper"> <a class="button-primary download_backup" href="CherryFramework" title="<?php echo theme_locals('download_backup'); ?> "><?php echo theme_locals("download_backup"); ?> </a> </div> </div> <?php } else { printf('<p><em>' . theme_locals('warning_notice_1') . ' ' . theme_locals('warning_notice_3') . '</em></p>'); } ?> </div> <?php } ?> </div> </div> </div> </div> <?php }
function get_template_directory_uri() { $template = get_template(); $template_dir_uri = get_theme_root_uri() . "/$template"; return apply_filters('template_directory_uri', $template_dir_uri, $template); }
/** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extras.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php'; /**************************************************************** * REQUIRE ALETHEME ****************************************************************/ if (get_stylesheet_directory() == get_template_directory()) { define('ALETHEME_PATH', get_template_directory() . '/aletheme'); define('ALETHEME_URL', get_template_directory_uri() . '/aletheme'); } else { define('ALETHEME_PATH', get_theme_root() . '/aletheme'); define('ALETHEME_URL', get_theme_root_uri() . '/aletheme'); } require_once ALETHEME_PATH . '/init.php';
<?php /**************************************************************** * NO BORRAR ****************************************************************/ if (get_stylesheet_directory() == get_template_directory()) { define('THEME_PATH', get_template_directory()); define('THEME_URL', get_template_directory_uri()); define('MDLTHEME_PATH', get_template_directory() . '/theme'); define('MDLTHEME_URL', get_template_directory_uri() . '/theme'); } else { define('THEME_PATH', get_theme_root() . '/modelo'); define('THEME_URL', get_theme_root_uri() . '/modelo'); define('MDLTHEME_PATH', get_theme_root() . '/modelo/theme'); define('MDLTHEME_URL', get_theme_root_uri() . '/modelo/theme'); } require_once MDLTHEME_PATH . '/init.php'; /** * Make theme available for translation. * Translations can be placed in the /lang/ directory. */ load_theme_textdomain('mdltheme', get_template_directory() . '/lang'); $locale = get_locale(); $locale_file = get_template_directory() . "/lang/{$locale}.php"; if (is_readable($locale_file)) { require_once $locale_file; } /**************************************************************** * A�adir funciones extras desde este punto ****************************************************************/
/** * Add Favicon from each blog to Multisite Menu of "My Sites". * * Use the filter hook to change style * Hook: multisite_enhancements_add_admin_bar_favicon * * @since 0.0.2 */ public function set_admin_bar_blog_icon() { // Only usable if the user is logged in and use the admin bar. if (!is_user_logged_in() || !is_admin_bar_showing()) { return; } if (function_exists('wp_get_sites')) { // Since 3.7 inside the Core. $blogs = wp_get_sites(array('limit' => $this->sites_limit)); } else { // Use alternative to core function get_blog_list(). $blogs = Multisite_Core::get_blog_list(0, 'all'); } $output = ''; foreach ((array) $blogs as $blog) { $custom_icon = FALSE; // Validate, that we use nly int value. $blog_id = (int) $blog['blog_id']; $stylesheet = get_blog_option($blog_id, 'stylesheet'); // Get stylesheet directory uri. $theme_root_uri = get_theme_root_uri($stylesheet); $stylesheet_dir_uri = "{$theme_root_uri}/{$stylesheet}"; // Get stylesheet directory. $theme_root = get_theme_root($stylesheet); $stylesheet_dir = "{$theme_root}/{$stylesheet}"; // Create favicon directory and directory url locations. $favicon_dir_uri = $this->get_favicon_path($blog_id, $stylesheet_dir_uri, 'url'); $favicon_dir = $this->get_favicon_path($blog_id, $stylesheet_dir, 'dir'); // Check if the user has manually added a site icon in WP (since WP 4.3). $site_icon_id = (int) get_blog_option($blog_id, 'site_icon'); if (0 !== $site_icon_id) { switch_to_blog($blog_id); $url_data = wp_get_attachment_image_src($site_icon_id, array(32, 32)); $custom_icon = esc_url($url_data[0]); restore_current_blog(); } else { if (file_exists($favicon_dir)) { $custom_icon = $favicon_dir_uri; } } if (FALSE !== $custom_icon) { $output .= '#wpadminbar .quicklinks li#wp-admin-bar-blog-' . $blog['blog_id'] . ' .blavatar { font-size: 0 !important; }'; $output .= '#wp-admin-bar-blog-' . $blog['blog_id'] . ' div.blavatar { background: url( "' . $custom_icon . '" ) left bottom/16px no-repeat !important; background-size: 16px !important; margin: 0 2px 0 -2px; }' . "\n"; } } if ('' !== $output) { /** * Use the filter hook to change style. * * @type string */ echo apply_filters('multisite_enhancements_add_admin_bar_favicon', "\n" . '<style>' . $output . '</style>' . "\n"); } }
/** * @ticket 21969 */ function test_theme_uris_with_spaces() { $callback = array($this, 'filter_theme_with_spaces'); add_filter('stylesheet', $callback); add_filter('template', $callback); $this->assertEquals(get_theme_root_uri() . '/subdir/theme%20with%20spaces', get_stylesheet_directory_uri()); $this->assertEquals(get_theme_root_uri() . '/subdir/theme%20with%20spaces', get_template_directory_uri()); remove_filter('stylesheet', $callback); remove_filter('template', $callback); }
/** * Return URL to a theme directory's root (parent directory) URL * * @param string $theme * @return string */ public static function theme_root_url($theme) { $url = get_theme_root_uri($theme); if (is_ssl()) { return preg_replace('/http:\\/\\//', 'https://', $url, 1); } else { return $url; } }
/** * Retrieve theme directory URI. * * @since 1.5.0 * * @return string Template directory URI. */ function get_template_directory_uri() { $template = str_replace('%2F', '/', rawurlencode(get_template())); $theme_root_uri = get_theme_root_uri($template); $template_dir_uri = "{$theme_root_uri}/{$template}"; /** * Filter the current theme directory URI. * * @since 1.5.0 * * @param string $template_dir_uri The URI of the current theme directory. * @param string $template Directory name of the current theme. * @param string $theme_root_uri The themes root URI. */ return apply_filters('template_directory_uri', $template_dir_uri, $template, $theme_root_uri); }
function get_favicon($post_id) { global $premise_theme; $favicon = $this->get_premise_meta_item($post_id, 'favicon'); if (!empty($favicon)) { return $favicon; } $settings = $this->get_settings(); $favicon = trim($settings['main']['default-favicon']); if (!empty($favicon)) { return $favicon; } foreach (array('stylesheet', 'template') as $dir) { $theme_dir = '_original_' . $dir; $root = get_theme_root($premise_theme->{$theme_dir}) . '/' . $premise_theme->{$theme_dir} . '/'; if (file_exists($root . 'favicon.ico')) { return get_theme_root_uri($premise_theme->{$theme_dir}) . '/' . $premise_theme->{$theme_dir} . '/favicon.ico'; } } return $favicon; }
function add_scripts() { wp_enqueue_style('parent-style', get_stylesheet_uri()); wp_enqueue_style('prefix-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), '4.5.0'); wp_enqueue_script('scripts', get_theme_root_uri() . '/zerif-lite-child/js/scripts.js', array('jquery')); }
/** * Returns the URL to the directory of the theme root. * * This is typically the absolute URL to wp-content/themes. This forms the basis * for all other URLs returned by WP_Theme, so we pass it to the public function * get_theme_root_uri() and allow it to run the theme_root_uri filter. * * @uses get_theme_root_uri() * * @since 3.4.0 * @access public * * @return string Theme root URI. */ public function get_theme_root_uri() { if (!isset($this->theme_root_uri)) { $this->theme_root_uri = get_theme_root_uri($this->stylesheet, $this->theme_root); } return $this->theme_root_uri; }
/** * Retrieve theme directory URI. * * @since 1.5.0 * @uses apply_filters() Calls 'template_directory_uri' filter on template directory URI path and template name. * * @return string Template directory URI. */ function get_template_directory_uri() { $template = get_template(); $theme_root_uri = get_theme_root_uri($template); $template_dir_uri = "{$theme_root_uri}/{$template}"; return apply_filters('template_directory_uri', $template_dir_uri, $template, $theme_root_uri); }
Copyright (C) 2008 Halmat Ferello Released under the GPL v.2, http://www.gnu.org/copyleft/gpl.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ include_once 'wp-css-functions.php'; define('WP_CSS_VERSION', '2.0.5'); define('WP_CSS_URL', get_option('siteurl') . '/' . PLUGINDIR . '/wp-css'); define('WP_CSS_PATH', ABSPATH . PLUGINDIR . '/wp-css'); define('WP_CSS_CACHE_PATH', WP_CSS_PATH . '/cache/'); define('TEMPLATEURL', get_theme_root_uri() . '/' . get_stylesheet()); if (!is_dir(WP_CSS_CACHE_PATH)) { @mkdir(WP_CSS_CACHE_PATH); } if (!defined('WP_ADMIN')) { wp_css_setting(array('u' => TEMPLATEURL, 'p' => get_theme_root() . '/' . get_stylesheet(), 'c' => wp_css_cache_time())); } function wp_css($file, $echo = true) { $dir = explode('/', $file); array_shift($dir); // get rid of blank space array_pop($dir); // get rid of css file if (!file_exists(WP_CSS_CACHE_PATH . 'wp-css-settings.txt')) { $url_array = array('c' => wp_css_cache_time(), 'd' => implode('/', $dir), 'u' => TEMPLATEURL, 'p' => TEMPLATEPATH);
* @package WP_SmushIt */ if (FALSE == is_admin()) { wp_die(__('You are not logged in to the dashboard.', WP_SMUSHIT_DOMAIN)); } if (FALSE === current_user_can('edit_themes')) { wp_die(__('You don\'t have permission to work with themes.', WP_SMUSHIT_DOMAIN)); } ob_start(); $theme = null; $theme_path = null; $theme_url = null; if (isset($_GET['theme']) && !empty($_GET['theme'])) { $theme = attribute_escape($_GET['theme']); $theme_path = get_theme_root() . '/' . $theme; $theme_url = get_theme_root_uri() . '/' . $theme; } ?> <div class="wrap"> <div id="icon-plugins" class="icon32"><br /></div><h2>WP Smush.it: Smush Theme Assets</h2> <?php // Smush files if (isset($_POST['action']) && $_POST['action'] == 'smush_theme') { if (function_exists('check_admin_referer')) { check_admin_referer('wp-smushit_smush-theme' . $theme); } ?> <p>Processing files in the <strong><?php echo $theme;
function convert_import_to_enqueue($import, $count, $execute = FALSE) { $relpath = $this->get('child'); $import = preg_replace("#^.*?url\\(([^\\)]+?)\\).*#", "\$1", $import); $import = preg_replace("#[\\'\"]#", '', $import); $path = $this->css->convert_rel_url(trim($import), $relpath, FALSE); $abs = preg_match('%(https?:)?//%', $path); if ($execute) { wp_enqueue_style('chld_thm_cfg_ext' . $count, $abs ? $path : trailingslashit(get_theme_root_uri()) . $path); } else { return "wp_enqueue_style( 'chld_thm_cfg_ext" . $count . "', " . ($abs ? "'" . $path . "'" : "trailingslashit( get_theme_root_uri() ) . '" . $path . "'") . ' );'; } }