Version Description
Download this release
Release Info
| Developer | freediver |
| Plugin | |
| Version | 2.7 |
| Comparing to | |
| See all releases | |
Code changes from version 2.6.3 to 2.7
- readme.txt +6 -1
- themedrive.php +505 -558
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: 2.
|
| 7 |
Stable tag: trunk
|
| 8 |
|
| 9 |
Safely test drive any theme as an administrator, while visitors use the default one.
|
|
@@ -19,6 +19,9 @@ Best part is you can even set the testing theme options (if it has them) in the
|
|
| 19 |
You can also preview any theme by adding "?theme=xxx" to your blog URL. For example http://www.myblog.com/?theme=Default
|
| 20 |
|
| 21 |
Changelog:
|
|
|
|
|
|
|
|
|
|
| 22 |
v2.6: Added user access level
|
| 23 |
|
| 24 |
v2.5.2: removed the thumbnail preview
|
|
@@ -31,6 +34,8 @@ v2.0:
|
|
| 31 |
- Instant theme preview using a live thumbnail preview
|
| 32 |
- Added ?theme=xxx to your URL's to preview the desired theme. Example http://www.myblog.com/?theme=Default
|
| 33 |
|
|
|
|
|
|
|
| 34 |
== Installation ==
|
| 35 |
|
| 36 |
1. Upload the whole plugin folder to your /wp-content/plugins/ folder.
|
| 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: 2.7
|
| 7 |
Stable tag: trunk
|
| 8 |
|
| 9 |
Safely test drive any theme as an administrator, while visitors use the default one.
|
| 19 |
You can also preview any theme by adding "?theme=xxx" to your blog URL. For example http://www.myblog.com/?theme=Default
|
| 20 |
|
| 21 |
Changelog:
|
| 22 |
+
|
| 23 |
+
v2.7: WP 2.7 cleanup and security update
|
| 24 |
+
|
| 25 |
v2.6: Added user access level
|
| 26 |
|
| 27 |
v2.5.2: removed the thumbnail preview
|
| 34 |
- Instant theme preview using a live thumbnail preview
|
| 35 |
- Added ?theme=xxx to your URL's to preview the desired theme. Example http://www.myblog.com/?theme=Default
|
| 36 |
|
| 37 |
+
Plugin by Vladimir Prelovac. Need a <a href="http://www.prelovac.com/vladimir/services">WordPress Expert</a>?
|
| 38 |
+
|
| 39 |
== Installation ==
|
| 40 |
|
| 41 |
1. Upload the whole plugin folder to your /wp-content/plugins/ folder.
|
themedrive.php
CHANGED
|
@@ -1,494 +1,444 @@
|
|
| 1 |
<?php
|
| 2 |
-
/*
|
| 3 |
-
Plugin Name: Theme Test Drive
|
| 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 |
-
Author URI: http://www.prelovac.com/vladimir/
|
| 9 |
-
|
| 10 |
-
To-Do:
|
| 11 |
-
- localization
|
| 12 |
-
- theme upload
|
| 13 |
-
- theme page snapshots
|
| 14 |
-
*/
|
| 15 |
-
|
| 16 |
-
// // // PLUGIN CODE // // //
|
| 17 |
-
|
| 18 |
-
$themedrive_localversion="2.
|
| 19 |
-
|
| 20 |
-
$wp_themedrive_plugin_url = trailingslashit(
|
| 21 |
-
|
| 22 |
-
function themedrive_handle_theme($package)
|
| 23 |
-
{
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
function themedrive_unzip($file, $dir)
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
{
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
{
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
{
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
$theme_names = array_keys($themes);
|
| 274 |
-
natcasesort($theme_names);
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
$ts = '<br /> <select name="td_themes">'."\n" ;
|
| 278 |
-
$tp = '<div id="theme_preview">
|
| 279 |
<div class="theme_links"><strong>Instant Theme Preview</strong><br/><br/>Hover over the link, reload the page if needed.<br/><ul>';
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
}
|
| 302 |
-
$ts .= ' </select>'."\n\n";
|
| 303 |
-
$tp.='</ul></div></div>';
|
| 304 |
-
}
|
| 305 |
-
// echo $tp;
|
| 306 |
-
|
| 307 |
-
echo $ts;
|
| 308 |
if (themedrive_is_enabled()) {
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
// Show message
|
| 375 |
-
_e('<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>');
|
| 376 |
-
|
| 377 |
-
}
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
_e('<style type="text/css"> div#dbx-content a{ text-decoration:none; }
|
| 381 |
-
</style> ');
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
global $wp_version;
|
| 385 |
-
if(version_compare($wp_version,"2.5",">=")) { _e(' <style type="text/css">
|
| 386 |
-
.wrap { max-width:1000px !important; } div#moremeta { float:right;
|
| 387 |
-
width:220px; margin-left:10px; } div#advancedstuff { width:770px; }
|
| 388 |
-
div#poststuff { margin-top:10px; } fieldset.dbx-box { margin-bottom:5px; }
|
| 389 |
-
|
| 390 |
-
</style>
|
| 391 |
-
<!--[if lt IE 7]>
|
| 392 |
-
<style type="text/css">
|
| 393 |
-
div#advancedstuff {
|
| 394 |
-
width:735px;
|
| 395 |
-
}
|
| 396 |
-
</style>
|
| 397 |
-
<![endif]-->
|
| 398 |
-
|
| 399 |
-
');
|
| 400 |
-
}
|
| 401 |
-
|
| 402 |
-
$access_level=get_option('td_level');
|
| 403 |
-
if (empty($access_level))
|
| 404 |
-
$access_level='10';
|
| 405 |
-
|
| 406 |
-
$imgpath=$wp_themedrive_plugin_url.'/i';
|
| 407 |
-
|
| 408 |
-
// Configuration Page
|
| 409 |
-
_e('
|
| 410 |
-
|
| 411 |
-
<div class="wrap" id="options-div">
|
| 412 |
-
<form name="form_themedrive" method="post" action="' . $_SERVER['REQUEST_URI'] . '">
|
| 413 |
-
<h2>Theme Test Drive '.$themedrive_localversion.'</h2>
|
| 414 |
-
<div id="poststuff">
|
| 415 |
-
<div id="moremeta">
|
| 416 |
-
<div id="sidebarBlocks" class="dbx-group">
|
| 417 |
-
<fieldset id="about" class="dbx-box">
|
| 418 |
-
<h3 class="dbx-handle">Information</h3>
|
| 419 |
-
<div id="dbx-content">
|
| 420 |
-
<img src="'. $imgpath.'/home.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins/theme-test-drive"> Theme Test Drive Home</a><br /><br />
|
| 421 |
-
<img src="'. $imgpath.'/help.png"><a href="http://www.prelovac.com/vladimir/forum"> Plugin Forums</a><br /><br />
|
| 422 |
-
<img src="'. $imgpath.'/rate.png"><a href="http://wordpress.org/extend/plugins/theme-test-drive/"> Rate this plugin</a><br /><br />
|
| 423 |
-
<img src="'. $imgpath.'/more.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins"> My WordPress Plugins</a><br /><br />
|
| 424 |
-
<br />
|
| 425 |
-
|
| 426 |
-
<p align="center">
|
| 427 |
-
<img src="'. $imgpath.'/p1.png"></p>
|
| 428 |
-
|
| 429 |
-
<p> <img src="'. $imgpath.'/idea.png"><a href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a></p>
|
| 430 |
-
</div>
|
| 431 |
-
</div>
|
| 432 |
-
</div>
|
| 433 |
-
|
| 434 |
-
<div id="advancedstuff"> <!-- Used to locate blocks in the main area. -->
|
| 435 |
-
|
| 436 |
-
<div id="mainBlocks" class="dbx-group" >
|
| 437 |
-
<div class="dbx-b-ox-wrapper">
|
| 438 |
-
<fieldset id="block-description" class="dbx-box">');
|
| 439 |
-
|
| 440 |
-
if (isset($_POST['theme_install']))
|
| 441 |
-
{
|
| 442 |
-
echo '
|
| 443 |
-
<div class="dbx-h-andle-wrapper">
|
| 444 |
-
<h3 class="dbx-handle">Theme installation</h3>
|
| 445 |
-
</div>';
|
| 446 |
-
|
| 447 |
-
$install_theme=!isset($_POST['install_theme'])? '': $_POST['install_theme'];
|
| 448 |
-
|
| 449 |
-
if ($install_theme!='')
|
| 450 |
-
{
|
| 451 |
-
themedrive_handle_theme($install_theme);
|
| 452 |
-
|
| 453 |
-
}
|
| 454 |
-
else
|
| 455 |
-
echo "No theme URL specified.<br>";
|
| 456 |
-
echo '<br><br>';
|
| 457 |
-
}
|
| 458 |
|
| 459 |
|
| 460 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 461 |
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
<
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
<input style="border:1px solid #D1D1D1;width:400px;" name="install_theme" id="install_theme" value=""/>
|
| 472 |
-
<br>
|
| 473 |
-
<input class="button" type="submit" name="theme_install" value="Install theme »" />
|
| 474 |
-
<br><br><br>
|
| 475 |
-
|
| 476 |
-
<div class="dbx-h-andle-wrapper">
|
| 477 |
-
<h3 class="dbx-handle">Usage</h3>
|
| 478 |
</div>
|
| 479 |
-
<div class="dbx-c-ontent-wrapper">
|
| 480 |
-
<div class="dbx-content">
|
| 481 |
-
<p>Select a theme to preview live on the site. Only administrator will be able to see the selected theme. </p>
|
| 482 |
-
<p>Additionally you may add "?theme=xxx" to your blog url, where xxx is the theme name you want to test.
|
| 483 |
-
</p>
|
| 484 |
-
');
|
| 485 |
-
|
| 486 |
-
themedrive_switcher();
|
| 487 |
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
<
|
| 491 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 492 |
<p>
|
| 493 |
<strong>Disabling:</strong> If you wish to stop using Theme Test Drive, press <em>Disable</em> button.
|
| 494 |
Alternatively, disabling this plug-in should also do the trick.
|
|
@@ -496,90 +446,87 @@ Alternatively, disabling this plug-in should also do the trick.
|
|
| 496 |
|
| 497 |
|
| 498 |
<p class="submit">
|
| 499 |
-
|
| 500 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 501 |
</p>
|
| 502 |
|
| 503 |
</form>
|
| 504 |
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
</div>
|
| 510 |
-
</div>
|
| 511 |
-
|
| 512 |
-
</fieldset>
|
| 513 |
-
|
| 514 |
</div>
|
| 515 |
</div>
|
| 516 |
</div>
|
| 517 |
-
<h4>plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h4>
|
| 518 |
</div>
|
| 519 |
|
| 520 |
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
//add_action("admin_head","themdrive_js");
|
| 582 |
-
|
| 583 |
-
//$tp.= '<p><img src="http://thumbnailspro.com/thumb.php?url='.trailingslashit(get_option('siteurl')).'?theme='.htmlspecialchars($theme_name).'&s=400" /><br /></p>';
|
| 584 |
-
//<p><img src="http://images.websnapr.com/?size=s&key=42d1W6HhpB0B&url='.trailingslashit(get_option('siteurl')).'?theme='.themedrive_get_theme().'" /><br /></p>
|
| 585 |
?>
|
| 1 |
<?php
|
| 2 |
+
/*
|
| 3 |
+
Plugin Name: Theme Test Drive
|
| 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.7
|
| 8 |
+
Author URI: http://www.prelovac.com/vladimir/
|
| 9 |
+
|
| 10 |
+
To-Do:
|
| 11 |
+
- localization
|
| 12 |
+
- theme upload
|
| 13 |
+
- theme page snapshots
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
// // // PLUGIN CODE // // //
|
| 17 |
+
|
| 18 |
+
$themedrive_localversion = "2.7";
|
| 19 |
+
|
| 20 |
+
$wp_themedrive_plugin_url = trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
|
| 21 |
+
|
| 22 |
+
function themedrive_handle_theme($package)
|
| 23 |
+
{
|
| 24 |
+
// select theme handling by commenting one of these funcitons
|
| 25 |
+
|
| 26 |
+
themedrive_handle_theme_liberal($package);
|
| 27 |
+
|
| 28 |
+
//themedrive_handle_theme_rigid($package);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
function themedrive_unzip($file, $dir)
|
| 33 |
+
{
|
| 34 |
+
if (!current_user_can('edit_files')) {
|
| 35 |
+
echo 'Oops, sorry you are not authorized to do this';
|
| 36 |
+
return false;
|
| 37 |
+
}
|
| 38 |
+
if (!class_exists('PclZip')) {
|
| 39 |
+
require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
$unzipArchive = new PclZip($file);
|
| 44 |
+
$list = $unzipArchive->properties();
|
| 45 |
+
if (!$list['nb'])
|
| 46 |
+
return false;
|
| 47 |
+
//echo "Number of files in archive : ".$list['nb']."<br>";
|
| 48 |
+
|
| 49 |
+
echo "Copying the files<br>";
|
| 50 |
+
$result = $unzipArchive->extract(PCLZIP_OPT_PATH, $dir);
|
| 51 |
+
if ($result == 0) {
|
| 52 |
+
echo 'Could not unarchive the file: ' . $unzipArchive->errorInfo(true) . ' <br />';
|
| 53 |
+
return false;
|
| 54 |
+
} else {
|
| 55 |
+
//print_r($result);
|
| 56 |
+
foreach ($result as $item) {
|
| 57 |
+
if ($item['status'] != 'ok')
|
| 58 |
+
echo $item['stored_filename'] . ' ... ' . $item['status'] . '<br>';
|
| 59 |
+
}
|
| 60 |
+
return true;
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
function themedrive_handle_theme_liberal($package)
|
| 65 |
+
{
|
| 66 |
+
echo "Downloading the theme from " . $package . "<br>";
|
| 67 |
+
$file = download_url($package);
|
| 68 |
+
|
| 69 |
+
if (is_wp_error($file)) {
|
| 70 |
+
echo 'Download failed: ' . $file->get_error_message();
|
| 71 |
+
return;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
echo "Unpacking the theme<br>";
|
| 75 |
+
|
| 76 |
+
// Unzip theme to theme directory
|
| 77 |
+
//theme dir
|
| 78 |
+
$result = themedrive_unzip($file, ABSPATH . "wp-content/themes/");
|
| 79 |
+
|
| 80 |
+
// Once extracted, delete the package
|
| 81 |
+
unlink($file);
|
| 82 |
+
|
| 83 |
+
if ($result)
|
| 84 |
+
echo "<br>Theme installed successfully.<br><br>";
|
| 85 |
+
else {
|
| 86 |
+
echo "<br>Error installing the theme.<br><br>You can try installing the theme manually: <a href=\"$package\">$package</a><br><br>";
|
| 87 |
+
}
|
| 88 |
+
return;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
function themedrive_handle_theme_rigid($package)
|
| 94 |
+
{
|
| 95 |
+
global $wp_filesystem;
|
| 96 |
+
|
| 97 |
+
if (!$wp_filesystem || !is_object($wp_filesystem))
|
| 98 |
+
WP_Filesystem($credentials);
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
if (!is_object($wp_filesystem)) {
|
| 102 |
+
echo '<strong><em>Could not access filesystem.</strong></em><br><br>';
|
| 103 |
+
return;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
if ($wp_filesystem->errors->get_error_code()) {
|
| 109 |
+
echo '<strong><em>Filesystem error ' . $wp_filesystem->errors->get_error_message() . '</strong></em><br><br>';
|
| 110 |
+
return;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
//Get the Base folder
|
| 114 |
+
$base = $wp_filesystem->get_base_dir();
|
| 115 |
+
|
| 116 |
+
if (empty($base)) {
|
| 117 |
+
echo '<strong><em>Unable to locate WordPress directory.</strong></em><br><br>';
|
| 118 |
+
return;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
echo "Downloading theme file from " . $package . "<br>";
|
| 124 |
+
$file = download_url($package);
|
| 125 |
+
|
| 126 |
+
if (is_wp_error($file)) {
|
| 127 |
+
echo '<strong><em>Download failed : ' . $file->get_error_message() . '</strong></em><br><br>';
|
| 128 |
+
return;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
$working_dir = $base . 'wp-content/upgrade/themes';
|
| 133 |
+
|
| 134 |
+
// Clean up working directory
|
| 135 |
+
if ($wp_filesystem->is_dir($working_dir))
|
| 136 |
+
$wp_filesystem->delete($working_dir, true);
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
echo "Unpacking the theme<br>";
|
| 140 |
+
// Unzip package to theme directory
|
| 141 |
+
$result = unzip_file($file, $working_dir);
|
| 142 |
+
if (is_wp_error($result)) {
|
| 143 |
+
unlink($file);
|
| 144 |
+
$wp_filesystem->delete($working_dir, true);
|
| 145 |
+
echo '<strong><em>Unpack failed : ' . $result->get_error_message() . '</strong></em><br><br>';
|
| 146 |
+
return;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
echo "Installing the theme<br>";
|
| 150 |
+
// Copy new version of plugin into place.
|
| 151 |
+
if (!copy_dir($working_dir, $base . "wp-content/themes")) {
|
| 152 |
+
//TODO: Uncomment? This DOES mean that the new files are available in the upgrade folder if it fails.
|
| 153 |
+
$wp_filesystem->delete($working_dir, true);
|
| 154 |
+
echo '<strong><em>Installation failed (theme already installed?)</strong></em><br><br>';
|
| 155 |
+
return;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
//Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
|
| 159 |
+
$filelist = array_keys($wp_filesystem->dirlist($working_dir));
|
| 160 |
+
|
| 161 |
+
// Remove working directory
|
| 162 |
+
$wp_filesystem->delete($working_dir, true);
|
| 163 |
+
|
| 164 |
+
// Once extracted, delete the package
|
| 165 |
+
unlink($file);
|
| 166 |
+
|
| 167 |
+
echo "Theme installed successfully.<br><br>";
|
| 168 |
+
return;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
function themedrive_get_theme()
|
| 172 |
+
{
|
| 173 |
+
$gettheme = get_option('td_themes');
|
| 174 |
+
|
| 175 |
+
if (!empty($gettheme)) {
|
| 176 |
+
return $gettheme;
|
| 177 |
+
} else {
|
| 178 |
+
return '';
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
function themedrive_get_level()
|
| 183 |
+
{
|
| 184 |
+
$getlevel = get_option('td_level');
|
| 185 |
+
|
| 186 |
+
if (!empty($getlevel)) {
|
| 187 |
+
return 'level_' . $getlevel;
|
| 188 |
+
} else {
|
| 189 |
+
return 'level_10';
|
| 190 |
+
}
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
function themedrive_determine_theme()
|
| 194 |
+
{
|
| 195 |
+
if (!isset($_GET['theme'])) {
|
| 196 |
+
if (!current_user_can(themedrive_get_level())) {
|
| 197 |
+
// not admin
|
| 198 |
+
return false;
|
| 199 |
+
} else {
|
| 200 |
+
$theme = themedrive_get_theme();
|
| 201 |
+
if ($theme == '') {
|
| 202 |
+
// no admin-only theme defined, short-circuit out
|
| 203 |
+
return false;
|
| 204 |
+
}
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
$all = $_GET + $_POST;
|
| 209 |
+
if (isset($all['theme'])) {
|
| 210 |
+
$theme = $all['theme'];
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
$theme_data = get_theme($theme);
|
| 214 |
+
|
| 215 |
+
if (!empty($theme_data)) {
|
| 216 |
+
// Don't let people peek at unpublished themes
|
| 217 |
+
if (isset($theme_data['Status']) && $theme_data['Status'] != 'publish') {
|
| 218 |
+
return false;
|
| 219 |
+
}
|
| 220 |
+
return $theme_data;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
// perhaps they are using the theme directory instead of title
|
| 224 |
+
$themes = 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
|
| 228 |
+
if ($theme_data['Stylesheet'] == $theme) {
|
| 229 |
+
// Don't let people peek at unpublished themes
|
| 230 |
+
if (isset($theme_data['Status']) && $theme_data['Status'] != 'publish') {
|
| 231 |
+
return false;
|
| 232 |
+
}
|
| 233 |
+
return $theme_data;
|
| 234 |
+
}
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
return false;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
function themedrive_get_template($template)
|
| 241 |
+
{
|
| 242 |
+
$theme = themedrive_determine_theme();
|
| 243 |
+
if ($theme === false) {
|
| 244 |
+
return $template;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
return $theme['Template'];
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
function themedrive_get_stylesheet($stylesheet)
|
| 251 |
+
{
|
| 252 |
+
$theme = themedrive_determine_theme();
|
| 253 |
+
if ($theme === false) {
|
| 254 |
+
return $stylesheet;
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
return $theme['Stylesheet'];
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
function themedrive_switcher()
|
| 261 |
+
{
|
| 262 |
+
$themes = get_themes();
|
| 263 |
+
|
| 264 |
+
$default_theme = get_current_theme();
|
| 265 |
+
|
| 266 |
+
if (count($themes) > 1) {
|
| 267 |
+
$theme_names = array_keys($themes);
|
| 268 |
+
natcasesort($theme_names);
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
$ts = '<select name="td_themes">' . "\n";
|
| 272 |
+
$tp = '<div id="theme_preview">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
<div class="theme_links"><strong>Instant Theme Preview</strong><br/><br/>Hover over the link, reload the page if needed.<br/><ul>';
|
| 274 |
+
|
| 275 |
+
foreach ($theme_names as $theme_name) {
|
| 276 |
+
// Skip unpublished themes.
|
| 277 |
+
if (isset($themes[$theme_name]['Status']) && $themes[$theme_name]['Status'] != 'publish') {
|
| 278 |
+
continue;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
if ((themedrive_get_theme() == $theme_name) || ((themedrive_get_theme() == '') && ($theme_name == $default_theme))) {
|
| 282 |
+
$ts .= ' <option value="' . $theme_name . '" selected="selected">' . htmlspecialchars($theme_name) . '</option>' . "\n";
|
| 283 |
+
} else {
|
| 284 |
+
$ts .= ' <option value="' . $theme_name . '">' . htmlspecialchars($theme_name) . '</option>' . "\n";
|
| 285 |
+
}
|
| 286 |
+
$tp .= '<li><a href="' . trailingslashit(get_option('siteurl')) . '?theme=' . htmlspecialchars($theme_name) . '">' . $theme_name . '</a></li>';
|
| 287 |
+
}
|
| 288 |
+
$ts .= ' </select>' . "\n\n";
|
| 289 |
+
$tp .= '</ul></div></div>';
|
| 290 |
+
}
|
| 291 |
+
// echo $tp;
|
| 292 |
+
|
| 293 |
+
echo $ts;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
if (themedrive_is_enabled()) {
|
| 295 |
+
echo '<strong>Theme Test Drive is Enabled.</strong><br />';
|
| 296 |
+
} else {
|
| 297 |
+
echo 'Theme Test Drive is Disabled.<br />';
|
| 298 |
+
}
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
add_filter('template', 'themedrive_get_template');
|
| 302 |
+
add_filter('stylesheet', 'themedrive_get_stylesheet');
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
// Admin Panel
|
| 307 |
+
function themedrive_add_pages()
|
| 308 |
+
{
|
| 309 |
+
add_theme_page('Theme Test Drive Options', 'Theme Test Drive', 8, __FILE__, 'themedrive_options_page');
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
function themedrive_is_enabled()
|
| 314 |
+
{
|
| 315 |
+
return get_option('td_themes');
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
// Options Page
|
| 319 |
+
function themedrive_options_page()
|
| 320 |
+
{
|
| 321 |
+
global $themedrive_localversion;
|
| 322 |
+
global $wp_themedrive_plugin_url;
|
| 323 |
+
|
| 324 |
+
$status = themedrive_getinfo();
|
| 325 |
+
|
| 326 |
+
$theVersion = $status[1];
|
| 327 |
+
$theMessage = $status[3];
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
if ((version_compare(strval($theVersion), strval($themedrive_localversion), '>') == 1)) {
|
| 332 |
+
$msg = 'Latest version available ' . ' <strong>' . $theVersion . '</strong><br />' . $theMessage;
|
| 333 |
+
_e('<div id="message" class="updated fade"><p>' . $msg . '</p></div>');
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
if ($_POST['button'] == 'Enable') {
|
| 337 |
+
check_admin_referer('theme-drive');
|
| 338 |
+
$themedrive = $_POST['td_themes'];
|
| 339 |
+
update_option('td_themes', $themedrive);
|
| 340 |
+
|
| 341 |
+
$access_level = (int)$_POST['access_level'];
|
| 342 |
+
update_option('td_level', $access_level);
|
| 343 |
+
$msg_status = "Theme Test Drive Enabled for administrator with " . $themedrive . ' theme.';
|
| 344 |
+
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
// Show message
|
| 348 |
+
_e('<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>');
|
| 349 |
+
} elseif ($_POST['button'] == 'Disable') {
|
| 350 |
+
check_admin_referer('theme-drive');
|
| 351 |
+
// Delete the option from the DB if it's empty
|
| 352 |
+
delete_option('td_themes');
|
| 353 |
+
|
| 354 |
+
$msg_status = "Theme Test Drive has been disabled.";
|
| 355 |
+
|
| 356 |
+
// Show message
|
| 357 |
+
_e('<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>');
|
| 358 |
+
}
|
| 359 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
+
$access_level = get_option('td_level');
|
| 364 |
+
if (empty($access_level))
|
| 365 |
+
$access_level = '10';
|
| 366 |
+
|
| 367 |
+
$imgpath = $wp_themedrive_plugin_url . '/i';
|
| 368 |
+
?>
|
| 369 |
+
<div class="wrap" style="max-width:950px !important;">
|
| 370 |
+
<h2>Plugin Central</h2>
|
| 371 |
+
|
| 372 |
+
<div id="poststuff" style="margin-top:10px;">
|
| 373 |
+
|
| 374 |
+
<div id="sideblock" style="float:right;width:220px;margin-left:10px;">
|
| 375 |
+
<h3>Information</h3>
|
| 376 |
+
<div id="dbx-content" style="text-decoration:none;">
|
| 377 |
+
<img src="<?php
|
| 378 |
+
echo $imgpath
|
| 379 |
+
?>/home.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins/plugin-central"> Plugin Central Home</a><br /><br />
|
| 380 |
+
<img src="<?php
|
| 381 |
+
echo $imgpath
|
| 382 |
+
?>/help.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/forum"> Plugin Forums</a><br /><br />
|
| 383 |
+
<img src="<?php
|
| 384 |
+
echo $imgpath
|
| 385 |
+
?>/rate.png"><a style="text-decoration:none;" href="http://wordpress.org/extend/plugins/plugin-central/"> Rate Pluign Central</a><br /><br />
|
| 386 |
+
<img src="<?php
|
| 387 |
+
echo $imgpath
|
| 388 |
+
?>/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> My WordPress Plugins</a><br /><br />
|
| 389 |
+
<br />
|
| 390 |
|
| 391 |
+
<p align="center">
|
| 392 |
+
<img src="<?php
|
| 393 |
+
echo $imgpath
|
| 394 |
+
?>/p1.png"></p>
|
| 395 |
+
|
| 396 |
+
<p> <img src="<?php
|
| 397 |
+
echo $imgpath
|
| 398 |
+
?>/idea.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a></p>
|
| 399 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
|
| 402 |
+
<div id="mainblock" style="width:710px">
|
| 403 |
+
|
| 404 |
+
<div class="dbx-content">
|
| 405 |
+
<form name="form_apu" method="post" action="<?php
|
| 406 |
+
echo $action_url
|
| 407 |
+
?>">
|
| 408 |
+
<?php
|
| 409 |
+
wp_nonce_field('theme-drive');
|
| 410 |
+
|
| 411 |
+
if (isset($_POST['theme_install'])) {
|
| 412 |
+
echo '<h3>Theme installation</h3>';
|
| 413 |
+
|
| 414 |
+
$install_theme = !isset($_POST['install_theme']) ? '' : $_POST['install_theme'];
|
| 415 |
+
|
| 416 |
+
if ($install_theme != '') {
|
| 417 |
+
themedrive_handle_theme($install_theme);
|
| 418 |
+
} else
|
| 419 |
+
echo "No theme URL specified.<br>";
|
| 420 |
+
echo '<br><br>';
|
| 421 |
+
}
|
| 422 |
+
?>
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
<h3>Easy Theme Installation</h3>
|
| 426 |
+
|
| 427 |
+
Enter the URL to the theme zip file and click Install theme.<br><br>
|
| 428 |
+
<input style="border:1px solid #D1D1D1;width:400px;" name="install_theme" id="install_theme" value="" />
|
| 429 |
+
<br>
|
| 430 |
+
<input class="button" type="submit" name="theme_install" value="Install theme »" class="button-primary" />
|
| 431 |
+
|
| 432 |
+
<h3 class="dbx-handle">Usage</h3>
|
| 433 |
+
<p>Select a theme to preview live on the site. Only administrator will be able to see the selected theme. </p>
|
| 434 |
+
<p>Additionally you may add "?theme=xxx" to your blog url, where xxx is the theme name you want to test.</p>
|
| 435 |
+
<?php
|
| 436 |
+
themedrive_switcher();
|
| 437 |
+
?>
|
| 438 |
+
<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>
|
| 439 |
+
<input style="border:1px solid #D1D1D1;width:100px;" name="access_level" id="access_level" value="<?php
|
| 440 |
+
echo $access_level
|
| 441 |
+
?>" /> Access level<br />
|
| 442 |
<p>
|
| 443 |
<strong>Disabling:</strong> If you wish to stop using Theme Test Drive, press <em>Disable</em> button.
|
| 444 |
Alternatively, disabling this plug-in should also do the trick.
|
| 446 |
|
| 447 |
|
| 448 |
<p class="submit">
|
| 449 |
+
<?php
|
| 450 |
+
if (themedrive_get_theme())
|
| 451 |
+
:
|
| 452 |
+
?>
|
| 453 |
+
<input type="submit" name="button" value="Disable Theme Drive" class="button-primary" />
|
| 454 |
+
<?php
|
| 455 |
+
else
|
| 456 |
+
:
|
| 457 |
+
?>
|
| 458 |
+
<input type="submit" name="button" value="Enable Theme Drive" class="button-primary" />
|
| 459 |
+
<?php
|
| 460 |
+
endif;
|
| 461 |
+
?>
|
| 462 |
+
|
| 463 |
</p>
|
| 464 |
|
| 465 |
</form>
|
| 466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 467 |
</div>
|
| 468 |
</div>
|
| 469 |
</div>
|
| 470 |
+
<h4>a plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h4>
|
| 471 |
</div>
|
| 472 |
|
| 473 |
|
| 474 |
+
<?php
|
| 475 |
+
}
|
| 476 |
+
// themedrive_options_page
|
| 477 |
+
|
| 478 |
+
// Add Options Page
|
| 479 |
+
add_action('admin_menu', 'themedrive_add_pages');
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
add_action('after_plugin_row', 'themedrive_check_plugin_version');
|
| 483 |
+
|
| 484 |
+
function themedrive_getinfo()
|
| 485 |
+
{
|
| 486 |
+
$checkfile = "http://svn.wp-plugins.org/theme-test-drive/trunk/themedrive.chk";
|
| 487 |
+
|
| 488 |
+
$status = array();
|
| 489 |
+
return $status;
|
| 490 |
+
$vcheck = wp_remote_fopen($checkfile);
|
| 491 |
+
|
| 492 |
+
if ($vcheck) {
|
| 493 |
+
$version = $themedrive_localversion;
|
| 494 |
+
|
| 495 |
+
$status = explode('@', $vcheck);
|
| 496 |
+
return $status;
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
function themedrive_check_plugin_version($plugin)
|
| 501 |
+
{
|
| 502 |
+
global $plugindir, $themedrive_localversion;
|
| 503 |
+
|
| 504 |
+
if (strpos($plugin, 'themedrive.php') !== false) {
|
| 505 |
+
$status = themedrive_getinfo();
|
| 506 |
+
|
| 507 |
+
$theVersion = $status[1];
|
| 508 |
+
$theMessage = $status[3];
|
| 509 |
+
|
| 510 |
+
if ((version_compare(strval($theVersion), strval($themedrive_localversion), '>') == 1)) {
|
| 511 |
+
$msg = 'Latest version available ' . ' <strong>' . $theVersion . '</strong><br />' . $theMessage;
|
| 512 |
+
echo '<td colspan="5" class="plugin-update" style="line-height:1.2em;">' . $msg . '</td>';
|
| 513 |
+
} else {
|
| 514 |
+
return;
|
| 515 |
+
}
|
| 516 |
+
}
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
function themdrive_js()
|
| 520 |
+
{
|
| 521 |
+
echo '<script type="text/javascript">var bubbleImagePath="' . get_bloginfo('wpurl') . '/wp-content/plugins/theme-test-drive/bg.png"</script>';
|
| 522 |
+
echo "\n";
|
| 523 |
+
echo '<script src="' . get_bloginfo('wpurl') . '/wp-content/plugins/theme-test-drive/previewbubble.js" type="text/javascript"></script>';
|
| 524 |
+
echo "\n";
|
| 525 |
+
}
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
//add_action("admin_head","themdrive_js");
|
| 529 |
+
|
| 530 |
+
//$tp.= '<p><img src="http://thumbnailspro.com/thumb.php?url='.trailingslashit(get_option('siteurl')).'?theme='.htmlspecialchars($theme_name).'&s=400" /><br /></p>';
|
| 531 |
+
//<p><img src="http://images.websnapr.com/?size=s&key=42d1W6HhpB0B&url='.trailingslashit(get_option('siteurl')).'?theme='.themedrive_get_theme().'" /><br /></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 532 |
?>
|
