• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP jetpack_is_mobile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中jetpack_is_mobile函数的典型用法代码示例。如果您正苦于以下问题:PHP jetpack_is_mobile函数的具体用法?PHP jetpack_is_mobile怎么用?PHP jetpack_is_mobile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了jetpack_is_mobile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: landscape_has_footer_widgets

 function landscape_has_footer_widgets()
 {
     if (jetpack_is_mobile('', true) && is_active_sidebar('sidebar-1')) {
         return true;
     }
     return false;
 }
开发者ID:pradeep-web,项目名称:brandt,代码行数:7,代码来源:jetpack.php


示例2: twentyfourteen_has_footer_widgets

 function twentyfourteen_has_footer_widgets($has_widgets)
 {
     if (Jetpack_User_Agent_Info::is_ipad() && is_active_sidebar('sidebar-1') || jetpack_is_mobile('', true) && (is_active_sidebar('sidebar-1') || is_active_sidebar('sidebar-2')) || is_active_sidebar('sidebar-3')) {
         return true;
     }
     return $has_widgets;
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:7,代码来源:twentyfourteen.php


示例3: penscratch_has_footer_widgets

 function penscratch_has_footer_widgets()
 {
     if (has_nav_menu('social') || jetpack_is_mobile('', true) && is_active_sidebar('sidebar-1')) {
         return true;
     }
     return false;
 }
开发者ID:hlgrogan,项目名称:Sphinx-Site,代码行数:7,代码来源:jetpack.php


示例4: panel_has_footer_widgets

 function panel_has_footer_widgets()
 {
     if (is_active_sidebar('footer-sidebar-1') || is_active_sidebar('footer-sidebar-2') || is_active_sidebar('footer-sidebar-3') || is_active_sidebar('sidebar-1') && jetpack_is_mobile('', true)) {
         return true;
     }
     return false;
 }
开发者ID:jun200,项目名称:wordpress,代码行数:7,代码来源:jetpack.php


示例5: oriental_infinite_scroll_has_footer_widgets

 function oriental_infinite_scroll_has_footer_widgets()
 {
     if (function_exists('jetpack_is_mobile') && jetpack_is_mobile('', true) && is_active_sidebar('sidebar-1')) {
         return true;
     }
     return false;
 }
开发者ID:AtomPy,项目名称:AtomPySite,代码行数:7,代码来源:functions.php


示例6: tinyframework_has_footer_widgets

/**
 * Check whether or not footer widgets are present. If they are present, then a button to
 * 'Load more posts' will be displayed and Infinite Scroll will not be triggered unless a user manually clicks on that button.
 *
 * @param bool $has_widgets
 * @uses Jetpack_User_Agent_Info::is_ipad, jetpack_is_mobile, is_active_sidebar
 * @filter infinite_scroll_has_footer_widgets
 * @return bool
 */
function tinyframework_has_footer_widgets($has_widgets)
{
    if ((Jetpack_User_Agent_Info::is_ipad() || function_exists('jetpack_is_mobile') && jetpack_is_mobile()) && is_active_sidebar('sidebar-1')) {
        $has_widgets = true;
    }
    return $has_widgets;
}
开发者ID:guillermohernandez,项目名称:OYFF-Wordpress-Theme,代码行数:16,代码来源:plugin-compatibility.php


示例7: jetpack_check_mobile

function jetpack_check_mobile()
{
    if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST || defined('APP_REQUEST') && APP_REQUEST) {
        return false;
    }
    if (!isset($_SERVER["HTTP_USER_AGENT"]) || isset($_COOKIE['akm_mobile']) && $_COOKIE['akm_mobile'] == 'false') {
        return false;
    }
    if (jetpack_mobile_exclude()) {
        return false;
    }
    if (1 == get_option('wp_mobile_disable')) {
        return false;
    }
    if (isset($_COOKIE['akm_mobile']) && $_COOKIE['akm_mobile'] == 'true') {
        return true;
    }
    $is_mobile = jetpack_is_mobile();
    /**
     * Filter the Mobile check results.
     *
     * @module minileven
     *
     * @since 1.8.0
     *
     * @param bool $is_mobile Is the reader on a mobile device.
     */
    return apply_filters('jetpack_check_mobile', $is_mobile);
}
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:29,代码来源:minileven.php


示例8: harmonic_infinite_scroll_has_footer_widgets

 function harmonic_infinite_scroll_has_footer_widgets()
 {
     if (jetpack_is_mobile('', true) && is_active_sidebar('sidebar-1')) {
         return true;
     }
     return false;
 }
开发者ID:Matwilk,项目名称:wordpress,代码行数:7,代码来源:jetpack.php


示例9: sorbet_infinite_scroll_footer_widgets

function sorbet_infinite_scroll_footer_widgets()
{
    if (has_nav_menu('secondary') || jetpack_is_mobile() && is_active_sidebar('sidebar-1')) {
        return true;
    }
    return false;
}
开发者ID:kanoka42,项目名称:kanoka42.github.io,代码行数:7,代码来源:jetpack.php


示例10: infinite_scroll_has_footer_widgets

 function infinite_scroll_has_footer_widgets()
 {
     if (jetpack_is_mobile('', true) && is_active_sidebar('primary-sidebar')) {
         return true;
     }
     return false;
 }
开发者ID:birdy10,项目名称:projetWordpress,代码行数:7,代码来源:functions.php


示例11: encounters_lite_has_footer_widgets

/**
 * Check whether or not footer widgets are present. If they are present, then a button to
 * 'Load more posts' will be displayed and IS will not be triggered unless a user manually clicks on that button.
 *
 * @param bool $has_widgets
 * @uses Jetpack_User_Agent_Info::is_ipad, jetpack_is_mobile, is_active_sidebar
 * @filter infinite_scroll_has_footer_widgets
 * @return bool
 */
function encounters_lite_has_footer_widgets($has_widgets)
{
    if ((Jetpack_User_Agent_Info::is_ipad() || function_exists('jetpack_is_mobile') && jetpack_is_mobile()) && is_active_sidebar('bottom1')) {
        $has_widgets = true;
    }
    return $has_widgets;
}
开发者ID:double360,项目名称:wordpress,代码行数:16,代码来源:jetpack.php


示例12: wpcom_vip_disable_lazyload_on_mobile

function wpcom_vip_disable_lazyload_on_mobile($enabled)
{
    if (function_exists('jetpack_is_mobile') && jetpack_is_mobile()) {
        $enabled = false;
    }
    if (class_exists('Jetpack_User_Agent_Info') && Jetpack_User_Agent_Info::is_ipad()) {
        $enabled = false;
    }
    return $enabled;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:10,代码来源:wpcom-helper.php


示例13: init

 static function init()
 {
     add_action('switch_theme', array(__CLASS__, 'reset'));
     add_action('wp_restore_post_revision', array(__CLASS__, 'restore_revision'), 10, 2);
     // Save revisions for posts of type safecss.
     add_filter('revision_redirect', array(__CLASS__, 'revision_redirect'));
     // Override the edit link, the default link causes a redirect loop
     add_filter('get_edit_post_link', array(__CLASS__, 'revision_post_link'), 10, 3);
     // Overwrite the content width global variable if one is set in the custom css
     add_action('template_redirect', array(__CLASS__, 'set_content_width'));
     add_action('admin_init', array(__CLASS__, 'set_content_width'));
     if (!is_admin()) {
         add_filter('stylesheet_uri', array(__CLASS__, 'style_filter'));
     }
     define('SAFECSS_USE_ACE', !jetpack_is_mobile() && !Jetpack_User_Agent_Info::is_ipad() && apply_filters('safecss_use_ace', true));
     // Register safecss as a custom post_type
     // Explicit capability definitions are largely unnecessary because the posts are manipulated in code via an options page, managing CSS revisions does check the capabilities, so let's ensure that the proper caps are checked.
     register_post_type('safecss', array('supports' => array('revisions'), 'label' => 'Custom CSS', 'can_export' => false, 'rewrite' => false, 'capabilities' => array('edit_post' => 'edit_theme_options', 'read_post' => 'read', 'delete_post' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'read_private_posts' => 'read')));
     // Short-circuit WP if this is a CSS stylesheet request
     if (isset($_GET['custom-css'])) {
         header('Content-Type: text/css', true, 200);
         header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT');
         // 1 year
         Jetpack_Custom_CSS::print_css();
         exit;
     }
     add_action('admin_enqueue_scripts', array('Jetpack_Custom_CSS', 'enqueue_scripts'));
     if (isset($_GET['page']) && 'editcss' == $_GET['page'] && is_admin()) {
         // Do migration routine if necessary
         Jetpack_Custom_CSS::upgrade();
         do_action('safecss_migrate_post');
     }
     add_action('wp_head', array('Jetpack_Custom_CSS', 'link_tag'), 101);
     add_filter('jetpack_content_width', array('Jetpack_Custom_CSS', 'jetpack_content_width'));
     add_filter('editor_max_image_size', array('Jetpack_Custom_CSS', 'editor_max_image_size'), 10, 3);
     if (!current_user_can('switch_themes') && !is_super_admin()) {
         return;
     }
     add_action('admin_menu', array('Jetpack_Custom_CSS', 'menu'));
     if (isset($_POST['safecss']) && false == strstr($_SERVER['REQUEST_URI'], 'options.php')) {
         check_admin_referer('safecss');
         $save_result = self::save(array('css' => stripslashes($_POST['safecss']), 'is_preview' => isset($_POST['action']) && $_POST['action'] == 'preview', 'preprocessor' => isset($_POST['custom_css_preprocessor']) ? $_POST['custom_css_preprocessor'] : '', 'add_to_existing' => isset($_POST['add_to_existing']) ? $_POST['add_to_existing'] == 'true' : true, 'content_width' => isset($_POST['custom_content_width']) ? $_POST['custom_content_width'] : false));
         if ($_POST['action'] == 'preview') {
             wp_safe_redirect(add_query_arg('csspreview', 'true', get_option('home')));
             exit;
         }
         if ($save_result) {
             add_action('admin_notices', array('Jetpack_Custom_CSS', 'saved_message'));
         }
     }
     // Modify all internal links so that preview state persists
     if (Jetpack_Custom_CSS::is_preview()) {
         ob_start(array('Jetpack_Custom_CSS', 'buffer'));
     }
 }
开发者ID:lokenxo,项目名称:familygenerator,代码行数:55,代码来源:custom-css.php


示例14: twenty_twelve_has_footer_widgets

/**
 * Handle `footer_widgets` argument for mobile devices
 *
 * @param bool $has_widgets
 * @uses jetpack_is_mobile, is_front_page, is_active_sidebar
 * @filter infinite_scroll_has_footer_widgets
 * @return bool
 */
function twenty_twelve_has_footer_widgets($has_widgets)
{
    if (function_exists('jetpack_is_mobile') && jetpack_is_mobile()) {
        if (is_front_page() && (is_active_sidebar('sidebar-2') || is_active_sidebar('sidebar-3'))) {
            $has_widgets = true;
        } elseif (is_active_sidebar('sidebar-1')) {
            $has_widgets = true;
        }
    }
    return $has_widgets;
}
开发者ID:jfbelisle,项目名称:magexpress,代码行数:19,代码来源:twentytwelve.php


示例15: twenty_eleven_has_footer_widgets

/**
 * Have we any footer widgets?
 *
 * @param bool $has_widgets
 * @uses is_active_sidebar
 * @uses jetpack_is_mobile
 * @filter infinite_scroll_has_footer_widgets
 * @return bool
 */
function twenty_eleven_has_footer_widgets($has_widgets)
{
    // Are any of the "Footer Area" sidebars active?
    if (is_active_sidebar('sidebar-3') || is_active_sidebar('sidebar-4') || is_active_sidebar('sidebar-5')) {
        return true;
    }
    // If we're on mobile and the Main Sidebar has widgets, it falls below the content, so we have footer widgets.
    if (function_exists('jetpack_is_mobile') && jetpack_is_mobile() && is_active_sidebar('sidebar-1')) {
        return true;
    }
    return $has_widgets;
}
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:21,代码来源:twentyeleven.php


示例16: __construct

 function __construct()
 {
     self::$instance = $this;
     add_action('wp_loaded', array($this, 'wp_loaded'));
     add_action('admin_init', array($this, 'add_providers'));
     //slim//add_action( 'jetpack_admin_menu', array( $this, 'jetpack_admin_menu' ) );
     add_action('admin_menu', array($this, 'admin_menu'), 20);
     if (!jetpack_is_mobile()) {
         add_action('admin_bar_menu', array($this, 'admin_bar_search'), 4);
     }
     add_filter('omnisearch_num_results', array($this, 'omnisearch_num_results'));
 }
开发者ID:estrategasdigitales,项目名称:flazam,代码行数:12,代码来源:omnisearch-core.php


示例17: add_image_placeholders

 public static function add_image_placeholders($content)
 {
     // Don't load for feeds, previews, attachment pages, non-mobile views
     if (is_preview() || is_feed() || is_attachment() || function_exists('jetpack_is_mobile') && !jetpack_is_mobile()) {
         return $content;
     }
     // In case you want to change the placeholder image
     $placeholder_image = apply_filters('responsive_images_placeholder_image', self::get_url('images/1x1.trans.gif'));
     preg_match_all('#<img[^>]+?[\\/]?>#', $content, $images, PREG_SET_ORDER);
     if (empty($images)) {
         return $content;
     }
     foreach ($images as $image) {
         $attributes = wp_kses_hair($image[0], array('http', 'https'));
         $new_image = '<img';
         $new_image_src = '';
         foreach ($attributes as $attribute) {
             $name = $attribute['name'];
             $value = $attribute['value'];
             // Remove the width and height attributes
             if (in_array($name, array('width', 'height'))) {
                 continue;
             }
             // Move the src to a data attribute and replace with a placeholder
             if ('src' == $name) {
                 $new_image_src = html_entity_decode(urldecode($value));
                 parse_str(parse_url($new_image_src, PHP_URL_QUERY), $image_args);
                 $new_image_src = remove_query_arg('h', $new_image_src);
                 $new_image_src = remove_query_arg('w', $new_image_src);
                 $new_image .= sprintf(' data-full-src="%s"', esc_url($new_image_src));
                 if (isset($image_args['w'])) {
                     $new_image .= sprintf(' data-full-width="%s"', esc_attr($image_args['w']));
                 }
                 if (isset($image_args['h'])) {
                     $new_image .= sprintf(' data-full-height="%s"', esc_attr($image_args['h']));
                 }
                 // replace actual src with our placeholder
                 $value = $placeholder_image;
             }
             $new_image .= sprintf(' %s="%s"', $name, esc_attr($value));
         }
         $new_image .= '/>';
         $new_image .= sprintf('<noscript><img src="%s" /></noscript>', $new_image_src);
         // compat for no-js and better crawling
         $content = str_replace($image[0], $new_image, $content);
     }
     return $content;
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:48,代码来源:responsive-images.php


示例18: wp_super_cache_jetpack_cookie_check

function wp_super_cache_jetpack_cookie_check($cache_key)
{
    if (file_exists(dirname(WPCACHEHOME) . '/jetpack/class.jetpack-user-agent.php')) {
        if (function_exists("jetpack_is_mobile") == false) {
            include dirname(WPCACHEHOME) . '/jetpack/class.jetpack-user-agent.php';
        }
        if (jetpack_is_mobile()) {
            return 'mobile';
        } else {
            return 'normal';
        }
    } else {
        wp_cache_debug("wp_super_cache_jetpack_cookie_check: jetpack UA file not found.");
        return "normal";
    }
}
开发者ID:crazyyy,项目名称:smartmagel,代码行数:16,代码来源:jetpack.php


示例19: widont

 /**
  * Eliminates widows in strings by replace the breaking space that appears before the last word with a non-breaking space.
  *
  * This function is defined on WordPress.com and can be a common source of frustration for VIP devs.
  * Now they can be frustrated in their local environments as well :)
  *
  * @param string $str Optional. String to operate on.
  * @return string
  * @link http://www.shauninman.com/post/heap/2006/08/22/widont_wordpress_plugin Typesetting widows
  */
 function widont($str = '')
 {
     // Don't apply on non-tablet mobile devices so the browsers can fit to the viewport properly.
     if (function_exists('jetpack_is_mobile') && jetpack_is_mobile() && class_exists('Jetpack_User_Agent_Info') && !Jetpack_User_Agent_Info::is_tablet()) {
         return $str;
     }
     // We're dealing with whitespace from here out, let's not have any false positives. :)
     $str = trim($str);
     // If string contains three or fewer words, don't join.
     if (count(preg_split('#\\s+#', $str)) <= 3) {
         return $str;
     }
     // Don't join if words exceed a certain length: minimum 10 characters, default 15 characters, filterable via `widont_max_word_length`.
     $widont_max_word_length = max(10, absint(apply_filters('widont_max_word_length', 15)));
     $regex = '#\\s+([^\\s]{1,' . $widont_max_word_length . '})\\s+([^\\s]{1,' . $widont_max_word_length . '})$#';
     return preg_replace($regex, ' $1&nbsp;$2', $str);
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:27,代码来源:wpcom-functions.php


示例20: jetpack_check_mobile

function jetpack_check_mobile()
{
    if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST || defined('APP_REQUEST') && APP_REQUEST) {
        return false;
    }
    if (!isset($_SERVER["HTTP_USER_AGENT"]) || isset($_COOKIE['akm_mobile']) && $_COOKIE['akm_mobile'] == 'false') {
        return false;
    }
    if (jetpack_mobile_exclude()) {
        return false;
    }
    if (1 == get_option('wp_mobile_disable')) {
        return false;
    }
    if (isset($_COOKIE['akm_mobile']) && $_COOKIE['akm_mobile'] == 'true') {
        return true;
    }
    $is_mobile = jetpack_is_mobile();
    return apply_filters('jetpack_check_mobile', $is_mobile);
}
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:20,代码来源:minileven.php



注:本文中的jetpack_is_mobile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP jetpack_og_get_image函数代码示例发布时间:2022-05-15
下一篇:
PHP jetpack_has_site_logo函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap