Example #1
0
 /**
  * Function to check if themes exist and if default theme exists, if so, returns the themes
  *
  * @package MobilePress
  * @since 1.1.1
  */
 private function mopr_select_themes()
 {
     $default_themes = $this->mopr_get_themes(MOPR_ROOT_PATH . 'themes');
     $custom_themes = $this->mopr_get_themes(WP_CONTENT_DIR . mopr_get_option('custom_themes', 1));
     if (is_array($default_themes) && is_array($custom_themes)) {
         // Merge themes
         $themes = array_merge($default_themes, $custom_themes);
         ksort($themes);
     } else {
         if (is_array($default_themes)) {
             $themes = $default_themes;
             ksort($themes);
         } else {
             if (is_array($custom_themes)) {
                 $themes = $custom_themes;
                 ksort($themes);
             } else {
                 $themes = array();
             }
         }
     }
     if (empty($themes)) {
         mopr_display_notice('<p>Please upload a theme to your MobilePress themes directory!</p>');
         return false;
     } else {
         if (empty($themes['Default']['Title'])) {
             mopr_display_notice('<p>You need to upload the default theme!</p>');
             return false;
         } else {
             return $themes;
         }
     }
 }
Example #2
0
 /**
  * Initialize the checking for a mobile browser
  *
  * @package MobilePress
  * @since 1.0
  */
 public function mopr_detect_device()
 {
     // ?mobile will render the selected non-touch mobile theme
     // ?nomobile renders the standard selected WordPress theme
     if (isset($_GET['mobile'])) {
         $this->browser = 'mobile';
         $this->activated = TRUE;
         $this->theme = mopr_get_option('mobile_theme', 1);
     } else {
         if (isset($_GET['nomobile'])) {
             $this->activated = FALSE;
         } else {
             if ($this->is_mobile($_SERVER['HTTP_USER_AGENT'], $_SERVER['HTTP_ACCEPT'], $_SERVER['HTTP_PROFILE'], $_SERVER['HTTP_X_WAP_PROFILE'])) {
                 if ($this->is_bot($_SERVER['HTTP_USER_AGENT'])) {
                     $this->browser = 'mobile';
                     $this->activated = TRUE;
                     $this->theme = mopr_get_option('mobile_theme', 1);
                 } else {
                     if ($this->is_tablet($_SERVER['HTTP_USER_AGENT'])) {
                         $this->activated = FALSE;
                     } else {
                         if ($this->is_touch($_SERVER['HTTP_USER_AGENT'])) {
                             $this->browser = 'touch';
                             $this->activated = TRUE;
                             $this->theme = mopr_get_option('mobile_theme', 1);
                         } else {
                             $this->browser = 'mobile';
                             $this->activated = TRUE;
                             $this->theme = mopr_get_option('mobile_theme', 1);
                         }
                     }
                 }
             }
         }
     }
     if ($_SESSION['MOPR_MOBILE_BROWSER'] != $this->browser && isset($_SESSION['MOPR_MOBILE_BROWSER'])) {
         session_unset();
         session_destroy();
     }
     $_SESSION['MOPR_MOBILE_BROWSER'] = $this->browser;
     $_SESSION['MOPR_MOBILE_ACTIVE'] = $this->activated;
     $_SESSION['MOPR_MOBILE_THEME'] = $this->theme;
 }
Example #3
0
 static function is_mobilepress()
 {
     if (function_exists('mopr_get_option') && WP_CONTENT_DIR . mopr_get_option('mobile_theme_root', 1) == get_theme_root()) {
         return true;
     }
     return false;
 }
Example #4
0
 /**
  * Does the checks and decides whether to render a mobile or normal website
  *
  * @package MobilePress
  * @since 1.0
  */
 public function mopr_load_site()
 {
     if (isset($_GET['killsession']) || $_SESSION['MOPR_FORCE_MOBILE'] == TRUE && !mopr_get_option('force_mobile', 1)) {
         session_unset();
         session_destroy();
         $_SESSION['MOPR_MOBILE_ACTIVE'] = '';
         $_SESSION['MOPR_MOBILE_BROWSER'] = '';
         $_SESSION['MOPR_MOBILE_THEME'] = '';
     }
     // Plugin preference is set to render entire site in mobile.
     if (mopr_get_option('force_mobile', 1)) {
         $_SESSION['MOPR_FORCE_MOBILE'] = TRUE;
         $_SESSION['MOPR_MOBILE_ACTIVE'] = TRUE;
         $_SESSION['MOPR_MOBILE_BROWSER'] = 'mobile';
         $_SESSION['MOPR_MOBILE_THEME'] = mopr_get_option('mobile_theme', 1);
     }
     // Check if mobile sesison var exists
     // Also, check if ?mobile or ?nomobile is set. If so, establish the session var so that subsequent page calls will render in the desired mode.
     if (!isset($_SESSION['MOPR_MOBILE_ACTIVE']) || trim($_SESSION['MOPR_MOBILE_ACTIVE']) == '' || isset($_GET['mobile']) || isset($_GET['nomobile'])) {
         require_once MOPR_PATH . 'classes/check.php';
         $mobilepress_check = new Mobilepress_check();
         $mobilepress_check->mopr_detect_device();
     }
     if ($_SESSION['MOPR_MOBILE_ACTIVE'] === TRUE) {
         // Double check session var for theme, fall back on default if any problems
         if (!isset($_SESSION['MOPR_MOBILE_THEME']) || trim($_SESSION['MOPR_MOBILE_THEME']) == '') {
             $_SESSION['MOPR_MOBILE_THEME'] = mopr_get_option('mobile_theme', 1);
         }
         require_once MOPR_PATH . 'classes/render.php';
         $Mobilepress_render = new Mobilepress_render();
         $Mobilepress_render->mopr_render_theme();
     }
 }
Example #5
0
?>
</em>"</h2>
		</div>

		<?php 
$access_key = 1;
?>
		<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>

		<div class="post">
			<?php 
        if (mopr_get_option('show_thumbnails') && has_post_thumbnail()) {
            $thumbnail_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
            ?>
			<a href="<?php 
            the_permalink();
            ?>
" class="thumbnail"><img src="<?php 
            echo mopr_create_thumbnail($thumbnail_url[0], 0, 50, 50);
            ?>
" /></a>
			<?php 
        }
        ?>
			<h2 class="title"><a href="<?php 
        the_permalink();
        ?>
Example #6
0
function bjll_compat_mobilepress()
{
    if (function_exists('mopr_get_option') && WP_CONTENT_DIR . mopr_get_option('mobile_theme_root', 1) == get_theme_root()) {
        add_filter('bjll/enabled', '__return_false');
    }
}
Example #7
0
			<div class="next"><?php 
                next_post_link();
                ?>
</div>
			<div class="prev"><?php 
                previous_post_link();
                ?>
</div>
			<div class="clearfix"></div>
		</div>
		<?php 
            }
            ?>

		<?php 
            $allow_comments = mopr_get_option('comments');
            if ($allow_comments == 'all' || $allow_comments == 'posts') {
                ?>
			<?php 
                comments_template('/comments.php', true);
                ?>
		<?php 
            }
            ?>

		<?php 
        }
        ?>
		<?php 
    }
    ?>
Example #8
0
 /**
  * Sets the maximum number of posts per page
  *
  * @package MobilePress
  * @since 1.2
  */
 public function mopr_set_page_posts()
 {
     return mopr_get_option('page_posts', 1);
 }
Example #9
0
<?php

// MobilePress path and table. No need to edit these options.
define('MOPR_PATH', trailingslashit(dirname(dirname(__FILE__))));
// System Path
define('MOPR_ROOT_PATH', trailingslashit(dirname(dirname(__FILE__))));
// Root Path
define('MOPR_SCRIPT_PATH', '/wp-content/plugins/' . trailingslashit(basename(dirname(dirname(dirname(__FILE__))))));
// Script friendly system path
define('MOPR_TABLE', $wpdb->prefix . 'mobilepress');
// Gets the MobilePress Versions
define('MOPR_VERSION', mopr_get_version());
define('MOPR_DBVERSION', mopr_get_option('version', 1));
Example #10
0
		<?php 
if (mopr_get_option('show_pages')) {
    ?>
		<div id="heading">
			<h2>Pages</h2>
		</div>

		<ul id="list">
			<?php 
    wp_list_pages('title_li=');
    ?>
		</ul>
		<?php 
}
?>

		<?php 
if (mopr_get_option('show_categories')) {
    ?>
		<div id="heading">
			<h2>Categories</h2>
		</div>

		<ul id="list">
			<?php 
    wp_list_categories('title_li=');
    ?>
		</ul>
		<?php 
}