本文整理汇总了PHP中wp_is_mobile函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_is_mobile函数的具体用法?PHP wp_is_mobile怎么用?PHP wp_is_mobile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_is_mobile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpex_footer_reveal_enabled
function wpex_footer_reveal_enabled($post_id = '')
{
// Disable on mobile
if (wp_is_mobile()) {
return false;
}
// Disable on 404
if (is_404()) {
return false;
}
// Disable on boxed style
if ('boxed' == wpex_main_layout()) {
return false;
}
// Get post id
$post_id = $post_id ? $post_id : wpex_get_the_ID();
// Meta check
if ($post_id) {
if ('on' == get_post_meta($post_id, 'wpex_footer_reveal', true)) {
return true;
} elseif ('off' == get_post_meta($post_id, 'wpex_footer_reveal', true)) {
return false;
}
}
// Theme option check
if (get_theme_mod('footer_reveal', false)) {
return true;
}
}
开发者ID:sergey-h,项目名称:naman,代码行数:29,代码来源:footer-functions.php
示例2: vantage_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @since vantage 1.0
*/
function vantage_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author
if (is_multi_author()) {
$classes[] = 'group-blog';
}
if (siteorigin_setting('layout_responsive')) {
$classes[] = 'responsive';
}
$classes[] = 'layout-' . siteorigin_setting('layout_bound');
$classes[] = 'no-js';
$is_full_width_template = is_page_template('templates/template-full.php') || is_page_template('templates/template-full-notitle.php');
if (!$is_full_width_template) {
$wc_shop_sidebar = vantage_is_woocommerce_active() && is_shop() && is_active_sidebar('shop');
if (!is_active_sidebar('sidebar-1') && !$wc_shop_sidebar) {
$classes[] = 'no-sidebar';
} else {
$classes[] = 'has-sidebar';
}
}
if (wp_is_mobile()) {
$classes[] = 'so-vantage-mobile-device';
}
$mega_menu_active = function_exists('max_mega_menu_is_enabled') && max_mega_menu_is_enabled('primary');
if (siteorigin_setting('navigation_menu_search') && !$mega_menu_active) {
$classes[] = 'has-menu-search';
}
if (siteorigin_setting('layout_force_panels_full')) {
$classes[] = 'panels-style-force-full';
}
return $classes;
}
开发者ID:simplon-emmanuelD,项目名称:Simplon-INESS,代码行数:37,代码来源:extras.php
示例3: siteorigin_north_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function siteorigin_north_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author.
if (is_multi_author()) {
$classes[] = 'group-blog';
}
$classes[] = 'no-js';
$classes[] = 'css3-animations';
$classes[] = 'responsive';
if (is_page()) {
$classes[] = 'page-layout-' . SiteOrigin_Settings_Page_Settings::get('layout');
$classes[] = 'page-layout-menu-' . SiteOrigin_Settings_Page_Settings::get('menu');
if (!SiteOrigin_Settings_Page_Settings::get('masthead_margin')) {
$classes[] = 'page-layout-no-masthead-margin';
}
if (!SiteOrigin_Settings_Page_Settings::get('footer_margin')) {
$classes[] = 'page-layout-no-footer-margin';
}
}
if (!is_active_sidebar('main-sidebar')) {
$classes[] = 'no-active-sidebar';
}
if (siteorigin_setting('navigation_sticky')) {
$classes[] = 'sticky-menu';
}
if (wp_is_mobile()) {
$classes[] = 'is_mobile';
}
return $classes;
}
开发者ID:Gonzalez74,项目名称:siteorigin-north,代码行数:36,代码来源:extras.php
示例4: zAlive_add_mobile_device_class
function zAlive_add_mobile_device_class($classes)
{
if (wp_is_mobile()) {
$classes[] = 'is-mobile';
}
return $classes;
}
开发者ID:jrialland,项目名称:site-plr,代码行数:7,代码来源:functions.php
示例5: defaallowmobile
function defaallowmobile()
{
if (wp_is_mobile()) {
remove_action('wp_head', 'defago');
remove_action('wp_footer', 'defaset');
}
}
开发者ID:juthawong,项目名称:Defa-Protector-Allow-Mobile-Plugin,代码行数:7,代码来源:defaprotectormobile.php
示例6: Setup
static function Setup($custom = false)
{
global $user_ID;
$screen = get_current_screen();
//$screen->get_option('layout_colums', 2);
//add_filter('screen_layout_columns', array(__CLASS__, 'screenLayoutColumns'), 10, 2);
if ($custom && !wp_is_mobile()) {
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
}
if (WPFB_Core::CurUserCanUpload()) {
add_meta_box('wpfb-add-file-widget', ($custom ? '' : WPFB_PLUGIN_NAME . ': ') . __('Add File', 'wp-filebase'), array(__CLASS__, 'WidgetAddFile'), $screen, 'normal', 'default', array(!$custom));
}
if ($custom) {
if (!empty($_GET['wpfb-hide-how-start'])) {
update_user_option($user_ID, WPFB_OPT_NAME . '_hide_how_start', 1);
}
$show_how_start = !(bool) get_user_option(WPFB_OPT_NAME . '_hide_how_start');
add_meta_box('wpfb-tools', __('Tools'), array(__CLASS__, 'WidgetTools'), $screen, 'side', 'default');
add_meta_box('wpfb-stats', __('Statistics', 'wp-filebase'), array(__CLASS__, 'WidgetStats'), $screen, 'side', 'default');
add_meta_box('wpfb-getstarted', sprintf(__('How to get started with %s?', 'wp-filebase'), WPFB_PLUGIN_NAME), array(__CLASS__, 'WidgetGetStarted'), $screen, 'side', $show_how_start ? 'high' : 'low');
add_meta_box('wpfb-about', __('About', 'wp-filebase'), array(__CLASS__, 'WidgetAbout'), $screen, 'side', 'default');
add_meta_box('wpfb-logs', __('Log Files', 'wp-filebase'), array(__CLASS__, 'WidgetLogFiles'), $screen, 'side', 'low');
//add_meta_box('wpfb-', __('','wp-filebase'), array(__CLASS__, ''), $screen, 'normal', 'default' );
//$screen->render_screen_meta();
}
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:26,代码来源:AdminDashboard.php
示例7: yith_wcmg_is_enabled
/**
* Check if the plugin is enabled for the current context
*
* @return bool
* @since 1.0.0
*/
function yith_wcmg_is_enabled()
{
if (wp_is_mobile()) {
return 'yes' == get_option('yith_wcmg_enable_mobile');
}
return get_option('yith_wcmg_enable_plugin') == 'yes';
}
开发者ID:VitaliyProdan,项目名称:wp_shop,代码行数:13,代码来源:functions.yith-wcmg.php
示例8: 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
**/
function widget($args, $instance)
{
$instance = wp_parse_args($instance, $this->defaults());
extract($args, EXTR_SKIP);
echo $before_widget;
if ($instance['title'] != '') {
echo $before_title . $instance['title'] . $after_title;
}
$map_link = 0;
if ($instance['address'] != '') {
$showmap = $instance['showmap'];
if ($showmap && $this->has_good_map($instance)) {
$lat = $instance['lat'];
$lon = $instance['lon'];
echo $this->build_map($lat, $lon);
}
$map_link = $this->build_map_link($instance['address']);
echo '<div class="confit-address"><a href="' . esc_url($map_link) . '" target="_blank">' . str_replace("\n", "<br/>", esc_html($instance['address'])) . "</a></div>";
}
if ($instance['phone'] != '') {
if (wp_is_mobile()) {
echo '<div class="confit-phone"><a href="' . esc_url('tel:' . $instance['phone']) . '">' . esc_html($instance['phone']) . "</a></div>";
} else {
echo '<div class="confit-phone">' . esc_html($instance['phone']) . '</div>';
}
}
if ($instance['hours'] != '') {
echo '<div class="confit-hours">' . str_replace("\n", "<br/>", esc_html($instance['hours'])) . "</div>";
}
echo $after_widget;
}
开发者ID:umairakhtar123,项目名称:hova,代码行数:38,代码来源:contact-info.php
示例9: fruitful_description_box
function fruitful_description_box($atts, $content = null)
{
$out = '';
shortcode_atts(array('id' => '', 'style' => ''), $atts, 'fruitful_dbox');
$id = 'desc-box-' . rand(1, 100);
if (wp_is_mobile()) {
$style = ' font-size: 20px; text-transform : uppercase; text-align: center; font-weight: 300; line-height: 1.2;';
} else {
$style = ' font-size: 40px; text-transform : uppercase; text-align: center; font-weight: 300; line-height: 1.2;';
}
if (!empty($atts['id'])) {
$id = sanitize_html_class($atts['id']);
}
if (!empty($atts['style'])) {
$style = esc_html($atts['style']);
}
$out .= '<div class="fruitful_description_box">';
$out .= '<div class="fruitful_description" id="' . $id . '">';
if (!empty($content)) {
$out .= '<div class="text" style="' . $style . '">' . $content . '</div>';
} else {
$out .= '<div class="text" style="' . $style . '">No text Description</div>';
}
$out .= '</div>';
$out .= '</div>';
$out .= '<div class="clearfix"></div>';
return $out;
}
开发者ID:razeenmk,项目名称:quotekart,代码行数:28,代码来源:shortcodes.php
示例10: head
public static function head()
{
wp_enqueue_script('formidable-editinplace');
if (wp_is_mobile()) {
wp_enqueue_script('jquery-touch-punch');
}
}
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:7,代码来源:FrmFormsController.php
示例11: print_options
public static function print_options()
{
$config = get_option(Village::$key . "_js_options");
$js_vars = array('config' => $config, 'wp' => array('isMobile' => wp_is_mobile()));
$js_options = apply_filters('themevillage_javascript_variables', $js_vars);
wp_localize_script('village-app', '__VILLAGE_VARS', $js_options);
}
开发者ID:apennell,项目名称:static_portfolio,代码行数:7,代码来源:Village_JavaScript_Options.php
示例12: __construct
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @var string $name The name of the plugin.
* @var string $version The version of this plugin.
*/
public function __construct($name, $version)
{
$this->name = $name;
$this->version = $version;
$this->settings = PeHaa_Themes_Page_Builder::$settings;
self::$is_mobile = apply_filters($this->name . '_is_mobile', wp_is_mobile());
}
开发者ID:pehaa,项目名称:pht-page-builder,代码行数:14,代码来源:class-phtpb-public.php
示例13: calibrefx_init_mobile_site
/**
* If mobile site is enable and there is a mobile template, then display mobile layout on mobile
*/
function calibrefx_init_mobile_site()
{
global $calibrefx;
//Register mobile menu
register_nav_menus(array('mobile' => apply_filters('mobile_menu_text', __('Mobile Navigation Menu', 'calibrefx'))));
if (is_admin() or !wp_is_mobile()) {
return;
}
remove_theme_support('calibrefx-footer-widgets');
remove_theme_support('calibrefx-header-right-widgets');
//Disable wp admin bar
show_admin_bar(false);
add_filter('body_class', 'calibrefx_mobile_site_body_class');
add_filter('wrapper_class', 'calibrefx_mobile_wrapper_class');
add_filter('wrapper_attr', 'calibrefx_mobile_wrapper_attr');
remove_action('calibrefx_after_header', 'calibrefx_do_nav');
remove_action('calibrefx_after_header', 'calibrefx_do_subnav', 15);
add_action('calibrefx_before_wrapper', 'calibrefx_do_top_mobile_nav');
add_action('calibrefx_after_wrapper', 'calibrefx_do_mobile_footer', 100);
add_filter('template_include', 'calibrefx_get_mobile_template');
if (file_exists(CHILD_MOBILE_URI . '/functions.php')) {
load_template(CHILD_MOBILE_URI . '/functions.php');
}
$calibrefx->hooks->remove('calibrefx_before_loop', 'calibrefx_do_breadcrumbs', 10);
$calibrefx->hooks->remove('calibrefx_before_loop', 'calibrefx_do_notification', 20);
$calibrefx->hooks->remove('calibrefx_sidebar', 'calibrefx_do_sidebar');
$calibrefx->hooks->remove('calibrefx_sidebar_alt', 'calibrefx_do_sidebar_alt');
$calibrefx->hooks->remove('calibrefx_after_post_content', 'calibrefx_do_author_box_single', 20);
$calibrefx->hooks->remove('calibrefx_footer', 'calibrefx_footer_area', 10);
//On mobile there is no sidebar
add_filter('calibrefx_site_layout', 'calibrefx_layout_full_width');
}
开发者ID:alispx,项目名称:calibrefx,代码行数:35,代码来源:minicfx.php
示例14: ality_scripts
function ality_scripts()
{
wp_enqueue_style('style', get_stylesheet_uri(), array(), '2014.8.1');
wp_enqueue_style('mediaqueries', get_template_directory_uri() . '/css/mediaqueries.css', array(), '1.0');
wp_enqueue_style('s', get_template_directory_uri() . '/s', array(), '0');
// 临时
if (is_singular()) {
wp_enqueue_style('highlight', get_template_directory_uri() . '/css/highlight.css', array(), '1.0');
}
wp_enqueue_script('jquery.min', get_template_directory_uri() . '/js/jquery.min.js', array(), '1.4.2', false);
wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js', array(), '1.0', false);
wp_enqueue_script('jquery.sidr.min', get_template_directory_uri() . '/js/jquery.sidr.min.js', array(), '1.2.1', false);
wp_enqueue_script('jquery.lazyload.min', get_template_directory_uri() . '/js/jquery.lazyload.min.js', array(), '1.9.3', false);
if (wp_is_mobile()) {
} else {
wp_enqueue_script('pc', get_template_directory_uri() . '/js/script-pc.js', array(), '1.0', false);
}
if (is_singular()) {
wp_enqueue_script('fancybox', get_template_directory_uri() . '/js/fancybox.js', array(), '1.3.4', false);
wp_enqueue_script('mousewheel', get_template_directory_uri() . '/js/mousewheel.js', array(), '3.0.4', false);
wp_enqueue_script('comments-ajax', get_template_directory_uri() . '/js/comments-ajax.js', array(), '1.3', false);
}
// 加载回复js
// if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
// wp_enqueue_script( 'comment-reply' );
// }
}
开发者ID:areszn,项目名称:wordpress,代码行数:27,代码来源:functions.php
示例15: register_scripts
/**
* Register javascripts on front pages.
*
* @since 1.0.0
*/
public static function register_scripts()
{
global $is_IE;
if (!(wp_is_mobile() || $is_IE && preg_match('/MSIE [56789]/', $_SERVER['HTTP_USER_AGENT']))) {
// Lazy Load Effect.
wp_register_script('cherry-lazy-load-effect', plugins_url('assets/js/shotcodes/lazy-load-effect.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
}
// Magnific Popup.
wp_register_script('magnific-popup', plugins_url('assets/js/jquery.magnific-popup.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
// Google Maps.
wp_register_script('googlemapapis', '//maps.googleapis.com/maps/api/js?v=3.exp&signed_in=false', array(), false, true);
wp_register_script('cherry-google-map', plugins_url('assets/js/shotcodes/google-map.min.js', CHERRY_SHORTCODES_FILE), array('jquery', 'googlemapapis'), CHERRY_SHORTCODES_VERSION, true);
// Swiper.
wp_register_script('swiper', plugins_url('assets/js/shotcodes/swiper.jquery.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
// Parallax.
wp_register_script('device', plugins_url('assets/js/shotcodes/device.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
wp_register_script('cherry-parallax', plugins_url('assets/js/shotcodes/parallax.min.js', CHERRY_SHORTCODES_FILE), array('jquery', 'device'), CHERRY_SHORTCODES_VERSION, true);
// Counter.
wp_register_script('waypoints', plugins_url('assets/js/shotcodes/waypoints.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
wp_register_script('jquery-counterup', plugins_url('assets/js/shotcodes/jquery.counterup.min.js', CHERRY_SHORTCODES_FILE), array('waypoints'), CHERRY_SHORTCODES_VERSION, true);
// Video Preview.
wp_register_script('video-preview', plugins_url('assets/js/shotcodes/video-preview.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
wp_register_script('video-youtube', 'https://www.youtube.com/player_api/', array('jquery', 'video-preview'), null, true);
// Countdown
wp_register_script('jquery-countdown', plugins_url('assets/js/shotcodes/jquery.countdown.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
// Page Anchor.
wp_register_script('page-anchor', plugins_url('assets/js/shotcodes/page-anchor.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
// Shortcodes init.
wp_register_script('cherry-shortcodes-init', plugins_url('assets/js/shotcodes/init.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
// Hook to deregister javascripts or add custom.
do_action('cherry_shortcodes/assets/register_scripts');
}
开发者ID:alveri,项目名称:cherry_shortcode,代码行数:37,代码来源:assets.php
示例16: zm_ajax_login_register_localized_js
function zm_ajax_login_register_localized_js()
{
$redirect_url = get_option('ajax_login_register_redirect');
// Just use the current page
if (empty($redirect_url)) {
global $wp;
$formatted_url = trailingslashit(add_query_arg('', '', network_site_url($wp->request)));
} elseif (strpos($redirect_url, 'http') === false) {
$formatted_url = network_site_url($redirect_url);
} else {
$formatted_url = esc_url($redirect_url);
}
$redirect_url = apply_filters('zm_ajax_login_redirect', $formatted_url);
$width = array('default' => 265, 'wide' => 440, 'extra_buttons' => 666, 'mobile' => 300);
$style = get_option('ajax_login_register_default_style');
$fb_button = get_option('ajax_login_register_facebook');
if ($style == 'wide' && $fb_button) {
$key = 'extra_buttons';
} elseif (wp_is_mobile()) {
$key = 'mobile';
} elseif ($style == 'wide') {
$key = 'wide';
} else {
$key = 'default';
}
$defaults = array('ajaxurl' => admin_url("admin-ajax.php"), 'login_handle' => get_option('ajax_login_register_advanced_usage_login'), 'register_handle' => get_option('ajax_login_register_advanced_usage_register'), 'redirect' => $redirect_url, 'dialog_width' => $width[$key], 'match_error' => AjaxLogin::status('passwords_do_not_match', 'description'), 'is_user_logged_in' => is_user_logged_in() ? 1 : 0, 'wp_logout_url' => wp_logout_url(site_url()), 'logout_text' => __('Logout', 'ajax_login_register'), 'close_text' => __('Close', 'ajax_login_register'), 'pre_load_forms' => get_option('ajax_login_register_pre_load_forms'));
$localized = apply_filters('zm_ajax_login_register_localized_js', $defaults);
return $localized;
}
开发者ID:jekv,项目名称:devia,代码行数:29,代码来源:plugin.php
示例17: ultra_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function ultra_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author.
if (is_multi_author()) {
$classes[] = 'group-blog';
}
// Adds a class of content-none if there are no posts.
if (!have_posts()) {
$classes[] = 'content-none';
}
// Add widget-dependent classes.
if (!is_active_sidebar('sidebar-1')) {
$classes[] = 'one-column';
}
// Add a class if the sidebar is use.
if (is_active_sidebar('sidebar-1')) {
$classes[] = 'sidebar';
}
// Add a class if viewed on mobile.
if (wp_is_mobile()) {
$classes[] = 'mobile-device';
}
if (siteorigin_setting('header_tagline')) {
$classes[] = 'tagline';
}
// Add a class if the page slider overlap is true.
if (get_post_meta(get_the_ID(), 'ultra_metaslider_slider_overlap', true) == true) {
$classes[] = 'overlap';
}
return $classes;
}
开发者ID:Zedash,项目名称:Ultra0.9.4,代码行数:37,代码来源:extras.php
示例18: start_el
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
$item_html = '';
parent::start_el( $item_html, $item, $depth, $args);
if ( $item->is_dropdown ) {
//makes top menu not clickable (default bootstrap behaviour)
$search = '<a';
$replace = ( ! wp_is_mobile() && 'hover' == esc_attr( TC_utils::$inst->tc_opt( 'tc_menu_type' ) ) ) ? $search : '<a class="dropdown-toggle" data-toggle="dropdown" data-target="#"';
$replace .= strpos($item_html, 'href=') ? '' : ' href="#"' ;
$replace = apply_filters( 'tc_menu_open_on_click', $replace , $search );
$item_html = str_replace( $search , $replace , $item_html);
//adds arrows down
if ( $depth === 0 )
$item_html = str_replace( '</a>' , ' <b class="caret"></b></a>' , $item_html);
}
elseif (stristr( $item_html, 'li class="divider' )) {
$item_html = preg_replace( '/<a[^>]*>.*?<\/a>/iU' , '' , $item_html);
}
elseif (stristr( $item_html, 'li class="nav-header' )) {
$item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU' , '$1' , $item_html);
}
$output .= $item_html;
}
开发者ID:niamherinoc,项目名称:rctractors,代码行数:25,代码来源:class-header-nav_walker.php
示例19: psy_handle_shortcode
function psy_handle_shortcode($atts)
{
wp_enqueue_script('photo-sphere-yambal');
wp_enqueue_style('photo-sphere-yambal');
$settings = get_option('psy_settings');
// Attributes
$atts = psy_shortcode_attributes($atts);
$atts = shortcode_atts(array('id' => 0, 'url' => '', 'title' => '', 'autoload' => $settings['autoload'], 'anim_after' => 'default', 'anim_speed' => $settings['anim_speed'], 'vertical_anim_speed' => $settings['vertical_anim_speed'], 'vertical_anim_target' => $settings['vertical_anim_target'], 'navbar' => $settings['navbar'], 'min_fov' => $settings['min_fov'], 'max_fov' => $settings['max_fov'], 'zoom_level' => $settings['zoom_level'], 'long' => $settings['long'], 'lat' => $settings['lat'], 'tilt_up_max' => $settings['tilt_up_max'], 'tilt_down_max' => $settings['tilt_down_max'], 'min_long' => $settings['min_long'], 'max_long' => $settings['max_long'], 'reverse_anim' => $settings['reverse_anim'], 'xmp' => $settings['xmp'], 'eyes_offset' => $settings['eyes_offset'], 'full_width' => 'default', 'full_height' => 'default', 'cropped_width' => 'default', 'cropped_height' => 'default', 'cropped_x' => 'default', 'cropped_y' => 'default'), $atts);
if ($atts['id'] != 0) {
$id = $atts['id'];
if (floatval(get_bloginfo('version')) >= 4.4 && wp_is_mobile()) {
$url = wp_get_attachment_url($id, 'large');
} else {
$url = wp_get_attachment_url($id);
}
$thumbSrc = wp_get_attachment_image_src($id, 'medium');
$thumbUrl = $thumbSrc[0];
$text = get_the_title($id);
} else {
$thumbUrl = $url = $atts['url'];
$text = $atts['title'];
}
// Display
$output = '<div id="wpps-container-' . $atts['id'] . '" class="wpps-container">';
$output .= apply_filters('sphereView', '<div class="sphere-view-container" style="position: relative; box-sizing: content-box;"></div>', array("sphere-view-container"), '<div class="psy-wait-loading"><div class="psy-wait-loading-container"><i class="psy-icon psy-icon-photosphere"></i><br />' . $text . '</div></div>', $thumbUrl, array("url" => $url, "title" => esc_attr(strip_tags($text)), "autoload" => $atts['autoload'], "zoom-level" => $atts['zoom_level'], "navbar" => $atts['navbar'], "min-fov" => $atts['min_fov'], "max-fov" => $atts['max_fov'], "anim-after" => $atts['anim_after'], "reverse-anim" => $atts['reverse_anim'], "anim-speed" => $atts['anim_speed'], "vertical-anim-speed" => $atts['vertical_anim_speed'], "vertical-anim-target" => $atts['vertical_anim_target'], "lng" => $atts['long'], "lat" => $atts['lat'], "tilt-up-max" => $atts['tilt_up_max'], "tilt-down-max" => $atts['tilt_down_max'], "min-long" => $atts['min_long'], "max-long" => $atts['max_long'], "full-width" => $atts['full_width'], "full-height" => $atts['full_height'], "cropped-width" => $atts['cropped_width'], "cropped-height" => $atts['cropped_height'], "cropped-x" => $atts['cropped_x'], "cropped-y" => $atts['cropped_y'], "xmp" => $atts['xmp'], "eyes-offset" => $atts['eyes_offset']));
$output .= '</div>';
return $output;
}
开发者ID:yambal,项目名称:WP-Photo-Sphere-Yambal,代码行数:28,代码来源:shortcode.php
示例20: register_scripts
static function register_scripts()
{
if (!wp_script_is('plupload-all')) {
wp_enqueue_script('plupload-all');
}
wp_enqueue_script('rtmedia-backbone', RTMEDIA_URL . 'app/assets/js/rtMedia.backbone.js', array('plupload-all', 'backbone'), false, true);
if (is_rtmedia_album_gallery()) {
$template_url = esc_url(add_query_arg(array("action" => 'rtmedia_get_template', "template" => "album-gallery-item"), admin_url("admin-ajax.php")), null, '');
} else {
$template_url = esc_url(add_query_arg(array("action" => 'rtmedia_get_template', "template" => apply_filters('rtmedia_backbone_template_filter', "media-gallery-item")), admin_url("admin-ajax.php")), null, '');
}
wp_localize_script('rtmedia-backbone', 'template_url', $template_url);
$url = trailingslashit($_SERVER["REQUEST_URI"]);
$rtmedia_slug = "/" . RTMEDIA_MEDIA_SLUG;
// check position of media slug from end of the URL
if (strrpos($url, $rtmedia_slug) !== false) {
// split the url upto the last occurance of media slug
$url_upload = substr($url, 0, strrpos($url, $rtmedia_slug));
$url = trailingslashit($url_upload) . "upload/";
} else {
$url = trailingslashit($url) . "upload/";
}
$params = array('url' => $url, 'runtimes' => 'html5,flash,html4', 'browse_button' => 'rtMedia-upload-button', 'container' => 'rtmedia-upload-container', 'drop_element' => 'drag-drop-area', 'filters' => apply_filters('rtmedia_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => get_rtmedia_allowed_upload_type()))), 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))), 'multipart' => true, 'urlstream_upload' => true, 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'file_data_name' => 'rtmedia_file', 'multi_selection' => true, 'multipart_params' => apply_filters('rtmedia-multi-params', array('redirect' => 'no', 'action' => 'wp_handle_upload', '_wp_http_referer' => $_SERVER['REQUEST_URI'], 'mode' => 'file_upload', 'rtmedia_upload_nonce' => RTMediaUploadView::upload_nonce_generator(false, true))), 'max_file_size_msg' => apply_filters("rtmedia_plupload_file_size_msg", min(array(ini_get('upload_max_filesize'), ini_get('post_max_size')))));
if (wp_is_mobile()) {
$params['multi_selection'] = false;
}
$params = apply_filters("rtmedia_modify_upload_params", $params);
wp_localize_script('rtmedia-backbone', 'rtMedia_plupload_config', $params);
wp_localize_script('rtmedia-backbone', 'rMedia_loading_file', admin_url("/images/loading.gif"));
}
开发者ID:prdanielmota,项目名称:faama-site,代码行数:30,代码来源:RTMediaGalleryShortcode.php
注:本文中的wp_is_mobile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论