PluginProbe
Jock On Air Now (JOAN) / 5.6.2
Jock On Air Now (JOAN) v5.6.2
4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 5.0 5.1 5.2.0 5.3.0 5.4.0 5.5.0 5.5.1 5.5.2 5.5.3 5.5.4 5.5.6 5.5.7 5.5.8 5.5.9 5.6 5.6.1 5.6.2 5.6.3 5.6.4 All 77 releases
joan / joan.php

joan.php in Jock On Air Now (JOAN) 5.6.2, at joan.php

870 lines 28.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Jock On Air Now
4 Plugin URI: https://gandenterprisesinc.com
5 Description: JOAN allows you to create, manage and display your station's programming schedule quite easily. After install use the widget to display the current show/Jock on air, display full station schedule by inserting the included shortcode into posts or pages. Create a new page, name it schedule or whatever you like place the schedule shortcode on it, add to your menu to display your full schedule.
6 Author: G &amp; D Enterprises, Inc.
7 Version: 5.6.2
8 Author URI: https://www.gandenterprisesinc.com
9
10 */
11
12 if (!defined('ABSPATH')) {
13 exit("Sorry, you are not allowed to access this page directly.");
14 }
15
16 /* Set constant for plugin directory */
17 define( 'SS3_URL', WP_PLUGIN_URL.'/joan' );
18
19 $joan_db_version = "3.1.1";
20
21 if (!isset($wpdb))
22 $wpdb = $GLOBALS['wpdb'];
23
24 $joanTable = $wpdb->prefix . "WPJoan";
25
26 $tz = get_option('timezone_string');
27 date_default_timezone_set($tz);
28
29 //Installation
30 function joan_install() {
31
32 global $wpdb;
33 global $joan_db_version;
34 global $joanTable;
35
36 $joanTable = $wpdb->prefix . "WPJoan";
37
38 if($wpdb->get_var("show tables like '$joanTable'") != $joanTable) {
39
40 $sql = "CREATE TABLE " . $joanTable . " (
41 id int(9) NOT NULL AUTO_INCREMENT,
42 dayOfTheWeek text NOT NULL,
43 startTime int(11) NOT NULL,
44 endTime int(11) NOT NULL,
45 startClock text not null,
46 endClock text not null,
47 showName text NOT NULL,
48 linkURL text NOT null,
49 imageURL text not null,
50 UNIQUE KEY id (id)
51 );";
52
53 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
54 dbDelta($sql);
55
56 add_option("joan_db_version", $joan_db_version);
57 }
58 }
59
60 register_activation_hook(__FILE__,'joan_install');
61 /* uninstall function */
62 function joan_uninstall(){
63 global $wpdb;
64 $joanTable = $wpdb->prefix . "WPJoan";
65 delete_option("joan_db_version");
66 $sql = "DROP TABLE IF EXISTS $joanTable";
67 $wpdb->query($sql);
68 }
69 register_uninstall_hook( __FILE__, 'joan_uninstall' );
70 //Register and create the Widget
71
72 class JoanWidget extends WP_Widget {
73
74 /**
75 * Declares the JoanWidget class.
76 *
77 */
78 function __construct(){
79 $widget_ops = array('classname' => 'joan_widget', 'description' => __( "Display your schedule with style.") );
80 $control_ops = array('width' => 300, 'height' => 300);
81 parent::__construct( 'Joan', __( 'Joan', 'joan' ), $widget_ops, $control_ops );
82 }
83
84 /**
85 * Displays the Widget
86 *
87 */
88 function widget($args, $instance){
89
90 extract($args);
91 $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
92
93 # Before the widget
94 echo $before_widget;
95
96 # The title
97 if ( $title ){
98 echo $before_title . $title . $after_title;
99 }
100 # Make the Joan widget
101 echo showme_joan();
102
103 # After the widget
104 echo $after_widget;
105 }
106
107 /**
108 * Saves the widgets settings.
109 *
110 */
111 function update($new_instance, $old_instance){
112 $instance = $old_instance;
113 $instance['title'] = strip_tags(stripslashes($new_instance['title']));
114 $instance['lineOne'] = strip_tags(stripslashes($new_instance['lineOne']));
115 $instance['lineTwo'] = strip_tags(stripslashes($new_instance['lineTwo']));
116
117 return $instance;
118 }
119
120 /**
121 * Creates the edit form for the widget.
122 *
123 */
124 function form($instance){
125 //Defaults
126 $instance = wp_parse_args( (array) $instance, array('title'=>'On Air Now') );
127
128 $title = htmlspecialchars($instance['title']);
129
130 # Output the options
131 echo '<p style="text-align:right;"><label for="' . $this->get_field_name('title') . '">' . __('Title:') . ' <input style="width: 250px;" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $title . '" /></label></p>';
132 }
133 } //End of widget
134
135
136 function JoanInit() {
137 register_widget('JoanWidget');
138 }
139 add_action('widgets_init', 'JoanInit');
140
141 function joan_default_options(){
142 //==== OPTIONS ====
143 add_option('joan_upcoming', 'yes');
144 add_option('joan_use_images', 'yes');
145 add_option('joan_shutitdown', 'no');
146 add_option('off_air_message', 'We are currently off the air.');
147 add_option('joan_css', '');
148 add_option('joan_shutitdown', 'no');
149 }
150 register_activation_hook(__FILE__,'joan_default_options');
151 function elementor_joan_widget(){
152
153 class Elementor_Joan_Widget extends \Elementor\Widget_Base {
154
155 /**
156 * Get widget name.
157 *
158 * Retrieve oEmbed widget name.
159 *
160 * @since 1.0.0
161 * @access public
162 *
163 * @return string Widget name.
164 */
165 public function get_name() {
166 return 'joan';
167 }
168
169 /**
170 * Get widget title.
171 *
172 * Retrieve oEmbed widget title.
173 *
174 * @since 1.0.0
175 * @access public
176 *
177 * @return string Widget title.
178 */
179 public function get_title() {
180 return __( 'Joke On Air Widget', 'joan' );
181 }
182
183 /**
184 * Get widget icon.
185 *
186 * Retrieve oEmbed widget icon.
187 *
188 * @since 1.0.0
189 * @access public
190 *
191 * @return string Widget icon.
192 */
193 public function get_icon() {
194 return 'fa fa-bars';
195 }
196
197 /**
198 * Get widget categories.
199 *
200 * Retrieve the list of categories the oEmbed widget belongs to.
201 *
202 * @since 1.0.0
203 * @access public
204 *
205 * @return array Widget categories.
206 */
207 public function get_categories() {
208 return [ 'general' ];
209 }
210
211 /**
212 * Register oEmbed widget controls.
213 *
214 * Adds different input fields to allow the user to change and customize the widget settings.
215 *
216 * @since 1.0.0
217 * @access protected
218 */
219 protected function _register_controls() {
220
221 $this->start_controls_section(
222 'content_section',
223 [
224 'label' => __( 'Content', 'plugin-name' ),
225 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
226 ]
227 );
228
229 $this->add_control(
230 'title',
231 [
232 'label' => __( 'Title of the widget', 'joan' ),
233 'type' => \Elementor\Controls_Manager::TEXT,
234 'input_type' => 'text',
235 'placeholder' => __( 'On Air Now', 'joan' ),
236 ]
237 );
238 $this->add_control(
239 'heading',
240 [
241 'label' => __( 'Heading', 'plugin-name' ),
242 'type' => \Elementor\Controls_Manager::SELECT,
243 'options' => [
244 'H1' => __( 'H1', 'plugin-name' ),
245 'H2' => __( 'H2', 'plugin-name' ),
246 'H3' => __( 'H3', 'plugin-name' ),
247 'H4' => __( 'H4', 'plugin-name' ),
248 'H5' => __( 'H5', 'plugin-name' ),
249 'H6' => __( 'H6', 'plugin-name' ),
250
251 ],
252 'default' => 'H1',
253 ]
254 );
255 $this->add_control(
256 'text_align',
257 [
258 'label' => __( 'Alignment', 'plugin-domain' ),
259 'type' => \Elementor\Controls_Manager::CHOOSE,
260 'options' => [
261 'left' => [
262 'title' => __( 'Left', 'plugin-domain' ),
263 'icon' => 'fa fa-align-left',
264 ],
265 'center' => [
266 'title' => __( 'Center', 'plugin-domain' ),
267 'icon' => 'fa fa-align-center',
268 ],
269 'right' => [
270 'title' => __( 'Right', 'plugin-domain' ),
271 'icon' => 'fa fa-align-right',
272 ],
273 ],
274 'default' => 'center',
275 'toggle' => true,
276 ]
277 );
278 $this->end_controls_section();
279
280 }
281
282 /**
283 * Render oEmbed widget output on the frontend.
284 *
285 * Written in PHP and used to generate the final HTML.
286 *
287 * @since 1.0.0
288 * @access protected
289 */
290 protected function render() {
291
292 $settings = $this->get_settings_for_display();
293
294 $title = htmlspecialchars( $settings['title'] );
295 $heading = $settings['heading'];
296 $title = !empty($title) ? $title : 'On Air Now';
297 $startHeading = sprintf("<%s>",$heading);
298 $endHeading = sprintf("</%s>",$heading);
299 $text_align = $settings['text_align'];
300
301
302 # Before the widget
303 echo sprintf('<div class="text-%s">',$text_align);
304
305 # The title
306
307 echo $startHeading. $title . $endHeading;
308 # Make the Joan widget
309 echo showme_joan();
310
311 # After the widget
312 echo '</div>';
313
314 }
315
316 }
317 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor_Joan_Widget() );
318 }
319
320 add_action( 'elementor/widgets/widgets_registered','elementor_joan_widget' );
321 //add_action( 'elementor/frontend/after_enqueue_styles', 'widget_styles' );
322 add_action( 'elementor/frontend/after_register_scripts', 'joan_header_scripts' );
323
324 //==== SHORTCODES ====
325
326 function joan_schedule_handler($atts, $content=null, $code=""){
327
328 if (!isset($wpdb)) $wpdb = $GLOBALS['wpdb'];
329 global $wpdb;
330 global $joanTable;
331
332 //Get the current schedule, divided into days
333 $daysOfTheWeek = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
334
335 $schedule = array();
336
337 $output = '';
338
339 foreach ($daysOfTheWeek as $day) {
340 if (!isset($wpdb)) $wpdb = $GLOBALS['wpdb'];
341 //Add this day's shows HTML to the $output array
342 $showsForThisDay = $wpdb->get_results( $wpdb->prepare ( "SELECT * FROM $joanTable WHERE dayOfTheWeek = %s ORDER BY startTime", $day ));
343
344 //Check to make sure this day has shows before saving the header
345 if ($showsForThisDay){
346 $output .= '<h2>'.$day.'</h2>';
347 $output .= '<ul class="joan-schedule">';
348 foreach ($showsForThisDay as $show){
349 $showName = $show->showName;
350 $startClock = $show->startClock;
351 $endClock = $show->endClock;
352 $linkURL = $show->linkURL;
353 $imageURL = $show->imageURL;
354
355 if ($linkURL){
356 $showName = '<a href="'.$linkURL.'">'.$showName.'</a>';
357 }
358
359 $output .= '<li><strong>'.$startClock.'</strong> - <strong>'.$endClock.'</strong>: '.$showName.'</li>';
360
361 }
362 $output .= '</ul>';
363 }
364 }
365 return $output;
366 }
367
368 add_shortcode('joan-schedule', 'joan_schedule_handler');
369
370 //Daily schedule
371 function joan_schedule_today($atts, $content=null, $code=""){
372
373 global $wpdb;
374 global $joanTable;
375
376 //Get the current schedule, divided into days
377 $daysOfTheWeek = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
378
379 $today = date('l');
380
381 $schedule = array();
382
383 $output = '';
384
385 foreach ($daysOfTheWeek as $day) {
386 //Add this day's shows HTML to the $output array
387 $showsForThisDay = $wpdb->get_results( $wpdb->prepare ( "SELECT * FROM $joanTable WHERE dayOfTheWeek = %s ORDER BY startTime", $day ));
388
389 if ($day == $today) {
390
391 //Check to make sure this day has shows before saving the header
392 if ($showsForThisDay){
393 $output .= '<h2 class="widget-title">Today - '.$today.'</h2>';
394 $output .= '<ul class="joan-schedule">';
395 foreach ($showsForThisDay as $show){
396 $showName = $show->showName;
397 $startClock = $show->startClock;
398 $endClock = $show->endClock;
399 $linkURL = $show->linkURL;
400 if ($linkURL){
401 $showName = '<a href="'.$linkURL.'">'.$showName.'</a>';
402 }
403 $output .= '<li><span class="show-time">'.$startClock./*' - '.$endClock.*/':</span> <span class="show-name">'.$showName.'</span></li>';
404 }
405 $output .= '</ul>';
406 }
407 }
408 }
409 return $output;
410 }
411
412 add_shortcode('schedule-today', 'joan_schedule_today');
413
414 //End daily schedule
415
416 function showme_joan(){
417
418 $output = '<style>'.get_option('joan_css', '').'</style>';
419 $output .= '<div class="joan-now-playing"></div>';
420 return $output;
421
422 }
423
424 add_shortcode('joan-now-playing', 'showme_joan');
425
426 function joan_init(){
427 add_action('admin_menu', 'joan_plugin_menu');
428 }
429 add_action( 'init', 'joan_init');
430
431 function joan_image_upload_scripts() {
432 wp_enqueue_script('media-upload');
433 wp_enqueue_script('thickbox');
434 wp_enqueue_script('my-upload');
435 }
436
437 function joan_image_upload_styles() {
438 wp_enqueue_style('thickbox');
439 }
440
441 if (isset($_GET['page']) && $_GET['page'] == 'joan_settings') {
442 add_action('admin_print_scripts', 'joan_image_upload_scripts');
443 add_action('admin_print_styles', 'joan_image_upload_styles');
444 }
445
446 //==== ADMIN OPTIONS AND SCHEDULE PAGE ====
447
448 function joan_plugin_menu() {
449 global $pagenow;
450 // Add a new submenu under Options:
451 add_menu_page('JOAN', 'Jock On Air Now', 'activate_plugins', 'joan_settings', 'joan_options_page');
452
453 // Modified by PHP Stack
454 if ($pagenow == 'admin.php' && isset($_GET['page'])) {
455 if ($_GET['page'] == 'joan_settings') {
456 wp_enqueue_style( "joan-admin", plugins_url('admin.css', __FILE__) );
457 wp_enqueue_script( "joan-admin", plugins_url('admin.js', __FILE__), array('jquery'), '1.0.0', true );
458 }
459 }
460 }
461
462 function joan_options_page(){
463 if (!isset($wpdb)) $wpdb = $GLOBALS['wpdb'];
464 global $wpdb;
465 global $joanTable;
466 //Check to see if the user is upgrading from an old Joan database
467
468 if (isset($_POST['upgrade-database'])){
469 if (check_admin_referer('upgrade_joan_database', 'upgrade_joan_database_field')){
470
471 if ($wpdb->get_var("show tables like '$joanTable'") != $joanTable){
472 $sql = "CREATE TABLE " . $joanTable . " (
473 id int(9) NOT NULL AUTO_INCREMENT,
474 dayOfTheWeek text NOT NULL,
475 startTime int(11) NOT NULL,
476 endTime int(11) NOT NULL,
477 startClock text not null,
478 endClock text not null,
479 showName text NOT NULL,
480 linkURL text NOT null,
481 imageURL text not null,
482 UNIQUE KEY id (id)
483 );";
484
485 $wpdb->query($sql);
486 }
487
488 $joanOldTable = $wpdb->prefix.'joan';
489
490 $oldJoanShows = $wpdb->get_results($wpdb->prepare("SELECT id, showstart, showend, showname, linkUrl, imageUrl FROM $joanOldTable WHERE id != %d", -1));
491 if ($oldJoanShows){
492 foreach ($oldJoanShows as $show){
493 $showname = $show->showname;
494 $startTime = $show->showstart;
495 $endTime = $show->showend;
496 $startDay = date('l', $startTime);
497 $startClock = date('g:i a', ($startTime));
498 $endClock = date('g:i a', ($endTime));
499 $linkURL = $show->linkUrl;
500 if ($linkURL == 'No link specified.'){
501 $linkURL = '';
502 }
503 $imageURL = $show->imageUrl;
504
505 //Insert the new show into the New Joan Databse
506 $wpdb->query( $wpdb->prepare("INSERT INTO $joanTable (dayOfTheWeek, startTime,endTime,startClock, endClock, showName, imageURL, linkURL) VALUES (%s, %d, %d , %s, %s, %s, %s, %s)", $startDay, $startTime, $endTime, $startClock, $endClock, $showname, $imageURL, $linkURL ) );
507 }
508 }
509 }
510 //Remove the old Joan table if the new table has been created
511 if($wpdb->get_var("show tables like '$joanTable'") == $joanTable) {
512 $wpdb->query("DROP TABLE $joanOldTable");
513 }
514 }
515
516 // echo '<script type="text/javascript" src="'.SS3_URL.'/admin.js" ></script>';
517
518 ?>
519 <div class="wrap">
520 <div class="joan-message-window">Message goes here.</div>
521 <h1>Jock On Air Now</h1>
522 <p><em>Let your listeners know when their favorite jock/show is on.</em><br /><small>by <a href='http://www.gandenterprisesinc.com' target='_blank'>G &amp; D Enterprises, Inc.</a></small></p>
523
524 <style>
525 .pcb {
526 width:100%;
527 height:423px;
528 border:none;
529 border-collapse:collapse;
530 padding:0px;
531 }
532 .pcb th {
533 align:top;
534 border:none;
535 padding:0px;
536 }
537 .pcb td {
538 align:top;
539 border:none;
540 padding:0px;
541 }
542 </style>
543 <table class="pcb">
544 <tbody>Advertisment
545 <tr>
546 <td align="top" width="100%"><a href="https://myradiohut.com" target="_blank"><img src="https://apps.myradiohut.com/web/images/joan_lite/rhut-banner1.png"></a>
547 <td align="top" width="423"><p><a href="https://vouscast.com" target="_blank"><img src="https://apps.myradiohut.com/web/images/joan_lite/vouscast_banner2.png"></a></p></td>
548 <td align="top" width="180"><p><a href="https://musidek.com" target="_blank"><img src="https://apps.myradiohut.com/web/images/joan_lite/admin_logo.png"></a></p></td>
549 </tr>
550 </tbody>
551 </table>
552
553
554 <?php
555 //Check to see if Joan 2.0 is installed
556 $table_name = $wpdb->prefix . "joan";
557 if($wpdb->get_var("show tables like '$table_name'") == $table_name) {
558 ?>
559 <div class="error">
560 <form method="post" action="">
561 <p><strong>Previous version of Joan detected.</strong> Be sure to backup your database before performing this upgrade. <input type="submit" class="button-primary" value="Upgrade my Joan Database" /></p>
562 <input type="hidden" name="upgrade-database" value=' ' />
563 <?php wp_nonce_field('upgrade_joan_database', 'upgrade_joan_database_field'); ?>
564 </form>
565 </div>
566 <?php
567 }
568
569 ?>
570
571 <input type="hidden" class="script-src" readonly="readonly" value="<?= esc_url($_SERVER['PHP_SELF']); ?>?page=joan_settings" />
572 <?php wp_nonce_field('delete_joan_entry', 'delete_entries_nonce_field'); ?>
573
574 <ul class="tab-navigation">
575 <li class="joan-scheudle"><img src="https://apps.myradiohut.com/web/images/joan_lite/button_schedule.png"></li>
576 <li class="joan-options"><img src="https://apps.myradiohut.com/web/images/joan_lite/button_options.png"></li>
577 <li class="shut-it-down"><img src="https://apps.myradiohut.com/web/images/joan_lite/button_on-off.png"></li>
578 <li class="joan-pre"><img src="https://apps.myradiohut.com/web/images/joan_lite/button_get-premium.png"></li>
579 </ul>
580
581 <div class="joan-tabs">
582
583 <div class="tab-container" id="joan-schedule">
584
585 <hr>
586
587 <h2>Schedule: Add New Shows To Schedule or Edit Existing Show Schedule</h2>
588
589
590 <div class="add-new-entry">
591
592 <form id="add-joan-entry" method="post" action="<?php echo get_admin_url()?>admin-ajax.php">
593 <input type='hidden' name='action' value='show-time-curd' />
594 <div class="set-joan-show-deets">
595 <div class="show-time-container">
596 <h3>Show Start</h3>
597 <label for="start">
598 <select class="startDay" name="sday">
599 <option value="Sunday">Sunday</option>
600 <option value="Monday">Monday</option>
601 <option value="Tuesday">Tuesday</option>
602 <option value="Wednesday">Wednesday</option>
603 <option value="Thursday">Thursday</option>
604 <option value="Friday">Friday</option>
605 <option value="Saturday">Saturday</option>
606 </select>
607 </label>
608
609 <label for="starttime">
610 <input id="starttime" class="text" name="startTime" size="5" maxlength="5" type="text" value="00:00" /></label>
611 </div>
612
613 <div class="show-time-container">
614 <h3>Show End</h3>
615 <label for="endday">
616 <select class="endDay" name="eday">
617 <option value="Sunday">Sunday</option>
618 <option value="Monday">Monday</option>
619 <option value="Tuesday">Tuesday</option>
620 <option value="Wednesday">Wednesday</option>
621 <option value="Thursday">Thursday</option>
622 <option value="Friday">Friday</option>
623 <option value="Saturday">Saturday</option>
624 </select>
625 </label>
626
627 <label for="endtime">
628 <input id="endtime" class="text" name="endTime" size="5" maxlength="5" type="text" value="00:00" /></label>
629 </div>
630 <div class="clr"></div>
631 <p><strong>Set WP clock to 24 hour time format (01:00 = 1 AM, 13:00 = 1 PM)</strong></p>
632 <p>Important, set your <a href="/wp-admin/options-general.php">timezone <strong>to a city</strong></a> which matches your local time.(Do NOT Use UTC)<br/>
633 <small><em>Current timezone: <?php if (get_option('timezone_string') == '') { echo '<strong style="color:red;">Set your <a href="options-general.php">timezone</a> city now.</strong></em></small></p>'; } else { echo get_option('timezone_string'); ?></em></small></p>
634
635 </div>
636
637 <div class="set-joan-show-deets">
638 <label for="showname"><h3>Show Details</h3></label>
639 <p>Name: <br/>
640 <input id="showname" type="text" name="showname" class="show-detail" />
641 </p>
642
643 <p>Link URL (optional):<br />
644 <label for="linkUrl">
645
646 <input type="text" name="linkUrl" placeholder="No URL specified." class="show-detail" />
647
648 </p>
649
650 <p id="primary-image"></p>
651 <p><input class="image-url" type="hidden" name="imageUrl" data-target-field-name="new show" value=""/></p>
652 <p><input type="button" class="upload-image button" data-target-field="new show" value="Upload Image" /></p>
653 <img src="" style="display:none;" data-target-field-name="new show" />
654 <p><a id="remove-primary-image" href="#"><small>Remove Image</small></a></p>
655
656
657 <input type="submit" class="button-primary" style="cursor: pointer;" value="Add Show" />
658 <input type="hidden" name="crud-action" value="create" />
659 <?php wp_nonce_field('add_joan_entry', 'joan_nonce_field'); ?>
660
661 <?php } ?>
662
663 </div>
664 </form>
665
666
667 <div class="clr"></div>
668
669 </div>
670
671 <h3>Current Schedule</h3>
672
673 <p>Edit Schedule: <a href="#" class="display-toggle full-display">Expand</a> | <a href="#" class="display-toggle simple-display">Retract</a></p>
674
675 <form method="post" action="<?php echo get_admin_url()?>admin-ajax.php" class="joan-update-shows">
676 <input type='hidden' name='action' value='show-time-curd' />
677 <div class="joan-schedule loading">
678 <div class="sunday-container"><h2>Sunday</h2></div><!-- end this day of the week -->
679 <div class="monday-container"><h2>Monday</h2></div><!-- end this day of the week -->
680 <div class="tuesday-container"><h2>Tuesday</h2></div><!-- end this day of the week -->
681 <div class="wednesday-container"><h2>Wednesday</h2></div><!-- end this day of the week -->
682 <div class="thursday-container"><h2>Thursday</h2></div><!-- end this day of the week -->
683 <div class="friday-container"><h2>Friday</h2></div><!-- end this day of the week -->
684 <div class="saturday-container"><h2>Saturday</h2></div><!-- end this day of the week -->
685 </div>
686 <input type="hidden" name="crud-action" value="update" />
687 <?php wp_nonce_field('save_joan_entries', 'joan_entries_nonce_field'); ?>
688
689 </form>
690
691 <p>Edit Schedule: <a href="#" class="display-toggle full-display">Expand</a> | <a href="#" class="display-toggle simple-display">Retract</a></p>
692
693
694 </div>
695
696 <div class="tab-container" id="joan-options">
697 <form method="post" action="">
698
699 <hr>
700
701 <h2>Select Options Below</h2>
702
703 <?php
704 if (isset( $_POST['update_joan_options'] ) && wp_verify_nonce( $_POST['update_joan_options'], 'joan_options_action' )) {
705 //Save posted options
706 if (isset($_POST['joan_options'])){
707 update_option('joan_upcoming', $_POST['joan_options']['showUpcoming']);
708 update_option('joan_use_images', $_POST['joan_options']['imagesOn']);
709 update_option('off_air_message', htmlentities(stripslashes($_POST['joan_options']['offAirMessage'])));
710 update_option('joan_css', htmlentities(stripslashes($_POST['joan_options']['joanCSS'])));
711
712 }
713 if (isset($_POST['shut-it-down'])) {
714
715 update_option('joan_shutitdown', $_POST['shut-it-down']);
716 }
717 }
718 //Set options variables
719 $showUpcoming = get_option('joan_upcoming');
720 $imagesOn = get_option('joan_use_images');
721 $shutItDown = get_option('joan_shutitdown');
722 $offAirMessage = get_option('off_air_message');
723 $joanCSS = get_option('joan_css');
724 //$shutItDown = get_option('joan_shutitdown');
725
726 ?>
727
728 <h3>Display Images</h3>
729 <form id="option" method="post" action="">
730 <?php wp_nonce_field('joan_options_action', 'update_joan_options'); ?>
731 <p>Show accompanying images with joans?</p>
732 <label><input type="radio"<?php if($imagesOn == 'yes') { ?> checked="checked"<?php } ?> name="joan_options[imagesOn]" value="yes" /> : Yes</label><br/>
733 <label><input type="radio"<?php if($imagesOn == 'no') { ?> checked="checked"<?php } ?> name="joan_options[imagesOn]" value="no" /> : No</label><br/>
734
735
736 <h3>Upcoming Timeslot</h3>
737
738 <p>Show the name/time of the next timeslot?</p>
739 <label><input type="radio"<?php if($showUpcoming == 'yes') { ?> checked="checked"<?php } ?> name="joan_options[showUpcoming]" value="yes" /> : Yes</label><br/>
740 <label><input type="radio"<?php if($showUpcoming == 'no') { ?> checked="checked"<?php } ?> name="joan_options[showUpcoming]" value="no" /> : No</label><br/>
741
742
743 <h3>Custom Message</h3>
744 <label>Message:<br /><input type="text" id="off-air-message" value="<?= $offAirMessage; ?>" name="joan_options[offAirMessage]" size="40" /></label>
745
746
747 <p class="submit">
748 <input type="submit" class="button-primary" value="Save Changes" />
749 </p>
750
751 <h2>Display Shortcodes</h2>
752
753 <h3>[joan-schedule]</h3>
754 <p>Display a list of the times and names of your events, broken down weekly, example:</p>
755 <div style="margin-left:30px;">
756 <h4>Mondays</h4>
757 <ul>
758 <li><strong>5:00 am - 10:00 am</strong> - Morning Ride</li>
759 <li><strong>10:00 am - 12:00 pm</strong> - The Vibe with MarkD</li>
760 </ul>
761 <h4>Saturdays</h4>
762 <ul>
763 <li><strong>10:00 am - 1:00 am</strong> - Drive Time</li>
764 <li><strong>1:00 pm - 4:00 pm</strong> - Kool Jamz</li>
765 </ul>
766 </div>
767 <h3>[joan-now-playing]</h3>
768 <p>Display the Current Show/jock widget.</p>
769 <h3>[schedule-today]</h3>
770 <p>Automatically display your schedule for each day of the week.</p>
771
772 <div class="clr"></div>
773
774
775 </div>
776
777 <div class="tab-container" id="joan-shut-it-down">
778
779 <hr>
780
781 <h2>Suspend schedule</h2>
782
783 <form method="post" action="">
784 <p>You can temporarily take down your schedule for any reason, during schedule updates, public holidays or station off-air periods etc.</p>
785 <label><input type="radio"<?php checked($shutItDown,'yes',true); ?> name="shut-it-down" value="yes" /> : Schedule Off</label><br/>
786 <label><input type="radio"<?php checked($shutItDown,'no',true); ?> name="shut-it-down" value="no" /> : Schedule On (Default)</label><br/>
787
788 <p class="submit">
789 <input type="submit" class="button-primary" value="Save changes" />
790 </p>
791 </form>
792
793
794 </div>
795 <div class="tab-container" id="joan-pre">
796
797 <style>
798 .pca {
799 width:100%;
800 height:423px;
801 border:none;
802 border-collapse:collapse;
803 padding:0px;
804 }
805 .pca th {
806 align:top;
807 border:none;
808 padding:0px;
809 }
810 .pca td {
811 align:top;
812 border:none;
813 padding:0px;
814 }
815 </style>
816 <table class="pca">
817 <tbody>
818 <tr>
819 <p></p><td align="top" width="100%"><h2>Introducing JOAN Premium, more features, access to updates and new features. Switch to JOAN Premium, get priorty support, including phone support Monday to Friday.</h2>
820 <h1>Switch to Joan Premium</h1>
821 <p>*Priority Support</p>
822 <p>*Schedule Import/Export</p>
823 <p>*Supports Localization</p>
824 <p>*Multi-site support(Pro 5 or Developer License Required)</p>
825 <p>*Update shows status</p>
826 <p>*Import/Export Schedule</p>
827 <p>*Easily add recurring shows </p>
828 <p>*Free feature upgrades</p>
829 <p>*Show Time in 24/Hrs Format</p>
830 <p>*Add/show Schedule Image</p>
831 <p>*Show/Hide Show status (Front-end)</p>
832 <p>*Default Image</p>
833 <p>multiple Display Shortcodes</p>
834 <p>Grid/List view schedule page<p/>
835 <p>Edit schedule without having to first delete shows</p>
836 <p><a href="https://gandenterprisesinc.com/pricing/" target="_blank"><h2>Switch to JOAN PREMIUM</h2></a></p>
837 <p><img src="https://apps.myradiohut.com/web/images/joan_lite/featured_img.jpg"></p></td>
838 <td></td>
839 </tr>
840 </tbody>
841 </table>
842
843 </div>
844
845 </div><!-- end the joan tabs -->
846
847 </div>
848
849 <?php
850
851 }
852
853 function joan_header_scripts(){
854
855
856 echo '<script>crudScriptURL = "'.get_admin_url().'admin-ajax.php"</script>';
857 wp_enqueue_script( "joan-front", plugins_url('joan.js', __FILE__), array(), '1.0.0', true );
858 }
859
860 add_action("wp_head","joan_header_scripts");
861
862
863 function _handle_form_action(){
864
865 include( plugin_dir_path( __FILE__ ) . 'crud.php' );
866
867 die(); // this is required to return a proper result
868 }
869 add_action('wp_ajax_show-time-curd', '_handle_form_action');
870 add_action('wp_ajax_nopriv_show-time-curd', '_handle_form_action');