Esempio n. 1
0
function mobileview_get_desktop_switch_link()
{
    $settings = mobileview_get_settings();
    if ($settings->show_switch_link) {
        if ($settings->home_page_redirect_address == 'same') {
            return apply_filters('mobileview_desktop_switch_link', get_bloginfo('url') . '?mobileview_switch=mobile&redirect=' . urlencode($_SERVER['REQUEST_URI']));
        } else {
            return apply_filters('mobileview_desktop_switch_link', get_bloginfo('url') . '?mobileview_switch=mobile&redirect=' . get_bloginfo('url'));
        }
    }
}
Esempio n. 2
0
function mobileview_has_plugin_warnings()
{
    global $mobileview;
    global $mobileview_plugin_warning_iterator;
    $settings = mobileview_get_settings();
    if (!$mobileview_plugin_warning_iterator) {
        $warnings = apply_filters('mobileview_plugin_warnings', $mobileview->warnings);
        if (!$warnings) {
            return;
        }
        ksort($warnings);
        $new_warnings = array();
        foreach ($warnings as $key => $value) {
            if (!in_array($key, $settings->dismissed_warnings)) {
                $new_warnings[$key] = $value;
            }
        }
        $mobileview_plugin_warning_iterator = new MobileViewArrayIterator($new_warnings);
    }
    return $mobileview_plugin_warning_iterator->have_items();
}
Esempio n. 3
0
<?php

$settings = mobileview_get_settings();
$hipnews_slider_disable = $settings->hipnews_slider_disable;
$hipnews_slider_cat = $settings->hipnews_slider_cat;
$hipnews_slider_count = $settings->hipnews_slider_count;
if (!$hipnews_slider_disable && is_front_page()) {
    query_posts(array('cat' => $hipnews_slider_cat, 'posts_per_page' => $hipnews_slider_count));
    $first = 0;
    global $hipnews_slider_ID;
    $hipnews_slider_ID = array();
    if (mobileview_have_posts()) {
        ?>

    <div class="featured-slider">
      <div class="flexslider">
        <ul class="slides">

<?php 
        while (mobileview_have_posts()) {
            mobileview_the_post();
            $first++;
            global $post;
            $hipnews_slider_ID[] = $post->ID;
            ?>

          <li>
            <img src="<?php 
            mobileview_the_post_thumbnail(false, 'feat-thumbnail');
            ?>
" class="attachment-post-thumbnail slider-thumbnail" alt="post thumbnail" />
Esempio n. 4
0
function mobileview_get_tab_setting_value()
{
    $settings = mobileview_get_settings();
    $name = mobileview_get_tab_setting_name();
    if (isset($settings->{$name})) {
        return $settings->{$name};
    } else {
        return false;
    }
}
Esempio n. 5
0
function mobileview_setup_theme_browser_tab()
{
    global $mobileview;
    $settings = mobileview_get_settings();
    if (!$settings->admin_client_mode_hide_browser) {
        mobileview_add_tab(__('Skins', 'mobileviewlang'), 'theme-browser', array(__('Skin Browser', 'mobileviewlang') => array('installed-themes', array(array('section-start', 'installed-themes', '&nbsp;'), array('theme-browser'), array('section-end')))), false, 'cabinet');
    }
    $theme_menu = apply_filters('mobileview_theme_menu', array());
    $current_theme = $mobileview->get_current_theme_info();
    // Check for skins
    if (isset($current_theme->skins) && count($current_theme->skins)) {
        $skin_options = array('none' => __('None', 'mobileviewlang'));
        foreach ($current_theme->skins as $skin) {
            $skin_options[$skin->basename] = $skin->name;
        }
        $skin_menu = array(__('Skin Settings', 'mobileviewlang') => array('theme-skins', array(array('section-start', 'available-skins', __('Available Skins', 'mobileviewlang')), array('list', 'current_theme_skin', __('Skin Settings', 'mobileviewlang'), __('Skins are alternate stylesheets which change the look and feel of a theme.', 'mobileviewlang'), $skin_options), array('section-end'))));
        $theme_menu = array_merge($theme_menu, $skin_menu);
    }
    // Add the skins menu
    if ($theme_menu) {
        $settings = $mobileview->get_settings();
        mobileview_add_tab(__("Skin Settings", 'mobileviewlang'), 'custom_theme', $theme_menu, false, 'settings');
    }
}
Esempio n. 6
0
function hipnews_mobile_hide_responses()
{
    $settings = mobileview_get_settings();
    return $settings->hipnews_hide_responses;
}
Esempio n. 7
0
function mobileview_custom_post_should_show($current)
{
    global $post;
    $settings = mobileview_get_settings();
    $available_posts = mobileview_custom_posts_get_list();
    if (array_key_exists($post->post_type, $available_posts)) {
        // Show custom post types
        if ($settings->mobileview_show_custom_post_taxonomy && is_single() && !is_page()) {
            $current = true;
        }
        if ($settings->mobileview_show_custom_post_taxonomy_on_blog && !is_single() && !is_page()) {
            $current = true;
        }
    }
    return $current;
}
Esempio n. 8
0
 function admin_ajax_handler()
 {
     if (current_user_can('manage_options')) {
         // Check security nonce
         $mobileview_nonce = $this->post['mobileview_nonce'];
         if (!wp_verify_nonce($mobileview_nonce, 'mobileview_admin')) {
             MOBILEVIEW_DEBUG(MOBILEVIEW_SECURITY, 'Invalid security nonce for AJAX call');
             exit;
         }
         header('HTTP/1.1 200 OK');
         $mobileview_ajax_action = $this->post['mobileview_action'];
         switch ($mobileview_ajax_action) {
             case 'activate-theme':
                 $settings = mobileview_get_settings();
                 $theme_location = $this->post['location'];
                 $theme_name = $this->post['name'];
                 if ($settings->current_theme_location != $theme_location) {
                     $paths = explode('/', ltrim(rtrim($theme_location, '/'), '/'));
                     $settings->current_theme_name = $paths[count($paths) - 1];
                     unset($paths[count($paths) - 1]);
                     $settings->current_theme_location = '/' . implode('/', $paths);
                     $settings->current_theme_friendly_name = $theme_name;
                     remove_all_filters('mobileview_theme_menu');
                     remove_all_filters('mobileview_default_settings');
                     $this->save_settings($settings);
                 }
                 break;
             case 'delete-theme':
                 $delete_src = WP_CONTENT_DIR . $this->post['location'];
                 $this->recursive_delete($delete_src);
                 @rmdir($delete_src);
                 break;
             case 'dismiss-warning':
                 $settings = $this->get_settings();
                 if ($this->post['plugin']) {
                     if (!in_array($this->post['plugin'], $settings->dismissed_warnings)) {
                         $settings->dismissed_warnings[] = $this->post['plugin'];
                         $this->save_settings($settings);
                     }
                 }
                 echo mobileview_get_plugin_warning_count();
                 break;
             case 'update-theme':
                 $cookie = json_decode($this->post['cookie'], true);
                 if ($cookie) {
                     $cookies = array();
                     foreach ($cookie as $name) {
                         $cookies[] = new WP_Http_Cookie($name);
                     }
                     global $wp_filesystem;
                     $filesystem = WP_Filesystem();
                     $skin_name = trim($this->post['name']);
                     $file_url = 'http://colorlabsproject.com/member/downloads/mobileview-skins/' . $skin_name . '/' . $skin_name . '.zip';
                     $tmpfname = wp_tempnam($file_url);
                     $get_zip_file = wp_remote_get($file_url, array('timeout' => 30, 'cookies' => $cookies, 'stream' => true, 'filename' => $tmpfname));
                     $target_dir = $wp_filesystem->find_folder(MOBILEVIEW_CUSTOM_THEME_DIRECTORY);
                     $do_unzip = unzip_file($get_zip_file['filename'], $target_dir);
                     unlink($tmpfname);
                     $message = '';
                     if (is_wp_error($do_unzip)) {
                         $error = $do_unzip->get_error_code();
                         if ('incompatible_archive' == $error) {
                             $message = '<h2 class="updater-error">' . __("Failed: Incompatible archive", "mobileviewlang") . '</h2>';
                         }
                         if ('empty_archive' == $error) {
                             $message = '<h2 class="updater-error">' . __("Failed: Empty Archive", "mobileviewlang") . '</h2>';
                         }
                         if ('mkdir_failed' == $error) {
                             $message = '<h2 class="updater-error">' . __("Failed: mkdir Failure", "mobileviewlang") . '</h2>';
                         }
                         if ('copy_failed' == $error) {
                             $message = '<h2 class="updater-error">' . __("Failed: Copy Failed", "mobileviewlang") . '</h2>';
                         }
                     } else {
                         $message = '<h2 class="updater-success"><strong>Well done!</strong> You successfully update ' . $skin_name . ' skin</h2>';
                     }
                     echo $message;
                 }
                 break;
             case 'mobileview-login':
                 $username = $this->post['username'];
                 $password = $this->post['password'];
                 $response = wp_remote_post("http://colorlabsproject.com/member/login.php", array('timeout' => 30, 'redirection' => 0, 'headers' => array(), 'body' => array('amember_login' => $this->post['username'], 'amember_pass' => $this->post['password'])));
                 if ($response['cookies'][2]) {
                     echo json_encode($response['cookies']);
                 }
                 break;
             default:
                 break;
         }
     } else {
         MOBILEVIEW_DEBUG(MOBILEVIEW_SECURITY, 'Insufficient security privileges for AJAX call');
     }
     die;
 }
Esempio n. 9
0
function hipnews_show_author_single()
{
    $settings = mobileview_get_settings();
    return $settings->hipnews_show_post_author_single;
}
Esempio n. 10
0
function hipnews_mobile_enable_zoom()
{
    $settings = mobileview_get_settings();
    return $settings->hipnews_mobile_enable_zoom;
}
Esempio n. 11
0
function mobileview_is_custom_latest_posts_page()
{
    global $post;
    $settings = mobileview_get_settings();
    if ($settings->mobileview_latest_posts_page == 'none') {
        return false;
    } else {
        rewind_posts();
        the_post();
        rewind_posts();
        return apply_filters('mobileview_is_custom_latest_posts_page', $settings->mobileview_latest_posts_page == $post->ID);
    }
}