本文整理汇总了PHP中get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP get_option函数的具体用法?PHP get_option怎么用?PHP get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_option函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: base_getBreadcrumbs
function base_getBreadcrumbs()
{
if (is_404()) {
return false;
}
// Hack to fix breadcrumbs when you're viewing the news home
if (is_home()) {
$post = new \Timber\Post(get_option('page_for_posts'));
} else {
global $post;
}
$breadcrumbs = [];
if ($post->post_parent) {
$parent_id = $post->post_parent;
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = new \Timber\Post($page->ID);
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
}
// Add 'Blog Home' to breadcrumbs if you're on a news post or archive
if ((is_single() || is_archive()) && !is_search()) {
$breadcrumbs[] = new \Timber\Post(get_option('page_for_posts'));
}
return $breadcrumbs;
}
开发者ID:wearebase,项目名称:web-wordpress,代码行数:27,代码来源:breadcrumbs.php
示例2: plugin_information
/**
* Sends and receives data to and from the server API
*
* @access public
* @since 1.0.0
* @return object $response
*/
public function plugin_information($args)
{
$target_url = $this->create_upgrade_api_url($args);
$apisslverify = get_option('mainwp_api_sslVerifyCertificate') === false || get_option('mainwp_api_sslVerifyCertificate') == 1 ? 1 : 0;
$request = wp_remote_get($target_url, array('timeout' => 50, 'sslverify' => $apisslverify));
// $request = wp_remote_post( MainWP_Api_Manager::instance()->getUpgradeUrl() . 'wc-api/upgrade-api/', array('body' => $args) );
if (is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) {
return false;
}
$response = unserialize(wp_remote_retrieve_body($request));
/**
* For debugging errors from the API
* For errors like: unserialize(): Error at offset 0 of 170 bytes
* Comment out $response above first
*/
// $response = wp_remote_retrieve_body( $request );
// print_r($response); exit;
if (is_object($response)) {
if (isset($response->package)) {
$response->package = apply_filters('mainwp_api_manager_upgrade_url', $response->package);
}
return $response;
} else {
return false;
}
}
开发者ID:reeslo,项目名称:mainwp,代码行数:33,代码来源:class-mainwp-api-manager-plugin-update.php
示例3: ue_closeDefaultEditor
/**
* 当开启UEditor插件时,关闭默认的编辑器
*/
function ue_closeDefaultEditor()
{
if (!get_option("close_default_editor")) {
add_option("close_default_editor");
}
update_option("close_default_editor", "true");
}
开发者ID:hjm8809,项目名称:xsphp.com,代码行数:10,代码来源:ueditor.class.php
示例4: render_content
public function render_content()
{
?>
<label>
<span class="customize-control-title"><?php
echo esc_html($this->label);
?>
</span>
<p class="description customize-section-description"><?php
echo esc_html($this->description);
?>
</p>
<select <?php
$this->link();
?>
disabled="disabled">
<?php
$var = get_option($this->field);
foreach ($this->options as $option) {
if ($this->options == $var) {
echo '<option value="' . $option . '" selected="selected">' . $option . '</option>';
} else {
echo '<option value="' . $option . '">' . $option . '</option>';
}
}
?>
</select>
</label>
<?php
}
开发者ID:Phoenix-redux,项目名称:koko,代码行数:31,代码来源:class-login-customizer-security-select-control.php
示例5: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$sticky = get_option('sticky_posts');
$number = empty($instance['number']) ? 1 : (int) $instance['number'];
$cat = empty($instance['category']) ? 0 : (int) $instance['category'];
if (is_single()) {
array_push($sticky, get_the_ID());
}
echo $before_widget;
if (!empty($title)) {
echo $before_title . $title . $after_title;
} else {
echo '<br />';
}
$featuredPosts = new WP_Query(array('posts_per_page' => $number, 'cat' => $cat, 'post__not_in' => $sticky, 'no_found_rows' => true));
while ($featuredPosts->have_posts()) {
$featuredPosts->the_post();
global $mb_content_area, $more;
$mb_content_area = 'sidebar';
get_template_part('content', get_post_format());
}
wp_reset_postdata();
echo $after_widget;
}
开发者ID:pavlinov,项目名称:1b.school59.eu,代码行数:26,代码来源:widget_feature.php
示例6: __construct
public function __construct($data = array())
{
parent::__construct($data);
if (!isset($data['name'])) {
$this->name = 'eventlist';
}
if (!isset($data['posts'])) {
$event_args = array();
// Get the active plugins.
$active_plugins = get_option('active_plugins');
// We do some guessing here for Tzolkin
if (in_array('tzolkin/tzolkin.php', $active_plugins)) {
$event_args = ['post_type' => 'tz_events'];
}
// Some more guessing for The Events Calendar
if (in_array('the-events-calendar/the-events-calendar.php', $active_plugins)) {
$event_args = ['post_type' => \Tribe__Events__Main::POSTTYPE, 'orderby' => 'event_date', 'order' => 'ASC', 'posts_per_page' => tribe_get_option('postsPerPage', 10), 'tribe_render_context' => 'default'];
}
$eventlist_event_args_filter = $this->name . '_event_args';
$event_args = apply_filters($eventlist_event_args_filter, $event_args);
Atom::add_debug_entry('Filter', $eventlist_event_args_filter);
$this->posts = new \WP_Query($event_args);
}
if (!isset($data['posts-structure'])) {
$posts_structure = ['PostClass' => ['children' => ['image', 'text']], 'image' => ['parts' => ['PostThumbnail']], 'text' => ['parts' => ['EventBadge', 'PostTitleLink', 'EventDate', 'ForceExcerpt', 'PostLink' => 'Read More']]];
$postlist_posts_structure_filter = $this->name . '_posts_structure';
$this->posts_structure = apply_filters($postlist_posts_structure_filter, $posts_structure);
Atom::add_debug_entry('Filter', $postlist_posts_structure_filter);
}
}
开发者ID:Clark-Nikdel-Powell,项目名称:Pattern-Library,代码行数:30,代码来源:event-list.php
示例7: __construct
function __construct()
{
add_action('init', array(&$this, 'set_core_fields'), 1);
add_action('init', array(&$this, 'set_predefined_fields'), 1);
add_action('init', array(&$this, 'set_custom_fields'), 1);
$this->saved_fields = get_option('um_fields');
}
开发者ID:chrisuehlein,项目名称:couponsite,代码行数:7,代码来源:um-builtin.php
示例8: InitClass
static function InitClass()
{
wp_enqueue_style(WPFB . '-admin', WPFB_PLUGIN_URI . 'css/admin.css', array(), WPFB_VERSION, 'all');
wp_register_script('jquery-deserialize', WPFB_PLUGIN_URI . 'bower_components/jquery-deserialize/dist/jquery.deserialize.min.js', array('jquery'), WPFB_VERSION);
if (isset($_GET['page'])) {
$page = $_GET['page'];
if ($page == 'wpfilebase_files') {
wp_enqueue_script('postbox');
wp_enqueue_style('dashboard');
} elseif ($page == 'wpfilebase' && isset($_GET['action']) && $_GET['action'] == 'sync') {
do_action('wpfilebase_sync');
wp_die("Filebase synced.");
}
}
add_action('wp_dashboard_setup', array(__CLASS__, 'AdminDashboardSetup'));
//wp_register_widget_control(WPFB_PLUGIN_NAME, "[DEPRECATED]".WPFB_PLUGIN_NAME .' '. __('File list','wp-filebase'), array(__CLASS__, 'WidgetFileListControl'), array('description' => __('DEPRECATED','wp-filebase')));
add_action('admin_print_scripts', array('WPFB_AdminLite', 'AdminPrintScripts'));
self::CheckChangedVer();
if (basename($_SERVER['PHP_SELF']) === "plugins.php") {
if (isset($_GET['wpfb-uninstall']) && current_user_can('edit_files')) {
update_option('wpfb_uninstall', !empty($_GET['wpfb-uninstall']) && $_GET['wpfb-uninstall'] != "0");
}
if (get_option('wpfb_uninstall')) {
function wpfb_uninstall_warning()
{
echo "\n\t\t\t\t<div id='wpfb-warning' class='updated fade'><p><strong>" . __('WP-Filebase will be uninstalled completely when deactivating the Plugin! All settings and File/Category Info will be deleted. Actual files in the upload directory will not be removed.', 'wp-filebase') . ' <a href="' . add_query_arg('wpfb-uninstall', '0') . '">' . __('Cancel') . "</a></strong></p></div>\n\t\t\t\t";
}
add_action('admin_notices', 'wpfb_uninstall_warning');
}
}
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:31,代码来源:AdminLite.php
示例9: nktagcloud_init
/**
* Things to run during init hook
*
* @since 0.8.6
*/
function nktagcloud_init()
{
// http://codex.wordpress.org/Determining_Plugin_and_Content_Directories
// Pre-2.6 compatibility
if (!defined('WP_CONTENT_URL')) {
define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
}
if (!defined('WP_CONTENT_DIR')) {
define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
}
if (!defined('WP_PLUGIN_URL')) {
define('WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins');
}
if (!defined('WP_PLUGIN_DIR')) {
define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
}
global $nktagcloud;
$nktagcloud = array('path' => WP_PLUGIN_DIR . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)), 'url' => WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)));
// always needed for footer link
// TODO which footer link? we don't need this in admin, or do we?
require_once 'inc/page.php';
if (is_admin()) {
require_once 'inc/admin.php';
add_action('admin_menu', 'nktagcloud_add_pages');
register_widget_control(__('Better Tag Cloud', 'nktagcloud'), 'nktagcloud_control');
register_sidebar_widget(__('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud');
} else {
add_shortcode('nktagcloud', 'nktagcloud_shortcode');
add_shortcode('nktagcloud_single', 'nktagcloud_single_shortcode');
register_sidebar_widget(__('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud');
}
}
开发者ID:howardlei82,项目名称:IGSM-Website,代码行数:37,代码来源:nktagcloud.php
示例10: follow_pinterest
function follow_pinterest($type, $id, $text = '', $icon = '')
{
$url = 'http://pinterest.com/' . $id . '/';
$text = $text == '' ? __('Follow me on', 'mr_social_sharing_toolkit') . ' Pinterest' : $text;
$blank = get_option('mr_social_sharing_follow_new') == 1 ? true : false;
return $this->get_icon($type, $url, $text, $icon, false, $blank);
}
开发者ID:EmmaTope,项目名称:Ekaruz-main,代码行数:7,代码来源:button.pinterest.php
示例11: run
function run()
{
$this->settings = get_site_option('itsec_hide_backend');
//Execute module functions on frontend init
if ($this->settings['enabled'] === true) {
$jetpack_active_modules = get_option('jetpack_active_modules');
if (is_multisite() && function_exists('is_plugin_active_for_network')) {
//see if Jetpack is active
$is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array())) || is_plugin_active_for_network('jetpack/jetpack.php');
} else {
$is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array()));
}
if (!($is_jetpack_active === true && is_array($jetpack_active_modules) && in_array('json-api', $jetpack_active_modules) && isset($_GET['action']) && $_GET['action'] == 'jetpack_json_api_authorization')) {
$this->auth_cookie_expired = false;
add_action('auth_cookie_expired', array($this, 'auth_cookie_expired'));
add_action('init', array($this, 'execute_hide_backend'), 1000);
add_action('login_init', array($this, 'execute_hide_backend_login'));
add_action('plugins_loaded', array($this, 'plugins_loaded'), 11);
add_filter('body_class', array($this, 'remove_admin_bar'));
add_filter('loginout', array($this, 'filter_loginout'));
add_filter('wp_redirect', array($this, 'filter_login_url'), 10, 2);
add_filter('lostpassword_url', array($this, 'filter_login_url'), 10, 2);
add_filter('site_url', array($this, 'filter_login_url'), 10, 2);
add_filter('retrieve_password_message', array($this, 'retrieve_password_message'));
add_filter('comment_moderation_text', array($this, 'comment_moderation_text'));
remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
}
}
}
开发者ID:Garth619,项目名称:DMA-Franconnect-Local,代码行数:29,代码来源:class-itsec-hide-backend.php
示例12: load_plugin_settings
function load_plugin_settings()
{
$this->context_options = get_option($this->options_name);
if (!is_array($this->context_options) || empty($this->context_options)) {
$this->context_options = array();
}
}
开发者ID:jaiweb,项目名称:ASP,代码行数:7,代码来源:widget-context.php
示例13: export
/**
* Export data
* @param string $format
* @param array $options
* @throws Exception
*/
public function export($format = self::EXPORT_DISPLAY, $options = array())
{
global $wpdb;
$options = array();
$options['upload_dir'] = wp_upload_dir();
$options['options'] = array();
$options['options']['permalink_structure'] = get_option('permalink_structure');
$widgets = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE 'widget_%'");
foreach ($widgets as $widget) {
$options['options'][$widget->option_name] = $this->compress(get_option($widget->option_name));
}
$options['options']['sidebars_widgets'] = $this->compress(get_option('sidebars_widgets'));
$current_template = get_option('stylesheet');
$options['options']["theme_mods_{$current_template}"] = $this->compress(get_option("theme_mods_{$current_template}"));
$data = serialize($options);
if ($format == self::EXPORT_DISPLAY) {
echo '<textarea>' . $data . '</textarea>';
}
//export settings to file
if ($format == self::EXPORT_FILE) {
$path = isset($options['path']) ? $options['path'] : self::getWpOptionsPath();
if (!file_put_contents($path, $data)) {
throw new Exception("Cannot save settings to: " . $path);
}
}
}
开发者ID:clevervaughn,项目名称:dottiesbiscuitbarn,代码行数:32,代码来源:ctDemoExporterImporter.class.php
示例14: stachestack_title
/**
* Page titles
*/
function stachestack_title()
{
if (is_home()) {
if (get_option('page_for_posts', true)) {
$title = get_the_title(get_option('page_for_posts', true));
} else {
$title = __('Latest Posts', 'stachestack');
}
} elseif (is_archive()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if ($term) {
$title = apply_filters('single_term_title', $term->name);
} elseif (is_post_type_archive()) {
$title = apply_filters('the_title', get_queried_object()->labels->name);
} elseif (is_day()) {
$title = sprintf(__('Daily Archives: %s', 'stachestack'), get_the_date());
} elseif (is_month()) {
$title = sprintf(__('Monthly Archives: %s', 'stachestack'), get_the_date('F Y'));
} elseif (is_year()) {
$title = sprintf(__('Yearly Archives: %s', 'stachestack'), get_the_date('Y'));
} elseif (is_author()) {
$title = sprintf(__('Author Archives: %s', 'stachestack'), get_queried_object()->display_name);
} else {
$title = single_cat_title('', false);
}
} elseif (is_search()) {
$title = sprintf(__('Search Results for %s', 'stachestack'), get_search_query());
} elseif (is_404()) {
$title = __('Not Found', 'stachestack');
} else {
$title = get_the_title();
}
return apply_filters('stachestack_title', $title);
}
开发者ID:BeardandFedora,项目名称:StacheStack,代码行数:37,代码来源:titles.php
示例15: widget
/**
* Outputs the HTML for this widget.
*
* @param array An array of standard parameters for widgets in this theme
* @param array An array of settings for this widget instance
* @return void Echoes it's output
**/
public function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$count = esc_attr($instance['count']);
$count = 0 < $count && $count < 10 ? $count : 2;
$loop = new WP_Query(array('post_type' => 'event', 'posts_per_page' => $count, 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => '_event_start', 'meta_query' => array(array('key' => '_event_end', 'value' => time(), 'compare' => '>'))));
if ($loop->have_posts()) {
echo $before_widget;
if ($instance['title']) {
echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
}
echo '<ul>';
while ($loop->have_posts()) {
$loop->the_post();
global $post;
$output = '<span class="meta">' . date(get_option('date_format'), get_post_meta(get_the_ID(), '_event_start', true)) . '</span> <a href="' . get_permalink() . '">' . get_the_title() . '</a>';
$read_more = apply_filters('em4wp_events_manager_upcoming_widget_output', $output, $post);
if ($read_more) {
echo '<li>' . $read_more . '</li>';
}
}
if ($instance['more_text']) {
echo '<li><a href="' . get_post_type_archive_link('event') . '">' . esc_attr($instance['more_text']) . '</a></li>';
}
echo '</ul>';
echo $after_widget;
}
wp_reset_postdata();
}
开发者ID:forsitemedia,项目名称:events-manager-for-wp,代码行数:36,代码来源:class-em4wp-upcoming-events.php
示例16: porto_page_title
function porto_page_title()
{
global $porto_settings;
$output = '';
if (!is_front_page()) {
} elseif (is_home()) {
$output .= $porto_settings['blog-title'];
}
if (is_singular()) {
$output .= porto_page_title_leaf();
} else {
if (is_post_type_archive()) {
if (is_search()) {
$output .= porto_page_title_leaf('search');
} else {
$output .= porto_page_title_archive();
}
} elseif (is_tax() || is_tag() || is_category()) {
$html = porto_page_title_leaf('term');
if (is_tag()) {
$output .= sprintf(__('Tag - %s', 'porto'), $html);
} elseif (is_tax('product_tag')) {
$output .= sprintf(__('Product Tag - %s', 'porto'), $html);
} else {
$output .= $html;
}
} elseif (is_date()) {
if (is_year()) {
$output .= porto_page_title_leaf('year');
} elseif (is_month()) {
$output .= porto_page_title_leaf('month');
} elseif (is_day()) {
$output .= porto_page_title_leaf('day');
}
} elseif (is_author()) {
$output .= porto_page_title_leaf('author');
} elseif (is_search()) {
$output .= porto_page_title_leaf('search');
} elseif (is_404()) {
$output .= porto_page_title_leaf('404');
} elseif (class_exists('bbPress') && is_bbpress()) {
if (bbp_is_search()) {
$output .= porto_page_title_leaf('bbpress_search');
} elseif (bbp_is_single_user()) {
$output .= porto_page_title_leaf('bbpress_user');
} else {
$output .= porto_page_title_leaf();
}
} else {
if (is_home() && !is_front_page()) {
if (get_option('show_on_front') == 'page') {
$output .= get_the_title(get_option('page_for_posts', true));
} else {
$output .= $porto_settings['blog-title'];
}
}
}
}
return apply_filters('porto_page_title', $output);
}
开发者ID:booklein,项目名称:wpbookle,代码行数:60,代码来源:page-title.php
示例17: ping_search_system
function ping_search_system()
{
global $site_link;
$url = '';
$last_ping = get_option('last_ping_search_system') != false ? get_option('last_ping_search_system') : 0;
$limit_time = time() - $last_ping > 3600;
//limit time 3600 sm - 1 hour;
if (count($_POST) > 1 && $limit_time) {
foreach ($_POST as $key) {
switch ($key) {
case 'google_ping':
$url = '//google.com/webmasters/sitemaps/ping?sitemap=';
break;
case 'yandex_ping':
$url = '//webmaster.yandex.ru/wmconsole/sitemap_list.xml?host=';
break;
case 'yahoo_ping':
$url = '//search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=';
break;
case 'bing_ping':
$url = '//www.bing.com/webmaster/ping.aspx?siteMap=';
break;
case 'ask_ping':
$url = '//submissions.ask.com/ping?sitemap=';
break;
}
if (@get_headers($url)) {
wp_remote_get($url . $site_link . "sitemap.xml");
}
}
update_option('last_ping_search_system', time());
}
}
开发者ID:hoangluanlee,项目名称:dlbh,代码行数:33,代码来源:sitemap-generator.php
示例18: spacious_scripts_styles_method
/**
* Register jquery scripts
*/
function spacious_scripts_styles_method()
{
/**
* Loads our main stylesheet.
*/
wp_enqueue_style('spacious_style', get_stylesheet_uri());
if (of_get_option('spacious_color_skin', 'light') == 'dark') {
wp_enqueue_style('spacious_dark_style', SPACIOUS_CSS_URL . '/dark.css');
}
/**
* Adds JavaScript to pages with the comment form to support
* sites with threaded comments (when in use).
*/
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
/**
* Register JQuery cycle js file for slider.
*/
wp_register_script('jquery_cycle', SPACIOUS_JS_URL . '/jquery.cycle.all.min.js', array('jquery'), '2.9999.5', true);
// wp_register_style( 'google_fonts', 'http://fonts.googleapis.com/css?family=Lato' );
/**
* Enqueue Slider setup js file.
*/
if (is_home() || is_front_page() && of_get_option('spacious_activate_slider', '0') == '1') {
wp_enqueue_script('spacious_slider', SPACIOUS_JS_URL . '/spacious-slider-setting.js', array('jquery_cycle'), false, true);
}
wp_enqueue_script('spacious-navigation', SPACIOUS_JS_URL . '/navigation.js', array('jquery'), false, true);
wp_enqueue_script('spacious-custom', SPACIOUS_JS_URL . '/spacious-custom.js', array('jquery'));
wp_enqueue_style('google_fonts');
$spacious_user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (preg_match('/(?i)msie [1-8]/', $spacious_user_agent)) {
wp_enqueue_script('html5', SPACIOUS_JS_URL . '/html5.js', true);
}
}
开发者ID:achrafse,项目名称:CitizenWatt-WordPress-theme,代码行数:38,代码来源:functions.php
示例19: fast_scripts
/**
* Enqueue scripts and styles for the theme.
*/
function fast_scripts()
{
//LOAD style.css via filesystem. Uses Sass to ompile '/assets/scss/style.scss' to: 'styl.css'
wp_enqueue_style('fast-sass', get_stylesheet_uri(), array(), '1.0.0');
//LOAD jQuery.min.js via CDN JS
wp_enqueue_script('fast-jquery', 'https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js', array(), '1.0.0', true);
//LOAD Boostrap.min.js via CDN JS
wp_enqueue_script('fast-bootstrap', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js', array(), '1.0.0', true);
//LOAD navigation.js via filesystem
wp_enqueue_script('fast-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), '1.0.0', true);
//LOAD fast-skip-link-focus.js via filesystem
//wp_enqueue_script( 'fast-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '1.0.0', true );
//LOAD instantclick.js via CDN JS
wp_enqueue_script('fast-instantclick', 'https://cdnjs.cloudflare.com/ajax/libs/instantclick/3.0.1/instantclick.min.js', array(), '1.0.0', true);
//CALL instant click into end of footer scripts, for init
function call_instant_click()
{
echo '<script data-no-instant>InstantClick.init();</script>';
}
add_action('wp_footer', 'call_instant_click', 200);
//load at end
//IF IS singlular & comments are enabled, load comment-reply.js via filesystem
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
开发者ID:brianotoole,项目名称:landing-page-skewed-containers,代码行数:29,代码来源:functions.php
示例20: _get_phpdoc_data
/**
* Generate the data from the PHPDoc markup.
*
* @param string $path Directory or file to scan for PHPDoc
* @param string $format What format the data is returned in: [json|array].
*
* @return string|array
*/
protected function _get_phpdoc_data($path, $format = 'json')
{
$output_cache_file = dirname(__DIR__) . '/cache-phpdoc.json';
/**
* Force delete last cache of phpdoc
* Compare directory and WordPress Version for detecting
*/
$delete_output_cache_file = false;
$wp_parser_root_import_dir = get_option('wp_parser_root_import_dir', '');
$directory_to_compare = wp_normalize_path(__DIR__);
if (false !== strpos($wp_parser_root_import_dir, $directory_to_compare)) {
$current_wp_version = get_bloginfo('version');
$wp_parser_imported_wp_version = get_option('wp_parser_imported_wp_version', $current_wp_version);
$delete_output_cache_file = $wp_parser_imported_wp_version != $current_wp_version;
}
/**
* Delete last cache of phpdoc, true for deleting or false to skip
*
* Default: false or compare wordpress version see above
*/
$delete_output_cache_file = apply_filters('sublime_delete_phpdoc_output_cache', $delete_output_cache_file);
if ($delete_output_cache_file) {
if (false !== stream_resolve_include_path($output_cache_file)) {
unlink($output_cache_file);
}
}
if (false !== stream_resolve_include_path($output_cache_file)) {
if ($output = file_get_contents($output_cache_file)) {
$output = 'json' == $format ? $output : json_decode($output, true);
}
} else {
WP_CLI::line(sprintf('Extracting PHPDoc from %s. This may take a few minutes...', $path));
$is_file = is_file($path);
$files = $is_file ? array($path) : Importer::set_parser_phpdoc($path);
$path = $is_file ? dirname($path) : $path;
if ($files instanceof WP_Error) {
WP_CLI::error(sprintf('Problem with %1$s: %2$s', $path, $files->get_error_message()));
exit;
}
$output = Importer::get_parser_phpdoc($files, $path);
/**
* Generate cache file from phpdoc, true for generate or false to skip
*
* Default: true
*/
if (apply_filters('sublime_create_phpdoc_output_cache', true)) {
file_put_contents($output_cache_file, json_encode($output, JSON_PRETTY_PRINT));
}
if ('json' == $format) {
$output = json_encode($output, JSON_PRETTY_PRINT);
}
}
if ($helper_directory = realpath(dirname(__DIR__) . '/missing')) {
$helpers = glob($helper_directory . '/*.php');
if (is_array($helpers)) {
$output = array_merge($output, Importer::get_parser_phpdoc($helpers, $helper_directory));
}
}
return $output;
}
开发者ID:23r9i0,项目名称:sublime,代码行数:68,代码来源:class-command.php
注:本文中的get_option函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论