function wptouch_get_theme_classes($extra_classes = array()) { $classes = $extra_classes; if (!is_network_admin() && wptouch_is_theme_active()) { $classes[] = 'active'; } if (wptouch_is_theme_in_cloud()) { $classes[] = 'cloud'; } if (wptouch_has_theme_tags()) { $tags = wptouch_get_theme_tags(); foreach ($tags as $tag) { $classes[] = $tag; } } $classes[] = 'name-' . wptouch_convert_to_class_name(wptouch_get_theme_title()); return $classes; }
?> <h3><?php echo $section->name; ?> </h3> <ul class="padded"> <?php foreach ($section->settings as $setting) { ?> <li class="wptouch-setting<?php if ($setting->is_pro) { echo " pro-setting"; } ?> " id="setting-<?php echo wptouch_convert_to_class_name($setting->name); ?> "> <?php wptouch_admin_render_setting($setting); ?> </li> <?php } ?> </ul> <?php /* TODO: Deprecated if ( wptouch_section_has_visible_settings( $section ) ) { ?> <h3><?php echo $section->name; ?> </h3>
?> -container"> <div class="item-information"> <?php if (wptouch_get_theme_icon()) { ?> <div class="image-wrapper"> <img src="<?php wptouch_the_theme_icon(); ?> " alt="<?php 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 class="version"><?php wptouch_the_theme_version(); ?> </span> <?php if (wptouch_has_theme_tags()) { ?> <?php $tags = wptouch_get_theme_tags(); ?> <?php foreach ($tags as $tag) { ?> <i class="wptouch-tooltip theme-tag tag-<?php echo wptouch_convert_to_class_name($tag); ?> " title="<?php echo sprintf(__('This theme supports %s devices', 'wptouch-pro'), wptouch_get_translated_device_type($tag)); ?> "></i> <?php } ?> <?php } ?> </h4> <h5> <?php echo sprintf(__('by %s', 'wptouch-pro'), wptouch_get_theme_author());
<img src="<?php wptouch_the_addon_preview_url(); ?> " alt="preview-image" /> </div> <?php } ?> </div> <!-- Carousel nav --> <a class="carousel-control left" href="#carousel-<?php echo wptouch_convert_to_class_name(wptouch_get_addon_title()); ?> " data-slide="prev">«</a> <a class="carousel-control right" href="#carousel-<?php echo wptouch_convert_to_class_name(wptouch_get_addon_title()); ?> " data-slide="next">»</a> </div> </div> <div class="modal-footer"> <button class="button" data-dismiss="modal" aria-hidden="true">Close</button> </div> </div> </div> <?php } ?> <div class="item-information"> <?php if (wptouch_cloud_addon_update_available()) {
function get_icons_from_packs($setname) { $settings = $this->get_settings(); $icon_packs = $this->get_available_icon_packs(); $icons = array(); if (isset($icon_packs[$setname])) { $pack = $icon_packs[$setname]; $dir = @opendir($pack->location); $class_name = wptouch_convert_to_class_name($setname); if ($dir) { while ($f = readdir($dir)) { if ($f == '.' || $f == '..' || $f == '.svn' || !$this->is_image_file($f)) { continue; } $icon_info = new stdClass(); $icon_info->location = $pack->location . '/' . $f; $icon_info->short_location = str_replace(WP_CONTENT_DIR, '', $icon_info->location); $icon_info->url = $pack->url . '/' . $f; $icon_info->name = $f; $icon_info->set = $setname; $icon_info->class_name = $class_name; $short_name_array = explode('.', $f); $short_name = $short_name_array[0]; $icon_info->short_name = $short_name; // add image size information if the user has the GD library installed if (function_exists('getimagesize')) { $icon_info->image_size = getimagesize($pack->location . '/' . $f); } $icons[$f . '/' . $setname] = $icon_info; } closedir($dir); } } ksort($icons); return $icons; }
function wptouch_pro_copy_theme($theme_name, $theme_location) { global $wptouch_pro; require_once WPTOUCH_DIR . '/core/file-operations.php'; $theme_location = WP_CONTENT_DIR . $theme_location; $theme_name = wptouch_convert_to_class_name($theme_name); $num = $wptouch_pro->get_theme_copy_num($theme_name); $copy_dest = WPTOUCH_CUSTOM_THEME_DIRECTORY . '/' . $theme_name . '-copy-' . $num; wptouch_create_directory_if_not_exist($copy_dest); $wptouch_pro->recursive_copy($theme_location, $copy_dest); $readme_file = $copy_dest . '/readme.txt'; $readme_info = $wptouch_pro->load_file($readme_file); if ($readme_info) { if (preg_match('#Theme Name: (.*)#', $readme_info, $matches)) { $new_name = $matches[1] . ' Copy #' . $num; $readme_info = str_replace($matches[0], 'Theme Name: ' . $new_name, $readme_info); $f = fopen($readme_file, "w+t"); if ($f) { fwrite($f, $readme_info); fclose($f); } } return array('name' => $new_name, 'location' => $copy_dest); } else { WPTOUCH_DEBUG(WPTOUCH_ERROR, "Unable to modify readme.txt file after copy"); return false; } }
function wptouch_is_multisite_extension() { return wptouch_convert_to_class_name(wptouch_get_addon_title()) == 'multisite'; }
function wptouch_pro_handle_admin_command() { global $wptouch_pro; if (isset($wptouch_pro->get['admin_command'])) { $admin_menu_nonce = $wptouch_pro->get['admin_menu_nonce']; if (wptouch_admin_menu_nonce_is_valid($admin_menu_nonce)) { // check user permissions if (current_user_can('switch_themes')) { switch ($wptouch_pro->get['admin_command']) { case 'activate_theme': WPTOUCH_DEBUG(WPTOUCH_INFO, 'Activating theme [' . $wptouch_pro->get['theme_name'] . ']'); $theme_to_activate = $wptouch_pro->get['theme_name']; if ($theme_to_activate) { $settings = $wptouch_pro->get_settings(); $paths = explode('/', ltrim(rtrim($wptouch_pro->get['theme_location'], '/'), '/')); $settings->current_theme_name = $paths[count($paths) - 1]; unset($paths[count($paths) - 1]); $settings->current_theme_location = '/' . implode('/', $paths); $settings->current_theme_friendly_name = $wptouch_pro->get['theme_name']; $settings->save(); } break; case 'activate_addon': WPTOUCH_DEBUG(WPTOUCH_INFO, 'Activating add-on [' . $wptouch_pro->get['addon_name'] . ']'); $addon_to_activate = $wptouch_pro->get['addon_name']; if ($addon_to_activate) { $settings = $wptouch_pro->get_settings(); if (!isset($settings->active_addons[$addon_to_activate])) { $paths = explode('/', ltrim(rtrim($wptouch_pro->get['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 = '/' . implode('/', $paths); $settings->active_addons[$addon_to_activate] = $addon_info; $settings->save(); } } break; case 'deactivate_addon': WPTOUCH_DEBUG(WPTOUCH_INFO, 'Deactivating add-on [' . $wptouch_pro->get['addon_name'] . ']'); $addon_to_deactivate = $wptouch_pro->get['addon_name']; if ($addon_to_deactivate) { $settings = $wptouch_pro->get_settings(); if (isset($settings->active_addons[$addon_to_deactivate])) { unset($settings->active_addons[$addon_to_deactivate]); $settings->save(); } } break; case 'copy_theme': WPTOUCH_DEBUG(WPTOUCH_INFO, 'Copying theme [' . $wptouch_pro->get['theme_name'] . ']'); require_once WPTOUCH_DIR . '/core/file-operations.php'; $copy_src = WP_CONTENT_DIR . $wptouch_pro->get['theme_location']; $theme_name = wptouch_convert_to_class_name($wptouch_pro->get['theme_name']); $num = $wptouch_pro->get_theme_copy_num($theme_name); $copy_dest = WPTOUCH_CUSTOM_THEME_DIRECTORY . '/' . $theme_name . '-copy-' . $num; wptouch_create_directory_if_not_exist($copy_dest); $wptouch_pro->recursive_copy($copy_src, $copy_dest); $readme_file = $copy_dest . '/readme.txt'; $readme_info = $wptouch_pro->load_file($readme_file); if ($readme_info) { if (preg_match('#Theme Name: (.*)#', $readme_info, $matches)) { $readme_info = str_replace($matches[0], 'Theme Name: ' . $matches[1] . ' Copy #' . $num, $readme_info); $f = fopen($readme_file, "w+t"); if ($f) { fwrite($f, $readme_info); fclose($f); } } } else { WPTOUCH_DEBUG(WPTOUCH_ERROR, "Unable to modify readme.txt file after copy"); } break; case 'delete_theme': WPTOUCH_DEBUG(WPTOUCH_INFO, 'Deleting theme [' . $wptouch_pro->get['theme_location'] . ']'); require_once WPTOUCH_DIR . '/core/file-operations.php'; $theme_location = WP_CONTENT_DIR . $wptouch_pro->get['theme_location']; $wptouch_pro->recursive_delete($theme_location); break; } } } $used_query_args = array('admin_menu_nonce', 'admin_command', 'theme_name', 'theme_location'); header('Location: ' . remove_query_arg($used_query_args)); die; } }