| 90 | | foreach ($theme_names as $theme_name) { |
|---|
| 91 | | if ( $theme_name == $ct->name ) |
|---|
| 92 | | continue; |
|---|
| 93 | | $template = $themes[$theme_name]['Template']; |
|---|
| 94 | | $stylesheet = $themes[$theme_name]['Stylesheet']; |
|---|
| 95 | | $title = $themes[$theme_name]['Title']; |
|---|
| 96 | | $version = $themes[$theme_name]['Version']; |
|---|
| 97 | | $description = $themes[$theme_name]['Description']; |
|---|
| 98 | | $author = $themes[$theme_name]['Author']; |
|---|
| 99 | | $screenshot = $themes[$theme_name]['Screenshot']; |
|---|
| 100 | | $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir']; |
|---|
| 101 | | $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template); |
|---|
| 102 | | ?> |
|---|
| 103 | | <div class="available-theme"> |
|---|
| 104 | | <h3><a href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3> |
|---|
| | 98 | // Pagination |
|---|
| | 99 | $themes_per_page = (int) apply_filters('themes_per_page', 16); |
|---|
| | 100 | $actual_page = (int) ( isset($_GET['pagination']) ) ? $_GET['pagination'] : 1; |
|---|
| | 101 | |
|---|
| | 102 | $found_themes = count($theme_names); |
|---|
| | 103 | $max_num_pages = ceil($found_themes/$themes_per_page); |
|---|
| 112 | | <p><?php echo $description; ?></p> |
|---|
| 113 | | </div> |
|---|
| 114 | | <?php } // end foreach theme_names ?> |
|---|
| | 111 | $start = ($actual_page - 1) * $themes_per_page; |
|---|
| | 112 | $end = $start + $themes_per_page; |
|---|
| | 113 | |
|---|
| | 114 | if ( $max_num_pages > 1 ) { |
|---|
| | 115 | $output = '<div class="pagination">'; |
|---|
| | 116 | $output .= __('Page: '); |
|---|
| | 117 | for ( $i = 1; $i <= $max_num_pages; $i++ ) { |
|---|
| | 118 | $output .= '<a href="themes.php?pagination='.$i.'">'.$i.'</a>'; |
|---|
| | 119 | } |
|---|
| | 120 | $output = str_replace('pagination='.$actual_page.'">', 'pagination='.$actual_page.'" class="current_page">', $output); |
|---|
| | 121 | $output .= '</div>'; |
|---|
| | 122 | echo $output; |
|---|
| | 123 | } |
|---|
| | 124 | |
|---|
| | 125 | $i = 0; |
|---|
| | 126 | foreach ( (array) $theme_names as $theme_name) { |
|---|
| | 127 | if ( ($i >= $start) && ($i < $end) ) { |
|---|
| | 128 | $template = $themes[$theme_name]['Template']; |
|---|
| | 129 | $stylesheet = $themes[$theme_name]['Stylesheet']; |
|---|
| | 130 | $title = $themes[$theme_name]['Title']; |
|---|
| | 131 | $version = $themes[$theme_name]['Version']; |
|---|
| | 132 | $description = $themes[$theme_name]['Description']; |
|---|
| | 133 | $author = $themes[$theme_name]['Author']; |
|---|
| | 134 | $screenshot = $themes[$theme_name]['Screenshot']; |
|---|
| | 135 | $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir']; |
|---|
| | 136 | $activate_link = wp_nonce_url("themes.php?action=activate&pagination=".$actual_page."&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template); |
|---|
| | 137 | ?> |
|---|
| | 138 | <div class="available-theme"> |
|---|
| | 139 | <h3><a href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3> |
|---|
| 116 | | <?php } ?> |
|---|
| | 141 | <a href="<?php echo $activate_link; ?>" class="screenshot"> |
|---|
| | 142 | <?php if ( $screenshot ) : ?> |
|---|
| | 143 | <img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="<?php echo attribute_escape(strip_tags($title)); ?>" /> |
|---|
| | 144 | <?php endif; ?> |
|---|
| | 145 | </a> |
|---|
| | 146 | <p><?php echo $description; ?></p> |
|---|
| | 147 | </div> |
|---|
| | 148 | <?php |
|---|
| | 149 | } |
|---|
| | 150 | $i++; |
|---|
| | 151 | } // end foreach theme_names |
|---|
| | 152 | |
|---|
| | 153 | if ( $max_num_pages > 1 ) { |
|---|
| | 154 | $output = '<div class="pagination">'; |
|---|
| | 155 | $output .= __('Page: '); |
|---|
| | 156 | for ( $i = 1; $i <= $max_num_pages; $i++ ) { |
|---|
| | 157 | $output .= '<a href="themes.php?pagination='.$i.'">'.$i.'</a>'; |
|---|
| | 158 | } |
|---|
| | 159 | $output = str_replace('pagination='.$actual_page.'">', 'pagination='.$actual_page.'" class="current_page">', $output); |
|---|
| | 160 | $output .= '</div>'; |
|---|
| | 161 | echo $output; |
|---|
| | 162 | } |
|---|
| | 163 | ?> |
|---|
| | 164 | <style type="text/css"> |
|---|
| | 165 | .pagination { clear:both;text-align:center; } |
|---|
| | 166 | .pagination a { margin: 0 3px; } |
|---|
| | 167 | .pagination a.current_page { font-weight:700; } |
|---|
| | 168 | </style> |
|---|
| | 169 | <?php |
|---|
| | 170 | } |
|---|