Ditty News Ticker - Version 3.0.8

Version Description

  • Minor bug fix in widget.php file
  • Added legacy helper for old extension versions
  • Added extension license error notices
Download this release

Release Info

Developer metaphorcreations
Plugin Icon 128x128 Ditty News Ticker
Version 3.0.8
Comparing to
See all releases

Code changes from version 3.0.7 to 3.0.8

ditty-news-ticker.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Ditty (formerly Ditty News Ticker)
5
  * Plugin URI: https://www.metaphorcreations.com/ditty
6
  * Description: Formerly Ditty News Ticker. Ditty is a multi-functional data display plugin.
7
- * Version: 3.0.7
8
  * Author: Metaphor Creations
9
  * Author URI: https://www.metaphorcreations.com
10
  * License: GPL-2.0+
@@ -20,7 +20,7 @@ if ( ! defined( 'WPINC' ) ) {
20
 
21
  // Plugin version.
22
  if ( ! defined( 'DITTY_VERSION' ) ) {
23
- define( 'DITTY_VERSION', '3.0.7' );
24
  }
25
 
26
  // Plugin Folder Path.
4
  * Plugin Name: Ditty (formerly Ditty News Ticker)
5
  * Plugin URI: https://www.metaphorcreations.com/ditty
6
  * Description: Formerly Ditty News Ticker. Ditty is a multi-functional data display plugin.
7
+ * Version: 3.0.8
8
  * Author: Metaphor Creations
9
  * Author URI: https://www.metaphorcreations.com
10
  * License: GPL-2.0+
20
 
21
  // Plugin version.
22
  if ( ! defined( 'DITTY_VERSION' ) ) {
23
+ define( 'DITTY_VERSION', '3.0.8' );
24
  }
25
 
26
  // Plugin Folder Path.
includes/class-ditty-extensions.php CHANGED
@@ -467,7 +467,7 @@ class Ditty_Extensions {
467
  * Attempt to activate a license
468
  *
469
  * @access public
470
- * @since 3.0
471
  */
472
  public function license_activate( $extension, $license_key, $item_id ) {
473
 
@@ -534,9 +534,23 @@ class Ditty_Extensions {
534
  $license_key_ajax = isset( $_POST['license'] ) ? sanitize_text_field( $_POST['license'] ) : false;
535
  $extension_ajax = isset( $_POST['extension'] ) ? esc_attr( $_POST['extension'] ) : false;
536
  $extension_id_ajax = isset( $_POST['extension_id'] ) ? intval( $_POST['extension_id'] ) : false;
537
- $extension_name_ajax = isset( $_POST['extension_name'] ) ? sanitize_text_field( $_POST['extension_name'] ) : false;
538
- if ( ! $license_key_ajax || ! $extension_id_ajax || ! $extension_ajax ) {
539
- wp_die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  }
541
  $data = $this->license_activate( $extension_ajax, $license_key_ajax, $extension_id_ajax );
542
  if ( 'valid' == $data['status'] ) {
@@ -548,12 +562,29 @@ class Ditty_Extensions {
548
  check_ajax_referer( 'ditty', 'security' );
549
  $extension_ajax = isset( $_POST['extension'] ) ? esc_attr( $_POST['extension'] ) : false;
550
  $extension_id_ajax = isset( $_POST['extension_id'] ) ? intval( $_POST['extension_id'] ) : false;
551
- $extension_name_ajax = isset( $_POST['extension_name'] ) ? sanitize_text_field( $_POST['extension_name'] ) : false;
552
  $license = $this->get_license( $extension_ajax );
553
- if ( ! $extension_id_ajax || ! $extension_ajax || ! isset( $license['key'] ) ) {
554
- wp_die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
  }
556
  $data = $this->license_activate( $extension_ajax, $license['key'], $extension_id_ajax );
 
 
 
557
  wp_send_json( $data );
558
  }
559
 
467
  * Attempt to activate a license
468
  *
469
  * @access public
470
+ * @since 3.0.8
471
  */
472
  public function license_activate( $extension, $license_key, $item_id ) {
473
 
534
  $license_key_ajax = isset( $_POST['license'] ) ? sanitize_text_field( $_POST['license'] ) : false;
535
  $extension_ajax = isset( $_POST['extension'] ) ? esc_attr( $_POST['extension'] ) : false;
536
  $extension_id_ajax = isset( $_POST['extension_id'] ) ? intval( $_POST['extension_id'] ) : false;
537
+
538
+ $error = '';
539
+ if ( ! $license_key_ajax || '' == $license_key_ajax ) {
540
+ $error = __( 'Error: License key is missing.', 'ditty-news-ticker' );
541
+ }
542
+ if ( ! $extension_id_ajax ) {
543
+ $error = __( 'Error: Extension ID is missing.', 'ditty-news-ticker' );
544
+ }
545
+ if ( ! $extension_ajax ) {
546
+ $error = __( 'Error: Invalid extension.', 'ditty-news-ticker' );
547
+ }
548
+ if ( '' != $error ) {
549
+ $data = array(
550
+ 'status' => 'error',
551
+ 'message' => $error,
552
+ );
553
+ wp_send_json( $data );
554
  }
555
  $data = $this->license_activate( $extension_ajax, $license_key_ajax, $extension_id_ajax );
556
  if ( 'valid' == $data['status'] ) {
562
  check_ajax_referer( 'ditty', 'security' );
563
  $extension_ajax = isset( $_POST['extension'] ) ? esc_attr( $_POST['extension'] ) : false;
564
  $extension_id_ajax = isset( $_POST['extension_id'] ) ? intval( $_POST['extension_id'] ) : false;
 
565
  $license = $this->get_license( $extension_ajax );
566
+
567
+ $error = '';
568
+ if ( ! isset( $license['key'] ) || '' == $license['key'] ) {
569
+ $error = __( 'Error: License key is missing.', 'ditty-news-ticker' );
570
+ }
571
+ if ( ! $extension_id_ajax ) {
572
+ $error = __( 'Error: Extension ID is missing.', 'ditty-news-ticker' );
573
+ }
574
+ if ( ! $extension_ajax ) {
575
+ $error = __( 'Error: Invalid extension.', 'ditty-news-ticker' );
576
+ }
577
+ if ( '' != $error ) {
578
+ $data = array(
579
+ 'status' => 'error',
580
+ 'message' => $error,
581
+ );
582
+ wp_send_json( $data );
583
  }
584
  $data = $this->license_activate( $extension_ajax, $license['key'], $extension_id_ajax );
585
+ if ( 'valid' == $data['status'] ) {
586
+ $data['license_key'] = substr( $license['key'], 0, -15 ) . '***************';
587
+ }
588
  wp_send_json( $data );
589
  }
590
 
includes/css/ditty-admin.css CHANGED
@@ -930,11 +930,11 @@ table.wp-list-table .type-ditty_display .row-actions {
930
  display: none; }
931
  #ditty-extensions .ditty-extension:not([data-api_keys="error"]) .ditty-extension__custom-keys-notification {
932
  display: none; }
933
- #ditty-extensions .ditty-extension[data-license_status="invalid"] .ditty-extension__header__overlay, #ditty-extensions .ditty-extension[data-license_status="deactivated"] .ditty-extension__header__overlay {
934
  background-color: rgba(225, 54, 46, 0.5); }
935
- #ditty-extensions .ditty-extension[data-license_status="invalid"] .ditty-extension__tab[data-slide_id="license"], #ditty-extensions .ditty-extension[data-license_status="deactivated"] .ditty-extension__tab[data-slide_id="license"] {
936
  background-color: #E1362E; }
937
- #ditty-extensions .ditty-extension[data-license_status="invalid"] .ditty-extension__license__message, #ditty-extensions .ditty-extension[data-license_status="deactivated"] .ditty-extension__license__message {
938
  color: #E1362E; }
939
  #ditty-extensions .ditty-extension[data-api="unauthorized"] .ditty-extension__tab[data-slide_id="api_connect"] {
940
  background-color: #FEBB00; }
930
  display: none; }
931
  #ditty-extensions .ditty-extension:not([data-api_keys="error"]) .ditty-extension__custom-keys-notification {
932
  display: none; }
933
+ #ditty-extensions .ditty-extension[data-license_status="invalid"] .ditty-extension__header__overlay, #ditty-extensions .ditty-extension[data-license_status="deactivated"] .ditty-extension__header__overlay, #ditty-extensions .ditty-extension[data-license_status="error"] .ditty-extension__header__overlay {
934
  background-color: rgba(225, 54, 46, 0.5); }
935
+ #ditty-extensions .ditty-extension[data-license_status="invalid"] .ditty-extension__tab[data-slide_id="license"], #ditty-extensions .ditty-extension[data-license_status="deactivated"] .ditty-extension__tab[data-slide_id="license"], #ditty-extensions .ditty-extension[data-license_status="error"] .ditty-extension__tab[data-slide_id="license"] {
936
  background-color: #E1362E; }
937
+ #ditty-extensions .ditty-extension[data-license_status="invalid"] .ditty-extension__license__message, #ditty-extensions .ditty-extension[data-license_status="deactivated"] .ditty-extension__license__message, #ditty-extensions .ditty-extension[data-license_status="error"] .ditty-extension__license__message {
938
  color: #E1362E; }
939
  #ditty-extensions .ditty-extension[data-api="unauthorized"] .ditty-extension__tab[data-slide_id="api_connect"] {
940
  background-color: #FEBB00; }
includes/helpers.php CHANGED
@@ -147,6 +147,9 @@ function ditty_extension_legacy_licenses( $licenses ) {
147
  foreach ( $legacy_licenses as $slug => $legacy_license ) {
148
  if ( $updated_slug = ditty_updated_extension_slug( $slug ) ) {
149
  if ( ! isset( $licenses[$updated_slug] ) ) {
 
 
 
150
  $licenses[$updated_slug] = $legacy_license;
151
  }
152
  }
@@ -305,6 +308,43 @@ function ditty_updated_extension_slug( $slug ) {
305
  }
306
  }
307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  /**
309
  * Set the global draft values
310
  * @since 3.0
147
  foreach ( $legacy_licenses as $slug => $legacy_license ) {
148
  if ( $updated_slug = ditty_updated_extension_slug( $slug ) ) {
149
  if ( ! isset( $licenses[$updated_slug] ) ) {
150
+ if ( ! isset( $legacy_license['item_id'] ) ) {
151
+ $legacy_license['item_id'] = ditty_updated_extension_id( $slug );
152
+ }
153
  $licenses[$updated_slug] = $legacy_license;
154
  }
155
  }
308
  }
309
  }
310
 
311
+ /**
312
+ * Return an updated legacy id
313
+ * @since 3.0
314
+ */
315
+ function ditty_updated_extension_id( $slug ) {
316
+ $updated_id = false;
317
+ switch ( $slug ) {
318
+ case 'ditty-facebook-ticker':
319
+ $updated_id = 1534;
320
+ break;
321
+ case 'ditty-image-ticker':
322
+ $updated_id = 1548;
323
+ break;
324
+ case 'ditty-instagram-ticker':
325
+ $updated_id = 2134;
326
+ break;
327
+ case 'ditty-mega-ticker':
328
+ $updated_id = 1547;
329
+ break;
330
+ case 'ditty-posts-ticker':
331
+ $updated_id = 1551;
332
+ break;
333
+ case 'ditty-rss-ticker':
334
+ $updated_id = 1549;
335
+ break;
336
+ case 'ditty-timed-ticker':
337
+ $updated_id = 12470;
338
+ break;
339
+ case 'ditty-twitter-ticker':
340
+ $updated_id = 1550;
341
+ break;
342
+ default:
343
+ break;
344
+ }
345
+ return $updated_id;
346
+ }
347
+
348
  /**
349
  * Set the global draft values
350
  * @since 3.0
includes/sass/admin/_extensions.scss CHANGED
@@ -349,7 +349,8 @@
349
  }
350
  }
351
  &[data-license_status="invalid"],
352
- &[data-license_status="deactivated"] {
 
353
  .ditty-extension__header__overlay {
354
  background-color: transparentize( $error_dark, .5 );
355
  }
349
  }
350
  }
351
  &[data-license_status="invalid"],
352
+ &[data-license_status="deactivated"],
353
+ &[data-license_status="error"] {
354
  .ditty-extension__header__overlay {
355
  background-color: transparentize( $error_dark, .5 );
356
  }
includes/widget.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Create a class for the widget
5
  *
6
- * @since 3.0
7
  */
8
  class ditty_widget extends WP_Widget {
9
 
@@ -25,7 +25,7 @@ class ditty_widget extends WP_Widget {
25
  extract( $args );
26
 
27
  // User-selected settings
28
- $title = $instance['title'];
29
  $title = apply_filters( 'widget_title', $title );
30
 
31
  $ditty = isset( $instance['ditty'] ) ? $instance['ditty'] : '';
3
  /**
4
  * Create a class for the widget
5
  *
6
+ * @since 3.0.8
7
  */
8
  class ditty_widget extends WP_Widget {
9
 
25
  extract( $args );
26
 
27
  // User-selected settings
28
+ $title = isset( $instance['title'] ) ? $instance['title'] : '';
29
  $title = apply_filters( 'widget_title', $title );
30
 
31
  $ditty = isset( $instance['ditty'] ) ? $instance['ditty'] : '';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: ticker, news, news ticker, rotator, data rotator, lists, data, aggregator, latest posts
5
  Requires at least: 4.5
6
  Tested up to: 5.8.2
7
- Stable tag: 3.0.7
8
  License: GPL2
9
 
10
  Formerly Ditty News Ticker. Ditty is a multi-functional data display plugin.
@@ -66,6 +66,11 @@ The most common cause for an unresponsive Ditty (when using scroll or rotate mod
66
 
67
  == Changelog ==
68
 
 
 
 
 
 
69
  = 3.0.7 =
70
  * .ditty-item css updates
71
  * Added wp_enqueue_script check to ensure wp_add_inline_script is only added once
@@ -616,4 +621,4 @@ The most common cause for an unresponsive Ditty (when using scroll or rotate mod
616
 
617
  == Upgrade Notice ==
618
 
619
- CSS updates, wp_add_inline_script bug fix, Ditty notification system updates, Ticker display updates
4
  Tags: ticker, news, news ticker, rotator, data rotator, lists, data, aggregator, latest posts
5
  Requires at least: 4.5
6
  Tested up to: 5.8.2
7
+ Stable tag: 3.0.8
8
  License: GPL2
9
 
10
  Formerly Ditty News Ticker. Ditty is a multi-functional data display plugin.
66
 
67
  == Changelog ==
68
 
69
+ = 3.0.8 =
70
+ * Minor bug fix in widget.php file
71
+ * Added legacy helper for old extension versions
72
+ * Added extension license error notices
73
+
74
  = 3.0.7 =
75
  * .ditty-item css updates
76
  * Added wp_enqueue_script check to ensure wp_add_inline_script is only added once
621
 
622
  == Upgrade Notice ==
623
 
624
+ Widget bug fix, extension license updates