Advertisement
Guest User

Untitled

a guest
Oct 4th, 2016
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 64.98 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: Olimometer
  4. Plugin URI: http://www.speaktothegeek.co.uk/oliblog/olimometer/
  5. Description: A dynamic fundraising thermometer with PayPal integration, customisable height, currency, background colour, transparency and skins.
  6. Author: Oliver Shingler
  7. Author URI: http://www.speaktothegeek.co.uk
  8. Version: 2.56
  9. */
  10.  
  11.  
  12. /* Copyright 2012 Oliver Shingler (email : oliver@shingler.co.uk)
  13.  
  14. This program is free software; you can redistribute it and/or modify
  15. it under the terms of the GNU General Public License, version 2, as
  16. published by the Free Software Foundation.
  17.  
  18. This program is distributed in the hope that it will be useful,
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. GNU General Public License for more details.
  22.  
  23. You should have received a copy of the GNU General Public License
  24. along with this program; if not, write to the Free Software
  25. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  26. */
  27.  
  28. add_action('admin_menu', 'olimometer_add_pages');
  29. add_filter('plugin_action_links', 'olimometer_action', -10, 2);
  30.  
  31. add_shortcode('show_olimometer','call_show_olimometer'); // Legacy
  32. add_shortcode('olimometer','call_show_olimometer');
  33. add_shortcode('olimometer_progress','olimometer_progress');
  34. add_shortcode('olimometer_target','olimometer_target');
  35. add_shortcode('olimometer_remaining','olimometer_remaining');
  36.  
  37. register_activation_hook(__FILE__,'olimometer_install');
  38. add_action('plugins_loaded', 'update_check');
  39.  
  40. /* Create the capabilities for this plugin
  41. - Make sure the administrator can always access this */
  42. $olimometer_capability_dashboard = "olimometer_dashboard_widget";
  43. $role = get_role( 'administrator' );
  44. $role->add_cap( $olimometer_capability_dashboard );
  45.  
  46. require_once("olimometer-class.php");
  47.  
  48.  
  49. /* Make sure we know where the Olimometer skins are stored */
  50. update_option("olimometer_skins_location",WP_PLUGIN_DIR."/".plugin_basename(dirname(__FILE__))."/");
  51. update_option("olimometer_skins_custom_location",WP_CONTENT_DIR."/uploads/olimometer/");
  52.  
  53.  
  54. /* Create new Olimometer*/
  55. if (isset($_REQUEST['olimometer_create']) && isset($_REQUEST['olimometer_description'])) {
  56. $new_olimometer = new Olimometer();
  57. $new_olimometer->olimometer_description = $_REQUEST['olimometer_description'];
  58. $new_olimometer->save();
  59. update_olimometer_last($new_olimometer->olimometer_id);
  60. }
  61.  
  62. /* Delete an Olimometer*/
  63. if (isset($_REQUEST['olimometer_delete'])) {
  64. if($_REQUEST['olimometer_id'] == 1)
  65. {
  66. // This is Olimometer #1... Can't delete it!
  67. }
  68. else
  69. {
  70. $dead_olimometer = new Olimometer();
  71.  
  72. $dead_olimometer->load($_REQUEST['olimometer_id']);
  73. $dead_olimometer->delete();
  74. update_olimometer_last(1);
  75. }
  76. }
  77.  
  78. /* Load an Olimometer */
  79. if (isset($_REQUEST['olimometer_load'])) {
  80. // Which one?
  81. update_olimometer_last($_REQUEST['olimometer_id']);
  82. }
  83.  
  84.  
  85. /* Global Options Save*/
  86. if (isset($_REQUEST['olimometer_global_submit'])) {
  87.  
  88. // What was the old role?
  89. $old_olimometer_dashboard_role = get_option('olimometer_dashboard_role','administrator');
  90.  
  91. // Need to save the dashboard role
  92. $new_olimometer_dashboard_role = $_REQUEST['olimometer_dashboard_role'];
  93. update_option("olimometer_dashboard_role",$new_olimometer_dashboard_role);
  94.  
  95.  
  96.  
  97. if($old_olimometer_dashboard_role == $new_olimometer_dashboard_role) {
  98. // No change.. do nothing
  99. }
  100. else {
  101. // Right, so we need to remove the old role's permissions as long as this isn't the administrator
  102. if($old_olimometer_dashboard_role == 'administrator') {
  103. // Don't do it.... we don't want to lock them out
  104. }
  105. else {
  106. // Bye bye capability for the old role
  107. $role = get_role( $old_olimometer_dashboard_role );
  108. $role->remove_cap( $olimometer_capability_dashboard );
  109. }
  110. // Now, we add the capability for the new role
  111. $role = get_role( $new_olimometer_dashboard_role );
  112. $role->add_cap( $olimometer_capability_dashboard );
  113. }
  114.  
  115. }
  116.  
  117. /* Main Settings save */
  118. if (isset($_REQUEST['olimometer_submit']) && isset($_REQUEST['olimometer_total_value'])) {
  119.  
  120. // Which olimometer do they wish to save?
  121. $current_olimometer_id = $_REQUEST['olimometer_id'];
  122.  
  123. // Create a new object with that value
  124. $an_olimometer = new Olimometer();
  125. $an_olimometer->olimometer_id = $current_olimometer_id;
  126.  
  127. // Get values from form and dump in to the object
  128. $an_olimometer->olimometer_description = $_REQUEST['olimometer_description'];
  129. $an_olimometer->olimometer_progress_value = $_REQUEST['olimometer_progress_value'];
  130. $an_olimometer->olimometer_total_value = $_REQUEST['olimometer_total_value'];
  131. $an_olimometer->olimometer_currency = $_REQUEST['olimometer_currency'];
  132. $an_olimometer->olimometer_thermometer_bg_colour = $_REQUEST['olimometer_thermometer_bg_colour'];
  133. $an_olimometer->olimometer_text_colour = $_REQUEST['olimometer_text_colour'];
  134. $an_olimometer->olimometer_thermometer_height = $_REQUEST['olimometer_thermometer_height'];
  135. $an_olimometer->olimometer_transparent = $_REQUEST['olimometer_transparent'];
  136. $an_olimometer->olimometer_show_target = $_REQUEST['olimometer_show_target'];
  137. $an_olimometer->olimometer_show_progress = $_REQUEST['olimometer_show_progress'];
  138. $an_olimometer->olimometer_progress_label = $_REQUEST['olimometer_progress_label'];
  139. $an_olimometer->olimometer_font_height = $_REQUEST['olimometer_font_height'];
  140. $an_olimometer->olimometer_suffix = $_REQUEST['olimometer_suffix'];
  141. //$an_olimometer->olimometer_skin = $_REQUEST['olimometer_skin'];
  142. $an_olimometer->olimometer_skin_slug = $_REQUEST['olimometer_skin_slug'];
  143. $an_olimometer->olimometer_use_paypal = $_REQUEST['olimometer_use_paypal'];
  144. $an_olimometer->olimometer_paypal_username = $_REQUEST['olimometer_paypal_username'];
  145. $an_olimometer->olimometer_paypal_password = $_REQUEST['olimometer_paypal_password'];
  146. $an_olimometer->olimometer_paypal_signature = $_REQUEST['olimometer_paypal_signature'];
  147. $an_olimometer->olimometer_paypal_extra_value = $_REQUEST['olimometer_paypal_extra_value'];
  148. $an_olimometer->olimometer_number_format = $_REQUEST['olimometer_number_format'];
  149. $an_olimometer->olimometer_link = $_REQUEST['olimometer_link'];
  150. $an_olimometer->olimometer_link_disable = $_REQUEST['olimometer_link_disable'];
  151. //echo "Overlay = xxx".$_REQUEST['olimometer_overlay']."xxx";
  152. $an_olimometer->olimometer_overlay = $_REQUEST['olimometer_overlay'];
  153. $an_olimometer->olimometer_overlay_image = $_REQUEST['upload_image'];
  154. $an_olimometer->olimometer_overlay_x = $_REQUEST['olimometer_overlay_x'];
  155. $an_olimometer->olimometer_overlay_y = $_REQUEST['olimometer_overlay_y'];
  156. $an_olimometer->olimometer_stayclassypid = $_REQUEST['olimometer_stayclassypid'];
  157. $an_olimometer->olimometer_stayclassyeid = $_REQUEST['olimometer_stayclassyeid'];
  158.  
  159.  
  160. // Save it
  161. $an_olimometer->save();
  162.  
  163. }
  164.  
  165. /* Dashboard Widget save */
  166. if (isset($_REQUEST['olimometer_dw_submit']) && isset($_REQUEST['olimometer_total_value'])) {
  167.  
  168. // Which olimometer do they wish to save?
  169. $current_olimometer_id = $_REQUEST['olimometer_id'];
  170.  
  171. // Create a new object with that value
  172. $an_olimometer = new Olimometer();
  173.  
  174. // Load the values for the chosen olimometer
  175. $an_olimometer->load($current_olimometer_id);
  176.  
  177. // Get values from form and dump in to the object
  178. $an_olimometer->olimometer_progress_value = $_REQUEST['olimometer_progress_value'];
  179. $an_olimometer->olimometer_total_value = $_REQUEST['olimometer_total_value'];
  180.  
  181. // Save it
  182. $an_olimometer->save();
  183.  
  184. }
  185.  
  186. function olimometer_action($links, $file) {
  187. // adds the link to the settings page in the plugin list page
  188. if ($file == plugin_basename(dirname(__FILE__).'/olimometer.php'))
  189. $links[] = "<a href='options-general.php?page=olimometer_manage'>" . __('Settings', 'Olimometer') . "</a>";
  190. return $links;
  191. }
  192.  
  193.  
  194.  
  195. function olimometer_add_pages() {
  196. add_submenu_page('options-general.php','Olimometer Settings', 'Olimometer', 'manage_options', 'olimometer_manage', 'olimometer_manage_page');
  197. }
  198.  
  199. function olimometer_admin_scripts() {
  200. //echo "loading admin scripts";
  201. wp_enqueue_script('media-upload');
  202. wp_enqueue_script('thickbox');
  203. wp_register_script('my-upload', WP_PLUGIN_URL.'/olimometer/my-script.js', array('jquery','media-upload','thickbox'));
  204. wp_enqueue_script('my-upload');
  205. }
  206.  
  207. function olimometer_admin_styles() {
  208. //echo "loading admin styles";
  209. wp_enqueue_style('thickbox');
  210. }
  211.  
  212. if (isset($_GET['page']) && $_GET['page'] == 'olimometer_manage') {
  213. // Add hooks to load image upload scripts
  214. add_action('admin_print_scripts', 'olimometer_admin_scripts');
  215. add_action('admin_print_styles', 'olimometer_admin_styles');
  216. }
  217.  
  218. function olimometer_manage_page() {
  219. echo '<div class="wrap">';
  220.  
  221.  
  222. ?>
  223. <script type="text/javascript" src="<?php echo plugins_url(); ?>/olimometer/jscolor/jscolor.js"></script>
  224.  
  225. <script language="javascript">
  226.  
  227.  
  228. function olimometer_progress($progress_type) {
  229. // 0 = Manual
  230. // 1 = PayPal
  231. // 2 = StayClassy Project
  232. // 3 = StayClassy Event
  233. if ($progress_type == 0) {
  234. // Enable manual
  235. olimometer_disable_manual(false);
  236. // Disable PayPal
  237. olimometer_disable_paypal(true);
  238. // Disable StayClassy
  239. olimometer_disable_stayclassy(true);
  240. // Disable StayClassy Event
  241. olimometer_disable_stayclassyevent(true);
  242. }
  243. if ($progress_type == 1) {
  244. // Enable PayPal
  245. olimometer_disable_paypal(false);
  246. // Disable Manual
  247. olimometer_disable_manual(true);
  248. // Disable StayClassy
  249. olimometer_disable_stayclassy(true);
  250. // Disable StayClassy Event
  251. olimometer_disable_stayclassyevent(true);
  252. }
  253. if ($progress_type == 2) {
  254. // Enable StayClassy
  255. olimometer_disable_stayclassy(false);
  256. // Disable PayPal
  257. olimometer_disable_paypal(true);
  258. // Disable Manual
  259. olimometer_disable_manual(true);
  260. // Disable StayClassy Event
  261. olimometer_disable_stayclassyevent(true);
  262. }
  263. if ($progress_type == 3) {
  264. // Disable StayClassy
  265. olimometer_disable_stayclassy(true);
  266. // Disable PayPal
  267. olimometer_disable_paypal(true);
  268. // Disable Manual
  269. olimometer_disable_manual(true);
  270. // Enable StayClassy Event
  271. olimometer_disable_stayclassyevent(false);
  272. }
  273. }
  274.  
  275. function olimometer_disable_manual($tof) {
  276. document.olimometer_form1.olimometer_progress_value.readOnly = $tof;
  277. }
  278.  
  279. function olimometer_disable_paypal($tof) {
  280. document.olimometer_form1.olimometer_paypal_username.readOnly = $tof;
  281. document.olimometer_form1.olimometer_paypal_password.readOnly = $tof;
  282. document.olimometer_form1.olimometer_paypal_signature.readOnly = $tof;
  283. document.olimometer_form1.olimometer_paypal_extra_value.readOnly = $tof;
  284. }
  285.  
  286. function olimometer_disable_stayclassy($tof) {
  287. document.olimometer_form1.olimometer_stayclassypid.readOnly = $tof;
  288. }
  289.  
  290. function olimometer_disable_stayclassyevent($tof) {
  291. document.olimometer_form1.olimometer_stayclassyeid.readOnly = $tof;
  292. }
  293.  
  294. function olimometer_overlay_disable() {
  295. document.olimometer_form1.upload_image.readOnly = true;
  296. document.olimometer_form1.olimometer_overlay_x.readOnly = true;
  297. document.olimometer_form1.olimometer_overlay_y.readOnly = true;
  298. document.olimometer_form1.upload_image_button.disabled = true;
  299. }
  300.  
  301. function olimometer_overlay_enable() {
  302. document.olimometer_form1.upload_image.readOnly = false;
  303. document.olimometer_form1.olimometer_overlay_x.readOnly = false;
  304. document.olimometer_form1.olimometer_overlay_y.readOnly = false;
  305. document.olimometer_form1.upload_image_button.disabled = false;
  306. }
  307.  
  308. </script>
  309.  
  310. <?php
  311. // Load the olimometer values:
  312. // If we are being asked to load a particular Olimometer's settings
  313. if (isset($_REQUEST['olimometer_load'])) {
  314. // Which one?
  315. update_olimometer_last($_REQUEST['olimometer_id']);
  316. $current_olimometer_id = $_REQUEST['olimometer_id'];
  317.  
  318. }
  319. else {
  320. if(get_olimometer_last() == 0)
  321. {
  322. $current_olimometer_id = 1;
  323. }
  324. else {
  325. $current_olimometer_id = get_olimometer_last();
  326. }
  327. }
  328.  
  329.  
  330.  
  331. $current_olimometer = new Olimometer();
  332. $current_olimometer->load($current_olimometer_id);
  333.  
  334.  
  335. echo '<div class="icon32" id="icon-options-general"><br></div><h2>Olimometer - '.$current_olimometer->olimometer_description.'</h2>';
  336.  
  337. ?>
  338. <table>
  339. <form method="post" id="olimometer_selection_form" name="olimometer_selection_form">
  340. <tr class="form-field form-required">
  341.  
  342. <td ><label for="name">Please choose an Olimometer:</label></td>
  343. <td>
  344. <?php
  345. echo olimometer_list($current_olimometer_id,"olimometer_id","olimometer_id");
  346. ?>
  347. </td>
  348.  
  349. <td><input type="submit" class="button-primary" name="olimometer_load" value="Load" /></td>
  350. </tr>
  351. </form>
  352.  
  353.  
  354.  
  355. <form method="post" id="olimometer_create_form" name="olimometer_create_form">
  356. <tr class="form-field form-required">
  357.  
  358. <td ><label for="name">Create a new Olimometer:</label></td>
  359. <td><input type="text" maxlength="30" name="olimometer_description"></input>
  360. </td>
  361.  
  362. <td><input type="submit" class="button-primary" name="olimometer_create" value="Create" /></td>
  363. </tr>
  364. </form>
  365.  
  366.  
  367. </table>
  368.  
  369.  
  370. <hr />
  371. <div id="olimometer_global_wrapper">
  372. <div class="alignleft" style="padding-right:12px;margin-right:12px;border-right:1px dashed grey;">
  373. <h3><?php echo $current_olimometer->olimometer_description; ?> Options</h3>
  374. <?php
  375.  
  376.  
  377.  
  378. // Now start the main options page
  379. echo '<p>';
  380. echo '<a href="#olimometer_details">Olimometer Details</a><br />';
  381. echo '<a href="#progressvalues">Progress Values</a><br />';
  382. echo '<a href="#appearance">Appearance and Layout</a><br />';
  383. echo '<a href="#diagnostics">Diagnostics</a><br />';
  384. echo '<a href="#OtherInformation">Other Information</a></p>';
  385.  
  386. ?>
  387. </div>
  388. <div id="olimometer_global_options">
  389. <!-- Global Options -->
  390. <h3>Global Options</h3>
  391. <form method="post" id="olimometer_global_options" name="olimometer_global_options">
  392. <table>
  393. <tr class="form-field form-required">
  394. <td valign="center" align="left">Dashboard Widget Role:</td>
  395. <td><select name="olimometer_dashboard_role" id="olimometer_dashboard_role" aria-required="true" >
  396. <?php
  397. // What's the current saved role for this option? administrator is default
  398. $olimometer_dashboard_role = get_option("olimometer_dashboard_role", "administrator");
  399.  
  400. // Display a drop-down list of all available roles, with the current saved one selected
  401. wp_dropdown_roles($selected = $olimometer_dashboard_role);
  402. ?>
  403. </select>
  404.  
  405. </td>
  406. </tr>
  407.  
  408. <tr>
  409. <td colspan=2><span class="description">Administrators will always have access to both the settings and dashboard widget.</span> </td>
  410. </tr>
  411. <tr>
  412. <td colspan=2>
  413. <input type="submit" class="button-primary" name="olimometer_global_submit" value="Save Global Options" />
  414. </td>
  415. </tr>
  416.  
  417.  
  418. </table>
  419.  
  420. </form>
  421.  
  422. </div>
  423. </div> <!-- olimometer_global_wrapper -->
  424.  
  425. <a name="olimometer_details"></a>
  426.  
  427. <div id="olimometer_details_wrapper" style="clear:both;">
  428. <hr />
  429.  
  430. <form method="post" id="olimometer_form1" name="olimometer_form1">
  431. <input type="hidden" id="olimometer_id" name="olimometer_id" value="<?php echo $current_olimometer_id; ?>">
  432.  
  433. <div class="alignleft" style="clear:both;margin-right:10px;">
  434. <h3>Olimometer Details</h3>
  435.  
  436. <table class="form-table">
  437. <tr class="form-field form-required">
  438. <th scope="row" valign="top"><label for="name">Olimometer Name:</label></th>
  439. <td><input name="olimometer_description" id="olimometer_description" type="text" maxlength="30" value="<?php
  440. echo $current_olimometer->olimometer_description;
  441. ?>" size="20" aria-required="true" />
  442. <p><span class="description">What would you like to call this Olimometer?</span></p></td>
  443. </tr>
  444. </table>
  445.  
  446. You can use the following shortcodes in your posts and pages for this Olimometer:<br />
  447. <ol>
  448. <li>Display the Olimometer: <i><b>[olimometer id=<?php echo $current_olimometer_id; ?>]</b></i></li>
  449. <li>Display the Amount Raised: <i><b>[olimometer_progress id=<?php echo $current_olimometer_id; ?>]</b></i></li>
  450. <li>Display the Target: <i><b>[olimometer_target id=<?php echo $current_olimometer_id; ?>]</b></i></li>
  451. <li>Display the amount remaining to hit Target: <i><b>[olimometer_remaining id=<?php echo $current_olimometer_id; ?>]</b></i></li>
  452.  
  453. </ol>
  454.  
  455. <p class="submit"><input type="submit" class="button-primary" name="olimometer_submit" value="Save Changes" /><input type="submit" class="button-primary" name="olimometer_delete" value="Delete this Olimometer" /></p>
  456.  
  457. </div><!-- Olimometer Details -->
  458. <div><h3>Preview</h3>
  459. <?php echo show_olimometer($current_olimometer_id); ?>
  460. </div>
  461.  
  462. </div><!-- olimometer_details_wrapper -->
  463.  
  464. <div id="restofform" style="clear:both;">
  465. <?php
  466. echo '<hr /><a name="progressvalues"></a>';
  467. echo '<h3>Progress Values</h3>';
  468.  
  469. ?>
  470. <table class="form-table">
  471. <tr class="form-required">
  472. <th scope="row" valign="top"><label for="name">Manual or Automatic Progress Tracking?</label></th>
  473. <td><input name="olimometer_use_paypal" id="olimometer_use_paypal" type="radio" value="0"<?php
  474. if($current_olimometer->olimometer_use_paypal == 0) {
  475. echo " checked";
  476. }
  477.  
  478. ?> onClick="olimometer_progress(0);"> Manual<br />
  479. <input name="olimometer_use_paypal" id="olimometer_use_paypal" type="radio" value="1"<?php
  480. if($current_olimometer->olimometer_use_paypal == 1) {
  481. echo " checked";
  482. }
  483.  
  484. ?> onClick="olimometer_progress(1);"> PayPal<br />
  485. <input name="olimometer_use_paypal" id="olimometer_use_paypal" type="radio" value="2"<?php
  486. if($current_olimometer->olimometer_use_paypal == 2) {
  487. echo " checked";
  488. }
  489.  
  490. ?> onClick="olimometer_progress(2);"> StayClassy Project<br />
  491. <input name="olimometer_use_paypal" id="olimometer_use_paypal" type="radio" value="3"<?php
  492. if($current_olimometer->olimometer_use_paypal == 3) {
  493. echo " checked";
  494. }
  495.  
  496. ?> onClick="olimometer_progress(3);"> StayClassy Event
  497.  
  498. <p><span class="description">Do you want to update the progress (current amount raised) manually or automatically by linking to a PayPal or StayClassy account?</span></p></td>
  499.  
  500. </tr>
  501.  
  502. <tr class="form-field form-required">
  503. <th scope="row" valign="top"><label for="name">Current Amount Raised (Progress Value)</label></th>
  504. <td><input name="olimometer_progress_value" id="olimometer_progress_value" type="text" value="<?php
  505. echo $current_olimometer->olimometer_progress_value;
  506.  
  507. ?>" size="40" aria-required="true" />
  508. <p><span class="description">How much money have you raised to date?</span></p></td>
  509. </tr>
  510. <tr class="form-field form-required">
  511. <th scope="row" valign="top"><label for="name">Target Amount</label></th>
  512. <td><input name="olimometer_total_value" id="olimometer_total_value" type="text" value="<?php
  513. echo $current_olimometer->olimometer_total_value;
  514. ?>" size="40" aria-required="true" />
  515. <p><span class="description">Input the total amount you would like to raise.</span></p></td>
  516. </tr>
  517.  
  518. <tr class="form-field form-required">
  519. <th scope="row" valign="top"><label for="name">Number Format</label></th>
  520. <td>
  521. <select name="olimometer_number_format">
  522. <option value="0" <?php if($current_olimometer->olimometer_number_format==0) { echo "SELECTED"; } ?>>1000</option>
  523. <option value="1" <?php if($current_olimometer->olimometer_number_format==1) { echo "SELECTED"; } ?>>1,000</option>
  524. <option value="2" <?php if($current_olimometer->olimometer_number_format==2) { echo "SELECTED"; } ?>>1000.00</option>
  525. <option value="3" <?php if($current_olimometer->olimometer_number_format==3) { echo "SELECTED"; } ?>>1,000.00</option>
  526. <option value="4" <?php if($current_olimometer->olimometer_number_format==4) { echo "SELECTED"; } ?>>1.000</option>
  527. <option value="5" <?php if($current_olimometer->olimometer_number_format==5) { echo "SELECTED"; } ?>>1.000,00</option>
  528. <option value="6" <?php if($current_olimometer->olimometer_number_format==6) { echo "SELECTED"; } ?>>1 000</option>
  529. <option value="7" <?php if($current_olimometer->olimometer_number_format==7) { echo "SELECTED"; } ?>>1 000,00</option>
  530. <option value="8" <?php if($current_olimometer->olimometer_number_format==8) { echo "SELECTED"; } ?>>1 000.00</option>
  531. </select>
  532. <p><span class="description">Please choose a display format for your values.</span></p></td>
  533. </tr>
  534.  
  535. <tr class="form-field">
  536. <th scope="row" valign="top"><label for="name">PayPal API Username</label></th>
  537. <td><input name="olimometer_paypal_username" id="olimometer_paypal_username" type="text" value="<?php
  538. echo $current_olimometer->olimometer_paypal_username;
  539. ?>" size="40" /></td>
  540. </tr>
  541.  
  542. <tr class="form-field">
  543. <th scope="row" valign="top"><label for="name">PayPal API Password</label></th>
  544. <td><input name="olimometer_paypal_password" id="olimometer_paypal_password" type="text" value="<?php
  545. echo $current_olimometer->olimometer_paypal_password;
  546. ?>" size="40" /></td>
  547. </tr>
  548.  
  549. <tr class="form-field">
  550. <th scope="row" valign="top"><label for="name">PayPal API Signature</label></th>
  551. <td><input name="olimometer_paypal_signature" id="olimometer_paypal_signature" type="text" value="<?php
  552. echo $current_olimometer->olimometer_paypal_signature;
  553. ?>" size="40" />
  554. <p><span class="description">To get your PayPal API credentials log in to your PayPal account. Under My Account, choose Profile then My Selling Preferences. Under the Selling Online section, choose the update link next to API Access, and finally choose Option 2 (Request API credentials).</span></p>
  555. </td>
  556. </tr>
  557.  
  558. <tr class="form-field form-required">
  559. <th scope="row" valign="top"><label for="name">Offline Donations</label></th>
  560. <td><input name="olimometer_paypal_extra_value" id="olimometer_paypal_extra_value" type="text" value="<?php
  561. echo $current_olimometer->olimometer_paypal_extra_value;
  562.  
  563. ?>" size="40" aria-required="true" />
  564. <p><span class="description">How much has been raised offline? This amount will be added to the PayPal total.</span></p></td>
  565. </tr>
  566.  
  567. <tr class="form-field form-required">
  568. <th scope="row" valign="top"><label for="name">StayClassy PID</label></th>
  569. <td><input name="olimometer_stayclassypid" id="olimometer_stayclassypid" type="text" value="<?php
  570. echo $current_olimometer->olimometer_stayclassypid;
  571.  
  572. ?>" size="40" aria-required="true" />
  573. <p><span class="description">Please enter your unique StayClassy.org project ID for which you would like to track the total.</span></p></td>
  574. </tr>
  575.  
  576. <tr class="form-field form-required">
  577. <th scope="row" valign="top"><label for="name">StayClassy EID</label></th>
  578. <td><input name="olimometer_stayclassyeid" id="olimometer_stayclassyeid" type="text" value="<?php
  579. echo $current_olimometer->olimometer_stayclassyeid;
  580.  
  581. ?>" size="40" aria-required="true" />
  582. <p><span class="description">Please enter your unique StayClassy.org event ID for which you would like to track the total.</span></p></td>
  583. </tr>
  584.  
  585. </table>
  586. <p class="submit"><input type="submit" class="button-primary" name="olimometer_submit" value="Save Changes" /></p>
  587.  
  588. <a name="appearance"></a>
  589.  
  590. <hr />
  591. <?php
  592.  
  593. echo '<h3>Appearance and Layout</h3>';
  594. ?>
  595.  
  596. <table class="form-table">
  597. <tr class="form-field">
  598. <th scope="row" valign="top"><label for="name">Prefix</label></th>
  599. <td>
  600. <select name="olimometer_currency">
  601. <option value="163" <?php if($current_olimometer->olimometer_currency=="163") { echo "SELECTED"; } ?>>&pound;</option>
  602. <option value="36" <?php if($current_olimometer->olimometer_currency=="36") { echo "SELECTED"; } ?>>$</option>
  603. <option value="8364" <?php if($current_olimometer->olimometer_currency=="8364") { echo "SELECTED"; } ?>>&#8364;</option>
  604. <option value="37" <?php if($current_olimometer->olimometer_currency=="37") { echo "SELECTED"; } ?>>%</option>
  605. <option value="165" <?php if($current_olimometer->olimometer_currency=="165") { echo "SELECTED"; } ?>>&yen;</option>
  606. <option value="162" <?php if($current_olimometer->olimometer_currency=="162") { echo "SELECTED"; } ?>>&#162;</option>
  607. <option value="112" <?php if($current_olimometer->olimometer_currency=="112") { echo "SELECTED"; } ?>>&#112;</option>
  608. <option value="8359" <?php if($current_olimometer->olimometer_currency=="8359") { echo "SELECTED"; } ?>>&#8359;</option>
  609. <option value="8356" <?php if($current_olimometer->olimometer_currency=="8356") { echo "SELECTED"; } ?>>&#8356;</option>
  610. <option value="176" <?php if($current_olimometer->olimometer_currency=="176") { echo "SELECTED"; } ?>>&#176;</option>
  611. <option value="10000" <?php if($current_olimometer->olimometer_currency=="10000") { echo "SELECTED"; } ?>>kr</option>
  612. <option value="10001" <?php if($current_olimometer->olimometer_currency=="10001") { echo "SELECTED"; } ?>>CHF</option>
  613. <option value="" <?php if($current_olimometer->olimometer_currency=="") { echo "SELECTED"; } ?>>No Prefix</option>
  614. </select>
  615. </td>
  616. </tr>
  617.  
  618. <tr class="form-field">
  619. <th scope="row" valign="top"><label for="name">Suffix</label></th>
  620. <td>
  621. <select name="olimometer_suffix">
  622. <option value="163" <?php if($current_olimometer->olimometer_suffix=="163") { echo "SELECTED"; } ?>>&pound;</option>
  623. <option value="36" <?php if($current_olimometer->olimometer_suffix=="36") { echo "SELECTED"; } ?>>$</option>
  624. <option value="8364" <?php if($current_olimometer->olimometer_suffix=="8364") { echo "SELECTED"; } ?>>&#8364;</option>
  625. <option value="37" <?php if($current_olimometer->olimometer_suffix=="37") { echo "SELECTED"; } ?>>%</option>
  626. <option value="165" <?php if($current_olimometer->olimometer_suffix=="165") { echo "SELECTED"; } ?>>&yen;</option>
  627. <option value="162" <?php if($current_olimometer->olimometer_suffix=="162") { echo "SELECTED"; } ?>>&#162;</option>
  628. <option value="112" <?php if($current_olimometer->olimometer_suffix=="112") { echo "SELECTED"; } ?>>&#112;</option>
  629. <option value="8359" <?php if($current_olimometer->olimometer_suffix=="8359") { echo "SELECTED"; } ?>>&#8359;</option>
  630. <option value="8356" <?php if($current_olimometer->olimometer_suffix=="8356") { echo "SELECTED"; } ?>>&#8356;</option>
  631. <option value="176" <?php if($current_olimometer->olimometer_suffix=="176") { echo "SELECTED"; } ?>>&#176;</option>
  632. <option value="10000" <?php if($current_olimometer->olimometer_suffix=="10000") { echo "SELECTED"; } ?>>kr</option>
  633. <option value="10001" <?php if($current_olimometer->olimometer_suffix=="10001") { echo "SELECTED"; } ?>>CHF</option>
  634. <option value="" <?php if($current_olimometer->olimometer_suffix=="") { echo "SELECTED"; } ?>>No Suffix</option>
  635. </select>
  636. </td>
  637. </tr>
  638.  
  639. <tr class="form-field form-required">
  640. <th scope="row" valign="top"><label for="name">Thermometer Skin</label></th>
  641. <td><select name="olimometer_skin_slug" id="olimometer_skin_slug" aria-required="true" >
  642.  
  643. <?php
  644. // Import list of Olimometer skins from XML file
  645. include_once('skins.php');
  646.  
  647. $olimometer_skins = new Olimometer_Skins();
  648. $olimometer_skins->olimometer_skins_location = get_option("olimometer_skins_location");
  649. $olimometer_skins->olimometer_skins_custom_location = get_option("olimometer_skins_custom_location");
  650. $olimometer_skins->load();
  651.  
  652. $olimometer_skin_names = array();
  653. $olimometer_skin_names = $olimometer_skins->get_skin_names();
  654.  
  655. // Loop around each skin name and display in a drop-down list
  656. foreach ($olimometer_skin_names as $olimometer_skin_name) {
  657. echo "<option value='".$olimometer_skin_name["skin_slug"]."'";
  658. if($current_olimometer->olimometer_skin_slug == $olimometer_skin_name["skin_slug"]) {
  659. echo " selected";
  660. }
  661. echo ">".$olimometer_skin_name["skin_name"]."</option>";
  662. }
  663.  
  664.  
  665.  
  666. ?>
  667.  
  668. </select>
  669. <p><span class="description">Choose a skin for the thermometer. A skin changes the look and design of the thermometer.</span></p></td>
  670. </tr>
  671.  
  672. <tr class="form-field form-required">
  673. <th scope="row" valign="top"><label for="name">Thermometer Height/Width</label></th>
  674. <td><input name="olimometer_thermometer_height" id="olimometer_thermometer_height" type="text" value="<?php
  675. echo $current_olimometer->olimometer_thermometer_height;
  676. ?>" size="40" aria-required="true" />
  677. <p><span class="description">The height (or width if using a horizontal skin) of the thermometer in pixels. Default = 200</span></p></td>
  678. </tr>
  679.  
  680. <tr class="form-field form-required">
  681. <th scope="row" valign="top"><label for="name">Background Colour</label></th>
  682. <td><input name="olimometer_thermometer_bg_colour" id="olimometer_thermometer_bg_colour" type="text" value="<?php
  683. echo $current_olimometer->olimometer_thermometer_bg_colour;
  684. ?>" size="40" aria-required="true" class="color" />
  685. <p><span class="description">Hex value for background colour of thermometer image (FFFFFF = white, 000000 = black)</span></p></td>
  686. </tr>
  687.  
  688. <tr class="form-field form-required">
  689. <th scope="row" valign="top"><label for="name">Transparent Background</label></th>
  690. <td><select name="olimometer_transparent" id="olimometer_transparent" aria-required="true" >
  691. <option value=0>No</option>
  692. <option value=1<?php
  693. if($current_olimometer->olimometer_transparent == 1) {
  694. echo " selected";
  695. }
  696.  
  697. ?>>Yes</option>
  698. </select>
  699. <p><span class="description">Make the thermometer background transparent? If you select this option to yes then make sure you choose a background colour above that is close to your site's actual background colour. This will help it blend in nicely.</span></p></td>
  700. </tr>
  701.  
  702. <tr class="form-field form-required">
  703. <th scope="row" valign="top"><label for="name">Text Height</label></th>
  704. <td><input name="olimometer_font_height" id="olimometer_font_height" type="text" value="<?php
  705. echo $current_olimometer->olimometer_font_height;
  706.  
  707. ?>" size="40" aria-required="true" />
  708. <p><span class="description">Specify the size of the font in pixels. Default = 8</span></p></td>
  709. </tr>
  710.  
  711. <tr class="form-field form-required">
  712. <th scope="row" valign="top"><label for="name">Text Colour</label></th>
  713. <td><input name="olimometer_text_colour" id="olimometer_text_colour" type="text" value="<?php
  714. echo $current_olimometer->olimometer_text_colour;
  715. ?>" size="40" aria-required="true" class="color" />
  716. <p><span class="description">Hex value for the text colour within the image (FFFFFF = white, 000000 = black)</span></p></td>
  717. </tr>
  718.  
  719.  
  720. <tr class="form-field form-required">
  721. <th scope="row" valign="top"><label for="name">Show Target Value</label></th>
  722. <td><select name="olimometer_show_target" id="olimometer_show_target" aria-required="true" >
  723. <option value=1<?php
  724. if($current_olimometer->olimometer_show_target == 1) {
  725. echo " selected";
  726. }
  727.  
  728. ?>>Yes</option>
  729. <option value=0<?php
  730. if( ($current_olimometer->olimometer_show_target == 0) ) {
  731. echo " selected";
  732. }
  733.  
  734. ?>>No</option>
  735. </select>
  736. <p><span class="description">Do you wish the target amount raised to be displayed on the image?</span></p></td>
  737. </tr>
  738.  
  739. <tr class="form-field form-required">
  740. <th scope="row" valign="top"><label for="name">Show Progress Value (Current Amount)</label></th>
  741. <td><select name="olimometer_show_progress" id="olimometer_show_progress" aria-required="true" >
  742. <option value=1<?php
  743. if($current_olimometer->olimometer_show_progress == 1) {
  744. echo " selected";
  745. }
  746.  
  747. ?>>Yes</option>
  748. <option value=0<?php
  749. if( ($current_olimometer->olimometer_show_progress == 0)) {
  750. echo " selected";
  751. }
  752.  
  753. ?>>No</option>
  754. </select>
  755. <p><span class="description">Do you wish the current amount raised to be displayed on the image? It will be placed underneath the thermometer with an optional text string specified below...</span></p></td>
  756. </tr>
  757.  
  758. <tr class="form-field">
  759. <th scope="row" valign="top"><label for="name">Progress Label</label></th>
  760. <td><input name="olimometer_progress_label" id="olimometer_progress_label" type="text" value="<?php
  761. echo $current_olimometer->olimometer_progress_label;
  762. ?>" size="40" aria-required="false" />
  763. <p><span class="description">(Optional) The text string to display before the Progress Value. Default = "Raised so far:"</span></p></td>
  764. </tr>
  765.  
  766. <tr class="form-field">
  767. <th scope="row" valign="top"><label for="name">Olimometer Hyperlink URL</label></th>
  768. <td><input name="olimometer_link" id="olimometer_link" type="text" value="<?php
  769. echo $current_olimometer->olimometer_link;
  770. ?>" size="40" aria-required="false" />
  771. <p><span class="description">(Optional) The URL users are directed to when clicking on an Olimometer image.</span></p></td>
  772. </tr>
  773.  
  774. <tr class="form-required">
  775. <th scope="row" valign="top"><label for="name">Disable Olimometer Hyperlink</label></th>
  776. <td><input name="olimometer_link_disable" id="olimometer_link_disable" type="radio" value="0"<?php
  777. if($current_olimometer->olimometer_link_disable == 0) {
  778. echo " checked";
  779. }
  780.  
  781. ?>> No<br />
  782. <input name="olimometer_link_disable" id="olimometer_link_disable" type="radio" value="1"<?php
  783. if($current_olimometer->olimometer_link_disable == 1) {
  784. echo " checked";
  785. }
  786.  
  787. ?>> Yes
  788. <p><span class="description">(Optional) Would you like to disable the hyperlink?</span></p></td>
  789. </tr>
  790.  
  791.  
  792. <!-- Overlay Image Begin -->
  793.  
  794. <tr class="form-required">
  795. <th scope="row" valign="top"><label for="name">Would you like to overlay an image on to the Olimometer?</label></th>
  796. <td><input name="olimometer_overlay" id="olimometer_overlay" type="radio" value="0"<?php
  797. if($current_olimometer->olimometer_overlay == 0) {
  798. echo " checked";
  799. }
  800.  
  801. ?> onClick="olimometer_overlay_disable();"> No<br />
  802. <input name="olimometer_overlay" id="olimometer_overlay" type="radio" value="1"<?php
  803. if($current_olimometer->olimometer_overlay == 1) {
  804. echo " checked";
  805. }
  806.  
  807. ?> onClick="olimometer_overlay_enable();"> Yes
  808.  
  809. <p><span class="description">The overlay image will be placed over the top of the Olimometer. You will need to specify x and y co-ordinates, in pixels, corresponding to where you would like to position the overlay in respect to the top-left corner of the Olimometer. This feature only works on vertical Olimometers.</span></p></td>
  810.  
  811. </tr>
  812.  
  813. <tr class="form-field">
  814. <th scope="row" valign="top"><label for="name">Overlay Image</label></th>
  815. <td><label for="upload_image"><input id="upload_image" type="text" size="36" name="upload_image" value="<?php
  816. echo $current_olimometer->olimometer_overlay_image;
  817. ?>" /><input id="upload_image_button" type="button" value="Upload Image" /><br />Enter a URL or upload an image for the overlay. NOTE: Only .PNG files are supported. Once uploaded, click on the 'Insert Into Post' button to auto-complete this field with your chosen image.</label></td>
  818. </tr>
  819.  
  820. <tr class="form-field">
  821. <th scope="row" valign="top"><label for="name">Overlay X Co-ordinate</label></th>
  822. <td><input name="olimometer_overlay_x" id="olimometer_overlay_x" type="text" value="<?php
  823. echo $current_olimometer->olimometer_overlay_x;
  824. ?>" size="40" aria-required="false" />
  825. <p><span class="description"></span></p></td>
  826. </tr>
  827. <tr class="form-field">
  828. <th scope="row" valign="top"><label for="name">Overlay Y Co-ordinate</label></th>
  829. <td><input name="olimometer_overlay_y" id="olimometer_overlay_y" type="text" value="<?php
  830. echo $current_olimometer->olimometer_overlay_y;
  831. ?>" size="40" aria-required="false" />
  832. <p><span class="description"></span></p></td>
  833. </tr>
  834.  
  835.  
  836. </table>
  837. <p class="submit"><input type="submit" class="button-primary" name="olimometer_submit" value="Save Changes" /></p>
  838. <?php
  839. echo '</form>';
  840.  
  841. ?>
  842.  
  843. <a name="diagnostics"></a>
  844.  
  845. <hr />
  846.  
  847. <?php
  848. echo '<h3>Diagnostics</h3>';
  849. echo 'GD Extension: ';
  850. if (extension_loaded('gd') && function_exists('gd_info')) {
  851. echo "Installed";
  852. }
  853. else {
  854. echo "<font color=red><b>NOT DETECTED</b></font>";
  855. }
  856. echo '<br />';
  857. echo 'PayPal Integration: ';
  858.  
  859. if($current_olimometer->get_paypal_balance() == FALSE) {
  860. echo "<font color=red><b>NOT WORKING</b></font>";
  861. }
  862. else {
  863. echo "OK. Current Balance = " . $current_olimometer->get_paypal_balance();
  864. }
  865. echo '<br />';
  866. echo '<hr /><a name="OtherInformation"></a>';
  867. echo '<h3>Other Information</h3>';
  868.  
  869. ?>
  870. <small><p><strong>Installation</strong></p>
  871. <p>For information on customising the Olimometer, creating skins, or for general documentation, please visit the FAQ: <a href='http://wordpress.org/extend/plugins/olimometer/faq/' target=_blank>http://wordpress.org/extend/plugins/olimometer/faq/</a></p>
  872. <p>You cannot delete the first Olimometer.</p>
  873.  
  874. <p><strong>Want to say thank you?</strong></p>
  875. <p>You can visit my site for more information or to make a donation: <a href='http://www.speaktothegeek.co.uk/oliblog/olimometer'>http://www.speaktothegeek.co.uk/oliblog/olimometer</a>.</p>
  876.  
  877.  
  878. <p>
  879. <table><tr><td style='background-color:white;'>
  880. <form action='https://www.paypal.com/cgi-bin/webscr' method='post' border=0>
  881. <input type='hidden' name='cmd' value='_s-xclick'>
  882. <input type='hidden' name='hosted_button_id' value='QLFWHB9SEJAYY'>
  883. <input type='image' src='https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online.' style='border:0px solid #FF0000;' >
  884. <img alt='' border='0' src='https://www.paypal.com/en_GB/i/scr/pixel.gif' width='1' height='1'>
  885. </form>
  886. </td></tr></table>
  887. </p>
  888.  
  889.  
  890.  
  891.  
  892. <p><strong>Credits</strong>
  893. <ul>
  894. <li>- The 'original' theme images are adapted from the PHP Fundraising Thermometer Generator by Sairam Suresh at <a href='http://www.entropyfarm.org'>www.entropyfarm.org</a></li>
  895. <li>- Colour Picker code courtesy of <a href="http://jscolor.com/" target="_blank">http://jscolor.com/</a>.</li>
  896. <li>- TrueType Font is from the <a href='https://fedorahosted.org/liberation-fonts/'>Liberation Fonts</a> collection.</li>
  897. <li>- Watermaster skin courtesy of <a href='http://www.fscinternational.com'>www.fscinternational.com</a></li>
  898. <li>- The 'Our Progress' skins are based on the thermometer in the <a href="http://wordpress.org/extend/plugins/fundraising-thermometer-plugin-for-wordpress/" target="_blank">Our Progress</a> Wordpress plugin.</li>
  899. <li>- The 'ProgPress' skins are based on the progress meters of the <a href="http://wordpress.org/extend/plugins/progpress/" target="_blank">ProgPress</a> plugin for Wordpress</li>
  900. </ul>
  901.  
  902.  
  903. </small>
  904. </div><!-- restofform -->
  905. </div><!-- Wrap -->
  906.  
  907. <script language="javascript">
  908.  
  909. if(document.olimometer_form1.olimometer_use_paypal[0].checked)
  910. {
  911. olimometer_progress(0);
  912. }
  913. if(document.olimometer_form1.olimometer_use_paypal[1].checked)
  914. {
  915. olimometer_progress(1);
  916. }
  917. if(document.olimometer_form1.olimometer_use_paypal[2].checked)
  918. {
  919. olimometer_progress(2);
  920. }
  921. if(document.olimometer_form1.olimometer_use_paypal[3].checked)
  922. {
  923. olimometer_progress(3);
  924. }
  925.  
  926. if(document.olimometer_form1.olimometer_overlay[0].checked)
  927. {
  928. olimometer_overlay_disable();
  929. }
  930. else
  931. {
  932. olimometer_overlay_enable();
  933. }
  934.  
  935. </script>
  936. <?php
  937.  
  938. }
  939.  
  940.  
  941. // Looks for shortcode parameters and calls show_olimometer with those parameters
  942. // Defaults to olimometer_id of 1
  943. function call_show_olimometer($atts) {
  944. extract( shortcode_atts( array(
  945. 'css_class' => '',
  946. 'id' => '1',
  947. ), $atts ) );
  948.  
  949. return show_olimometer($id,$css_class);
  950. }
  951.  
  952.  
  953. // Displays the olimometer img.
  954. // Parameters:
  955. // $css_class = a string of css classes to be applied to the img
  956. // $olimometer_id = int
  957. //
  958. function show_olimometer($olimometer_id,$css_class = '') {
  959. // Load the olimometer
  960. $current_olimometer = new Olimometer();
  961. $current_olimometer->load($olimometer_id);
  962. return $current_olimometer->show($css_class);
  963. }
  964.  
  965.  
  966.  
  967.  
  968. function my_money_format($format, $num) {
  969. if (function_exists('money_format')) {
  970. return (money_format($format,$num));
  971. } else {
  972. return "$" . number_format($num, 2);
  973. }
  974.  
  975. }
  976.  
  977.  
  978. // Returns the given Olimometer's progress amount.
  979. /*function olimometer_progress($olimometer_id) {
  980. // Load the olimometer
  981. $current_olimometer = new Olimometer();
  982. $current_olimometer->load($olimometer_id);
  983. //return $current_olimometer->show($css_class);
  984. }*/
  985.  
  986. /***************
  987. Olimometer Sidebar Widget
  988. ****************/
  989.  
  990. class OlimometerWidget extends WP_Widget
  991. {
  992. /**
  993. * Register widget with WordPress.
  994. */
  995. public function __construct() {
  996. parent::__construct(
  997. 'OlimometerWidget', // Base ID
  998. 'Olimometer', // Name
  999. array( 'description' => __( 'Displays the Olimometer in a sidebar widget', 'text_domain' ), ) // Args
  1000. );
  1001. }
  1002.  
  1003. /**
  1004. * Front-end display of widget.
  1005. *
  1006. * @see WP_Widget::widget()
  1007. *
  1008. * @param array $args Widget arguments.
  1009. * @param array $instance Saved values from database.
  1010. */
  1011. public function widget( $args, $instance ) {
  1012. extract($args, EXTR_SKIP);
  1013.  
  1014. echo $before_widget;
  1015. $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
  1016. $olimometer_id = $instance['olimometer_id'];
  1017. $header = $instance['header'];
  1018. $footer = $instance['footer'];
  1019. $img_css = $instance['img_css'];
  1020. $div_css = $instance['div_css'];
  1021. $olimometer_donate_address = $instance['olimometer_donate_address'];
  1022. $olimometer_donate_currency = $instance['olimometer_donate_currency'];
  1023. $olimometer_donate_locale = $instance['olimometer_donate_locale'];
  1024.  
  1025. if($olimometer_id > 0)
  1026. {
  1027. // All is good
  1028. }
  1029. else
  1030. {
  1031. // Set a default olimometer_id
  1032. $olimometer_id = 1;
  1033. }
  1034.  
  1035.  
  1036. if (!empty($title))
  1037. echo $before_title . $title . $after_title;
  1038.  
  1039. // WIDGET CODE GOES HERE
  1040. echo "<div id='olimometer_widget'";
  1041. if(strlen($div_css) > 0) {
  1042. echo " class='$div_css'";
  1043. }
  1044. echo ">";
  1045. echo $header;
  1046. echo show_olimometer($olimometer_id,$img_css);
  1047. echo $footer;
  1048.  
  1049. if($olimometer_donate_address == "") {
  1050. // It's empty, so don't display a paypal button
  1051. }
  1052. else {
  1053. ?>
  1054. <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-payments"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="<?php echo $olimometer_donate_address; ?>" /><input type="hidden" name="currency_code" value="<?php echo $olimometer_donate_currency; ?>" /><input type="image" style="padding: 5px 0;" id="ppbutton" src="https://www.paypal.com/<?php echo $olimometer_donate_locale; ?>/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" id="ppbutton" style="padding: 5px 0;" src="https://www.paypal.com/<?php echo $olimometer_donate_locale; ?>/i/scr/pixel.gif" width="1" height="1" /></div></form>
  1055. <?php
  1056. }
  1057.  
  1058. echo "</div><!-- olimometer_widget div -->";
  1059.  
  1060. echo $after_widget;
  1061. }
  1062.  
  1063. /**
  1064. * Back-end widget form.
  1065. *
  1066. * @see WP_Widget::form()
  1067. *
  1068. * @param array $instance Previously saved values from database.
  1069. */
  1070. public function form( $instance ) {
  1071. $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'header' => '', 'footer' => '', 'img_css' => '', 'div_css' => '', 'olimometer_donate_address' => '', 'olimometer_donate_currency' => '', 'olimometer_donate_locale' => '' ) );
  1072. $title = $instance['title'];
  1073. $olimometer_id = $instance['olimometer_id'];
  1074. $header = $instance['header'];
  1075. $footer = $instance['footer'];
  1076. $img_css = $instance['img_css'];
  1077. $div_css = $instance['div_css'];
  1078. $olimometer_donate_address = $instance['olimometer_donate_address'];
  1079. $olimometer_donate_currency = $instance['olimometer_donate_currency'];
  1080. $olimometer_donate_locale = $instance['olimometer_donate_locale'];
  1081.  
  1082. if($olimometer_donate_locale == '') {
  1083. // Set default locale
  1084. $olimometer_donate_locale = 'en_US';
  1085. }
  1086.  
  1087.  
  1088. $currency_codes = array('AUD' => 'Australian Dollars (A $)',
  1089. 'CAD' => 'Canadian Dollars (C $)',
  1090. 'EUR' => 'Euros (&euro;)',
  1091. 'GBP' => 'Pounds Sterling (&pound;)',
  1092. 'JPY' => 'Yen (&yen;)',
  1093. 'USD' => 'U.S. Dollars ($)',
  1094. 'NZD' => 'New Zealand Dollar ($)',
  1095. 'CHF' => 'Swiss Franc',
  1096. 'HKD' => 'Hong Kong Dollar ($)',
  1097. 'SGD' => 'Singapore Dollar ($)',
  1098. 'SEK' => 'Swedish Krona',
  1099. 'DKK' => 'Danish Krone',
  1100. 'PLN' => 'Polish Zloty',
  1101. 'NOK' => 'Norwegian Krone',
  1102. 'HUF' => 'Hungarian Forint',
  1103. 'CZK' => 'Czech Koruna',
  1104. 'ILS' => 'Israeli Shekel',
  1105. 'MXN' => 'Mexican Peso',
  1106. 'BRL' => 'Brazilian Real',
  1107. 'TWD' => 'Taiwan New Dollar',
  1108. 'PHP' => 'Philippine Peso',
  1109. 'TRY' => 'Turkish Lira',
  1110. 'THB' => 'Thai Baht');
  1111.  
  1112. $localized_buttons = array('en_AU' => 'Australia - Australian English',
  1113. 'de_DE/AT' => 'Austria - German',
  1114. 'nl_NL/BE' => 'Belgium - Dutch',
  1115. 'fr_XC' => 'Canada - French',
  1116. 'zh_XC' => 'China - Simplified Chinese',
  1117. 'fr_FR/FR' => 'France - French',
  1118. 'de_DE/DE' => 'Germany - German',
  1119. 'it_IT/IT' => 'Italy - Italian',
  1120. 'ja_JP/JP' => 'Japan - Japanese',
  1121. 'es_XC' => 'Mexico - Spanish',
  1122. 'nl_NL/NL' => 'Netherlands - Dutch',
  1123. 'pl_PL/PL' => 'Poland - Polish',
  1124. 'es_ES/ES' => 'Spain - Spanish',
  1125. 'de_DE/CH' => 'Switzerland - German',
  1126. 'fr_FR/CH' => 'Switzerland - French',
  1127. 'en_US' => 'United States - U.S. English');
  1128.  
  1129.  
  1130. ?>
  1131. <p><label for="<?php echo $this->get_field_id('olimometer_id'); ?>">Olimometer: <?php
  1132. echo olimometer_list(esc_attr($olimometer_id),$this->get_field_id('olimometer_id'),$this->get_field_name('olimometer_id'));
  1133. ?>
  1134. </label></p>
  1135. <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
  1136. <p><label for="<?php echo $this->get_field_id('header'); ?>">Header: <textarea class="widefat" rows=4 id="<?php echo $this->get_field_id('header'); ?>" name="<?php echo $this->get_field_name('header'); ?>"><?php echo esc_attr($header); ?></textarea></label></p>
  1137. <p><label for="<?php echo $this->get_field_id('footer'); ?>">Footer: <textarea class="widefat" rows=4 id="<?php echo $this->get_field_id('footer'); ?>" name="<?php echo $this->get_field_name('footer'); ?>"><?php echo esc_attr($footer); ?></textarea></label></p>
  1138. <p><label for="<?php echo $this->get_field_id('img_css'); ?>">CSS class(es) for image: <input class="widefat" id="<?php echo $this->get_field_id('img_css'); ?>" name="<?php echo $this->get_field_name('img_css'); ?>" type="text" value="<?php echo esc_attr($img_css); ?>" /></label></p>
  1139. <p><label for="<?php echo $this->get_field_id('div_css'); ?>">CSS class(es) for widget: <input class="widefat" id="<?php echo $this->get_field_id('div_css'); ?>" name="<?php echo $this->get_field_name('div_css'); ?>" type="text" value="<?php echo esc_attr($div_css); ?>" /></label></p>
  1140. <p><label for="<?php echo $this->get_field_id('olimometer_donate_address'); ?>">If you'd like a PayPal donate button, enter your account email address here: <input class="widefat" id="<?php echo $this->get_field_id('olimometer_donate_address'); ?>" name="<?php echo $this->get_field_name('olimometer_donate_address'); ?>" type="text" value="<?php echo esc_attr($olimometer_donate_address); ?>" /></label></p>
  1141. <p><label for="<?php echo $this->get_field_id('olimometer_donate_currency'); ?>">PayPal donation currency:<select name="<?php echo $this->get_field_name('olimometer_donate_currency'); ?>" id="<?php echo $this->get_field_id('olimometer_donate_currency'); ?>">
  1142. <?php
  1143. foreach ( $currency_codes as $key => $code ) {
  1144. echo '<option value="'.$key.'"';
  1145. if (esc_attr($olimometer_donate_currency) == $key) {
  1146. echo ' selected="selected"';
  1147. }
  1148. echo '>'.$code.'</option>';
  1149. } ?></select></label></p>
  1150. <p><label for="<?php echo $this->get_field_id('olimometer_donate_locale'); ?>">PayPal donation locale:<select name="<?php echo $this->get_field_name('olimometer_donate_locale'); ?>" id="<?php echo $this->get_field_id('olimometer_donate_locale'); ?>">
  1151. <?php
  1152. foreach ( $localized_buttons as $key => $code ) {
  1153. echo '<option value="'.$key.'"';
  1154. if (esc_attr($olimometer_donate_locale) == $key) {
  1155. echo ' selected="selected"';
  1156. }
  1157. echo '>'.$code.'</option>';
  1158. } ?></select></label></p>
  1159.  
  1160.  
  1161. <?php
  1162. }
  1163.  
  1164. /**
  1165. * Sanitize widget form values as they are saved.
  1166. *
  1167. * @see WP_Widget::update()
  1168. *
  1169. * @param array $new_instance Values just sent to be saved.
  1170. * @param array $old_instance Previously saved values from database.
  1171. *
  1172. * @return array Updated safe values to be saved.
  1173. */
  1174. public function update( $new_instance, $old_instance ) {
  1175. $instance = $old_instance;
  1176. $instance['title'] = $new_instance['title'];
  1177. $instance['header'] = $new_instance['header'];
  1178. $instance['footer'] = $new_instance['footer'];
  1179. $instance['img_css'] = $new_instance['img_css'];
  1180. $instance['div_css'] = $new_instance['div_css'];
  1181. $instance['olimometer_id'] = $new_instance['olimometer_id'];
  1182. $instance['olimometer_donate_address'] = $new_instance['olimometer_donate_address'];
  1183. $instance['olimometer_donate_currency'] = $new_instance['olimometer_donate_currency'];
  1184. $instance['olimometer_donate_locale'] = $new_instance['olimometer_donate_locale'];
  1185. return $instance;
  1186. }
  1187.  
  1188.  
  1189.  
  1190. }
  1191. add_action( 'widgets_init', create_function('', 'return register_widget("OlimometerWidget");') );
  1192.  
  1193.  
  1194. /* *****
  1195. Start of Dashboard Widget section
  1196. **** */
  1197.  
  1198. function olimometer_dashboard_widget_function() {
  1199. echo '<div class="wrap">';
  1200.  
  1201. if(strlen(get_olimometer_last()) > 0)
  1202. {
  1203. $current_olimometer_id = get_olimometer_last();
  1204. }
  1205. else {
  1206. $current_olimometer_id = 1;
  1207. }
  1208.  
  1209. // Load the olimometer
  1210. $dash_olimometer = new Olimometer();
  1211. $dash_olimometer->load($current_olimometer_id);
  1212.  
  1213.  
  1214. ?>
  1215.  
  1216. <table>
  1217. <form method="post" id="olimometer_selection_form" name="olimometer_selection_form">
  1218. <tr class="form-field form-required">
  1219.  
  1220. <td ><label for="name">Please choose an Olimometer:</label></td>
  1221. <td>
  1222. <?php
  1223. echo olimometer_list($current_olimometer_id,"olimometer_id","olimometer_id");
  1224. ?>
  1225. </td>
  1226.  
  1227. <td><input type="submit" class="button-primary" name="olimometer_load" value="Load" /></td>
  1228. </tr>
  1229. </form>
  1230. </table>
  1231.  
  1232. <table class="form-table">
  1233. <form method="post">
  1234. <input type="hidden" id="olimometer_id" name="olimometer_id" value="<?php echo $current_olimometer_id ?>">
  1235. <tr class="form-field form-required">
  1236. <th scope="row" valign="top"><label for="name">Current Amount Raised (Progress Value)</label></th>
  1237. <td><input name="olimometer_progress_value" id="olimometer_progress_value" type="text" value="<?php
  1238. echo $dash_olimometer->olimometer_progress_value;
  1239.  
  1240. ?>" size="40" aria-required="true" /></td>
  1241. </tr>
  1242. <tr class="form-field form-required">
  1243. <th scope="row" valign="top"><label for="name">Target Amount</label></th>
  1244. <td><input name="olimometer_total_value" id="olimometer_total_value" type="text" value="<?php
  1245. echo $dash_olimometer->olimometer_total_value;
  1246. ?>" size="40" aria-required="true" /></td>
  1247. </tr>
  1248. </table>
  1249. <p>
  1250.  
  1251.  
  1252.  
  1253. </p>
  1254. <p><input type="submit" class="button-primary" name="olimometer_dw_submit" value="Update" />
  1255.  
  1256. &nbsp;&nbsp;<a href='options-general.php?page=olimometer_manage'>Settings</a>
  1257. <?php
  1258. echo '</p></form></div>';
  1259.  
  1260. }
  1261.  
  1262. function olimometer_add_dashboard_widgets() {
  1263. if ( current_user_can( "olimometer_dashboard_widget" ) ) {
  1264. wp_add_dashboard_widget('olimometer_dashboard_widget', 'Olimometer', 'olimometer_dashboard_widget_function');
  1265. }
  1266. }
  1267.  
  1268. add_action('wp_dashboard_setup', 'olimometer_add_dashboard_widgets' );
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280. /************************
  1281. Database Functions
  1282. ************************/
  1283. global $olimometer_db_version;
  1284. $olimometer_db_version = "2.47";
  1285.  
  1286. function olimometer_install() {
  1287. global $wpdb;
  1288. global $olimometer_db_version;
  1289.  
  1290. $table_name = $wpdb->prefix . "olimometer_olimometers";
  1291.  
  1292. // Create the table....
  1293. $sql = "CREATE TABLE $table_name (
  1294. olimometer_id mediumint(9) NOT NULL AUTO_INCREMENT,
  1295. olimometer_description VARCHAR(255),
  1296. olimometer_progress_value DOUBLE,
  1297. olimometer_total_value DOUBLE,
  1298. olimometer_currency VARCHAR(255),
  1299. olimometer_thermometer_bg_colour VARCHAR(255),
  1300. olimometer_text_colour VARCHAR(255),
  1301. olimometer_thermometer_height mediumint(9),
  1302. olimometer_transparent tinyint,
  1303. olimometer_show_target tinyint,
  1304. olimometer_show_progress tinyint,
  1305. olimometer_progress_label VARCHAR(255),
  1306. olimometer_font_height smallint,
  1307. olimometer_suffix VARCHAR(255),
  1308. olimometer_skin_slug VARCHAR(255),
  1309. olimometer_use_paypal tinyint,
  1310. olimometer_paypal_extra_value DOUBLE,
  1311. olimometer_paypal_username VARCHAR(255),
  1312. olimometer_paypal_password VARCHAR(255),
  1313. olimometer_paypal_signature VARCHAR(255),
  1314. olimometer_number_format tinyint,
  1315. olimometer_link VARCHAR(255),
  1316. olimometer_overlay tinyint,
  1317. olimometer_overlay_image VARCHAR(255),
  1318. olimometer_overlay_x int,
  1319. olimometer_overlay_y int,
  1320. olimometer_stayclassypid int,
  1321. olimometer_stayclassyeid int,
  1322. olimometer_link_disable int,
  1323. UNIQUE KEY olimometer_id (olimometer_id)
  1324. );";
  1325.  
  1326. require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  1327. dbDelta($sql);
  1328.  
  1329. update_option("olimometer_db_version", $olimometer_db_version);
  1330.  
  1331. // Now, create the first olimometer object if one doesn't exist:
  1332. //$olimometer_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $table_name;" ) );
  1333. $olimometer_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM %d;", $table_name ) );
  1334. if($olimometer_count == 0)
  1335. {
  1336. $first_olimometer = new Olimometer();
  1337. $first_olimometer->save();
  1338. }
  1339. }
  1340.  
  1341.  
  1342.  
  1343. // Check for updates
  1344. function update_check() {
  1345. // Has this plugin been updated to v2.00 (database version)?
  1346. if( (strlen(get_option("olimometer_updated_to_two")) > 0) && (strlen(get_option("olimometer_db_version")) > 0))
  1347. {
  1348. // Yes it has!
  1349. // If currently installed database version is less than current version required for this plugin, then we need to upgrade
  1350. $required_db_version = 2.47;
  1351. $installed_db_version = get_option("olimometer_db_version");
  1352. if($installed_db_version < $required_db_version) {
  1353. olimometer_install();
  1354. // Now we need to do one-off upgrades for specific versions:
  1355. if($installed_db_version < 2.20) {
  1356. // Skin upgrade, we need to work out which skins were used in the database and write the slug names in
  1357. global $wpdb;
  1358. $table_name = $wpdb->prefix . "olimometer_olimometers";
  1359. $search_results = $wpdb->get_results(
  1360. "
  1361. SELECT *
  1362. FROM $table_name
  1363. "
  1364. );
  1365.  
  1366. // Loop around results:
  1367. foreach ( $search_results as $search_result )
  1368. {
  1369. // What is the id of the olimometer?
  1370. $search_olimometer_id = $search_result->olimometer_id;
  1371.  
  1372. // What was the skin id used?
  1373. $search_skin = $search_result->olimometer_skin;
  1374.  
  1375. // Check the skin id and create a slug accordingly
  1376. $new_slug = "";
  1377. switch ($search_skin) {
  1378. case 0:
  1379. $new_slug = "oli-default";
  1380. break;
  1381. case 1:
  1382. $new_slug = "oli-rounded";
  1383. break;
  1384. case 2:
  1385. $new_slug = "oli-bold-chunky";
  1386. break;
  1387. case 3:
  1388. $new_slug = "oli-watermaster";
  1389. break;
  1390. case 4:
  1391. $new_slug = "oli-ourprogress-blue";
  1392. break;
  1393. case 5:
  1394. $new_slug = "oli-ourprogress-green";
  1395. break;
  1396. case 6:
  1397. $new_slug = "oli-ourprogress-red";
  1398. break;
  1399. }
  1400.  
  1401. // Now insert that in to the database:
  1402. $wpdb->update($table_name,
  1403. array( 'olimometer_skin_slug' => $new_slug
  1404. ),
  1405. array( 'olimometer_id' => $search_olimometer_id )
  1406. );
  1407. }
  1408.  
  1409.  
  1410. }
  1411. }
  1412.  
  1413. }
  1414. else
  1415. {
  1416.  
  1417. // No it hasn't, so we need to import the old variables and save as the first olimometer
  1418.  
  1419. // Create the database
  1420. olimometer_install();
  1421.  
  1422. $old_olimometer = new Olimometer();
  1423. $old_olimometer->olimometer_id = 1;
  1424.  
  1425. if(strlen(get_option("olimometer_progress_value")) > 0) {$old_olimometer->olimometer_progress_value = get_option("olimometer_progress_value");}
  1426. if(strlen(get_option("olimometer_total_value") ) > 0 ) { $old_olimometer->olimometer_total_value = get_option("olimometer_total_value"); }
  1427. if(strlen(get_option("olimometer_currency")) > 0) {$old_olimometer->olimometer_currency = get_option("olimometer_currency");}
  1428. if(strlen(get_option("olimometer_thermometer_bg_colour")) > 1) {$old_olimometer->olimometer_thermometer_bg_colour = get_option("olimometer_thermometer_bg_colour");}
  1429. if(strlen(get_option("olimometer_text_colour")) > 1) {$old_olimometer->olimometer_text_colour = get_option("olimometer_text_colour");}
  1430. if(strlen(get_option("olimometer_thermometer_height")) > 1) {$old_olimometer->olimometer_thermometer_height = get_option("olimometer_thermometer_height");}
  1431. if(strlen(get_option("olimometer_transparent")) > 0) {$old_olimometer->olimometer_transparent = get_option("olimometer_transparent");}
  1432. if(strlen(get_option("olimometer_show_target")) > 0) {$old_olimometer->olimometer_show_target = get_option("olimometer_show_target");}
  1433. if(strlen(get_option("olimometer_show_progress")) > 0) {$old_olimometer->olimometer_show_progress = get_option("olimometer_show_progress");}
  1434. if(strlen(get_option("olimometer_progress_label")) > 1) {$old_olimometer->olimometer_progress_label = get_option("olimometer_progress_label");}
  1435. if(strlen(get_option("olimometer_font_height")) > 1) {$old_olimometer->olimometer_font_height = get_option("olimometer_font_height");}
  1436. if(strlen(get_option("olimometer_suffix")) > 0) {$old_olimometer->olimometer_suffix = get_option("olimometer_suffix");}
  1437. if(strlen(get_option("olimometer_skin")) > 0) {$old_olimometer->olimometer_skin = get_option("olimometer_skin");}
  1438. if(strlen(get_option("olimometer_use_paypal")) > 0) {$old_olimometer->olimometer_use_paypal = get_option("olimometer_use_paypal");}
  1439. if(strlen(get_option("olimometer_paypal_username")) > 0) {$old_olimometer->olimometer_paypal_username = get_option("olimometer_paypal_username");}
  1440. if(strlen(get_option("olimometer_paypal_password")) > 0) {$old_olimometer->olimometer_paypal_password = get_option("olimometer_paypal_password");}
  1441. if(strlen(get_option("olimometer_paypal_signature")) > 0) {$old_olimometer->olimometer_paypal_signature = get_option("olimometer_paypal_signature");}
  1442.  
  1443. $old_olimometer->save();
  1444.  
  1445. // Mark the old olimometer as upgraded
  1446. update_option("olimometer_updated_to_two", 1);
  1447. }
  1448.  
  1449. }
  1450.  
  1451.  
  1452. function olimometer_list($selected_olimometer,$form_id,$form_name)
  1453. {
  1454. $current_olimometer_id = $selected_olimometer;
  1455.  
  1456. // Create a form of olimometers from the database
  1457. global $wpdb;
  1458. $table_name = $wpdb->prefix . "olimometer_olimometers";
  1459. $search_results = $wpdb->get_results(
  1460. "
  1461. SELECT olimometer_id, olimometer_description
  1462. FROM $table_name
  1463. "
  1464. );
  1465.  
  1466. $return_string = "<select name='". $form_name . "' id='". $form_id ."' aria-required='true' >";
  1467.  
  1468. foreach ( $search_results as $search_result )
  1469. {
  1470. $return_string = $return_string . "<option value='".$search_result->olimometer_id."'";
  1471. if($current_olimometer_id == $search_result->olimometer_id)
  1472. {
  1473. $return_string = $return_string . " SELECTED";
  1474. }
  1475. $return_string = $return_string . ">".$search_result->olimometer_description."</option>";
  1476. }
  1477.  
  1478. $return_string = $return_string . "</select>";
  1479. return $return_string;
  1480. }
  1481.  
  1482.  
  1483. // Saves the olimometer_last value for this user
  1484. function update_olimometer_last($last_olimometer_id) {
  1485. // What is this user's user_id?
  1486. require_once (ABSPATH . WPINC . '/pluggable.php');
  1487. global $current_user; $current_user = wp_get_current_user();
  1488. //get_currentuserinfo();
  1489.  
  1490. update_option('olimometer_last_' . $current_user->user_login, $last_olimometer_id);
  1491. }
  1492.  
  1493. // Returns the olimometer_last value for this user
  1494. function get_olimometer_last() {
  1495. // What is this user's user_id?
  1496. require_once (ABSPATH . WPINC . '/pluggable.php');
  1497. global $current_user; $current_user = wp_get_current_user();
  1498. //get_currentuserinfo();
  1499.  
  1500. $olimometer_last = get_option('olimometer_last_' . $current_user->user_login);
  1501. return $olimometer_last;
  1502. }
  1503.  
  1504. // Shortcode to display the current amount raised all formatted nice and that
  1505. function olimometer_progress($atts) {
  1506. extract( shortcode_atts( array(
  1507. 'id' => '1',
  1508. ), $atts ) );
  1509.  
  1510. $an_olimometer = new Olimometer();
  1511. $an_olimometer->load($id);
  1512.  
  1513. return $an_olimometer->get_display_progress();
  1514. }
  1515.  
  1516. // Shortcode to display the target amount all formatted nice and that
  1517. function olimometer_target($atts) {
  1518. extract( shortcode_atts( array(
  1519. 'id' => '1',
  1520. ), $atts ) );
  1521.  
  1522. $an_olimometer = new Olimometer();
  1523. $an_olimometer->load($id);
  1524.  
  1525. return $an_olimometer->get_display_total();
  1526. }
  1527.  
  1528. // Shortcode to display the amount left to raise to meet the target formatted nice and that
  1529. function olimometer_remaining($atts) {
  1530. extract( shortcode_atts( array(
  1531. 'id' => '1',
  1532. ), $atts ) );
  1533.  
  1534. $an_olimometer = new Olimometer();
  1535. $an_olimometer->load($id);
  1536.  
  1537. return $an_olimometer->get_display_remaining();
  1538. }
  1539.  
  1540.  
  1541. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement