function __construct()
 {
     global $wp_locale;
     if (!function_exists('esc_html') || is_admin() || function_exists('p2_date_time_with_microformat') || function_exists('bnc_is_iphone') && bnc_is_iphone()) {
         return;
     }
     load_plugin_textdomain('localtime', false, dirname(plugin_basename(__FILE__)) . '/localization/');
     // Inject HTML into the various date/time functions
     add_filter('get_the_date', array(&$this, 'add_html'), 1, 2);
     add_filter('get_post_time', array(&$this, 'add_html'), 1, 2);
     add_filter('get_comment_date', array(&$this, 'add_html'), 1, 2);
     add_filter('get_comment_time', array(&$this, 'add_html'), 1, 2);
     // Enqueue the script
     wp_enqueue_script('localtime', plugins_url('localtime.js', __FILE__), array('jquery', 'utils'), $this->version);
     $localization = array();
     $localization['translated_title'] = __('This date and/or time has been adjusted to match your timezone', 'localtime');
     // The localization functionality can't handle objects, that's why
     // we are using poor man's hash maps here -- using prefixes of the variable names
     foreach ($wp_locale->month as $key => $month) {
         $localization['locale']["month_{$key}"] = $month;
     }
     $i = 1;
     foreach ($wp_locale->month_abbrev as $key => $month) {
         $localization['locale']["monthabbrev_" . sprintf('%02d', $i++)] = $month;
     }
     foreach ($wp_locale->weekday as $key => $day) {
         $localization['locale']["weekday_{$key}"] = $day;
     }
     $i = 1;
     foreach ($wp_locale->weekday_abbrev as $key => $day) {
         $localization['locale']["weekdayabbrev_" . sprintf('%02d', $i++)] = $day;
     }
     wp_localize_script('localtime', 'localtime', $localization);
 }
function wptouch_core_header_check_use()
{
    if (false && function_exists('bnc_is_iphone') && !bnc_is_iphone()) {
        echo '<div class="content post">';
        echo sprintf(__("%sWarning%s", "wptouch"), '<a href="#" class="h2">', '</a>');
        echo '<div class="mainentry">';
        echo __("Sorry, this theme is only meant for use with WordPress on certain smartphones.", "wptouch");
        echo '</div></div>';
        echo '' . get_footer() . '';
        echo '</body>';
        die;
    }
}
Esempio n. 3
0
function wptouch_switch()
{
    global $wptouch_plugin;
    if (bnc_is_iphone() && $wptouch_plugin->desired_view == 'normal') {
        echo '<div id="wptouch-switch-link">';
        _e("Mobile Theme", "wptouch");
        echo "<a onclick=\"document.getElementById('switch-on').style.display='block';document.getElementById('switch-off').style.display='none';\" href=\"" . get_bloginfo('siteurl') . "/?theme_view=mobile&wptouch_redirect=" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\"><img id=\"switch-on\" src=\"" . compat_get_plugin_url('wptouch') . "/themes/core/core-images/on.jpg\" alt=\"on switch image\" class=\"wptouch-switch-image\" style=\"display:none\" /><img id=\"switch-off\" src=\"" . compat_get_plugin_url('wptouch') . "/themes/core/core-images/off.jpg\" alt=\"off switch image\" class=\"wptouch-switch-image\" /></a>";
        echo '</div>';
    }
}
Esempio n. 4
0
function wptouch_switch()
{
    global $wptouch_plugin;
    if (bnc_is_iphone() && $wptouch_plugin->desired_view == 'normal') {
        echo '<div id="switch">';
        _e("Mobile Theme", "wptouch");
        echo '<div>';
        echo "<a id='switch-link' onclick=\"var addActive = document.getElementById('switch-on'); addActive.className = addActive.className + ' active';var removeActive = document.getElementById('switch-off'); removeActive.className = ' ';\" href=\"" . home_url() . "/?wptouch_view=mobile&wptouch_redirect_nonce=" . wp_create_nonce('wptouch_redirect') . "&wptouch_redirect=" . urlencode($_SERVER['REQUEST_URI']) . "\">";
        echo '<span id="switch-on">ON</span>';
        echo '<span id="switch-off" class="active">OFF</span>';
        echo '</a>';
        echo '</div></div>';
    }
}
 private function _is_mobile()
 {
     $is_mobile = $this->isKtai();
     if (!$is_mobile && function_exists('bnc_is_iphone')) {
         global $wptouch_plugin;
         $is_mobile = bnc_is_iphone();
         if ($is_mobile && isset($wptouch_plugin)) {
             $is_mobile = isset($wptouch_plugin->desired_view) ? $wptouch_plugin->desired_view == 'mobile' : true;
         }
     }
     return $is_mobile;
 }