本文整理汇总了PHP中Jetpack::is_development_version方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack::is_development_version方法的具体用法?PHP Jetpack::is_development_version怎么用?PHP Jetpack::is_development_version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jetpack
的用法示例。
在下文中一共展示了Jetpack::is_development_version方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: twentyfifteen_init_jetpack
function twentyfifteen_init_jetpack()
{
/**
* Add our compat CSS file for custom widget stylings and such.
* Set the version equal to filemtime for development builds, and the JETPACK__VERSION for production.
*/
$version = Jetpack::is_development_version() ? filemtime(plugin_dir_path(__FILE__) . 'twentyfifteen.css') : JETPACK__VERSION;
wp_enqueue_style('twentyfifteen-jetpack', plugins_url('twentyfifteen.css', __FILE__), array(), $version);
wp_style_add_data('twentyfifteen-jetpack', 'rtl', 'replace');
}
示例2: twentysixteen_init_jetpack
function twentysixteen_init_jetpack()
{
/**
* Add our compat CSS file for custom widget stylings and such.
* Set the version equal to filemtime for development builds, and the JETPACK__VERSION for production
* or skip it entirely for wpcom.
*/
$version = false;
if (method_exists('Jetpack', 'is_development_version')) {
$version = Jetpack::is_development_version() ? filemtime(plugin_dir_path(__FILE__) . 'twentysixteen.css') : JETPACK__VERSION;
}
wp_enqueue_style('twentysixteen-jetpack', plugins_url('twentysixteen.css', __FILE__), array(), $version);
wp_style_add_data('twentysixteen-jetpack', 'rtl', 'replace');
}
示例3: implode_frontend_css
/**
* This methods removes all of the registered css files on the frontend
* from Jetpack in favor of using a single file. In effect "imploding"
* all the files into one file.
*
* Pros:
* - Uses only ONE css asset connection instead of 15
* - Saves a minimum of 56k
* - Reduces server load
* - Reduces time to first painted byte
*
* Cons:
* - Loads css for ALL modules. However all selectors are prefixed so it
* should not cause any issues with themes.
* - Plugins/themes dequeuing styles no longer do anything. See
* jetpack_implode_frontend_css filter for a workaround
*
* For some situations developers may wish to disable css imploding and
* instead operate in legacy mode where each file loads seperately and
* can be edited individually or dequeued. This can be accomplished with
* the following line:
*
* add_filter( 'jetpack_implode_frontend_css', '__return_false' );
*
* @since 3.2
**/
public function implode_frontend_css($travis_test = false)
{
$do_implode = true;
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
$do_implode = false;
}
/**
* Allow CSS to be concatenated into a single jetpack.css file.
*
* @since 3.2.0
*
* @param bool $do_implode Should CSS be concatenated? Default to true.
*/
$do_implode = apply_filters('jetpack_implode_frontend_css', $do_implode);
// Do not use the imploded file when default behaviour was altered through the filter
if (!$do_implode) {
return;
}
// We do not want to use the imploded file in dev mode, or if not connected
if (Jetpack::is_development_mode() || !self::is_active()) {
if (!$travis_test) {
return;
}
}
// Do not use the imploded file if sharing css was dequeued via the sharing settings screen
if (get_option('sharedaddy_disable_resources')) {
return;
}
/*
* Now we assume Jetpack is connected and able to serve the single
* file.
*
* In the future there will be a check here to serve the file locally
* or potentially from the Jetpack CDN
*
* For now:
* - Enqueue a single imploded css file
* - Zero out the style_loader_tag for the bundled ones
* - Be happy, drink scotch
*/
add_filter('style_loader_tag', array($this, 'concat_remove_style_loader_tag'), 10, 2);
$version = Jetpack::is_development_version() ? filemtime(JETPACK__PLUGIN_DIR . 'css/jetpack.css') : JETPACK__VERSION;
wp_enqueue_style('jetpack_css', plugins_url('css/jetpack.css', __FILE__), array(), $version);
wp_style_add_data('jetpack_css', 'rtl', 'replace');
}
示例4: jetpack_debug_display_handler
//.........这里部分代码省略.........
?>
<hr />
<div id="connected-user-details">
<p><?php
printf(__('The primary connection is owned by <strong>%s</strong>\'s WordPress.com account.', 'jetpack'), esc_html(Jetpack::get_master_user_email()));
?>
</p>
</div>
<?php
}
?>
</div>
<div id="contact-message" <?php
if (!isset($_GET['contact'])) {
?>
style="display:none" <?php
}
?>
>
<?php
if (self::is_jetpack_support_open()) {
?>
<form id="contactme" method="post" action="https://jetpack.com/contact-support/">
<input type="hidden" name="action" value="submit">
<input type="hidden" name="jetpack" value="needs-service">
<input type="hidden" name="contact_form" id="contact_form" value="1">
<input type="hidden" name="blog_url" id="blog_url" value="<?php
echo esc_attr(site_url());
?>
">
<?php
$subject_line = sprintf(_x('from: %s Jetpack contact form', 'Support request email subject line', 'jetpack'), esc_attr(site_url()));
if (Jetpack::is_development_version()) {
$subject_line = 'BETA ' . $subject_line;
}
$subject_line_input = printf('<input type="hidden" name="subject" id="subject" value="%s"">', $subject_line);
?>
<div class="formbox">
<label for="message" class="h"><?php
esc_html_e('Please describe the problem you are having.', 'jetpack');
?>
</label>
<textarea name="message" cols="40" rows="7" id="did"></textarea>
</div>
<div id="name_div" class="formbox">
<label class="h" for="your_name"><?php
esc_html_e('Name', 'jetpack');
?>
</label>
<span class="errormsg"><?php
esc_html_e('Let us know your name.', 'jetpack');
?>
</span>
<input name="your_name" type="text" id="your_name" value="<?php
esc_html_e($current_user->display_name, 'jetpack');
?>
" size="40">
</div>
<div id="email_div" class="formbox">
<label class="h" for="your_email"><?php
esc_html_e('E-mail', 'jetpack');
?>
</label>
示例5: page_admin_scripts
function page_admin_scripts()
{
if ($this->is_redirecting) {
return;
// No need for scripts on a fallback page
}
$is_dev_mode = Jetpack::is_development_mode();
// Enqueue jp.js and localize it
wp_enqueue_script('react-plugin', plugins_url('_inc/build/admin.js', JETPACK__PLUGIN_FILE), array(), JETPACK__VERSION, true);
if (!$is_dev_mode) {
// Required for Analytics
wp_enqueue_script('jp-tracks', '//stats.wp.com/w.js', array(), gmdate('YW'), true);
}
$localeSlug = explode('_', get_locale());
$localeSlug = $localeSlug[0];
// Collecting roles that can view site stats
$stats_roles = array();
$enabled_roles = function_exists('stats_get_option') ? stats_get_option('roles') : array('administrator');
foreach (get_editable_roles() as $slug => $role) {
$stats_roles[$slug] = array('name' => translate_user_role($role['name']), 'canView' => is_array($enabled_roles) ? in_array($slug, $enabled_roles, true) : false);
}
$response = rest_do_request(new WP_REST_Request('GET', '/jetpack/v4/module/all'));
$modules = $response->get_data();
// Preparing translated fields for JSON encoding by transforming all HTML entities to
// respective characters.
foreach ($modules as $slug => $data) {
$modules[$slug]['name'] = html_entity_decode($data['name']);
$modules[$slug]['description'] = html_entity_decode($data['description']);
$modules[$slug]['short_description'] = html_entity_decode($data['short_description']);
$modules[$slug]['long_description'] = html_entity_decode($data['long_description']);
}
// Add objects to be passed to the initial state of the app
wp_localize_script('react-plugin', 'Initial_State', array('WP_API_root' => esc_url_raw(rest_url()), 'WP_API_nonce' => wp_create_nonce('wp_rest'), 'pluginBaseUrl' => plugins_url('', JETPACK__PLUGIN_FILE), 'connectionStatus' => array('isActive' => Jetpack::is_active(), 'isStaging' => Jetpack::is_staging_site(), 'devMode' => array('isActive' => $is_dev_mode, 'constant' => defined('JETPACK_DEV_DEBUG') && JETPACK_DEV_DEBUG, 'url' => site_url() && false === strpos(site_url(), '.'), 'filter' => apply_filters('jetpack_development_mode', false)), 'isPublic' => '1' == get_option('blog_public'), 'isInIdentityCrisis' => Jetpack::validate_sync_error_idc_option()), 'dismissedNotices' => $this->get_dismissed_jetpack_notices(), 'isDevVersion' => Jetpack::is_development_version(), 'currentVersion' => JETPACK__VERSION, 'happinessGravIds' => jetpack_get_happiness_gravatar_ids(), 'getModules' => $modules, 'showJumpstart' => jetpack_show_jumpstart(), 'rawUrl' => Jetpack::build_raw_urls(get_home_url()), 'adminUrl' => esc_url(admin_url()), 'stats' => array('data' => array('general' => false, 'day' => false, 'week' => false, 'month' => false), 'roles' => $stats_roles), 'settingNames' => array('jetpack_holiday_snow_enabled' => function_exists('jetpack_holiday_snow_option_name') ? jetpack_holiday_snow_option_name() : false), 'userData' => array('currentUser' => jetpack_current_user_data()), 'locale' => $this->get_i18n_data(), 'localeSlug' => $localeSlug, 'jetpackStateNotices' => array('messageCode' => Jetpack::state('message'), 'errorCode' => Jetpack::state('error'), 'errorDescription' => Jetpack::state('error_description')), 'tracksUserData' => Jetpack_Tracks_Client::get_connected_user_tracks_identity(), 'currentIp' => function_exists('jetpack_protect_get_ip') ? jetpack_protect_get_ip() : false));
}
示例6: allowed_redirect_hosts
/**
* Returns an array of hosts that SSO will redirect to.
*
* Instead of accessing JETPACK__API_BASE within the method directly, we set it as the
* default for $api_base due to restrictions with testing constants in our tests.
*
* @since 4.3.0
*
* @param array $hosts
* @param string $api_base
*
* @return array
*/
static function allowed_redirect_hosts($hosts, $api_base = JETPACK__API_BASE)
{
if (empty($hosts)) {
$hosts = array();
}
$hosts[] = 'wordpress.com';
$hosts[] = 'jetpack.wordpress.com';
if ((Jetpack::is_development_mode() || Jetpack::is_development_version()) && false === strpos($api_base, 'jetpack.wordpress.com/jetpack')) {
$base_url_parts = parse_url(esc_url_raw($api_base));
if ($base_url_parts && !empty($base_url_parts['host'])) {
$hosts[] = $base_url_parts['host'];
}
}
return array_unique($hosts);
}
示例7: elseif
?>
</a>
<?php
} elseif ($data['is_connected'] && !$data['is_user_connected'] && current_user_can('jetpack_connect_user')) {
?>
<a href="<?php
echo Jetpack::init()->build_connect_url();
?>
" class="download-jetpack"><?php
esc_html_e('Connect your account', 'jetpack');
?>
</a>
<?php
}
?>
</div>
</div>
<?php
}
?>
<div id="deactivate-success"></div>
<?php
if (Jetpack::is_development_version()) {
?>
<a id="jump-start-deactivate" style="cursor:pointer; display: block; text-align: center; margin-top: 25px;"><?php
esc_html_e('RESET EVERYTHING (during testing only) - will reset modules to default as well', 'jetpack');
?>
</a>
<?php
}
// is_development_version
示例8: test_is_dev_version_false_with_number_dot_number_dot_number
function test_is_dev_version_false_with_number_dot_number_dot_number()
{
Jetpack_Constants::set_constant('JETPACK__VERSION', '4.3.1');
$this->assertFalse(Jetpack::is_development_version());
}
示例9: page_admin_scripts
function page_admin_scripts()
{
// Enqueue jp.js and localize it
wp_enqueue_script('react-plugin', plugins_url('_inc/build/admin.js', JETPACK__PLUGIN_FILE), array(), time(), true);
wp_enqueue_style('dops-css', plugins_url('_inc/build/dops-style.css', JETPACK__PLUGIN_FILE), array(), time());
wp_enqueue_style('components-css', plugins_url('_inc/build/style.min.css', JETPACK__PLUGIN_FILE), array(), time());
$localeSlug = explode('_', get_locale());
$localeSlug = $localeSlug[0];
// Add objects to be passed to the initial state of the app
wp_localize_script('react-plugin', 'Initial_State', array('WP_API_root' => esc_url_raw(rest_url()), 'WP_API_nonce' => wp_create_nonce('wp_rest'), 'pluginBaseUrl' => plugins_url('', JETPACK__PLUGIN_FILE), 'connectionStatus' => array('isActive' => Jetpack::is_active(), 'isStaging' => Jetpack::is_staging_site(), 'devMode' => array('isActive' => Jetpack::is_development_mode(), 'constant' => defined('JETPACK_DEV_DEBUG') && JETPACK_DEV_DEBUG, 'url' => site_url() && false === strpos(site_url(), '.'), 'filter' => apply_filters('jetpack_development_mode', false))), 'dismissedNotices' => $this->get_dismissed_jetpack_notices(), 'isDevVersion' => Jetpack::is_development_version(), 'currentVersion' => JETPACK__VERSION, 'happinessGravIds' => jetpack_get_happiness_gravatar_ids(), 'getModules' => Jetpack_Core_Json_Api_Endpoints::get_modules(), 'showJumpstart' => jetpack_show_jumpstart(), 'rawUrl' => Jetpack::build_raw_urls(get_home_url()), 'adminUrl' => esc_url(admin_url()), 'statsData' => build_initial_stats_shape(), 'settingNames' => array('jetpack_holiday_snow_enabled' => function_exists('jetpack_holiday_snow_option_name') ? jetpack_holiday_snow_option_name() : false), 'userData' => array('othersLinked' => jetpack_get_other_linked_users(), 'currentUser' => jetpack_current_user_data()), 'locale' => $this->get_i18n_data(), 'localeSlug' => $localeSlug, 'jetpackStateNotices' => array('messageCode' => Jetpack::state('message'), 'errorCode' => Jetpack::state('error'), 'errorDescription' => Jetpack::state('error_description'))));
}
示例10: implode_frontend_css
/**
* This methods removes all of the registered css files on the frontend
* from Jetpack in favor of using a single file. In effect "imploding"
* all the files into one file.
*
* Pros:
* - Uses only ONE css asset connection instead of 15
* - Saves a minimum of 56k
* - Reduces server load
* - Reduces time to first painted byte
*
* Cons:
* - Loads css for ALL modules. However all selectors are prefixed so it
* should not cause any issues with themes.
* - Plugins/themes dequeuing styles no longer do anything. See
* jetpack_implode_frontend_css filter for a workaround
*
* For some situations developers may wish to disable css imploding and
* instead operate in legacy mode where each file loads seperately and
* can be edited individually or dequeued. This can be accomplished with
* the following line:
*
* add_filter( 'jetpack_implode_frontend_css', '__return_false' );
*
* @since 3.2
**/
public function implode_frontend_css()
{
global $wp_styles;
$do_implode = true;
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
$do_implode = false;
}
$do_implode = apply_filters('jetpack_implode_frontend_css', $do_implode);
// Do not use the imploded file when default behaviour was altered through the filter
if (!$do_implode) {
return;
}
// We do not want to use the imploded file in dev mode
if (Jetpack::is_development_mode()) {
return;
}
// Do not use the imploded file if sharing css was dequeued via the sharing settings screen
if (get_option('sharedaddy_disable_resources')) {
return;
}
/*
* Now we assume Jetpack is connected and able to serve the single
* file.
*
* In the future there will be a check here to serve the file locally
* or potentially from the Jetpack CDN
*
* For now:
* - Dequeue ALL of the frontend css files
* - Enqueue a single imploded css file
* - Be happy, drink scotch
*/
$to_dequeue = array('jetpack-carousel', 'grunion.css', 'the-neverending-homepage', 'jetpack_likes', 'jetpack_related-posts', 'sharedaddy', 'jetpack-slideshow', 'presentations', 'jetpack-subscriptions', 'tiled-gallery', 'widget-conditions', 'jetpack_display_posts_widget', 'gravatar-profile-widget', 'widget-grid-and-list', 'jetpack-widgets');
$wp_styles->remove($to_dequeue);
$version = Jetpack::is_development_version() ? filemtime(JETPACK__PLUGIN_DIR . 'css/jetpack.css') : JETPACK__VERSION;
wp_enqueue_style('jetpack_css', plugins_url('css/jetpack.css', __FILE__), array(), $version);
wp_style_add_data('jetpack_css', 'rtl', 'replace');
}