Example #1
0
function wptouch_show_children($template_name, $absolute_path = false)
{
    global $wptouch_menu_item;
    global $wptouch_menu_items;
    global $wptouch_menu_iterator;
    // save old items
    $old_items = $wptouch_menu_items;
    $old_iterator = $wptouch_menu_iterator;
    $wptouch_menu_items = $wptouch_menu_item->submenu;
    $wptouch_menu_iterator = new WPtouchArrayIterator($wptouch_menu_items);
    if ($absolute_path) {
        include $template_name;
    } else {
        wptouch_do_template($template_name);
    }
    // restore state of old items
    $wptouch_menu_items = $old_items;
    $wptouch_menu_iterator = $old_iterator;
}
Example #2
0
 function init_theme()
 {
     $settings = $this->get_settings();
     $this->inject_dynamic_javascript();
     if ($settings->footer_message) {
         add_action('wp_footer', array(&$this, 'show_custom_footer_message'));
     }
     if ($settings->show_wptouch_in_footer) {
         add_action('wp_footer', array(&$this, 'show_wptouch_message_in_footer'));
     }
     if ($settings->custom_stats_code) {
         add_action('wp_footer', array(&$this, 'put_stats_in_footer'));
     }
     if ($settings->show_footer_load_times) {
         add_action('wp_footer', array(&$this, 'show_footer_load_time'));
     }
     if ($settings->custom_css_file) {
         add_action('wp_footer', array(&$this, 'inject_custom_css_in_footer'));
     }
     // Setup advertising
     if ($settings->advertising_type != 'none' || $settings->ipad_advertising_type != 'none') {
         switch ($settings->advertising_location) {
             case 'footer':
                 add_action('wptouch_advertising_bottom', array(&$this, 'handle_advertising'));
                 break;
             case 'header':
                 add_action('wptouch_advertising_top', array(&$this, 'handle_advertising'));
                 break;
             default:
                 WPTOUCH_DEBUG(WPTOUCH_WARNING, 'Unknown advertising location: ' . $settings->advertising_location);
                 break;
         }
     }
     wp_enqueue_script('wptouch-ajax', get_wptouch_url() . '/include/js/wptouch.js', array('jquery'), md5(WPTOUCH_VERSION));
     $localize_params = array('ajaxurl' => get_bloginfo('wpurl') . '/wp-admin/admin-ajax.php', 'siteurl' => str_replace(array('http://' . $_SERVER['SERVER_NAME'] . '', 'https://' . $_SERVER['SERVER_NAME'] . ''), '', get_bloginfo('url') . '/'), 'SITETITLE' => str_replace(' ', '', get_bloginfo('title')), 'security_nonce' => wp_create_nonce('wptouch-ajax'), 'expiryDays' => $settings->classic_webapp_notice_expiry_days);
     wp_localize_script('wptouch-ajax', 'WPtouch', apply_filters('wptouch_localize_scripts', $localize_params));
     do_action('wptouch_init');
     // Do the theme init
     do_action('wptouch_theme_init');
     // Load the language file
     if ($this->locale) {
         do_action('wptouch_theme_language', $this->locale);
     }
     // Do custom page templates
     if (isset($this->get['wptouch_page_template'])) {
         $page_name = false;
         foreach ($this->custom_page_templates as $name => $template_name) {
             if ($template_name[0] == $this->get['wptouch_page_template']) {
                 $page_name = $name;
                 break;
             }
         }
         if ($page_name) {
             $this->is_custom_page_template = true;
             $menu_items = $this->add_static_menu_items(array());
             if (isset($menu_items[$page_name])) {
                 $this->custom_page_template_id = $menu_items[$page_name]->page_id;
             }
             $template_file = basename($this->get['wptouch_page_template']);
             if (!wptouch_do_template($template_file . '.php')) {
                 echo "Unable to locate template file " . $template_file;
             }
         }
         die;
     }
     $this->disable_plugins();
 }