diff --git a/mobilepress.php b/mobilepress.php new file mode 100644 index 0000000..b3c54b0 --- /dev/null +++ b/mobilepress.php @@ -0,0 +1,87 @@ +create_admin(); + } + else + { + // Start a session if not started already + if ( ! session_id()) + { + @session_start(); + } + + // Load the ad/analytics helpers + require_once(dirname(__FILE__) . '/system/helpers/ad_analytics_functions.php'); + + // Initialize the MobilePress check logic and rendering + $mobilepress->load_site(); + } +} + +// Are we uninstalling the plugin? +if (function_exists('register_uninstall_hook')) +{ + register_uninstall_hook(__FILE__, 'mopr_load_uninstall'); +} + +if ( ! function_exists('mopr_load_uninstall')) +{ + function mopr_load_uninstall() + { + require_once(dirname(__FILE__) . '/system/classes/uninstall.php'); + $uninstall = new MobilePress_uninstall; + } +} +?> \ No newline at end of file diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..9ec3f8e --- /dev/null +++ b/readme.txt @@ -0,0 +1,70 @@ +=== MobilePress === +Contributors: mattgeri, tylerreed +Tags: mobile, iphone, android, mobilepress, cell phone, cellphone, handset, nokia, motorola, att, sprint, verizon, blackberry, palm, windows ce, opera, operamini, opera mini, google, yahoo, plugin, comments, posts +Requires at least: 2.3 +Tested up to: 2.8.6 +Stable tag: 1.1.4 + +MobilePress is a WordPress plugin that will render your WordPress blog on mobile +handsets, with the ability to use customized mobile themes, track analytics and +serve ads. + + +== Description == + +MobilePress is a WordPress plugin that will render your WordPress blog on mobile +handsets, with the ability to use customized themes. Built into MobilePress is the +ability to track your mobile sites analytics and serve ads with [Aduity.com](http://aduity.com). + +Integration with [Aduity.com](http://aduity.com) enables you to serve ads from some of the biggest +mobile ad networks such as Admob, Quattro Wireless, Buzzcity and InMobi. You can +also serve you own managed ads. You will also be able to track your visitors every +move with Aduity analytics. + +The plugin allows WordPress theme developers to create custom mobile themes for +MobilePress enabled blogs. Theme designers can create specific iPhone themes or +generic mobile themes for other mobile devices. + +MobilePress is SEO enabled and detects Google, Yahoo and MSN mobile search bots. +These mobile search engine bots will see the mobile version of your blog and get +your mobile site indexed in the mobile search results. + +For more information and a full set of docs, please visit the official MobilePress +website at [MobilePress.co.za](http://mobilepress.co.za) + + +== Installation == + +Installation instructions available at: [MobilePress.co.za](http://mobilepress.co.za/download/installation) + + +== Config & Settings == + +Once successfully installed, you will be presented with a few options. + += Blog Title = + +Changing this will replace the title of your blog when being viewed on a +mobile device. So, instead of "My cool blog", you could replace it with +something like "My mobile blog". This will not affect your site when being +viewed on a regular web browser. + += Blog Description = + +This is the same as changing your blog title, but will modify your blog's +description instead. + += Force Mobile Site = + +This option will force your site to be rendered as mobile, regardless of where +it is being viewed from. Regular web browsers will see the mobile version. + + +== Frequently Asked Questions == + +FAQ available at: [MobilePress.co.za](http://mobilepress.co.za/support) + + +== Screenshots == + +Screenshots are available at: [MobilePress.co.za](http://mobilepress.co.za) \ No newline at end of file diff --git a/system/classes/admin.php b/system/classes/admin.php new file mode 100644 index 0000000..c2ce0b2 --- /dev/null +++ b/system/classes/admin.php @@ -0,0 +1,645 @@ +

MobilePress table is empty!

'; + mopr_display_notice($message); + } + else + { + // Check if an upgrade is needed + if (MOPR_DBVERSION < MOPR_VERSION) + { + $message = '

Your MobilePress install is not the latest version!

'; + mopr_display_notice($message); + } + } + } + else + { + // If the table doesnt exist throw message to create it + $message = '

MobilePress table does not exist!

'; + mopr_display_notice($message); + } + } + + /** + * Renders the MobilePress ads and analytics page + * + * @package MobilePress + * @since 1.1 + */ + function render_ads_analytics() + { + if (isset($_POST['add'])) + { + global $wpdb; + + // Options to be added + $updates = array( + 'aduity_account_public_key' => $_POST['apk'], + 'aduity_account_secret_key' => $_POST['ask'] + ); + + // Update the options table + foreach ($updates as $name => $update) + { + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_value = '%s' + WHERE + option_name = '" . $name . "' + ", $update) + ); + } + } + else if (isset($_POST['edit'])) + { + global $wpdb; + + if ( ! isset($_POST['error'])) + { + // Options to be edited + $updates = array( + 'aduity_account_public_key' => $_POST['apk'], + 'aduity_account_secret_key' => $_POST['ask'], + 'aduity_analytics_enabled' => $_POST['analytics_enabled'], + 'aduity_ads_enabled' => $_POST['ads_enabled'], + 'aduity_debug_mode' => $_POST['debug_mode'], + 'aduity_ads_type' => $_POST['type'], + 'aduity_ads_campaign' => $_POST['campaign'], + 'aduity_ads_ad' => $_POST['ad'], + 'aduity_ads_location' => $_POST['location'] + ); + } + else + { + // Options to be edited + $updates = array( + 'aduity_account_public_key' => $_POST['apk'], + 'aduity_account_secret_key' => $_POST['ask'] + ); + } + + // Update the options table + foreach ($updates as $name => $update) + { + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_value = '%s' + WHERE + option_name = '" . $name . "' + ", $update) + ); + } + + mopr_display_notice("

Options Saved

"); + } + + $apk = mopr_get_option('aduity_account_public_key'); + $ask = mopr_get_option('aduity_account_secret_key'); + + // Check if they have setup their account yet + if ($apk == '' || $ask == '') + { + // Load ads and analytics setup view + mopr_load_view('admin_ads_analytics_setup'); + } + else + { + $data['apk'] = $apk; + $data['ask'] = $ask; + $data['analytics_enabled'] = mopr_get_option('aduity_analytics_enabled'); + $data['ads_enabled'] = mopr_get_option('aduity_ads_enabled'); + $data['debug_mode'] = mopr_get_option('aduity_debug_mode'); + $data['type'] = mopr_get_option('aduity_ads_type'); + $data['campaign'] = mopr_get_option('aduity_ads_campaign'); + $data['ad'] = mopr_get_option('aduity_ads_ad'); + $data['location'] = mopr_get_option('aduity_ads_location'); + + // Load libraries + $json = mopr_load_json_library(); + $aduity = mopr_load_aduity_api_library($apk, $ask); + + // Lets do some checks + $validate = $json->decode($aduity->request('validate')); + + if ($validate->response == 'ok') + { + // Lets get the url of their Aduity account + $data['url'] = $json->decode($aduity->request('get_account_url')); + $data['url'] = $data['url']->url; + + // Importantly, we need to make sure this blog matches a site added to their Aduity account + $sites = $json->decode($aduity->request('get_sites')); + $spk = mopr_get_option('aduity_site_public_key'); + + $domain = str_replace('http://', '', str_replace('https://', '', $_SERVER['HTTP_HOST'])); + $domain = str_replace('www.', '', $domain); + $domain = explode('/', $domain); + $domain = $domain[0]; + + if ($sites->response == 'ok') + { + foreach ($sites->sites as $site_data) + { + if ($domain == $site_data->site_domain) + { + if ($spk != $site_data->site_public_key) + { + global $wpdb; + + // Update site public key + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_value = '%s' + WHERE + option_name = 'aduity_site_public_key' + ", $site_data->site_public_key) + ); + + $updated = TRUE; + } + else if ($spk == $site_data->site_public_key) + { + $updated = TRUE; + } + } + } + } + + if ( ! isset($updated)) + { + // Display site error + mopr_display_notice('

This domain has not been added to your Aduity account, please add it.

'); + } + + if ($data['debug_mode']) + { + // Display debug warning + mopr_display_notice('

Warning! Debug mode is enabled, thus ads will be displayed but not counted and analytics will not be tracked

'); + } + + // Get campaigns + $data['campaigns'] = $json->decode($aduity->request('get_campaigns')); + + if ($data['campaigns']->response == 'ok') + { + $data['campaigns'] = $data['campaigns']->campaigns; + } + else + { + $data['campaigns'] = NULL; + } + + // Get ads + $data['ads'] = $json->decode($aduity->request('get_ads')); + + if ($data['ads']->response == 'ok') + { + $data['ads'] = $data['ads']->ads; + } + else + { + $data['ads'] = NULL; + } + } + else if ($validate->response == 'error') + { + // Deal with validation error here + mopr_display_notice("

Invalid account public key or account secret key, please check keys and try again.

"); + + // Tell view we have a validation error + $data['validation_error'] = TRUE; + } + + // Load ads and analytics view + mopr_load_view('admin_ads_analytics', $data); + } + } + + /** + * Renders the MobilePress options page + * + * @package MobilePress + * @since 1.0 + */ + function render_options() + { + if (isset($_POST['save'])) + { + global $wpdb; + + $themes_directory = trim($_POST['themes_directory'], '/'); + + // Options to be added + $updates = array( + 'title' => $_POST['title'], + 'description' => $_POST['description'], + 'force_mobile' => $_POST['force_mobile'], + 'themes_directory' => $themes_directory + ); + + // Update the options table + foreach ($updates as $name => $update) + { + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_value = '%s' + WHERE + option_name = '" . $name . "' + ", $update) + ); + } + + mopr_display_notice("

Options Saved

"); + + $update_success = TRUE; + } + else if (isset($_POST['upgrade'])) + { + require_once(MOPR_PATH . 'classes/install.php'); + $upgrade = new MobilePress_install; + + mopr_display_notice("

MobilePress Upgraded

"); + + $update_success = TRUE; + } + else if (isset($_POST['create'])) + { + require_once(MOPR_PATH . 'classes/install.php'); + $install = new MobilePress_install; + + mopr_display_notice("

MobilePress table has been created

"); + + $update_success = TRUE; + } + else if (isset($_POST['add'])) + { + require_once(MOPR_PATH . 'classes/install.php'); + $install = new MobilePress_install; + $install->add_defaults(); + + mopr_display_notice("

MobilePress options have been added to your table

"); + + $update_success = TRUE; + } + + // Options to send to view + $data['title'] = mopr_get_option('title', 1); + $data['description'] = mopr_get_option('description', 1); + $data['force_mobile'] = mopr_get_option('force_mobile', 1); + $data['themes_directory'] = mopr_get_option('themes_directory', 1); + + // Check if table exists and if version is out dated, display appropriate message + // Since we cannot redefine a constant (i.e. our version), we only run the checks if we have not just upgraded/updated + if ( ! isset($update_success)) + { + $this->initial_checks(); + } + + // Load options view + mopr_load_view('admin_options', $data); + } + + /** + * Renders the themes page + * + * @package MobilePress + * @since 1.0 + */ + function render_themes() + { + // What theme are we dealing with? + if (isset($_GET['section'])) + { + $section = $_GET['section']; + $current_theme = mopr_get_option($section, 2); + + if ($section == 'iphone_theme') + { + $data['browser'] = "iPhone Browser"; + } + else if ($section == 'default_theme') + { + $data['browser'] = "Default Browser"; + } + } + else + { + $section = "default_theme"; + $current_theme = mopr_get_option($section, 2); + $data['browser'] = "Default Browser"; + } + + // Do we need to activate a theme? + if (isset($_GET['action']) == "activate") + { + global $wpdb; + + $template = $_GET['template']; + $theme_name = $_GET['theme']; + + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_value = '%s', + option_value_2 = '%s' + WHERE + option_name = '%s' + ", $template, $theme_name, $section) + ); + + $message = "

" . $theme_name . " has been activated for the " . $data['browser'] . "

"; + + // Update the current theme (we've just changed it) + $current_theme = $theme_name; + + mopr_display_notice($message); + } + + // Check if table exists and if version is out dated, display appropriate message + $this->initial_checks(); + + // Data to be passed to view + $data['section'] = $section; + $data['current_theme'] = $current_theme; + $data['themes'] = $this->select_themes($section); + + // Load the theme view + mopr_load_view('admin_themes', $data); + } + + /** + * Function to check if themes exist and if default theme exists, if so, returns the themes + * + * @package MobilePress + * @since 1.1.1 + */ + function select_themes($section) + { + // Get the defaul themes + $default_themes = $this->get_themes(MOPR_ROOT_PATH . "system/themes"); + + // Get any themes from the users local theme directory + $local_themes = $this->get_themes(rtrim(WP_CONTENT_DIR, '/') . '/' . mopr_get_option('themes_directory', 1)); + + if (is_array($default_themes) && is_array($local_themes)) + { + // Merge themes + $themes = array_merge($default_themes, $local_themes); + ksort($themes); + } + else if (is_array($default_themes)) + { + $themes = $default_themes; + ksort($themes); + } + else if (is_array($local_themes)) + { + $themes = $local_themes; + ksort($themes); + } + else + { + $themes = array(); + } + + if (empty($themes)) + { + $message = "

Please upload a theme to your mobilepress themes directory!

"; + mopr_display_notice($message); + return false; + } + else + { + if (empty($themes['Default']['Title'])) + { + $message = "

You need to upload the default theme!

"; + mopr_display_notice($message); + return false; + } + else + { + return $themes; + } + } + } + + // ---------------------------------------- + // CORE WORDPRESS FUNCTIONS FOR THEME VIEWS + // ---------------------------------------- + + /** + * Core WP function for getting themes (with a few modifications) - located at: wp-includes/theme.php + * + * @package MobilePress + * @since 1.0 + */ + function get_themes($directory) { + $themes = array(); + $theme_loc = $theme_root = $directory; + + // Files in wp-content/themes directory and one subdir down + $themes_dir = @ opendir($theme_root); + if ( !$themes_dir ) + return false; + + while ( ($theme_dir = readdir($themes_dir)) !== false ) { + if ( is_dir($theme_root . '/' . $theme_dir) && is_readable($theme_root . '/' . $theme_dir) ) { + if ( $theme_dir{0} == '.' || $theme_dir == '..' || $theme_dir == 'CVS' ) + continue; + $stylish_dir = @ opendir($theme_root . '/' . $theme_dir); + $found_stylesheet = false; + while ( ($theme_file = readdir($stylish_dir)) !== false ) { + if ( $theme_file == 'style.css' ) { + $theme_files[] = $theme_dir . '/' . $theme_file; + $found_stylesheet = true; + break; + } + } + @closedir($stylish_dir); + if ( !$found_stylesheet ) { // look for themes in that dir + $subdir = "$theme_root/$theme_dir"; + $subdir_name = $theme_dir; + $theme_subdir = @ opendir( $subdir ); + while ( ($theme_dir = readdir($theme_subdir)) !== false ) { + if ( is_dir( $subdir . '/' . $theme_dir) && is_readable($subdir . '/' . $theme_dir) ) { + if ( $theme_dir{0} == '.' || $theme_dir == '..' || $theme_dir == 'CVS' ) + continue; + $stylish_dir = @ opendir($subdir . '/' . $theme_dir); + $found_stylesheet = false; + while ( ($theme_file = readdir($stylish_dir)) !== false ) { + if ( $theme_file == 'style.css' ) { + $theme_files[] = $subdir_name . '/' . $theme_dir . '/' . $theme_file; + $found_stylesheet = true; + break; + } + } + @closedir($stylish_dir); + } + } + @closedir($theme_subdir); + $wp_broken_themes[$theme_dir] = array('Name' => $theme_dir, 'Title' => $theme_dir, 'Description' => __('Stylesheet is missing.')); + } + } + } + if ( is_dir( $theme_dir ) ) + @closedir( $theme_dir ); + + if ( !$themes_dir || !$theme_files ) + return $themes; + + sort($theme_files); + + foreach ( (array) $theme_files as $theme_file ) { + if ( !is_readable("$theme_root/$theme_file") ) { + $wp_broken_themes[$theme_file] = array('Name' => $theme_file, 'Title' => $theme_file, 'Description' => __('File not readable.')); + continue; + } + + $theme_data = get_theme_data("$theme_root/$theme_file"); + + $name = $theme_data['Name']; + $title = $theme_data['Title']; + $description = wptexturize($theme_data['Description']); + $version = $theme_data['Version']; + $author = $theme_data['Author']; + $template = $theme_data['Template']; + $stylesheet = dirname($theme_file); + + $screenshot = false; + foreach ( array('png', 'gif', 'jpg', 'jpeg') as $ext ) { + if (file_exists("$theme_root/$stylesheet/screenshot.$ext")) { + $screenshot = "screenshot.$ext"; + break; + } + } + + if ( empty($name) ) { + $name = dirname($theme_file); + $title = $name; + } + + if ( empty($template) ) { + if ( file_exists(dirname("$theme_root/$theme_file/index.php")) ) + $template = dirname($theme_file); + else + continue; + } + + $template = trim($template); + + if ( !file_exists("$theme_root/$template/index.php") ) { + $parent_dir = dirname(dirname($theme_file)); + if ( file_exists("$theme_root/$parent_dir/$template/index.php") ) { + $template = "$parent_dir/$template"; + } else { + $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.')); + continue; + } + } + + $stylesheet_files = array(); + $stylesheet_dir = @ dir("$theme_root/$stylesheet"); + if ( $stylesheet_dir ) { + while ( ($file = $stylesheet_dir->read()) !== false ) { + if ( !preg_match('|^\.+$|', $file) && preg_match('|\.css$|', $file) ) + $stylesheet_files[] = "$theme_loc/$stylesheet/$file"; + } + } + + $template_files = array(); + $template_dir = @ dir("$theme_root/$template"); + if ( $template_dir ) { + while(($file = $template_dir->read()) !== false) { + if ( !preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file) ) + $template_files[] = "$theme_loc/$template/$file"; + } + } + + $template_dir = dirname($template_files[0]); + $stylesheet_dir = dirname($stylesheet_files[0]); + + if ( empty($template_dir) ) + $template_dir = '/'; + if ( empty($stylesheet_dir) ) + $stylesheet_dir = '/'; + + // Check for theme name collision. This occurs if a theme is copied to + // a new theme directory and the theme header is not updated. Whichever + // theme is first keeps the name. Subsequent themes get a suffix applied. + // The Default always trump their pretenders. + if ( isset($themes[$name]) ) { + if ( ('Default' == $name) && + ('default' == $stylesheet) ) { + // If another theme has claimed to be one of our default themes, move + // them aside. + $suffix = $themes[$name]['Stylesheet']; + $new_name = "$name/$suffix"; + $themes[$new_name] = $themes[$name]; + $themes[$new_name]['Name'] = $new_name; + } else { + $name = "$name/$stylesheet"; + } + } + + $themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files, 'Template Dir' => $template_dir, 'Stylesheet Dir' => $stylesheet_dir, 'Status' => $theme_data['Status'], 'Screenshot' => $screenshot, 'Tags' => $theme_data['Tags'], 'Theme Root' => $theme_root, 'Theme Root URI' => str_replace( WP_CONTENT_DIR, content_url(), $theme_root ) ); + } + + // Resolve theme dependencies. + $theme_names = array_keys($themes); + + foreach ( (array) $theme_names as $theme_name ) { + $themes[$theme_name]['Parent Theme'] = ''; + if ( $themes[$theme_name]['Stylesheet'] != $themes[$theme_name]['Template'] ) { + foreach ( (array) $theme_names as $parent_theme_name ) { + if ( ($themes[$parent_theme_name]['Stylesheet'] == $themes[$parent_theme_name]['Template']) && ($themes[$parent_theme_name]['Template'] == $themes[$theme_name]['Template']) ) { + $themes[$theme_name]['Parent Theme'] = $themes[$parent_theme_name]['Name']; + break; + } + } + } + } + + return $themes; + } + } +} +?> \ No newline at end of file diff --git a/system/classes/check.php b/system/classes/check.php new file mode 100644 index 0000000..c7cad3f --- /dev/null +++ b/system/classes/check.php @@ -0,0 +1,89 @@ +theme = mopr_get_option('default_theme', 1); + + // If viewing the mobile website + switch(TRUE) + { + // ?mobile accesses the mobile version of the website + case (isset($_GET['mobile'])): + $browser = "mobile"; + $activated = TRUE; + break; + + // If forcing iphone theme + case (isset($_GET['iphone'])): + $browser = "iphone"; + $activated = TRUE; + $theme = mopr_get_option('iphone_theme',1); + break; + + // ?nomobile renders the orignial website + case (isset($_GET['nomobile'])): + $activated = FALSE; + $theme = ''; + break; + + // Apple/iPhone browser renders as mobile + case (preg_match('/(apple|iphone|ipod)/i', $_SERVER['HTTP_USER_AGENT']) && preg_match('/mobile/i', $_SERVER['HTTP_USER_AGENT'])): + $browser = "iphone"; + $activated = TRUE; + $theme = mopr_get_option('iphone_theme',1); + break; + + // Other mobile browsers render as mobile + case (preg_match('/(blackberry|configuration\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|treo|up.browser|up.link|vodafone|windows ce|xda |xda_)/i', $_SERVER['HTTP_USER_AGENT'])): + $browser = "mobile"; + $activated = TRUE; + break; + + // Wap browser + case (((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'text/vnd.wap.wml') > 0) || (strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')>0)) || ((isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])))): + $activated = TRUE; + break; + + // Shortend user agents + case (in_array(strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,3)),array('lg '=>'lg ','lg-'=>'lg-','lg_'=>'lg_','lge'=>'lge'))); + $browser = "mobile"; + $activated = TRUE; + break; + + // More shortend user agents + case (in_array(strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4)),array('acs-'=>'acs-','amoi'=>'amoi','doco'=>'doco','eric'=>'eric','huaw'=>'huaw','lct_'=>'lct_','leno'=>'leno','mobi'=>'mobi','mot-'=>'mot-','moto'=>'moto','nec-'=>'nec-','phil'=>'phil','sams'=>'sams','sch-'=>'sch-','shar'=>'shar','sie-'=>'sie-','wap_'=>'wap_','zte-'=>'zte-'))); + $browser = "mobile"; + $activated = TRUE; + break; + + // Render mobile site for mobile search engines + case (preg_match('/Googlebot-Mobile/i', $_SERVER['HTTP_USER_AGENT']) || preg_match('/YahooSeeker\/M1A1-R2D2/i', $_SERVER['HTTP_USER_AGENT'])): + $browser = "mobile"; + $activated = TRUE; + break; + } + + $_SESSION['MOPR_MOBILE_BROWSER'] = $browser; + $_SESSION['MOPR_MOBILE_ACTIVE'] = $activated; + $_SESSION['MOPR_MOBILE_THEME'] = $theme; + } + + } +} +?> \ No newline at end of file diff --git a/system/classes/core.php b/system/classes/core.php new file mode 100644 index 0000000..8f4ecb1 --- /dev/null +++ b/system/classes/core.php @@ -0,0 +1,137 @@ +init(); + } + + // Set the browser variable + $browser = $_SESSION['MOPR_MOBILE_BROWSER']; + + // This is for testing mobile themes in a normal browser and mobile browsers, resets browser session if you are switching between mobile browsers + if ((isset($_GET['mobile']) && ($browser != "mobile")) || (isset($_GET['iphone']) && ($browser != "iphone"))) + { + require_once(MOPR_PATH . 'classes/check.php'); + $checkmobile = new MobilePress_check; + $checkmobile->init(); + + // Reset the browser variable + $browser = $_SESSION['MOPR_MOBILE_BROWSER']; + } + + 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('default_theme', 1); + } + + // Render time! + require_once(MOPR_PATH . 'classes/render.php'); + $render = new MobilePress_render(); + $render->init(); + } + else + { + // MOPR_MOBILE_ACTIVE has explicitly been set to false. Either by following nomobile link, or there were no matches in the detection script (We're using a web browser) + } + } + + } +} +?> \ No newline at end of file diff --git a/system/classes/install.php b/system/classes/install.php new file mode 100644 index 0000000..368f24f --- /dev/null +++ b/system/classes/install.php @@ -0,0 +1,274 @@ +upgrade(); + } + else + { + $this->setup_table(); + $this->add_defaults(); + } + } + + /** + * Inserts default values into the MobilePress database + * + * @package MobilePress + * @since 1.0 + */ + function add_defaults() + { + global $wpdb; + + // Add default options + $sql = "INSERT INTO " . MOPR_TABLE . " ( + option_name, + option_value, + option_value_2 + ) + VALUES + ('version', '" . MOPR_VERSION . "', ''), + ('title', '', ''), + ('description', '', ''), + ('themes_directory', 'mobile-themes', ''), + ('default_theme', 'default', 'Default'), + ('iphone_theme', 'iphone', 'iPhone'), + ('force_mobile', '0', ''), + ('aduity_account_public_key', '', ''), + ('aduity_account_secret_key', '', ''), + ('aduity_site_public_key', '', ''), + ('aduity_ads_enabled', '0', ''), + ('aduity_analytics_enabled', '0', ''), + ('aduity_debug_mode', '0', ''), + ('aduity_ads_type', '0', ''), + ('aduity_ads_campaign', '0', ''), + ('aduity_ads_ad', '0', ''), + ('aduity_ads_location', '0', '') + "; + + $results = $wpdb->query($sql); + } + + /** + * Creates the MobilePress Table + * + * @package MobilePress + * @since 1.0 + */ + function setup_table() + { + $sql = " + CREATE TABLE " . MOPR_TABLE . " ( + id mediumint(9) NOT NULL AUTO_INCREMENT, + option_name VARCHAR(100) NOT NULL, + option_value VARCHAR(100) NOT NULL, + option_value_2 VARCHAR(100) NOT NULL, + UNIQUE KEY id (id)) + ENGINE = MYISAM + CHARACTER SET utf8 + COLLATE utf8_unicode_ci; + "; + + // Require upgrade.php from the CORE + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + dbDelta($sql); + } + + /** + * Upgrades the plugin database if it is outdated + * + * @package MobilePress + * @since 1.0.2 + */ + function upgrade() + { + global $wpdb; + + if (MOPR_DBVERSION < '1.0.2') + $this->upgrade_102(); + + if (MOPR_DBVERSION < '1.1') + $this->upgrade_110(); + + if (MOPR_DBVERSION < '1.1.1') + $this->upgrade_111(); + + // Change the version in the database to the latest version after upgrade + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_value = '%s' + WHERE + option_name = 'version' + ", MOPR_VERSION) + ); + } + + /** + * Critical upgrades for plugin version 1.0.2 and lower + * + * @package MobilePress + * @since 1.0.2 + */ + function upgrade_102() + { + global $wpdb; + + // First delete any duplicate DB entries that may have been caused by a bug prior to version 1.0.2 + $sql = "DELETE FROM " . MOPR_TABLE . " WHERE id > 11"; + $delete = $wpdb->query($sql); + + // Reset auto increment + $sql = "ALTER TABLE " . MOPR_TABLE . " AUTO_INCREMENT = 1"; + $reset = $wpdb->query($sql); + } + + /** + * Upgrades for plugin version 1.1 and lower + * + * @package MobilePress + * @since 1.1 + */ + function upgrade_110() + { + global $wpdb; + + // First we needa alter the option_value2 column name + $sql = "ALTER TABLE " . MOPR_TABLE . " CHANGE option_value2 option_value_2 VARCHAR(100) NOT NULL"; + $reset = $wpdb->query($sql); + + // Delete options we no longer need + $sql = "DELETE FROM " . MOPR_TABLE . " WHERE option_name = 'windowstheme'"; + $delete = $wpdb->query($sql); + + $sql = "DELETE FROM " . MOPR_TABLE . " WHERE option_name = 'operamtheme'"; + $delete = $wpdb->query($sql); + + $sql = "DELETE FROM " . MOPR_TABLE . " WHERE option_name = 'iswebbrowser_iphone'"; + $delete = $wpdb->query($sql); + + $sql = "DELETE FROM " . MOPR_TABLE . " WHERE option_name = 'iswebbrowser_windows'"; + $delete = $wpdb->query($sql); + + $sql = "DELETE FROM " . MOPR_TABLE . " WHERE option_name = 'iswebbrowser_operamini'"; + $delete = $wpdb->query($sql); + + // Update some changed options + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_name = '%s' + WHERE + option_name = 'defaulttheme' + ", "default_theme") + ); + + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_name = '%s' + WHERE + option_name = 'iphonetheme' + ", "iphone_theme") + ); + + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_name = '%s' + WHERE + option_name = 'forcemobile' + ", "force_mobile") + ); + + // Change option values from "true" to "1" and "false" to "0" + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_value = '%s' + WHERE + option_value = 'true' + ", "1") + ); + + $wpdb->query( + $wpdb->prepare(" + UPDATE + " . MOPR_TABLE . " + SET + option_value = '%s' + WHERE + option_value = 'false' + ", "0") + ); + + // Insert new options + $sql = "INSERT INTO " . MOPR_TABLE . " ( + option_name, + option_value, + option_value_2 + ) + VALUES + ('aduity_account_public_key', '', ''), + ('aduity_account_secret_key', '', ''), + ('aduity_site_public_key', '', ''), + ('aduity_ads_enabled', '0', ''), + ('aduity_analytics_enabled', '0', ''), + ('aduity_ads_type', '0', ''), + ('aduity_ads_campaign', '0', ''), + ('aduity_ads_ad', '0', ''), + ('aduity_ads_location', '0', '') + "; + + $results = $wpdb->query($sql); + } + + function upgrade_111() + { + global $wpdb; + + // Insert new options + $sql = "INSERT INTO " . MOPR_TABLE . " ( + option_name, + option_value, + option_value_2 + ) + VALUES + ('themes_directory', 'mobile-themes', ''), + ('aduity_debug_mode', '0', '') + "; + + $results = $wpdb->query($sql); + } + } +} +?> \ No newline at end of file diff --git a/system/classes/render.php b/system/classes/render.php new file mode 100644 index 0000000..5fdd6ff --- /dev/null +++ b/system/classes/render.php @@ -0,0 +1,189 @@ +default_theme = mopr_get_option('default_theme', 1); + $this->title = mopr_get_option('title', 1); + $this->description = mopr_get_option('description', 1); + } + + /** + * Initialize the rendering of the mobile website + * + * @package MobilePress + * @since 1.0 + */ + function init() + { + add_filter('stylesheet', array(&$this, 'set_stylesheet')); + add_filter('theme_root', array(&$this, 'set_theme_root')); + add_filter('theme_root_uri', array(&$this, 'set_theme_uri')); + add_filter('template', array(&$this, 'set_template')); + + if ($this->title != '') + { + add_filter('option_blogname', array(&$this, 'set_title')); + } + + if ($this->description != '') + { + add_filter('option_blogdescription', array(&$this, 'set_description')); + } + } + + /** + * Returns the mobile blogs description + * + * @package MobilePress + * @since 1.0 + * @return STRING The mobile blogs description + */ + function set_description() + { + return $this->description; + } + + /** + * Sets the stylesheet to the themes mobile stylesheet + * + * @package MobilePress + * @since 1.0 + * @return STRING Name of the theme where the stylesheet will be called + */ + function set_stylesheet() + { + if ( ! isset($_SESSION['MOPR_MOBILE_THEME']) || trim($_SESSION['MOPR_MOBILE_THEME']) == '') + { + $stylesheet = $this->default_theme; + } + else + { + $stylesheet = $_SESSION['MOPR_MOBILE_THEME']; + } + + return $stylesheet; + } + + /** + * Sets the blogs template to the MobilePress template + * + * @package MobilePress + * @since 1.0 + * @return STRING The name of the MobilePress template to be used for rendering + */ + function set_template() + { + if ( ! isset($_SESSION['MOPR_MOBILE_THEME']) || trim($_SESSION['MOPR_MOBILE_THEME']) == '') + { + $template = $this->default_theme; + } + else + { + $template = $_SESSION['MOPR_MOBILE_THEME']; + } + + return $template; + } + + /** + * Sets the theme root to the MobilePress theme directory + * + * @package MobilePress + * @since 1.0 + * @return STRING Root directory of the MobilePress theme directory + */ + function set_theme_root() + { + if ( ! isset($_SESSION['MOPR_MOBILE_THEME']) || trim($_SESSION['MOPR_MOBILE_THEME']) == '') + { + $template = $this->default_theme; + } + else + { + $template = $_SESSION['MOPR_MOBILE_THEME']; + } + + if ($template == 'default' || $template == 'iphone') + { + return MOPR_ROOT_PATH . "system/themes"; + } + else + { + return rtrim(WP_CONTENT_DIR, '/') . '/' . mopr_get_option('themes_directory', 1); + } + } + + /** + * Sets the path to the themes directory + * + * @package MobilePress + * @since 1.0 + * @return STRING The MobilePress theme directory + */ + function set_theme_uri() + { + if ( ! isset($_SESSION['MOPR_MOBILE_THEME']) || trim($_SESSION['MOPR_MOBILE_THEME']) == '') + { + $template = $this->default_theme; + } + else + { + $template = $_SESSION['MOPR_MOBILE_THEME']; + } + + if ($template == 'default' || $template == 'iphone') + { + return get_bloginfo('wpurl') . "/wp-content/plugins/mobilepress/system/themes"; + } + else + { + return get_bloginfo('wpurl') . "/wp-content/" . mopr_get_option('themes_directory', 1); + } + } + + /** + * Returns the mobile blogs title + * + * @package MobilePress + * @since 1.0 + * @return STRING The mobile blogs title + */ + function set_title() + { + return $this->title; + } + + } +} +?> \ No newline at end of file diff --git a/system/classes/uninstall.php b/system/classes/uninstall.php new file mode 100644 index 0000000..a71ebbd --- /dev/null +++ b/system/classes/uninstall.php @@ -0,0 +1,38 @@ +delete_table(); + } + + /** + * Deletes the MobilePress table + * + * @package MobilePress + * @since 1.0.2 + */ + function delete_table() + { + global $wpdb; + $sql = "DROP TABLE IF EXISTS " . MOPR_TABLE; + $wpdb->query($sql); + } + + } +} +?> \ No newline at end of file diff --git a/system/config/config.php b/system/config/config.php new file mode 100644 index 0000000..dbe12b1 --- /dev/null +++ b/system/config/config.php @@ -0,0 +1,11 @@ +prefix . 'mobilepress'); + +// For WP versions < 2.6 +if ( ! defined( 'WP_CONTENT_DIR' ) ) + define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); +?> \ No newline at end of file diff --git a/system/config/versions.php b/system/config/versions.php new file mode 100644 index 0000000..4abd213 --- /dev/null +++ b/system/config/versions.php @@ -0,0 +1,5 @@ + diff --git a/system/helpers/ad_analytics_functions.php b/system/helpers/ad_analytics_functions.php new file mode 100644 index 0000000..e657f0b --- /dev/null +++ b/system/helpers/ad_analytics_functions.php @@ -0,0 +1,94 @@ + $campaign, 'ad_public_key' => $ad)); + } + else + { + aduity_display_ad(array('campaign_public_key' => $campaign)); + } + } + else + { + aduity_display_ad(); + } + } + else if ($ads_type == '2') + { + aduity_display_ad(array('network_ads' => 1)); + } + + return; + } +} + +if ( ! function_exists('mopr_analytics')) +{ + function mopr_analytics() + { + if ( ! mopr_get_option('aduity_analytics_enabled')) + { + return; + } + + // Include the Aduity library + require_once(MOPR_PATH . 'libraries/aduity_core.php'); + + $title = wp_title('', FALSE); + + if (is_home()) + { + $title = get_bloginfo('name'); + } + + aduity_analytics(array('page_title' => $title)); + } +} +?> \ No newline at end of file diff --git a/system/helpers/functions.php b/system/helpers/functions.php new file mode 100644 index 0000000..beb465b --- /dev/null +++ b/system/helpers/functions.php @@ -0,0 +1,186 @@ +get_var("SELECT COUNT(*) FROM " . MOPR_TABLE) == 0) + { + return TRUE; + } + else + { + return FALSE; + } + } +} + +if ( ! function_exists('mopr_check_table_exists')) +{ + /** + * Checks if the MobilePress table exists in the WordPress database + * + * @package MobilePress + * @since 1.0 + * @return BOOL True or false + */ + function mopr_check_table_exists() + { + global $wpdb; + + if ($wpdb->get_var("SHOW TABLES LIKE '" . MOPR_TABLE . "'") == MOPR_TABLE) + { + return TRUE; + } + else + { + return FALSE; + } + + } +} + +if ( ! function_exists('mopr_display_notice')) +{ + /** + * Displays an admin area notice + * + * @package MobilePress + * @since 1.0 + * @param STRING $notice The message you want to be displayed + */ + function mopr_display_notice($notice) + { + echo '
' . $notice . '
'; + } +} + +if ( ! function_exists('mopr_get_option')) +{ + /** + * Fetches the specified option from the MobilePress database table + * + * @package MobilePress + * @since 1.0 + * @param STRING $option_name The name of the option that must be fetched + * @param INT $number The first or second option value + * @return STRING Returns the option value + */ + function mopr_get_option($option_name, $number = NULL) + { + global $wpdb; + + if ($number == NULL) + { + $number = 0; + } + else + { + $number -= 1; + } + + // Select the option from the mobilepress table + $sql = "SELECT option_value, option_value_2 FROM " . MOPR_TABLE . " WHERE option_name='" . $wpdb->escape($option_name) . "'"; + $result = $wpdb->get_row($sql, ARRAY_N); + + if (isset($result[$number])) + { + return $result[$number]; + } + + return NULL; + } +} + +if ( ! function_exists('mopr_get_version')) +{ + /** + * Fetches and returns the current version of the plugin + * + * @package MobilePress + * @since 1.0 + * @return INT Version number of the plugin + */ + function mopr_get_version() + { + if ( ! function_exists('get_plugin_data')) + { + if (file_exists(ABSPATH . 'wp-admin/includes/plugin.php')) + { + require_once(ABSPATH . 'wp-admin/includes/plugin.php'); + } + else + { + return "Error!"; + } + } + + $data = get_plugin_data(dirname(dirname(dirname(__FILE__))) . '/mobilepress.php'); + return $data['Version']; + } +} + +if ( ! function_exists('mopr_load_view')) +{ + /** + * Loads a view + * + * @package MobilePress + * @since 1.1 + */ + function mopr_load_view($view, $vars = NULL) + { + if ($vars != NULL) + { + foreach ($vars as $name => $value) + { + // Assign definied variables sent to function with the name they set + $$name = $value; + } + } + + if (($_view = include(MOPR_PATH . 'views/' . $view . '.php')) !== FALSE) + { + echo trim($_view, '1'); + } + } +} + +if ( ! function_exists('mopr_load_json_library')) +{ + /** + * Loads the JSON library + * + * @package MobilePress + * @since 1.1 + */ + function mopr_load_json_library() + { + require_once(MOPR_PATH . 'libraries/json.php'); + return new Services_JSON(); + } +} + +if ( ! function_exists('mopr_load_aduity_api_library')) +{ + /** + * Loads the Aduity Library + * + * @package MobilePress + * @since 1.1 + */ + function mopr_load_aduity_api_library($apk, $ask) + { + require_once(MOPR_PATH . 'libraries/aduity_api.php'); + return new Aduity_api_request($apk, $ask); + } +} +?> \ No newline at end of file diff --git a/system/libraries/aduity_api.php b/system/libraries/aduity_api.php new file mode 100644 index 0000000..71f288e --- /dev/null +++ b/system/libraries/aduity_api.php @@ -0,0 +1,89 @@ +apk = $apk; + $this->ask = $ask; + } + + function make_request() + { + // Open a new connection to the ad server + $conn = @fsockopen($this->api_uri, 80, $errno, $errstr, 5); + + if ( ! $conn) + { + return NULL; + } + else + { + $header = "GET /" . $this->version . $this->request_uri . " HTTP/1.0\r\n"; + $header .= "Host: " . $this->api_uri . "\r\n"; + $header .= "Connection: close\r\n\r\n"; + + fputs($conn, $header, strlen($header)); + + // Lets grab the JSON data + while ( ! feof($conn)) + { + $data = fgets($conn); + + if (isset($start_copy)) + { + $content .= $data; + } + + if ($data == "\r\n" && ! isset($start_copy)) + { + $start_copy = TRUE; + } + } + } + + fclose($conn); + + return $content; + } + + function request($request_type, $request_params = NULL) + { + // First lets set initial request URI vars + $this->request_uri = '?apk=' . $this->apk . '&ask=' . $this->ask; + + // Now deal with the request type + $this->_set_request_type($request_type); + + // Now we deal with parameters + if ($request_params != NULL && is_array($request_params)) + { + foreach ($request_params as $param => $value) + { + $this->_set_request_params($param, $value); + } + } + + // Now lets make and return the request + return $this->make_request(); + } + + function _set_request_params($param, $value) + { + $this->request_uri .= '&' . $param . '=' . $value; + } + + function _set_request_type($request_type) + { + $this->request_uri .= "&request_type=" . $request_type; + } + } +} +?> \ No newline at end of file diff --git a/system/libraries/aduity_core.php b/system/libraries/aduity_core.php new file mode 100644 index 0000000..82a7a19 --- /dev/null +++ b/system/libraries/aduity_core.php @@ -0,0 +1,253 @@ + 1 + ); + + if (is_array($request_params)) + { + // Merge the request type and parameters + $request_data = array_merge($request_type, $request_params); + } + else + { + $request_data = $request_type; + } + + $request = new Aduity_request($request_data); + } +} + + +if ( ! function_exists('aduity_display_ad')) +{ + function aduity_display_ad($request_params = NULL) + { + // Set the request type + $request_type = array( + 'request_type' => 2 + ); + + if (is_array($request_params)) + { + // Merge the request type and parameters + $request_data = array_merge($request_type, $request_params); + } + else + { + $request_data = $request_type; + } + + // Make the request + $request = new Aduity_request($request_data); + } +} + +if ( ! class_exists('Aduity_request')) +{ + class Aduity_request { + + var $account_public_key = NULL; + var $site_public_key = NULL; + var $campaign_public_key = NULL; + var $ad_public_key = NULL; + var $ad_type = NULL; + var $keywords = NULL; + var $network_ads_only = NULL; + var $page_title = NULL; + var $request_data; + var $request_type; + var $request_server = 'r.aduity.com'; + + function Aduity_request($request_data) + { + if (ACCOUNT_PUBLIC_KEY != '' && SITE_PUBLIC_KEY != '') + { + // Set the account public key + $this->account_public_key = ACCOUNT_PUBLIC_KEY; + + // Set site public key + $this->site_public_key = SITE_PUBLIC_KEY; + + // Set the request type for use throughout the class + $this->request_type = $request_data['request_type']; + + // Set campaign public key if available + if (array_key_exists('campaign_public_key', $request_data)) + $this->campaign_public_key = $request_data['campaign_public_key']; + + // Set the ad public key if available + if (array_key_exists('ad_public_key', $request_data)) + $this->ad_public_key = $request_data['ad_public_key']; + + // Set the ad type if available + if (array_key_exists('ad_type', $request_data)) + $this->ad_type = $request_data['ad_type']; + + // Are we only displaying network ads? + if (array_key_exists('network_ads', $request_data)) + $this->network_ads_only = $request_data['network_ads']; + + // Set up our keywords if we have any + if (array_key_exists('keywords', $request_data)) + $this->keywords = $request_data['keywords']; + + // Setup the page title for analytics + if (array_key_exists('page_title', $request_data)) + $this->page_title = $request_data['page_title']; + + // Setup the data + $this->_set_request_data(); + + // Make the request + if ($this->request_type == 1) + { + $this->analytics_request(); + } + else if ($this->request_type == 2) + { + $this->ad_request(); + } + } + + return; + } + + function ad_request() + { + // Display the ad + echo $this->make_request(); + } + + function analytics_request() + { + // All we do for now is make the request + $this->make_request(); + } + + function make_request() + { + // Open a new connection to the server + $conn = @fsockopen($this->request_server, 80, $errno, $errstr, 5); + + if ( ! $conn) + { + return NULL; + } + else + { + $header = "POST / HTTP/1.0\r\n"; + $header .= "Host: " . $this->request_server . "\r\n"; + $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; + $header .= "Content-Length: " . strlen($this->request_data) . "\r\n"; + $header .= "Connection: close\r\n\r\n"; + $header .= $this->request_data; + + fputs($conn, $header, strlen($header)); + + if ($this->request_type == 2) + { + // Lets grab the ad code + while ( ! feof($conn)) + { + $data = fgets($conn); + + if (isset($start_copy)) + { + $content .= $data; + } + + if ($data == "\r\n" && ! isset($start_copy)) + { + $start_copy = TRUE; + } + } + } + } + + fclose($conn); + + if (isset($content)) + { + return $content; + } + } + + function _set_request_data() + { + // Create the data we need + $this->request_data = '&apk=' . $this->account_public_key; + + $this->request_data .= '&spk=' . $this->site_public_key; + + $this->request_data .= '&rt=' . $this->request_type; + + // We only need this data it is set and we are serving an ad + if (isset($this->campaign_public_key)) + $this->request_data .= '&cpk=' . $this->campaign_public_key; + + if (isset($this->ad_public_key)) + $this->request_data .= '&adpk=' . $this->ad_public_key; + + if (isset($this->ad_type)) + $this->request_data .= '&adt=' . $this->ad_type; + + if (isset($this->keywords)) + $this->request_data .= '&kw=' . $this->keywords; + + if (isset($this->network_ads_only)) + $this->request_data .= '&na=' . $this->network_ads_only; + + if (isset($this->page_title)) + $this->request_data .= '&pt=' . $this->page_title; + + // some variables we can determine on our own + $this->request_data .= '&d=' . $_SERVER['HTTP_HOST']; + $this->request_data .= '&p=' . $_SERVER['REQUEST_URI']; + $this->request_data .= '&r=' . $_SERVER['HTTP_REFERER']; + $this->request_data .= '&t=' . time(); + + // is the user's brower Opera Mini? + if (array_key_exists('HTTP_X_OPERAMINI_PHONE_UA', $_SERVER)) + { + $this->request_data .= '&ua=' . $_SERVER['HTTP_X_OPERAMINI_PHONE_UA']; + $this->request_data .= '&browser=1'; + } + else + { + $this->request_data .= '&ua=' . $_SERVER['HTTP_USER_AGENT']; + $this->request_data .= '&browser=0'; + } + + if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) + { + $this->request_data .= '&ip=' . $_SERVER['HTTP_X_FORWARDED_FOR']; + } + else + { + $this->request_data .= '&ip=' . $_SERVER['REMOTE_ADDR']; + } + + $this->request_data .= '&db=' . REQUEST_DEBUG; + } + } +} +?> \ No newline at end of file diff --git a/system/libraries/js/jquery.livequery.js b/system/libraries/js/jquery.livequery.js new file mode 100644 index 0000000..dde8ad8 --- /dev/null +++ b/system/libraries/js/jquery.livequery.js @@ -0,0 +1,250 @@ +/*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * + * Version: 1.0.3 + * Requires jQuery 1.1.3+ + * Docs: http://docs.jquery.com/Plugins/livequery + */ + +(function($) { + +$.extend($.fn, { + livequery: function(type, fn, fn2) { + var self = this, q; + + // Handle different call patterns + if ($.isFunction(type)) + fn2 = fn, fn = type, type = undefined; + + // See if Live Query already exists + $.each( $.livequery.queries, function(i, query) { + if ( self.selector == query.selector && self.context == query.context && + type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) ) + // Found the query, exit the each loop + return (q = query) && false; + }); + + // Create new Live Query if it wasn't found + q = q || new $.livequery(this.selector, this.context, type, fn, fn2); + + // Make sure it is running + q.stopped = false; + + // Run it immediately for the first time + q.run(); + + // Contnue the chain + return this; + }, + + expire: function(type, fn, fn2) { + var self = this; + + // Handle different call patterns + if ($.isFunction(type)) + fn2 = fn, fn = type, type = undefined; + + // Find the Live Query based on arguments and stop it + $.each( $.livequery.queries, function(i, query) { + if ( self.selector == query.selector && self.context == query.context && + (!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped ) + $.livequery.stop(query.id); + }); + + // Continue the chain + return this; + } +}); + +$.livequery = function(selector, context, type, fn, fn2) { + this.selector = selector; + this.context = context || document; + this.type = type; + this.fn = fn; + this.fn2 = fn2; + this.elements = []; + this.stopped = false; + + // The id is the index of the Live Query in $.livequery.queries + this.id = $.livequery.queries.push(this)-1; + + // Mark the functions for matching later on + fn.$lqguid = fn.$lqguid || $.livequery.guid++; + if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++; + + // Return the Live Query + return this; +}; + +$.livequery.prototype = { + stop: function() { + var query = this; + + if ( this.type ) + // Unbind all bound events + this.elements.unbind(this.type, this.fn); + else if (this.fn2) + // Call the second function for all matched elements + this.elements.each(function(i, el) { + query.fn2.apply(el); + }); + + // Clear out matched elements + this.elements = []; + + // Stop the Live Query from running until restarted + this.stopped = true; + }, + + run: function() { + // Short-circuit if stopped + if ( this.stopped ) return; + var query = this; + + var oEls = this.elements, + els = $(this.selector, this.context), + nEls = els.not(oEls); + + // Set elements to the latest set of matched elements + this.elements = els; + + if (this.type) { + // Bind events to newly matched elements + nEls.bind(this.type, this.fn); + + // Unbind events to elements no longer matched + if (oEls.length > 0) + $.each(oEls, function(i, el) { + if ( $.inArray(el, els) < 0 ) + $.event.remove(el, query.type, query.fn); + }); + } + else { + // Call the first function for newly matched elements + nEls.each(function() { + query.fn.apply(this); + }); + + // Call the second function for elements no longer matched + if ( this.fn2 && oEls.length > 0 ) + $.each(oEls, function(i, el) { + if ( $.inArray(el, els) < 0 ) + query.fn2.apply(el); + }); + } + } +}; + +$.extend($.livequery, { + guid: 0, + queries: [], + queue: [], + running: false, + timeout: null, + + checkQueue: function() { + if ( $.livequery.running && $.livequery.queue.length ) { + var length = $.livequery.queue.length; + // Run each Live Query currently in the queue + while ( length-- ) + $.livequery.queries[ $.livequery.queue.shift() ].run(); + } + }, + + pause: function() { + // Don't run anymore Live Queries until restarted + $.livequery.running = false; + }, + + play: function() { + // Restart Live Queries + $.livequery.running = true; + // Request a run of the Live Queries + $.livequery.run(); + }, + + registerPlugin: function() { + $.each( arguments, function(i,n) { + // Short-circuit if the method doesn't exist + if (!$.fn[n]) return; + + // Save a reference to the original method + var old = $.fn[n]; + + // Create a new method + $.fn[n] = function() { + // Call the original method + var r = old.apply(this, arguments); + + // Request a run of the Live Queries + $.livequery.run(); + + // Return the original methods result + return r; + } + }); + }, + + run: function(id) { + if (id != undefined) { + // Put the particular Live Query in the queue if it doesn't already exist + if ( $.inArray(id, $.livequery.queue) < 0 ) + $.livequery.queue.push( id ); + } + else + // Put each Live Query in the queue if it doesn't already exist + $.each( $.livequery.queries, function(id) { + if ( $.inArray(id, $.livequery.queue) < 0 ) + $.livequery.queue.push( id ); + }); + + // Clear timeout if it already exists + if ($.livequery.timeout) clearTimeout($.livequery.timeout); + // Create a timeout to check the queue and actually run the Live Queries + $.livequery.timeout = setTimeout($.livequery.checkQueue, 20); + }, + + stop: function(id) { + if (id != undefined) + // Stop are particular Live Query + $.livequery.queries[ id ].stop(); + else + // Stop all Live Queries + $.each( $.livequery.queries, function(id) { + $.livequery.queries[ id ].stop(); + }); + } +}); + +// Register core DOM manipulation methods +$.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove'); + +// Run Live Queries when the Document is ready +$(function() { $.livequery.play(); }); + + +// Save a reference to the original init method +var init = $.prototype.init; + +// Create a new init method that exposes two new properties: selector and context +$.prototype.init = function(a,c) { + // Call the original init and save the result + var r = init.apply(this, arguments); + + // Copy over properties if they exist already + if (a && a.selector) + r.context = a.context, r.selector = a.selector; + + // Set properties + if ( typeof a == 'string' ) + r.context = c || document, r.selector = a; + + // Return the result + return r; +}; + +// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091) +$.prototype.init.prototype = $.prototype; + +})(jQuery); \ No newline at end of file diff --git a/system/libraries/json.php b/system/libraries/json.php new file mode 100644 index 0000000..b513791 --- /dev/null +++ b/system/libraries/json.php @@ -0,0 +1,812 @@ + + * @author Matt Knapp + * @author Brett Stimmerman + * @copyright 2005 Michal Migurski + * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_SLICE', 1); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_STR', 2); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_ARR', 3); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_OBJ', 4); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_CMT', 5); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_LOOSE_TYPE', 16); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_SUPPRESS_ERRORS', 32); + +/** + * Converts to and from JSON format. + * + * Brief example of use: + * + * + * // create a new instance of Services_JSON + * $json = new Services_JSON(); + * + * // convert a complexe value to JSON notation, and send it to the browser + * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); + * $output = $json->encode($value); + * + * print($output); + * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] + * + * // accept incoming POST data, assumed to be in JSON notation + * $input = file_get_contents('php://input', 1000000); + * $value = $json->decode($input); + * + */ +if ( ! class_exists('Services_JSON')) +{ + class Services_JSON + { + /** + * constructs a new JSON instance + * + * @param int $use object behavior flags; combine with boolean-OR + * + * possible values: + * - SERVICES_JSON_LOOSE_TYPE: loose typing. + * "{...}" syntax creates associative arrays + * instead of objects in decode(). + * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. + * Values which can't be encoded (e.g. resources) + * appear as NULL instead of throwing errors. + * By default, a deeply-nested resource will + * bubble up with an error, so all return values + * from encode() should be checked with isError() + */ + function Services_JSON($use = 0) + { + $this->use = $use; + } + + /** + * convert a string from one UTF-16 char to one UTF-8 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf16 UTF-16 character + * @return string UTF-8 character + * @access private + */ + function utf162utf8($utf16) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); + } + + $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + + switch(true) { + case ((0x7F & $bytes) == $bytes): + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x7F & $bytes); + + case (0x07FF & $bytes) == $bytes: + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xC0 | (($bytes >> 6) & 0x1F)) + . chr(0x80 | ($bytes & 0x3F)); + + case (0xFFFF & $bytes) == $bytes: + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xE0 | (($bytes >> 12) & 0x0F)) + . chr(0x80 | (($bytes >> 6) & 0x3F)) + . chr(0x80 | ($bytes & 0x3F)); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encode($var) + { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + $properties = array_map(array($this, 'name_value'), + array_keys($var), + array_values($var)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + // treat it like a regular array + $elements = array_map(array($this, 'encode'), $var); + + foreach($elements as $element) { + if(Services_JSON::isError($element)) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = get_object_vars($var); + + $properties = array_map(array($this, 'name_value'), + array_keys($vars), + array_values($vars)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) + ? 'null' + : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function name_value($name, $value) + { + $encoded_value = $this->encode($value); + + if(Services_JSON::isError($encoded_value)) { + return $encoded_value; + } + + return $this->encode(strval($name)) . ':' . $encoded_value; + } + + /** + * reduce a string by removing leading and trailing comments and whitespace + * + * @param $str string string value to strip of comments and whitespace + * + * @return string string value stripped of comments and whitespace + * @access private + */ + function reduce_string($str) + { + $str = preg_replace(array( + + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + + ), '', $str); + + // eliminate extraneous space + return trim($str); + } + + /** + * decodes a JSON string into appropriate variable + * + * @param string $str JSON-formatted string + * + * @return mixed number, boolean, string, array, or object + * corresponding to given JSON input string. + * See argument 1 to Services_JSON() above for object-output behavior. + * Note that decode() always returns strings + * in ASCII or UTF-8 format! + * @access public + */ + function decode($str) + { + $str = $this->reduce_string($str); + + switch (strtolower($str)) { + case 'true': + return true; + + case 'false': + return false; + + case 'null': + return null; + + default: + $m = array(); + + if (is_numeric($str)) { + // Lookie-loo, it's a number + + // This would work on its own, but I'm trying to be + // good about returning integers where appropriate: + // return (float)$str; + + // Return float or int, as appropriate + return ((float)$str == (integer)$str) + ? (integer)$str + : (float)$str; + + } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { + // STRINGS RETURNED IN UTF-8 FORMAT + $delim = substr($str, 0, 1); + $chrs = substr($str, 1, -1); + $utf8 = ''; + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c < $strlen_chrs; ++$c) { + + $substr_chrs_c_2 = substr($chrs, $c, 2); + $ord_chrs_c = ord($chrs{$c}); + + switch (true) { + case $substr_chrs_c_2 == '\b': + $utf8 .= chr(0x08); + ++$c; + break; + case $substr_chrs_c_2 == '\t': + $utf8 .= chr(0x09); + ++$c; + break; + case $substr_chrs_c_2 == '\n': + $utf8 .= chr(0x0A); + ++$c; + break; + case $substr_chrs_c_2 == '\f': + $utf8 .= chr(0x0C); + ++$c; + break; + case $substr_chrs_c_2 == '\r': + $utf8 .= chr(0x0D); + ++$c; + break; + + case $substr_chrs_c_2 == '\\"': + case $substr_chrs_c_2 == '\\\'': + case $substr_chrs_c_2 == '\\\\': + case $substr_chrs_c_2 == '\\/': + if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || + ($delim == "'" && $substr_chrs_c_2 != '\\"')) { + $utf8 .= $chrs{++$c}; + } + break; + + case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): + // single, escaped unicode character + $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) + . chr(hexdec(substr($chrs, ($c + 4), 2))); + $utf8 .= $this->utf162utf8($utf16); + $c += 5; + break; + + case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): + $utf8 .= $chrs{$c}; + break; + + case ($ord_chrs_c & 0xE0) == 0xC0: + // characters U-00000080 - U-000007FF, mask 110XXXXX + //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 2); + ++$c; + break; + + case ($ord_chrs_c & 0xF0) == 0xE0: + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 3); + $c += 2; + break; + + case ($ord_chrs_c & 0xF8) == 0xF0: + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 4); + $c += 3; + break; + + case ($ord_chrs_c & 0xFC) == 0xF8: + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 5); + $c += 4; + break; + + case ($ord_chrs_c & 0xFE) == 0xFC: + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 6); + $c += 5; + break; + + } + + } + + return $utf8; + + } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { + // array, or object notation + + if ($str{0} == '[') { + $stk = array(SERVICES_JSON_IN_ARR); + $arr = array(); + } else { + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = array(); + } else { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = new stdClass(); + } + } + + array_push($stk, array('what' => SERVICES_JSON_SLICE, + 'where' => 0, + 'delim' => false)); + + $chrs = substr($str, 1, -1); + $chrs = $this->reduce_string($chrs); + + if ($chrs == '') { + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } else { + return $obj; + + } + } + + //print("\nparsing {$chrs}\n"); + + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c <= $strlen_chrs; ++$c) { + + $top = end($stk); + $substr_chrs_c_2 = substr($chrs, $c, 2); + + if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + // found a comma that is not inside a string, array, etc., + // OR we've reached the end of the character list + $slice = substr($chrs, $top['where'], ($c - $top['where'])); + array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + // we are in an array, so just push an element onto the stack + array_push($arr, $this->decode($slice)); + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + // we are in an object, so figure + // out the property name and set an + // element in an associative array, + // for now + $parts = array(); + + if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // "name":value pair + $key = $this->decode($parts[1]); + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // name:value pair, where name is unquoted + $key = $parts[1]; + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } + + } + + } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + // found a quote, and we are not inside a string + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + //print("Found start of string at {$c}\n"); + + } elseif (($chrs{$c} == $top['delim']) && + ($top['what'] == SERVICES_JSON_IN_STR) && + ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { + // found a quote, we're in a string, and it's not escaped + // we know that it's not escaped becase there is _not_ an + // odd number of backslashes at the end of the string so far + array_pop($stk); + //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '[') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-bracket, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); + //print("Found start of array at {$c}\n"); + + } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + // found a right-bracket, and we're in an array + array_pop($stk); + //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '{') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-brace, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + //print("Found start of object at {$c}\n"); + + } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + // found a right-brace, and we're in an object + array_pop($stk); + //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($substr_chrs_c_2 == '/*') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a comment start, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $c++; + //print("Found start of comment at {$c}\n"); + + } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { + // found a comment end, and we're in one now + array_pop($stk); + $c++; + + for ($i = $top['where']; $i <= $c; ++$i) + $chrs = substr_replace($chrs, ' ', $i, 1); + + //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } + + } + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + return $obj; + + } + + } + } + } + + /** + * @todo Ultimately, this should just call PEAR::isError() + */ + function isError($data, $code = null) + { + if (class_exists('pear')) { + return PEAR::isError($data, $code); + } elseif (is_object($data) && (get_class($data) == 'services_json_error' || + is_subclass_of($data, 'services_json_error'))) { + return true; + } + + return false; + } + } +} + +if (class_exists('PEAR_Error')) { + + if ( ! class_exists('Services_JSON_Error')) + { + class Services_JSON_Error extends PEAR_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + parent::PEAR_Error($message, $code, $mode, $options, $userinfo); + } + } + } + +} else { + + if ( ! class_exists('Services_JSON_Error')) + { + /** + * @todo Ultimately, this class shall be descended from PEAR_Error + */ + class Services_JSON_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + + } + } + } + +} +?> \ No newline at end of file diff --git a/system/themes/default/archive.php b/system/themes/default/archive.php new file mode 100644 index 0000000..5ea7b1b --- /dev/null +++ b/system/themes/default/archive.php @@ -0,0 +1,43 @@ + + +
+ +
+ + +

Archives

+ +

Archive for

+ +

Archive for

+ +

Archive for

+ + +
+ + + +
+

+

.

+
+ + + +

Page Not Found

+

Sorry, The page you are looking for cannot be found!

+ + + + + +
+

+
+ + + +
+ + diff --git a/system/themes/default/comments.php b/system/themes/default/comments.php new file mode 100644 index 0000000..fd2ed6f --- /dev/null +++ b/system/themes/default/comments.php @@ -0,0 +1,64 @@ +post_password)) { + if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { + ?> + +
+

This post is password protected. Enter the password to view comments.

+
+ + + +
+ +

+ +
+ + + + + +
+

says:

+ + comment_approved == '0') : ?> +

Your comment is awaiting moderation.

+ +

Posted on

+
+ + + + + + comment_status): ?> + +
+

Be the first to leave a comment.

+
+ + + +
+

Sorry, comments are closed on this post.

+
+ + + + + + + +
+

Post A Comment.

+
diff --git a/system/themes/default/footer.php b/system/themes/default/footer.php new file mode 100644 index 0000000..9f505d7 --- /dev/null +++ b/system/themes/default/footer.php @@ -0,0 +1,26 @@ + + +
+ +
+ + + +
+ + + + + diff --git a/system/themes/default/functions.php b/system/themes/default/functions.php new file mode 100644 index 0000000..2e241f3 --- /dev/null +++ b/system/themes/default/functions.php @@ -0,0 +1,33 @@ +max_num_pages; + + if ( $max_num_pages > 1 ) { + return true; + } + else { + return false; + } +} + +// This function checks to see if they are using permalinks +// If they are we need to display ? in the view/post comments links before the comment=true variable is declared etc +function mopr_check_permalink() { + $permalink = get_option('permalink_structure'); + + if ($permalink == "") { + echo "&"; + } + else { + echo "?"; + } +} + +function CommentID() { + global $id; + echo $id; +} +?> diff --git a/system/themes/default/header.php b/system/themes/default/header.php new file mode 100644 index 0000000..aded65a --- /dev/null +++ b/system/themes/default/header.php @@ -0,0 +1,135 @@ + + + + <?php if (is_home()) { bloginfo('name'); } ?><?php if (is_month()) { the_time('F Y'); } ?><?php if (is_category()) { single_cat_title(); } ?><?php if (is_single()) { the_title(); } ?><?php if (is_page()) { the_title(); } ?><?php if (is_tag()) { single_tag_title(); } ?><?php if (is_404()) { echo "Page Not Found!"; } ?> + + + + + + + + + +
+ + + +
+ +
\ No newline at end of file diff --git a/system/themes/default/index.php b/system/themes/default/index.php new file mode 100644 index 0000000..58ed4e3 --- /dev/null +++ b/system/themes/default/index.php @@ -0,0 +1,50 @@ + + +
+ +
+ +

Latest Blog Posts

+ +
+ + + + +
+

+

.

+
+ + + +

Page Not Found

+

Sorry, The page you are looking for cannot be found!

+ + + + + +
+

+
+ + + +
+ +

Blog Pages

+ +
+ +
+ +
    + +
+ +
+ +
+ + diff --git a/system/themes/default/page.php b/system/themes/default/page.php new file mode 100644 index 0000000..c2354bc --- /dev/null +++ b/system/themes/default/page.php @@ -0,0 +1,59 @@ + + +
+ + + + + +
+ +

+ +
+ +
+ + &after=

&next_or_number=number&pagelink=Page %'); ?> +
+ +
+

.

+
+ +
+
+

View or Post Comments.

+
+
+ + + +

Page Not Found

+

Sorry, The page you are looking for cannot be found!

+ + + + + +
+ + diff --git a/system/themes/default/postcomment.php b/system/themes/default/postcomment.php new file mode 100644 index 0000000..6551db0 --- /dev/null +++ b/system/themes/default/postcomment.php @@ -0,0 +1,65 @@ +
+ +

Leave A Reply

+ +
+ + + + + +
+

You must be logged in to post a comment.

+
+ + + +
+ +
+ + + +

Logged in as . Log out

+ + + +

/> +

+ +

/> +

+ +

+

+ + + +

+

+ + +

+ ID); ?> + +
+ +
+ + + + + +
+

Sorry, comments are closed on this post.

+
+ + + + + +
+

View The Comments.

+
diff --git a/system/themes/default/screenshot.png b/system/themes/default/screenshot.png new file mode 100644 index 0000000..b5b3a37 Binary files /dev/null and b/system/themes/default/screenshot.png differ diff --git a/system/themes/default/search.php b/system/themes/default/search.php new file mode 100644 index 0000000..a3a3b8e --- /dev/null +++ b/system/themes/default/search.php @@ -0,0 +1,35 @@ + + +
+ +
+ +

Search for ""

+ +
+ + + +
+

+

.

+
+ + + +

Page Not Found

+

Sorry, The page you are looking for cannot be found!

+ + + + + +
+

+
+ + + +
+ + diff --git a/system/themes/default/single.php b/system/themes/default/single.php new file mode 100644 index 0000000..9aa9bc7 --- /dev/null +++ b/system/themes/default/single.php @@ -0,0 +1,59 @@ + + +
+ + + + + +
+ +

+ +
+ +
+ + &after=

&next_or_number=number&pagelink=Page %'); ?> +
+ +
+

. Posted in .

+
+ +
+
+

View or Post Comments.

+
+
+ + + +

Page Not Found

+

Sorry, The page you are looking for cannot be found!

+ + + + + +
+ + diff --git a/system/themes/default/style.css b/system/themes/default/style.css new file mode 100644 index 0000000..fd2512c --- /dev/null +++ b/system/themes/default/style.css @@ -0,0 +1,9 @@ +/* +Theme Name: Default +Theme URI: http://wordpress.org +Description: The default MobilePress theme. +Author: Aduity +Author URI: http://aduity.com +Version: 1.0 +Tags: mobile, mobilepress, light blue, grey, orange +*/ \ No newline at end of file diff --git a/system/themes/iphone/archive.php b/system/themes/iphone/archive.php new file mode 100644 index 0000000..1e87c5e --- /dev/null +++ b/system/themes/iphone/archive.php @@ -0,0 +1,48 @@ + + +
+ +
+ + +

Archives

+ +

Archive for

+ +

Archive for

+ +

Archive for

+ + +
+ + + +
+

+

.

+
+ + + +
+

Page Not Found

+
+ +
+

Sorry, The page you are looking for cannot be found!

+
+ + + + + +
+

+
+ + + +
+ + diff --git a/system/themes/iphone/comments.php b/system/themes/iphone/comments.php new file mode 100644 index 0000000..b561d2e --- /dev/null +++ b/system/themes/iphone/comments.php @@ -0,0 +1,56 @@ +post_password)) { + if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { + ?> + +
+

This post is password protected. Enter the password to view comments.

+
+ + + +
+ +

+ +
+ + + + + +
+

says:

+ + comment_approved == '0') : ?> +

Your comment is awaiting moderation.

+ +

Posted on

+
+ + + + + + comment_status): ?> + +
+

Be the first to leave a comment.

+
+ + + +
+

Sorry, comments are closed on this post.

+
+ + + + diff --git a/system/themes/iphone/footer.php b/system/themes/iphone/footer.php new file mode 100644 index 0000000..29307ed --- /dev/null +++ b/system/themes/iphone/footer.php @@ -0,0 +1,26 @@ + + +
+ +
+ + + +
+ + + + + diff --git a/system/themes/iphone/functions.php b/system/themes/iphone/functions.php new file mode 100644 index 0000000..2e241f3 --- /dev/null +++ b/system/themes/iphone/functions.php @@ -0,0 +1,33 @@ +max_num_pages; + + if ( $max_num_pages > 1 ) { + return true; + } + else { + return false; + } +} + +// This function checks to see if they are using permalinks +// If they are we need to display ? in the view/post comments links before the comment=true variable is declared etc +function mopr_check_permalink() { + $permalink = get_option('permalink_structure'); + + if ($permalink == "") { + echo "&"; + } + else { + echo "?"; + } +} + +function CommentID() { + global $id; + echo $id; +} +?> diff --git a/system/themes/iphone/header.php b/system/themes/iphone/header.php new file mode 100644 index 0000000..d8f0daf --- /dev/null +++ b/system/themes/iphone/header.php @@ -0,0 +1,24 @@ + + + + <?php if (is_home()) { bloginfo('name'); } ?><?php if (is_month()) { the_time('F Y'); } ?><?php if (is_category()) { single_cat_title(); } ?><?php if (is_single()) { the_title(); } ?><?php if (is_page()) { the_title(); } ?><?php if (is_tag()) { single_tag_title(); } ?><?php if (is_404()) { echo "Page Not Found!"; } ?> + + + + + + + + + + +
+ + + +
+ +
\ No newline at end of file diff --git a/system/themes/iphone/images/wait.gif b/system/themes/iphone/images/wait.gif new file mode 100644 index 0000000..4557ca1 Binary files /dev/null and b/system/themes/iphone/images/wait.gif differ diff --git a/system/themes/iphone/index.php b/system/themes/iphone/index.php new file mode 100644 index 0000000..172a014 --- /dev/null +++ b/system/themes/iphone/index.php @@ -0,0 +1,53 @@ + + +
+ +
+ +

Latest Blog Posts

+ +
+ + + + +
+

+

.

+
+ + + +
+

Page Not Found

+
+ +
+

Sorry, The page you are looking for cannot be found!

+
+ + + + + +
+

+
+ + + +
+

Blog Pages

+
+ +
+ +
    + +
+ +
+ +
+ + diff --git a/system/themes/iphone/js/jquery.min.js b/system/themes/iphone/js/jquery.min.js new file mode 100644 index 0000000..82b98e1 --- /dev/null +++ b/system/themes/iphone/js/jquery.min.js @@ -0,0 +1,32 @@ +/* + * jQuery 1.2.6 - New Wave Javascript + * + * Copyright (c) 2008 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ + * $Rev: 5685 $ + */ +(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else +return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else +return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else +selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else +this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else +return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else +jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else +jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("",""]||!tags.indexOf("",""]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!tags.indexOf("",""]||(!tags.indexOf("",""]||!tags.indexOf("",""]||jQuery.browser.msie&&[1,"div
","
"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf(""&&tags.indexOf("=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else +ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else +while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return im[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else +for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("
").append(res.responseText.replace(//g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else +xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else +jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else +for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else +s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else +e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;ithis.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); \ No newline at end of file diff --git a/system/themes/iphone/page.php b/system/themes/iphone/page.php new file mode 100644 index 0000000..2b925bb --- /dev/null +++ b/system/themes/iphone/page.php @@ -0,0 +1,64 @@ + + +
+ + + + + +
+ +

+ +
+ +
+ + &after=

&next_or_number=number&pagelink=Page %'); ?> +
+ +
+

.

+
+ +
+
+

View or Post Comments.

+
+
+ + + +
+

Page Not Found

+
+ +
+

Sorry, The page you are looking for cannot be found!

+
+ + + + + +
+ + diff --git a/system/themes/iphone/postcomment.php b/system/themes/iphone/postcomment.php new file mode 100644 index 0000000..ccc7403 --- /dev/null +++ b/system/themes/iphone/postcomment.php @@ -0,0 +1,57 @@ +
+ +

Leave A Reply

+ +
+ + + + + +
+

You must be logged in to post a comment.

+
+ + + +
+ +
+ + + +

Logged in as . Log out

+ + + +

/> +

+ +

/> +

+ +

+

+ + + +

+

+ + +

+ ID); ?> + +
+ +
+ + + + + +
+

Sorry, comments are closed on this post.

+
+ + \ No newline at end of file diff --git a/system/themes/iphone/screenshot.png b/system/themes/iphone/screenshot.png new file mode 100644 index 0000000..b5b3a37 Binary files /dev/null and b/system/themes/iphone/screenshot.png differ diff --git a/system/themes/iphone/search.php b/system/themes/iphone/search.php new file mode 100644 index 0000000..84bce7f --- /dev/null +++ b/system/themes/iphone/search.php @@ -0,0 +1,40 @@ + + +
+ +
+ +

Search for ""

+ +
+ + + +
+

+

.

+
+ + + +
+

Page Not Found

+
+ +
+

Sorry, The page you are looking for cannot be found!

+
+ + + + + +
+

+
+ + + +
+ + diff --git a/system/themes/iphone/single.php b/system/themes/iphone/single.php new file mode 100644 index 0000000..347efff --- /dev/null +++ b/system/themes/iphone/single.php @@ -0,0 +1,78 @@ + +
+ + + +
+ +

+ +
+ +
+ + &after=

&next_or_number=number&pagelink=Page %'); ?> +
+ +
+

. Posted in .

+
+ +
+
+

View or Post Comments.

+
+
+ + + +
+
+ + + +
+

Page Not Found

+
+ +
+

Sorry, The page you are looking for cannot be found!

+
+ + + +
+ + + \ No newline at end of file diff --git a/system/themes/iphone/style.css b/system/themes/iphone/style.css new file mode 100644 index 0000000..cd4cb48 --- /dev/null +++ b/system/themes/iphone/style.css @@ -0,0 +1,125 @@ +/* +Theme Name: iPhone +Theme URI: http://wordpress.org +Description: The default MobilePress theme with special effects for the iPhone. +Author: Aduity +Author URI: http://aduity.com +Version: 1.0 +Tags: mobile, mobilepress, light blue, grey, orange +*/ + +/* Simple Reset */ + +body, html, div, span, h1, h2, h3, h4, h5, h6, p, ul, ol, li, blockquote, form, input, fieldset { margin: 0; padding: 0;} + +img, fieldset { border: none; outline: none; } + + img { height: auto; max-height: 300px; max-width: 300px; width: auto; } + +ul, ol { list-style: none; } + +/* General Styles */ + +body { background: #aaa; font: 62.5% Verdana, Arial, Trebuchet MS; } + +/* Structure */ + +#headerwrap { width: 100%; } + + #header { background: #333; border-bottom: 1px solid #ccc; padding: 8px; } + +#infoblock, #pageblock { background: #e4f2fd; border-bottom: 1px solid #c6d9e9; color: #333; } + +.aduity { background: #f5f5f5; border-bottom: 1px solid #c6d9e9; text-align: center; } + +#contentwrap { width: 100%; } + + .post { background: #f5f5f5; border-bottom: 1px solid #c6d9e9; padding: 8px; } + + .page { background: #f5f5f5; padding: 8px; } + +#postfoot { background: #e4f2fd; color: #333; padding: 8px; } + +#indexpostfoot { background: #555; color: #333; padding: 8px; } + +#loading { background: #fff url(images/wait.gif) center no-repeat; clear: both; display: none; font-size: 12px; height: 30px; padding: 5px 0px; text-align: center; } + +#comments { background: #e4f2fd; border-top: 1px solid #c6d9e9; color: #333; padding: 8px; } + + .comments { display: none; } + +#searchwrap { width: 100%; } + + #search { background: #555; border-top: 1px solid #777; padding: 8px; } + +#footerwrap { width: 100%; } + + #footer { background: #333; padding: 8px; } + +/* Headings */ + +h1 { font-size: 1.4em; line-height: 1.4em; margin: 0 0 10px 0; } + + #header h1 { color: #ccc; margin: 0; } + + #header h1 a { color: #ccc; text-decoration: none; } + +h2 { font-size: 1.2em; line-height: 1.4em; margin: 0 0 10px 0; } + + h2 a { color: #2583ad; } + + h2.title { margin: 0; } + + #infoblock h2 { padding: 8px; margin: 0; } + + #pageblock h2 { padding: 8px; margin: 0; } + +h3 { font-size: 1.2em; line-height: 1.4em; margin: 0 0 10px 0; } + +/* Typography */ + +.aduity a { color: #d54e21; font-size: 1.2em; line-height: 1.4em; } + +p { color: #333; font-size: 1.2em; line-height: 1.4em; margin: 0 0 10px 0; } + + p a { color: #d54e21; } + + #header p { color: #888; font-size: 1.1em; margin: 0; } + + #header p a { color: #888; } + + .post p.subtitle { font-size: 1.1em; margin: 0; } + + .post p.singleline { margin: 0; } + + .post p.commentfoot { font-size: 1.1em; } + + .oneline p { margin: 0; } + + #postfoot p, #indexpostfoot p { font-size: 1.1em; margin: 0; } + + #postfoot p a { color: #d54e21; } + + #indexpostfoot p a { color: #ccc; } + + #comments p { font-size: 1.1em; margin: 0; } + + #comments p a { color: #d54e21; } + + #footer p { color: #666; font-size: 1.1em; margin: 0; } + + #footer p a { color: #666; } + +ul { list-style: disc; margin: 0 0 10px 25px; } + +ol { list-style: decimal; margin: 0 0 10px 25px; } + + ul li, ol li { color: #333; font-size: 1.2em; padding: 2px; } + + ol#pages { margin: 0 0 0 20px; } + + ol#pages li { color: #333; font-size: 1.1em; padding-left: 0; } + + ol#pages li a { color: #d54e21; } + +blockquote { border-left: 4px solid #ccc; margin: 8px; padding-left: 4px; } \ No newline at end of file diff --git a/system/views/admin_ads_analytics.php b/system/views/admin_ads_analytics.php new file mode 100644 index 0000000..33802e1 --- /dev/null +++ b/system/views/admin_ads_analytics.php @@ -0,0 +1,262 @@ +
+ + +

+
+ +

Ads & Analytics Settings

+ + + + + + + + + + + + + +
Enable Analytics: + +
Enable Ad Serving: + +
Enable Debug Mode: + + Useful for testing purposes. Ads will display in web browser when enabled +
+
+

Ad Serving Options

+
+
+ + + + + + + + + + + + + + + + + +
Type Of Ads: + +
Choose A Campaign: + +
Choose An Ad: + +
Ad Location: + +
+
+ + + +

Aduity Account Details

+ + + + + + + + + +
Account Public Key: + Find in your account settings. +
Account Secret Key: + Find in your account settings. +
+

+
+
\ No newline at end of file diff --git a/system/views/admin_ads_analytics_setup.php b/system/views/admin_ads_analytics_setup.php new file mode 100644 index 0000000..78bd4ba --- /dev/null +++ b/system/views/admin_ads_analytics_setup.php @@ -0,0 +1,25 @@ +
+

+

Setup Ads & Analytics

+

MobilePress gives you the ability to integrate with Aduity for mobile ad serving and analytics.

+

You will have to register an account at Aduity. Once you have done that, grab the account key and secret key so that to authenticate your MobilePress plugin with Aduity. You will then be able to configure ad serving and analytics from within MobilePress.

+

Account Settings

+

Please enter your Aduity account public key and account secret key.

+
+ + + + + + + + + +
Account Public Key: + Find in your account settings. +
Account Secret Key: + Find in your account settings. +
+

+
+
\ No newline at end of file diff --git a/system/views/admin_options.php b/system/views/admin_options.php new file mode 100644 index 0000000..a04027e --- /dev/null +++ b/system/views/admin_options.php @@ -0,0 +1,43 @@ +
+
+

+

Options

+ + + + + + + + + + + + + + + + + +
Blog Title: + Leave blank to default to your WordPress blog title +
Blog Description: + Leave blank to default to your WordPress blog description +
Mobile Themes Directory: + Where are you storing your mobile themes in wp-content/? +
Force Mobile Site? + +
+

+
+

Did You Know?

+

You can easily view your mobile theme in a web browser by visiting /?mobile or /?iphone for the iphone theme.

+

Remember, to view your normal blog theme again, simply visit /?nomobile.

+

Custom Themes

+

Why not create a custom theme for your mobile blog? Mobile themes are created in the same way as normal WordPress themes are created. Simply upload your mobile themes to wp-content/

+

Additional Support

+

Check out the official MobilePress support docs if you are having any trouble with the plugin. There is also a help desk where you can ask questions.

+
\ No newline at end of file diff --git a/system/views/admin_themes.php b/system/views/admin_themes.php new file mode 100644 index 0000000..7d07dc8 --- /dev/null +++ b/system/views/admin_themes.php @@ -0,0 +1,38 @@ +
+

+

Mobile Themes

+
+ + + + +
+ + + + (Select the browser you want to choose a theme for) +
+
+ + +

Current Theme For

+ $themes, 'current_theme' => $current_theme)); ?> +

Select A New Theme For

+ $themes, 'section' => $section)); ?> + +

No themes found!

+ +
\ No newline at end of file diff --git a/system/views/admin_themes_available_themes.php b/system/views/admin_themes_available_themes.php new file mode 100644 index 0000000..04ca114 --- /dev/null +++ b/system/views/admin_themes_available_themes.php @@ -0,0 +1,73 @@ +
+ + $cols ) { +?> + + $theme_name ) { + $class = array('available-theme'); + if ( $row == 1 ) $class[] = 'top'; + if ( $col == 1 ) $class[] = 'left'; + if ( $row == $rows ) $class[] = 'bottom'; + if ( $col == 3 ) $class[] = 'right'; +?> + + + + +
+' . __('Activate') . ''; + $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]); + $actions = implode ( ' | ', $actions ); +?> + + + + + +

+

+ + +

%2$s. The stylesheet files are located in %3$s. %4$s uses templates from %5$s. Changes made to the templates will affect both themes.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme); ?>

+ +

%2$s.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ) ); ?>

+ + +

+ + +
+
\ No newline at end of file diff --git a/system/views/admin_themes_current_theme.php b/system/views/admin_themes_current_theme.php new file mode 100644 index 0000000..163d197 --- /dev/null +++ b/system/views/admin_themes_current_theme.php @@ -0,0 +1,16 @@ +
+ +<?php _e('Current theme preview'); ?> + +

+

+ +

%2$s. The stylesheet files are located in %3$s. %4$s uses templates from %5$s. Changes made to the templates will affect both themes.'), $themes[$current_theme]['Title'], str_replace( WP_CONTENT_DIR, '', $themes[$current_theme]['Template Dir'] ), str_replace( WP_CONTENT_DIR, '', $themes[$current_theme]['Stylesheet Dir'] ), $themes[$current_theme]['Title'], $themes[$current_theme]['Parent Theme']); ?>

+ +

%2$s.'), $themes[$current_theme]['Title'], str_replace( WP_CONTENT_DIR, '', $themes[$current_theme]['Template Dir'] ), str_replace( WP_CONTENT_DIR, '', $themes[$current_theme]['Stylesheet Dir'] ) ); ?>

+ + +

+ +
+
\ No newline at end of file diff --git a/system/views/images/icon.png b/system/views/images/icon.png new file mode 100644 index 0000000..71ec4ef Binary files /dev/null and b/system/views/images/icon.png differ