function wptouch_get_menu_icon($page_id) { global $wptouch_pro; if ($page_id == false) { $page_id = wptouch_get_menu_id(); } $menu_icon = get_post_meta($page_id, '_wptouch_pro_menu_item_icon', true); if ($menu_icon) { return wptouch_check_url_ssl(site_url() . $menu_icon); } else { return wptouch_get_site_default_icon(); } }
function wptouch_get_menu_icon($page_id) { global $wptouch_pro; if ($page_id == false) { $page_id = wptouch_get_menu_id(); } $menu_icon = get_post_meta($page_id, '_wptouch_pro_menu_item_icon', true); if ($menu_icon) { $icon = wptouch_check_url_ssl(site_url() . $menu_icon); if (!defined('WPTOUCH_IS_FREE')) { $wptouch_free_potential_path = DIRECTORY_SEPARATOR . 'wptouch' . DIRECTORY_SEPARATOR; if (strpos($icon, $wptouch_free_potential_path) !== false) { return str_replace($wptouch_free_potential_path, DIRECTORY_SEPARATOR . 'wptouch-pro-3' . DIRECTORY_SEPARATOR, $icon); } } return $icon; } else { return wptouch_get_site_default_icon(); } }
function wptouch_setup_base_content_dir() { global $blog_id; global $wptouch_pro; $wptouch_upload_dir = wp_upload_dir(); // Where we want the base content directory to be $desirable_dir = '/wptouch-data'; if (is_multisite()) { define('WPTOUCH_BASE_CONTENT_MS_DIR', WP_CONTENT_DIR . $desirable_dir); define('WPTOUCH_BASE_CONTENT_MS_URL', wptouch_check_url_ssl(WP_CONTENT_URL) . $desirable_dir); if ($blog_id) { wptouch_create_directory_if_not_exist(WPTOUCH_BASE_CONTENT_MS_DIR); $desirable_dir = $desirable_dir . '/' . $blog_id; } } $undesirable_dir = $wptouch_upload_dir['basedir'] . '/wptouch-data'; if (file_exists($undesirable_dir)) { // Need to migrate here //define( 'WPTOUCH_BASE_CONTENT_DIR', $wptouch_upload_dir[ 'basedir' ] . '/wptouch-data' ); //define( 'WPTOUCH_BASE_CONTENT_URL', wptouch_check_url_ssl( $wptouch_upload_dir[ 'baseurl' ] . '/wptouch-data' ) ); wptouch_create_directory_if_not_exist(WP_CONTENT_DIR . $desirable_dir); $migration_paths = array('themes', 'icons', 'lang', 'uploads', 'add-ons', 'backups'); foreach ($migration_paths as $path) { if (file_exists($undesirable_dir . '/' . $path)) { if (!file_exists(WP_CONTENT_DIR . $desirable_dir . '/' . $path)) { // This is a fresh migration, so let's just move it if (!rename($undesirable_dir . '/' . $path, WP_CONTENT_DIR . $desirable_dir . '/' . $path)) { define('WPTOUCH_MIGRATION_OLD_ISSUE', 1); } } } } } define('WPTOUCH_BASE_CONTENT_DIR', WP_CONTENT_DIR . $desirable_dir); define('WPTOUCH_BASE_CONTENT_URL', wptouch_check_url_ssl(WP_CONTENT_URL) . $desirable_dir); }
function foundation_prepare_uploaded_file_url($uploaded_file) { if (!strstr($uploaded_file, 'http') && !strstr($uploaded_file, 'wp-content')) { $uploaded_file = WPTOUCH_BASE_CONTENT_URL . $uploaded_file; } else { $uploaded_file = wptouch_check_url_ssl($uploaded_file); } return $uploaded_file; }
function wptouch_get_theme_preview_url() { global $wptouch_theme_preview_item; return wptouch_check_url_ssl(wptouch_get_theme_url() . '/preview/' . $wptouch_theme_preview_item); }
function wptouch_admin_handle_ajax($wptouch_pro, $ajax_action) { switch ($ajax_action) { case 'dismiss-warning': $wptouch_pro->check_plugins_for_warnings(); $settings = $wptouch_pro->get_settings(); if ($wptouch_pro->post['plugin']) { if (!in_array($wptouch_pro->post['plugin'], $settings->dismissed_warnings)) { $settings->dismissed_warnings[] = $wptouch_pro->post['plugin']; $settings->save(); } } echo wptouch_get_plugin_warning_count(); break; case 'enable-menu-item': if (isset($wptouch_pro->post['is_checked']) && isset($wptouch_pro->post['page_id'])) { $page_id = $wptouch_pro->post['page_id']; // save the icon state if ($wptouch_pro->post['is_checked']) { delete_post_meta($page_id, '_wptouch_pro_menu_item_disabled'); } else { update_post_meta($page_id, '_wptouch_pro_menu_item_disabled', '1'); } echo '0'; } break; case 'update-page-icon': if (isset($wptouch_pro->post['page_id']) && isset($wptouch_pro->post['image_file'])) { $page_id = $wptouch_pro->post['page_id']; $image_file = str_replace(wptouch_check_url_ssl(site_url()), '', $wptouch_pro->post['image_file']); // save the icon state update_post_meta($page_id, '_wptouch_pro_menu_item_icon', $image_file); echo '0'; } break; case 'reset-page-icons-and-state': $wptouch_pro->reset_icon_states(); echo '0'; break; case 'set-default-icon': $settings = wptouch_get_settings(); $settings->default_menu_icon = str_replace(wptouch_check_url_ssl(site_url()), '', $wptouch_pro->post['image_file']); $settings->save(); echo '0'; break; case 'reset-page-icon': if (isset($wptouch_pro->post['page_id'])) { delete_post_meta($wptouch_pro->post['page_id'], '_wptouch_pro_menu_item_icon'); echo '0'; } break; case 'delete-image-upload': if (isset($wptouch_pro->post['setting_name'])) { $wptouch_pro->update_encoded_setting($wptouch_pro->post['setting_name'], false); echo '0'; } break; case 'delete-custom-icon': if (current_user_can('upload_files')) { if (isset($wptouch_pro->post['icon_name'])) { $icon_location = WPTOUCH_CUSTOM_ICON_DIRECTORY . '/' . $wptouch_pro->post['icon_name']; unlink($icon_location); echo '0'; } } break; case 'load-news': echo wptouch_capture_include_file(WPTOUCH_DIR . '/admin/html/news.php'); break; case 'load-notifications': case 'load-notifications-plugin': wptouch_notification_setup(); $result = array(); $result['html'] = wptouch_capture_include_file(WPTOUCH_DIR . '/admin/html/notification-content.php'); $result['count'] = wptouch_get_notification_count(); echo json_encode($result); break; case 'dismiss-notification': wptouch_notification_setup(); $settings = wptouch_get_settings(); if (!in_array($wptouch_pro->post['notification_key'], $settings->dismissed_notifications)) { $settings->dismissed_notifications[] = $wptouch_pro->post['notification_key']; $settings->save(); } $result = array(); $result['html'] = wptouch_capture_include_file(WPTOUCH_DIR . '/admin/html/notification-content.php'); $result['count'] = wptouch_get_notification_count(); echo json_encode($result); break; case 'load-plugin-compat-list': $wptouch_pro->generate_plugin_hook_list(true); $compat_settings = wptouch_get_settings('compat'); if (is_array($compat_settings->plugin_hooks) && count($compat_settings->plugin_hooks)) { $changed = false; foreach ($compat_settings->plugin_hooks as $name => $value) { if (!isset($compat_settings->enabled_plugins[$name])) { $compat_settings->enabled_plugins[$name] = 1; $changed = true; } } if ($changed) { $compat_settings->save(); } } echo wptouch_capture_include_file(WPTOUCH_DIR . '/admin/settings/html/plugin-compat-ajax.php'); break; case 'prep-settings-download': require_once WPTOUCH_DIR . '/core/admin-backup-restore.php'; $backup_file = wptouch_backup_settings(); echo $backup_file; break; case 'load-touchboard-area': if (defined('WPTOUCH_IS_FREE')) { $content = wp_remote_get('http://wptouch-pro-3.s3.amazonaws.com/WPtouchBoard/free/page.xhtml'); } else { $content = wp_remote_get('http://wptouch-pro-3.s3.amazonaws.com/WPtouchBoard/pro/3.4/page.xhtml'); } if (!is_wp_error($content)) { echo $content['body']; } break; case 'load-upgrade-area': $content = wp_remote_get('http://wptouch-pro-3.s3.amazonaws.com/WPtouchBoard/upgrade/page.xhtml'); if (!is_wp_error($content)) { echo $content['body']; } break; case 'download-icon-set': global $wptouch_pro; require_once WPTOUCH_DIR . '/core/icon-set-installer.php'; $icon_set_installer = new WPtouchIconSetInstaller(); $icon_set_installer->install($wptouch_pro->post['base'], $wptouch_pro->post['url']); if (file_exists(WPTOUCH_BASE_CONTENT_DIR . '/icons/' . $wptouch_pro->post['base'])) { echo '1'; } else { echo '0'; } break; case 'get-icon-set-info': require_once WPTOUCH_DIR . '/core/admin-icons.php'; echo wptouch_capture_include_file(WPTOUCH_DIR . '/admin/settings/html/installed_icon_sets_ajax.php'); break; case 'admin-change-log': if (!defined('WPTOUCH_IS_FREE')) { $change_log = wp_remote_get(WPTOUCH_PRO_README_FILE); } else { $change_log = wp_remote_get('http://plugins.svn.wordpress.org/wptouch/trunk/readme.txt'); } if (!is_wp_error($change_log)) { $content = $change_log['body']; $result = preg_match_all("#= Version (.*) =(.*)\n=#iUs", $content, $matches); if ($result) { $entries = count($matches[0]); for ($i = 0; $i < $entries; $i++) { echo '<h4 style="font-family: Helvetica, sans-serif">' . sprintf(__('Version %s', 'wptouch-pro'), $matches[1][$i]) . '</h4><ul style="font-family: Helvetica, sans-serif; font-size: 13px">'; echo str_replace('* ', '<li style="padding-top:3px;padding-bottom:3px;">', str_replace("\n", "</li>\n", $matches[2][$i])); echo '</ul>'; } } } else { echo __('There is a temporary issue retrieving the change-log. Please try again later.', 'wptouch-pro'); } break; case 'load-addon-browser': require_once WPTOUCH_DIR . '/admin/settings/html/extension-browser-ajax.php'; break; case 'load-theme-browser': require_once WPTOUCH_DIR . '/admin/settings/html/theme-browser-ajax.php'; break; case 'repair-active-theme': $result = wptouch_repair_active_theme_from_cloud($errors); if (wptouch_migration_is_theme_broken()) { echo '0'; } else { echo '1'; } break; default: do_action('wptouch_admin_ajax_' . $ajax_action); do_action('wptouch_admin_ajax_intercept', $ajax_action); break; } }
function setup_child_theme_styles() { $css_file = $this->check_and_use_css_file($this->get_stylesheet_directory(false) . '/style.css'); wp_enqueue_style('wptouch_child', wptouch_check_url_ssl($css_file), array('wptouch-parent'), WPTOUCH_VERSION); }
define('WPTOUCH_CUSTOM_SET_DIRECTORY', WPTOUCH_BASE_CONTENT_DIR . '/icons'); define('WPTOUCH_CUSTOM_UPLOAD_DIRECTORY', WPTOUCH_BASE_CONTENT_DIR . '/uploads'); define('WPTOUCH_CUSTOM_ICON_DIRECTORY', WPTOUCH_BASE_CONTENT_DIR . '/icons/custom'); define('WPTOUCH_CUSTOM_THEME_DIRECTORY', WPTOUCH_BASE_CONTENT_DIR . '/themes'); define('WPTOUCH_CUSTOM_ADDON_DIRECTORY', WPTOUCH_BASE_CONTENT_DIR . '/extensions'); define('WPTOUCH_CUSTOM_LANG_DIRECTORY', WPTOUCH_BASE_CONTENT_DIR . '/lang'); define('WPTOUCH_DEBUG_DIRECTORY', WPTOUCH_BASE_CONTENT_DIR . '/debug'); define('WPTOUCH_DEBUG_URL', WPTOUCH_BASE_CONTENT_URL . '/debug'); define('WPTOUCH_CACHE_DIRECTORY', WPTOUCH_BASE_CONTENT_DIR . '/cache'); define('WPTOUCH_BACKUP_DIRECTORY', WPTOUCH_BASE_CONTENT_DIR . '/backups'); define('WPTOUCH_CACHE_URL', WPTOUCH_BASE_CONTENT_URL . '/cache'); define('WPTOUCH_CUSTOM_ICON_URL', WPTOUCH_BASE_CONTENT_URL . '/icons/custom'); // Separates the two types of settings in terms of usability define('WPTOUCH_SETTING_BASIC', 0); define('WPTOUCH_SETTING_ADVANCED', 1); define('WPTOUCH_DEFAULT_MENU_ICON', str_replace(wptouch_check_url_ssl(site_url()), '', plugins_url(WPTOUCH_ROOT_NAME) . '/resources/icons/elegant/Paper.png')); define('WPTOUCH_DEFAULT_HOMESCREEN_ICON', WPTOUCH_URL . '/admin/images/default-bookmark.png'); define('WPTOUCH_SECS_IN_DAY', 60 * 60 * 24); define('WPTOUCH_MULTISITE_LICENSED', 'wptouch_pro_licensed'); define('WPTOUCH_THUMBNAIL_SIZE', 144); define('WPTOUCH_FEATURED_SIZE', 900); define('WPTOUCH_EXCERPT_LENGTH', 24); define('WPTOUCH_PRO_README_FILE', 'http://www.wptouch.com/wptouch-pro-3/readme.txt'); define('ADDON_SETTING_DOMAIN', 'addons'); define('WPTOUCH_API_GENERAL_CACHE_TIME', 1800); define('WPTOUCH_THEME_ADDON_TRANSIENT_TIME', 600); if (defined('WPTOUCH_IS_FREE')) { define('WPTOUCH_API_CHECK_INTERVAL', 43200); } else { define('WPTOUCH_API_CHECK_INTERVAL', 1500); }
function https_for_ssl($content) { return wptouch_check_url_ssl($content); }
function wptouch_save_menu_icon($menu_id, $menu_item_db_id, $args) { if (isset($_POST['menu-item-icon']) && isset($_POST['menu-item-icon'][$menu_item_db_id])) { $image_file = str_replace(wptouch_check_url_ssl(site_url()), '', $_POST['menu-item-icon'][$menu_item_db_id]); if (substr($image_file, 0, 2) == '//') { // Fix for sites that implement protocol-relative media URLs, e.g. with Cloudflare plugin $image_file = substr($image_file, 2); $image_file = substr($image_file, strpos($image_file, '/')); } update_post_meta($menu_item_db_id, '_wptouch_pro_menu_item_icon', $image_file); } }
function wptouch_save_menu_icon($menu_id, $menu_item_db_id, $args) { if (isset($_POST['menu-item-icon']) && isset($_POST['menu-item-icon'][$menu_item_db_id])) { $image_file = str_replace(wptouch_check_url_ssl(site_url()), '', $_POST['menu-item-icon'][$menu_item_db_id]); update_post_meta($menu_item_db_id, '_wptouch_pro_menu_item_icon', $image_file); } }
<a class="button buynow" href="<?php wptouch_the_theme_buy_url(); ?> "> <?php _e('Add to License', 'wptouch-pro'); ?> </a> <?php } ?> <?php } elseif (!wptouch_is_theme_active() && !is_network_admin() || wptouch_is_theme_in_cloud()) { ?> <a class="button activate" href="<?php echo wptouch_check_url_ssl(wptouch_get_theme_activate_link_url()); ?> "> <?php echo $activate_label; ?> </a> <?php if (!wptouch_can_cloud_install() && wptouch_is_theme_in_cloud() && wptouch_get_theme_download_url() && !wptouch_get_theme_buy_url() && (!wptouch_is_controlled_network() || is_network_admin())) { ?> <a class="button download theme" href="<?php wptouch_the_theme_download_url(); ?> "> <?php
<?php echo wptouch_get_activation_label(); ?> </a> <?php } ?> <?php } ?> <?php if (!wptouch_can_cloud_install()) { ?> <a class="button activate" href="<?php echo wptouch_check_url_ssl(wptouch_get_addon_activate_link_url()); ?> "> <?php } ?> <?php } ?> <?php } else { ?> <!-- Plugin is active --> <?php if (!wptouch_is_multisite_extension()) { ?>