function do_api_request($method, $command, $params = array(), $do_auth = false) { $url = BNC_API_URL . "/{$method}/{$command}/"; // Always use the PHP serialization method for data $params['format'] = 'php'; if (is_multisite()) { $params['multisite'] = 1; $params['site_id'] = get_current_blog_id(); $params['network_activated'] = is_plugin_active_for_network(WPTOUCH_PLUGIN_SLUG) ? '1' : '0'; $params['network_controlled'] = wptouch_is_controlled_network() ? '1' : '0'; } else { $params['multisite'] = 0; } if ($do_auth && $this->might_have_license) { // Sort the parameters ksort($params); // Generate a string to use for authorization $auth_string = ''; foreach ($params as $key => $value) { $auth_string = $auth_string . $key . $value; } WPTOUCH_DEBUG(WPTOUCH_INFO, 'Auth string [' . $auth_string . '], Key [' . $this->license_key . ']'); // Create the authorization hash using the server nonce and the license key $params['auth'] = md5($auth_string . $this->license_key); } $body_params = array(); foreach ($params as $key => $value) { $body_params[] = $key . '=' . urlencode($value); } $body = implode('&', $body_params); $options = array('method' => 'POST', 'timeout' => BNC_API_TIMEOUT, 'body' => $body); $options['headers'] = array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 'Content-Length' => strlen($body), 'User-Agent' => 'WordPress/' . get_bloginfo("version") . '/WPtouch-Pro/' . WPTOUCH_VERSION, 'Referer' => get_bloginfo("url")); $this->attempts++; WPTOUCH_DEBUG(WPTOUCH_INFO, 'Attempting to connect to URL: ' . $url); $raw_response = wp_remote_request($url, $options); if (!is_wp_error($raw_response)) { if ($raw_response['response']['code'] == 200) { // echo "\n\n" . $raw_response[ 'body' ] . "\n\n"; die; $result = unserialize($raw_response['body']); $this->response_code = $result['code']; return $result; } else { WPTOUCH_DEBUG(WPTOUCH_WARNING, "Unable to connect to server. Response code is " . $raw_response['response']['code']); return false; } } else { $this->server_down = true; return false; } }
function wptouch_is_network_available($type, $check_product = false) { if ($type == 'theme' && !$check_product) { global $wptouch_cur_theme; $check_product = $wptouch_cur_theme; } elseif (!$check_product) { global $wptouch_cur_addon; $check_product = $wptouch_cur_addon; } if ($check_product) { if (!is_multisite()) { return true; } else { if ($check_product->location != 'cloud') { return true; } elseif (!wptouch_is_controlled_network() || wptouch_is_controlled_network() && is_network_admin()) { return true; } return false; } } return false; }
wptouch_the_theme_title(); ?> " id="<?php echo wptouch_convert_to_class_name(wptouch_get_theme_title()); ?> " /> </div><!-- image-wrapper --> <?php } ?> <h2> <?php wptouch_the_theme_title(); ?> <?php if (!wptouch_is_theme_in_cloud() && is_network_admin() && wptouch_is_controlled_network()) { ?> <span class="installed"><?php _e('Installed', 'wptouch-pro'); ?> </span> <?php } ?> </h2> <p class="desc"> <?php wptouch_the_theme_description(); ?> </p>
<?php if (!defined('FOUNDATION_SETTING_DOMAIN')) { define('FOUNDATION_SETTING_DOMAIN', 'foundation'); } if (!wptouch_is_controlled_network() || wptouch_is_controlled_network() && is_network_admin()) { add_filter('wptouch_admin_page_render_wptouch-admin-general-settings', 'wptouch_render_updates_page'); } add_filter('wptouch_admin_page_render_wptouch-admin-general-settings', 'wptouch_render_general_page'); add_filter('wptouch_admin_page_render_wptouch-admin-general-settings', 'wptouch_render_compat_page'); add_filter('wptouch_admin_page_render_wptouch-admin-general-settings', 'wptouch_render_devices_page'); add_filter('wptouch_admin_page_render_wptouch-admin-general-settings', 'wptouch_render_menu_page'); add_filter('wptouch_admin_page_render_wptouch-admin-general-settings', 'wptouch_render_themes'); add_filter('wptouch_admin_page_render_wptouch-admin-general-settings', 'wptouch_render_theme_customize_page'); add_filter('wptouch_admin_page_render_wptouch-admin-general-settings', 'wptouch_render_theme_gopro_page'); add_filter('wptouch_admin_page_render_wptouch-admin-general-settings', 'wptouch_render_addons'); add_filter('wptouch_admin_page_render_wptouch-admin-general-settings', 'wptouch_render_addon_settings'); function wptouch_render_updates_page($page_options) { global $wptouch_pro; if ($wptouch_pro->theme_upgrades_available() || $wptouch_pro->extension_upgrades_available() || wptouch_is_update_available() != WPTOUCH_VERSION) { $settings = wptouch_get_settings(); wptouch_add_sub_page(WPTOUCH_ADMIN_UPDATES_AVAILABLE, 'updates-available', $page_options); wptouch_add_page_section(WPTOUCH_ADMIN_UPDATES_AVAILABLE, __('Updates Available', 'wptouch-pro'), 'updates-available', array(wptouch_add_setting('updates-available', 'theme-extension-updates-available', false, false, WPTOUCH_SETTING_BASIC, '4.0')), $page_options); } return $page_options; } function wptouch_render_general_page($page_options) { $settings = wptouch_get_settings(); wptouch_add_sub_page(WPTOUCH_ADMIN_SETUP_GENERAL, 'setup-general-general', $page_options);
function wptouch_activate_addon($addon_to_activate) { global $wptouch_pro; if ($addon_to_activate) { $settings = $wptouch_pro->get_settings(); $is_multisite = $addon_to_activate == 'Multisite'; $extension_active = false; if ($is_multisite) { $multisite_info = get_site_option('wptouch_multisite_active', false, false); if ($multisite_info) { $extension_active = true; } } else { $extension_active = isset($settings->active_addons[$addon_to_activate]); } if (!$extension_active) { $available_addons = $wptouch_pro->get_available_addons(true); if (isset($available_addons[$addon_to_activate]) && $available_addons[$addon_to_activate]->location == 'cloud') { $addon_location = wptouch_pro_install_addon($available_addons[$addon_to_activate]); if (is_object($addon_location)) { $continue = false; } } else { $addon_location = $available_addons[$addon_to_activate]->location; } if (wptouch_is_controlled_network() && (is_network_admin() && !$is_multisite)) { $continue = false; } else { $continue = true; } if ($continue) { $paths = explode(DIRECTORY_SEPARATOR, ltrim(rtrim($addon_location, DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR)); $addon_info = new stdClass(); $addon_info->addon_name = $paths[count($paths) - 1]; unset($paths[count($paths) - 1]); $addon_info->location = DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $paths); if ($is_multisite) { $multisite_info = $addon_info; update_site_option('wptouch_multisite_active', $multisite_info); } else { $settings->active_addons[$addon_to_activate] = $addon_info; $settings->save(); } do_action('wptouch_activated_addon_' . $addon_info->addon_name); } } } }
function check_for_self_destruct() { if (isset($this->post['wptouch-self-destruct'])) { $nonce = $this->post['wptouch-self-destruct-nonce']; if (!wp_verify_nonce($nonce, 'tsarbomba') || !current_user_can('activate_plugins')) { return; } // Self Destruct $wipe_settings = false; $wipe_wptouch_data = false; $wipe_deactivate = false; if (isset($this->post['wptouch-self-destruct-1'])) { $wipe_settings = true; } else { if (isset($this->post['wptouch-self-destruct-2'])) { $wipe_settings = true; $wipe_wptouch_data = true; } else { if (isset($this->post['wptouch-self-destruct-3'])) { $wipe_settings = true; $wipe_wptouch_data = true; $wipe_deactivate = true; } } } // Wipe all settings, including the active domain and foundation/framework if ($wipe_settings) { $setting_domains = $this->get_active_setting_domains(); foreach ($setting_domains as $domain) { if ($domain == 'bncid') { continue; } $setting_name = $this->get_wp_setting_name_for_domain($domain); if ($this->is_domain_site_wide($domain)) { delete_site_option($setting_name); } else { delete_option($setting_name); } } do_action('wptouch_after_self_destruct'); } if ($wipe_wptouch_data) { require_once WPTOUCH_DIR . '/core/file-operations.php'; if (wptouch_is_controlled_network()) { wptouch_recursive_delete(WPTOUCH_BASE_CONTENT_MS_DIR); } else { wptouch_recursive_delete(WPTOUCH_BASE_CONTENT_DIR); } } if ($wipe_deactivate) { deactivate_plugins(WPTOUCH_PLUGIN_ACTIVATE_NAME); wp_redirect(admin_url('plugins.php')); exit; } else { setcookie('jQu3ry_5teps_St@te_wptouch-wizard-container', '', time() - 3600); wp_redirect(wptouch_admin_url('admin.php?page=wptouch-admin-wizard')); exit; } } if (isset($this->get['wptouch_license_action']) && $this->get['wptouch_license_action'] == 'remove_license') { $nonce = $this->get['wptouch_license_nonce']; if (wp_verify_nonce($nonce, 'tsarbomba') && current_user_can('activate_plugins')) { $this->setup_bncapi(); $this->bnc_api->user_remove_license(); wp_redirect(add_query_arg(array('wptouch_license_action' => null, 'wptouch_license_nonce' => null))); die; } } }
" /></a></td> <td> <h4><a href="//www.wptouch.com/account"><?php echo wptouchize_it(__('WPtouch Pro Account', 'wptouch-pro')); ?> </a></h4> <p><?php echo wptouchize_it(__('Access your WPtouch Pro account to mange your license, access support resources, or upgrade your license.', 'wptouch-pro')); ?> </p> </td> </tr> </table> </div> <?php if (!wptouch_is_controlled_network() || wptouch_is_controlled_network() && current_user_can('manage_network')) { ?> <div class="wptouch-installation"> <h2><?php _e('Installation', 'wptouch-pro'); ?> </h2> <input type="hidden" name="wptouch-self-destruct" value="1" /> <input type="hidden" name="wptouch-self-destruct-nonce" value="<?php echo wp_create_nonce('tsarbomba'); ?> " /> <table> <tr> <td><button class="button" id="backup-button"><?php _e('Download Settings', 'wptouch-pro');
?> > <?php $hide_keys = array('Updates Available', 'Multisite Setup', 'General', 'Compatibility', 'Customize Theme', 'Devices', 'Themes', 'Extensions', 'Customizer', 'Theme Settings', 'Menu Settings'); if (!defined('WPTOUCH_IS_FREE')) { $hide_keys[] = 'Go Pro'; } $show_keys = array_diff(array_keys($panel_options), $hide_keys); ?> <h2><?php _e('Setup', 'wptouch-pro'); ?> </h2> <ul> <?php if (!defined('WPTOUCH_IS_FREE') && (!wptouch_is_controlled_network() || wptouch_is_controlled_network() && is_network_admin())) { ?> <?php global $wptouch_pro; ?> <?php if ($wptouch_pro->theme_upgrades_available() || $wptouch_pro->extension_upgrades_available()) { ?> <li><a href="#" class="updates-available<?php if (isset($_COOKIE['wptouch-4-admin-menu']) && $_COOKIE['wptouch-4-admin-menu'] == 'updates-available') { echo ' active'; } ?> " data-page-slug="updates-available"><?php _e('Updates Available', 'wptouch-pro'); ?>
} ?> <?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 _e('Download', 'wptouch-pro'); ?> </a> <?php } ?> <?php }
"><?php _e('Upload', 'wptouch-pro'); ?> </button> <p class="small"><?php _e('You can activate extensions in the next step', 'wptouch-pro'); ?> </p> </section> <?php } ?> <?php if (!is_network_admin()) { if (wptouch_is_controlled_network()) { $extensions = $wptouch_pro->get_available_addons(false); } else { $extensions = $wptouch_pro->get_available_addons(wptouch_can_cloud_install()); } if (count($extensions) > 0) { ?> <details>Activate Extensions</details> <section class="activate-extensions"> <h2><?php _e('Activate Extensions', 'wptouch-pro'); ?> </h2> <p><?php echo wptouchize_it(__('Extensions are like mini-plugins that help you extend WPtouch Pro. You can also manage Extensions at any time from the WPtouch Pro settings panel.', 'wptouch-pro')); ?>
<?php if (current_user_can('install_plugins') && !defined('WPTOUCH_IS_FREE')) { ?> <div class="action-buttons<?php if (!wptouch_can_cloud_install()) { ?> no-install<?php } ?> "> <?php if (is_network_admin()) { ?> <?php if (wptouch_is_controlled_network() || wptouch_is_multisite_extension()) { ?> <?php if (!wptouch_is_addon_active()) { ?> <?php if (wptouch_get_addon_buy_url()) { ?> <a class="button buynow" href="<?php wptouch_the_addon_buy_url(); ?> "> <?php _e('Add to License', 'wptouch-pro'); ?> </a>