Example #1
0
function wptouch_customizer_scripts()
{
    if (wptouch_is_customizing_mobile()) {
        wp_enqueue_style('wptouch-theme-customizer-css', WPTOUCH_URL . '/admin/customizer/wptouch-customizer.css', '', md5(WPTOUCH_VERSION));
        wp_enqueue_style('wptouch-admin-fontello', WPTOUCH_URL . '/admin/fontello/css/fontello-embedded.css', '', md5(WPTOUCH_VERSION));
        wp_enqueue_script('wptouch-theme-customizer-js', WPTOUCH_URL . '/admin/customizer/wptouch-customizer.js', array('jquery'), md5(WPTOUCH_VERSION), true);
        global $wptouch_pro;
        $theme = $wptouch_pro->get_current_theme_info();
        $customizer_params = array('device_orientation' => __('Device + Orientation', 'wptouch-pro'), 'device_tags' => $theme->tags, 'settings_url' => admin_url('admin.php?page=wptouch-admin-general-settings'));
        wp_localize_script('wptouch-theme-customizer-js', 'WPtouchCustomizer', $customizer_params);
    }
    wp_enqueue_script('jquery-plugins', WPTOUCH_URL . '/admin/js/wptouch-admin-plugins.js', array('jquery'), md5(WPTOUCH_VERSION), true);
    wp_enqueue_script('wptouch-theme-customizer-switch', WPTOUCH_URL . '/admin/customizer/wptouch-customizer-switch.js', array('jquery'), md5(WPTOUCH_VERSION), true);
    $customizer_switch_params = array('mobile_switch' => __('Switch to Mobile Theme', 'wptouch-pro'), 'desktop_switch' => __('Switch to Desktop Theme', 'wptouch-pro'));
    wp_localize_script('wptouch-theme-customizer-switch', 'WPtouchCustomizerSwitch', $customizer_switch_params);
    // It's a 3.x stock theme, or older copied theme, load the shim js file to help out displaced settings in the customizer
    if (wptouch_theme_version_compare('4', '<')) {
        wp_enqueue_script('wptouch-theme-customizer-shim', WPTOUCH_URL . '/admin/customizer/wptouch-customizer-shim.js', array('jquery'), md5(WPTOUCH_VERSION), true);
    }
}
Example #2
0
 function is_supported_device()
 {
     $user_agent = apply_filters('wptouch_user_agent', str_replace('Twitter for iPhone', '', $_SERVER['HTTP_USER_AGENT']));
     $settings = $this->get_settings();
     if ($this->is_in_preview_mode()) {
         return true;
     } elseif ($settings->new_display_mode == false && !wptouch_is_customizing_mobile()) {
         return false;
     }
     // Now that preview mode is out of the way, let's figure out the proper list of user agents
     $supported_agents = $this->get_supported_user_agents();
     // Figure out the active device type and the active device class
     foreach ($supported_agents as $agent) {
         if ($agent != array() && $this->user_agent_matches($user_agent, $agent)) {
             $agent_ok = true;
             $exclusion_list = apply_filters('wptouch_exclusion_list', array());
             foreach ($exclusion_list as $exclude_user_agent) {
                 $friendly_exclude = preg_quote($exclude_user_agent);
                 if (preg_match("#{$friendly_exclude}#i", $user_agent)) {
                     $agent_ok = false;
                     break;
                 }
             }
             if (!$agent_ok) {
                 continue;
             }
             $this->active_device = $agent;
             $supported_device_classes = $this->get_supported_theme_device_classes();
             foreach ($supported_device_classes as $device_class => $device_user_agents) {
                 if (in_array($agent, $device_user_agents)) {
                     $this->active_device_class = $device_class;
                 }
             }
             return true;
         } else {
             $this->active_device = $this->active_device_class = false;
         }
     }
     return false;
 }
Example #3
0
function wptouch_admin_render_menu()
{
    global $panel_options;
    global $wptouch_panel_slug;
    // Determine which menu generated this page
    $page_name = $_GET['page'];
    $admin_panel_name = $page_name . '.php';
    $wptouch_panel_slug = $page_name;
    if (file_exists(WPTOUCH_ADMIN_DIR . '/pages/' . $admin_panel_name)) {
        require_once WPTOUCH_ADMIN_DIR . '/pages/' . $admin_panel_name;
    }
    $panel_options = apply_filters('wptouch_admin_page_render_' . $page_name, $panel_options);
    if ($page_name == WPTOUCH_PRO_ADMIN_GENERAL_SETTINGS || wptouch_is_customizing_mobile()) {
        $panel_options = apply_filters('wptouch_admin_page_render_wptouch-admin-theme-settings', $panel_options);
    }
    include WPTOUCH_DIR . '/core/admin-render.php';
}