Version Description
- Update for compatibility to WordPress 3.4.1 by replacing deprecated calls (thanks Lance Willett!)
- Use new WP_Theme API for loading themes and getting theme information
- Fix PHP warnings
Download this release
Release Info
Developer | freediver |
Plugin | Theme Test Drive |
Version | 2.8.3 |
Comparing to | |
See all releases |
Code changes from version 2.8.2 to 2.8.3
- readme.txt +6 -1
- themedrive.php +33 -25
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: freediver
|
|
3 |
Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=920155875
|
4 |
Tags: theme, themes, admin, test
|
5 |
Requires at least: 2.3
|
6 |
-
Tested up to: 3.
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Safely test drive any theme as an administrator, while visitors use the default one.
|
@@ -22,6 +22,11 @@ Plugin by Vladimir Prelovac. Need a <a href="http://www.prelovac.com/vladimir/se
|
|
22 |
|
23 |
== Changelog ==
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
= 2.8.2 =
|
26 |
* WordPress 3.2 compatibility
|
27 |
|
3 |
Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=920155875
|
4 |
Tags: theme, themes, admin, test
|
5 |
Requires at least: 2.3
|
6 |
+
Tested up to: 3.4.1
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Safely test drive any theme as an administrator, while visitors use the default one.
|
22 |
|
23 |
== Changelog ==
|
24 |
|
25 |
+
= 2.8.3 =
|
26 |
+
* Update for compatibility to WordPress 3.4.1 by replacing deprecated calls (thanks Lance Willett!)
|
27 |
+
* Use new WP_Theme API for loading themes and getting theme information
|
28 |
+
* Fix PHP warnings
|
29 |
+
|
30 |
= 2.8.2 =
|
31 |
* WordPress 3.2 compatibility
|
32 |
|
themedrive.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/theme-test-drive
|
5 |
Description: Safely test drive any theme while visitors are using the default one. Includes instant theme preview via thumbnail.
|
6 |
Author: Vladimir Prelovac
|
7 |
-
Version: 2.8.
|
8 |
Author URI: http://www.prelovac.com/vladimir/
|
9 |
|
10 |
To-Do:
|
@@ -15,7 +15,7 @@
|
|
15 |
|
16 |
// // // PLUGIN CODE // // //
|
17 |
|
18 |
-
$themedrive_localversion = "2.8.
|
19 |
|
20 |
$wp_themedrive_plugin_url = trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
|
21 |
|
@@ -210,7 +210,7 @@
|
|
210 |
$theme = $all['theme'];
|
211 |
}
|
212 |
|
213 |
-
$theme_data =
|
214 |
|
215 |
if (!empty($theme_data)) {
|
216 |
// Don't let people peek at unpublished themes
|
@@ -221,7 +221,7 @@
|
|
221 |
}
|
222 |
|
223 |
// perhaps they are using the theme directory instead of title
|
224 |
-
$themes =
|
225 |
|
226 |
foreach ($themes as $theme_data) {
|
227 |
// use Stylesheet as it's unique to the theme - Template could point to another theme's templates
|
@@ -259,9 +259,9 @@
|
|
259 |
|
260 |
function themedrive_switcher()
|
261 |
{
|
262 |
-
$themes =
|
263 |
|
264 |
-
$default_theme =
|
265 |
|
266 |
if (count($themes) > 1) {
|
267 |
$theme_names = array_keys($themes);
|
@@ -279,11 +279,11 @@
|
|
279 |
}
|
280 |
|
281 |
if ((themedrive_get_theme() == $theme_name) || ((themedrive_get_theme() == '') && ($theme_name == $default_theme))) {
|
282 |
-
$ts .= ' <option value="' . $theme_name . '" selected="selected">' .
|
283 |
} else {
|
284 |
-
$ts .= ' <option value="' . $theme_name . '">' .
|
285 |
}
|
286 |
-
$tp .= '<li><a href="' . trailingslashit(get_option('siteurl')) . '?theme=' .
|
287 |
}
|
288 |
$ts .= ' </select>' . "\n\n";
|
289 |
$tp .= '</ul></div></div>';
|
@@ -313,7 +313,7 @@
|
|
313 |
// Admin Panel
|
314 |
function themedrive_add_pages()
|
315 |
{
|
316 |
-
add_theme_page('Theme Test Drive Options', 'Theme Test Drive',
|
317 |
}
|
318 |
|
319 |
|
@@ -327,20 +327,20 @@
|
|
327 |
{
|
328 |
global $themedrive_localversion;
|
329 |
global $wp_themedrive_plugin_url;
|
330 |
-
|
331 |
$status = themedrive_getinfo();
|
332 |
|
333 |
-
$theVersion = $status[1];
|
334 |
-
$theMessage = $status[3];
|
335 |
|
336 |
|
337 |
|
338 |
if ((version_compare(strval($theVersion), strval($themedrive_localversion), '>') == 1)) {
|
339 |
$msg = 'Latest version available ' . ' <strong>' . $theVersion . '</strong><br />' . $theMessage;
|
340 |
-
|
341 |
}
|
342 |
|
343 |
-
if ($_POST['button']
|
344 |
check_admin_referer('theme-drive');
|
345 |
$themedrive = $_POST['td_themes'];
|
346 |
update_option('td_themes', $themedrive);
|
@@ -352,8 +352,8 @@
|
|
352 |
|
353 |
|
354 |
// Show message
|
355 |
-
|
356 |
-
} elseif ($_POST['button']
|
357 |
check_admin_referer('theme-drive');
|
358 |
// Delete the option from the DB if it's empty
|
359 |
delete_option('td_themes');
|
@@ -361,7 +361,7 @@
|
|
361 |
$msg_status = "Theme Test Drive has been disabled.";
|
362 |
|
363 |
// Show message
|
364 |
-
|
365 |
}
|
366 |
|
367 |
|
@@ -385,8 +385,11 @@
|
|
385 |
</div>
|
386 |
|
387 |
<div id="mainblock" style="width:710px">
|
388 |
-
|
389 |
<div class="dbx-content">
|
|
|
|
|
|
|
390 |
<form name="form_apu" method="post" action="<?php
|
391 |
echo $action_url
|
392 |
?>">
|
@@ -422,7 +425,7 @@
|
|
422 |
?>
|
423 |
<p>You can specify the level of users to have access to the selected theme preview. By default it is set to 10 (admin only). Level 7 are editors, level 4 are authors and level 1 are contributors. The access level is ignored for accessing the site with ?theme=xxx paramaeter. </p>
|
424 |
<input style="border:1px solid #D1D1D1;width:100px;" name="access_level" id="access_level" value="<?php
|
425 |
-
echo $access_level
|
426 |
?>" /> Access level<br />
|
427 |
<p>
|
428 |
<strong>Disabling:</strong> If you wish to stop using Theme Test Drive, press <em>Disable</em> button.
|
@@ -477,12 +480,17 @@ Alternatively, disabling this plug-in should also do the trick.
|
|
477 |
function themedrive_check_plugin_version($plugin)
|
478 |
{
|
479 |
global $plugindir, $themedrive_localversion;
|
|
|
|
|
|
|
480 |
|
481 |
if (strpos($plugin, 'themedrive.php') !== false) {
|
482 |
$status = themedrive_getinfo();
|
483 |
-
|
484 |
-
|
485 |
-
|
|
|
|
|
486 |
|
487 |
if ((version_compare(strval($theVersion), strval($themedrive_localversion), '>') == 1)) {
|
488 |
$msg = 'Latest version available ' . ' <strong>' . $theVersion . '</strong><br />' . $theMessage;
|
@@ -495,9 +503,9 @@ Alternatively, disabling this plug-in should also do the trick.
|
|
495 |
|
496 |
function themdrive_js()
|
497 |
{
|
498 |
-
echo '<script type="text/javascript">var bubbleImagePath="' .
|
499 |
echo "\n";
|
500 |
-
echo '<script src="' .
|
501 |
echo "\n";
|
502 |
}
|
503 |
|
4 |
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/theme-test-drive
|
5 |
Description: Safely test drive any theme while visitors are using the default one. Includes instant theme preview via thumbnail.
|
6 |
Author: Vladimir Prelovac
|
7 |
+
Version: 2.8.3
|
8 |
Author URI: http://www.prelovac.com/vladimir/
|
9 |
|
10 |
To-Do:
|
15 |
|
16 |
// // // PLUGIN CODE // // //
|
17 |
|
18 |
+
$themedrive_localversion = "2.8.3";
|
19 |
|
20 |
$wp_themedrive_plugin_url = trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
|
21 |
|
210 |
$theme = $all['theme'];
|
211 |
}
|
212 |
|
213 |
+
$theme_data = wp_get_theme($theme);
|
214 |
|
215 |
if (!empty($theme_data)) {
|
216 |
// Don't let people peek at unpublished themes
|
221 |
}
|
222 |
|
223 |
// perhaps they are using the theme directory instead of title
|
224 |
+
$themes = wp_get_themes();
|
225 |
|
226 |
foreach ($themes as $theme_data) {
|
227 |
// use Stylesheet as it's unique to the theme - Template could point to another theme's templates
|
259 |
|
260 |
function themedrive_switcher()
|
261 |
{
|
262 |
+
$themes = wp_get_themes();
|
263 |
|
264 |
+
$default_theme = wp_get_theme();
|
265 |
|
266 |
if (count($themes) > 1) {
|
267 |
$theme_names = array_keys($themes);
|
279 |
}
|
280 |
|
281 |
if ((themedrive_get_theme() == $theme_name) || ((themedrive_get_theme() == '') && ($theme_name == $default_theme))) {
|
282 |
+
$ts .= ' <option value="' . esc_attr( $theme_name ) . '" selected="selected">' . $themes[$theme_name]['Name'] . '</option>' . "\n";
|
283 |
} else {
|
284 |
+
$ts .= ' <option value="' . esc_attr( $theme_name ) . '">' . $themes[$theme_name]['Name'] . '</option>' . "\n";
|
285 |
}
|
286 |
+
$tp .= '<li><a href="' . trailingslashit(get_option('siteurl')) . '?theme=' . esc_url($theme_name) . '">' . $theme_name . '</a></li>';
|
287 |
}
|
288 |
$ts .= ' </select>' . "\n\n";
|
289 |
$tp .= '</ul></div></div>';
|
313 |
// Admin Panel
|
314 |
function themedrive_add_pages()
|
315 |
{
|
316 |
+
add_theme_page( 'Theme Test Drive Options', 'Theme Test Drive', 'edit_theme_options', 'themedrive_options_page', 'themedrive_options_page' );
|
317 |
}
|
318 |
|
319 |
|
327 |
{
|
328 |
global $themedrive_localversion;
|
329 |
global $wp_themedrive_plugin_url;
|
330 |
+
|
331 |
$status = themedrive_getinfo();
|
332 |
|
333 |
+
$theVersion = isset( $status[1] ) ? $status[1] : '';
|
334 |
+
$theMessage = isset( $status[3] ) ? $status[3] : '';
|
335 |
|
336 |
|
337 |
|
338 |
if ((version_compare(strval($theVersion), strval($themedrive_localversion), '>') == 1)) {
|
339 |
$msg = 'Latest version available ' . ' <strong>' . $theVersion . '</strong><br />' . $theMessage;
|
340 |
+
echo '<div id="message" class="updated fade"><p>' . $msg . '</p></div>';
|
341 |
}
|
342 |
|
343 |
+
if ( isset( $_POST['button'] ) && 'Enable Theme Drive' == $_POST['button']) {
|
344 |
check_admin_referer('theme-drive');
|
345 |
$themedrive = $_POST['td_themes'];
|
346 |
update_option('td_themes', $themedrive);
|
352 |
|
353 |
|
354 |
// Show message
|
355 |
+
echo '<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>';
|
356 |
+
} elseif ( isset( $_POST['button'] ) && 'Disable Theme Drive' == $_POST['button'] ) {
|
357 |
check_admin_referer('theme-drive');
|
358 |
// Delete the option from the DB if it's empty
|
359 |
delete_option('td_themes');
|
361 |
$msg_status = "Theme Test Drive has been disabled.";
|
362 |
|
363 |
// Show message
|
364 |
+
echo '<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>';
|
365 |
}
|
366 |
|
367 |
|
385 |
</div>
|
386 |
|
387 |
<div id="mainblock" style="width:710px">
|
388 |
+
<?php $action_url; ?>
|
389 |
<div class="dbx-content">
|
390 |
+
<?php if ( ! isset( $action_url) )
|
391 |
+
$action_url = '';
|
392 |
+
?>
|
393 |
<form name="form_apu" method="post" action="<?php
|
394 |
echo $action_url
|
395 |
?>">
|
425 |
?>
|
426 |
<p>You can specify the level of users to have access to the selected theme preview. By default it is set to 10 (admin only). Level 7 are editors, level 4 are authors and level 1 are contributors. The access level is ignored for accessing the site with ?theme=xxx paramaeter. </p>
|
427 |
<input style="border:1px solid #D1D1D1;width:100px;" name="access_level" id="access_level" value="<?php
|
428 |
+
echo esc_attr( $access_level )
|
429 |
?>" /> Access level<br />
|
430 |
<p>
|
431 |
<strong>Disabling:</strong> If you wish to stop using Theme Test Drive, press <em>Disable</em> button.
|
480 |
function themedrive_check_plugin_version($plugin)
|
481 |
{
|
482 |
global $plugindir, $themedrive_localversion;
|
483 |
+
|
484 |
+
$theVersion = '';
|
485 |
+
$theMessage = '';
|
486 |
|
487 |
if (strpos($plugin, 'themedrive.php') !== false) {
|
488 |
$status = themedrive_getinfo();
|
489 |
+
|
490 |
+
if ( isset( $status[1] ) )
|
491 |
+
$theVersion = $status[1];
|
492 |
+
if ( isset( $status[3] ) )
|
493 |
+
$theMessage = $status[3];
|
494 |
|
495 |
if ((version_compare(strval($theVersion), strval($themedrive_localversion), '>') == 1)) {
|
496 |
$msg = 'Latest version available ' . ' <strong>' . $theVersion . '</strong><br />' . $theMessage;
|
503 |
|
504 |
function themdrive_js()
|
505 |
{
|
506 |
+
echo '<script type="text/javascript">var bubbleImagePath="' . site_url() . '/wp-content/plugins/theme-test-drive/bg.png"</script>';
|
507 |
echo "\n";
|
508 |
+
echo '<script src="' . site_url() . '/wp-content/plugins/theme-test-drive/previewbubble.js" type="text/javascript"></script>';
|
509 |
echo "\n";
|
510 |
}
|
511 |
|