' . __( 'Cheatin’ uh?' ) . '' . '

' . __( 'You are not allowed to edit theme options on this site.' ) . '

', 403 ); } if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { if ( 'activate' == $_GET['action'] ) { check_admin_referer('switch-theme_' . $_GET['stylesheet']); // SitePad pre switch theme function apply_filters('pre_switch_theme', $_GET['stylesheet']); $theme = wp_get_theme( $_GET['stylesheet'] ); if ( ! $theme->exists() || ! $theme->is_allowed() ) { wp_die( '

' . __( 'Cheatin’ uh?' ) . '

' . '

' . __( 'The requested theme does not exist.' ) . '

', 403 ); } switch_theme( $theme->get_stylesheet() ); wp_redirect( admin_url('themes.php?activated=true') ); exit; } elseif ( 'delete' == $_GET['action'] ) { check_admin_referer('delete-theme_' . $_GET['stylesheet']); $theme = wp_get_theme( $_GET['stylesheet'] ); if ( ! current_user_can( 'delete_themes' ) ) { wp_die( '

' . __( 'Cheatin’ uh?' ) . '

' . '

' . __( 'You are not allowed to delete this item.' ) . '

', 403 ); } if ( ! $theme->exists() ) { wp_die( '

' . __( 'Cheatin’ uh?' ) . '

' . '

' . __( 'The requested theme does not exist.' ) . '

', 403 ); } $active = wp_get_theme(); if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) { wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) ); } else { delete_theme( $_GET['stylesheet'] ); wp_redirect( admin_url( 'themes.php?deleted=true' ) ); } exit; } } wp_enqueue_script( 'script_handle', plugin_dir_url( __FILE__ ) . 'script.js', array( 'jquery', 'wp-util' ), '1.0', true ); $title = __('Manage Themes'); $parent_file = 'themes.php'; if ( current_user_can( 'switch_themes' ) ) { $themes = wp_prepare_themes_for_js(); } else { $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) ); } require_once( ABSPATH . 'site-admin/admin-header.php' ); ?>

  ';esc_html_e( 'Themes' ); ?>

$theme){ if($category != strtolower($theme['category'])){ unset($themes[$id]); } } } // Filter the themes by search query $query = optGET('q'); $query = rawurldecode($query); $searched = array(); if(!empty($query)){ $pagedurl .= 'q='.$query.'&'; foreach($themes as $id => $theme){ // Search by theme name if(substr(strtolower($theme['name']), 0, strlen($query)) === $query){ $searched[$id] = $theme; } // Search by Slug if(substr($theme['id'], 0, strlen($query)) === $query){ $searched[$id] = $theme; } // Search by tags $tags = explode(',', $theme['tags']); foreach($tags as $x => $v){ if(substr($v, 0, strlen($query)) === $query){ $searched[$id] = $theme; } } } } // Pagination $paged = (int) optGET('paged'); $perpage = 21; // Don't Show Pagination if search value less than perpage if(!empty($searched)){ $total_pages = ceil(count($searched)/$perpage); }else{ $total_pages = ceil(count($themes)/$perpage); } $current_page = 1; // Is it a valid page if(!empty($paged)){ $current_page = $paged; } if($paged > $total_pages){ $current_page = $paged = 1; } if($total_pages > 1){ echo '
    '; $pagedurl .= 'paged='; $previous = $current_page - 1; $next = $current_page + 1; if($current_page > 1){ echo '
  • «
  • <
  • '; } $start = 1; if($current_page > 1){ $start = $current_page - 1; } $end = $current_page + 1; if($end >= $total_pages){ $end = $total_pages; } for($start; $start <= $end; $start++){ echo '
  • '.$start.'
  • '; } if($current_page < $total_pages){ echo '
  • >
  • »
  • '; } echo '
'; } // Pagination ends ?>

Visit site' ), home_url( '/' ) ); ?>

'.__('Your new theme has been activated. You will now be redirected to the').' '.BRAND_SM_EDITOR.'

'; }else{ ?>

Visit site' ), home_url( '/' ) ); ?>


'; /* * This PHP is synchronized with the tmpl-theme template below! */ if(empty($paged)) $paged = 1; $skip = ($paged - 1) * $perpage; $count = 0; $skipped = 0; // Display Search Query (condition added to search from all themes and not only search results) if(!empty($searched)){ $show_themes = $searched; }else{ $show_themes = $themes; } foreach ( $show_themes as $theme ) : $aria_action = esc_attr( $theme['id'] . '-action' ); $aria_name = esc_attr( $theme['id'] . '-name' ); // We have already displayed themes allowed per page if($count >= $perpage){ break; } // Are we to skip themes until we reach the themes for desired page if(!empty($skip) && $skipped < $skip){ $skipped++; continue; } $count++; $needs_premium = 0; if(isset($theme['type']) && $theme['type'] > $sitepad['features']['themes']){ $needs_premium = 1; } ?>
'.$sitepad['theme_levels'][$theme['type']].'
'; } ?>

Active: %s' ), $theme['name'] ); ?>