Ditty News Ticker - Version 2.2.10

Version Description

  • Added settings option to make ticker posts private
Download this release

Release Info

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

Code changes from version 2.2.9 to 2.2.10

Files changed (4) hide show
  1. ditty-news-ticker.php +1 -1
  2. inc/post-types.php +8 -5
  3. inc/settings.php +31 -13
  4. readme.txt +5 -2
ditty-news-ticker.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://dittynewsticker.com/
5
  Description: Ditty News Ticker is a multi-functional data display plugin
6
  Text Domain: ditty-news-ticker
7
  Domain Path: languages
8
- Version: 2.2.9
9
  Author: Metaphor Creations
10
  Author URI: http://www.metaphorcreations.com
11
  Contributors: metaphorcreations
5
  Description: Ditty News Ticker is a multi-functional data display plugin
6
  Text Domain: ditty-news-ticker
7
  Domain Path: languages
8
+ Version: 2.2.10
9
  Author: Metaphor Creations
10
  Author URI: http://www.metaphorcreations.com
11
  Contributors: metaphorcreations
inc/post-types.php CHANGED
@@ -2,11 +2,14 @@
2
 
3
 
4
  /* --------------------------------------------------------- */
5
- /* !Add the post type - 2.1.11 */
6
  /* --------------------------------------------------------- */
7
 
8
  function mtphr_dnt_setup_post_types() {
9
-
 
 
 
10
  $labels = array(
11
  'name' => __( 'News Tickers', 'ditty-news-ticker' ),
12
  'singular_name' => __( 'News Ticker', 'ditty-news-ticker' ),
@@ -25,8 +28,8 @@ function mtphr_dnt_setup_post_types() {
25
  // Create the arguments
26
  $args = array(
27
  'labels' => $labels,
28
- 'public' => true,
29
- 'publicly_queryable' => true,
30
  'exclude_from_search' => true,
31
  'show_ui' => true,
32
  'capability_type' => 'ditty_news_ticker',
@@ -37,7 +40,7 @@ function mtphr_dnt_setup_post_types() {
37
  'menu_icon' => 'dashicons-ditty-news-ticker',
38
  'supports' => array( 'title', 'author' ),
39
  'rewrite' => array( 'slug' => __( 'ticker', 'ditty-news-ticker' ) ),
40
- 'show_in_nav_menus' => true,
41
  );
42
 
43
  register_post_type( 'ditty_news_ticker', $args );
2
 
3
 
4
  /* --------------------------------------------------------- */
5
+ /* !Add the post type - 2.2.10 */
6
  /* --------------------------------------------------------- */
7
 
8
  function mtphr_dnt_setup_post_types() {
9
+
10
+ $settings = mtphr_dnt_general_settings();
11
+ $public = ! intval( $settings['private_posts'] );
12
+
13
  $labels = array(
14
  'name' => __( 'News Tickers', 'ditty-news-ticker' ),
15
  'singular_name' => __( 'News Ticker', 'ditty-news-ticker' ),
28
  // Create the arguments
29
  $args = array(
30
  'labels' => $labels,
31
+ 'public' => $public,
32
+ 'publicly_queryable' => $public,
33
  'exclude_from_search' => true,
34
  'show_ui' => true,
35
  'capability_type' => 'ditty_news_ticker',
40
  'menu_icon' => 'dashicons-ditty-news-ticker',
41
  'supports' => array( 'title', 'author' ),
42
  'rewrite' => array( 'slug' => __( 'ticker', 'ditty-news-ticker' ) ),
43
+ 'show_in_nav_menus' => $public,
44
  );
45
 
46
  register_post_type( 'ditty_news_ticker', $args );
inc/settings.php CHANGED
@@ -79,7 +79,7 @@ function mtphr_dnt_settings_display( $active_tab = null ) {
79
 
80
 
81
  /* --------------------------------------------------------- */
82
- /* !Get the settings - 1.4.5 */
83
  /* --------------------------------------------------------- */
84
 
85
  if( !function_exists('mtphr_dnt_general_settings') ) {
@@ -93,6 +93,7 @@ function mtphr_dnt_general_settings_defaults() {
93
  $defaults = array(
94
  'wysiwyg' => '',
95
  'edit_links' => '',
 
96
  'css' => ''
97
  );
98
  return $defaults;
@@ -102,24 +103,16 @@ function mtphr_dnt_general_settings_defaults() {
102
 
103
 
104
  /* --------------------------------------------------------- */
105
- /* !Setup the settings - 1.4.0 */
106
  /* --------------------------------------------------------- */
107
 
108
  function mtphr_dnt_initialize_settings() {
109
 
110
  $settings = mtphr_dnt_general_settings();
111
-
112
-
113
- /* --------------------------------------------------------- */
114
- /* !Add the setting sections - 1.4.0 */
115
- /* --------------------------------------------------------- */
116
 
117
  add_settings_section( 'mtphr_dnt_general_settings_section', __( 'Ditty News Ticker settings', 'ditty-news-ticker' ), false, 'mtphr_dnt_general_settings' );
118
-
119
-
120
- /* --------------------------------------------------------- */
121
- /* !Add the settings - 1.4.0 */
122
- /* --------------------------------------------------------- */
123
 
124
  /* Visual Editor */
125
  $title = mtphr_dnt_settings_label( __( 'Visual Editor', 'ditty-news-ticker' ), __('Use the visual editor to create tick contents', 'ditty-news-ticker') );
@@ -129,6 +122,10 @@ function mtphr_dnt_initialize_settings() {
129
  $title = mtphr_dnt_settings_label( __( 'Quick Edit Links', 'ditty-news-ticker' ), __('Add quick edit links on the front-end of the site for editors and admins', 'ditty-news-ticker') );
130
  add_settings_field( 'mtphr_dnt_general_settings_edit_links', $title, 'mtphr_dnt_general_settings_edit_links', 'mtphr_dnt_general_settings', 'mtphr_dnt_general_settings_section', array('settings' => $settings) );
131
 
 
 
 
 
132
  /* Custom CSS */
133
  $title = mtphr_dnt_settings_label( __( 'Custom CSS', 'ditty-news-ticker' ), __('Add custom css to style your ticker without modifying any external files', 'ditty-news-ticker') );
134
  add_settings_field( 'mtphr_dnt_general_settings_css', $title, 'mtphr_dnt_general_settings_css', 'mtphr_dnt_general_settings', 'mtphr_dnt_general_settings_section', array('settings' => $settings) );
@@ -175,6 +172,20 @@ function mtphr_dnt_general_settings_edit_links( $args ) {
175
  }
176
  }
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  /* --------------------------------------------------------- */
179
  /* !CSS - 1.4.0 */
180
  /* --------------------------------------------------------- */
@@ -194,13 +205,20 @@ function mtphr_dnt_general_settings_css( $args ) {
194
 
195
 
196
  /* --------------------------------------------------------- */
197
- /* !Sanitize the setting fields - 1.4.0 */
198
  /* --------------------------------------------------------- */
199
 
200
  if( !function_exists('mtphr_dnt_general_settings_sanitize') ) {
201
  function mtphr_dnt_general_settings_sanitize( $fields ) {
202
 
203
  $fields['css'] = isset( $fields['css'] ) ? wp_kses_post($fields['css']) : '';
 
 
 
 
 
 
 
204
 
205
  return $fields;
206
  }
79
 
80
 
81
  /* --------------------------------------------------------- */
82
+ /* !Get the settings - 2.2.10 */
83
  /* --------------------------------------------------------- */
84
 
85
  if( !function_exists('mtphr_dnt_general_settings') ) {
93
  $defaults = array(
94
  'wysiwyg' => '',
95
  'edit_links' => '',
96
+ 'private_posts' => '',
97
  'css' => ''
98
  );
99
  return $defaults;
103
 
104
 
105
  /* --------------------------------------------------------- */
106
+ /* !Setup the settings - 2.2.10 */
107
  /* --------------------------------------------------------- */
108
 
109
  function mtphr_dnt_initialize_settings() {
110
 
111
  $settings = mtphr_dnt_general_settings();
112
+
 
 
 
 
113
 
114
  add_settings_section( 'mtphr_dnt_general_settings_section', __( 'Ditty News Ticker settings', 'ditty-news-ticker' ), false, 'mtphr_dnt_general_settings' );
115
+
 
 
 
 
116
 
117
  /* Visual Editor */
118
  $title = mtphr_dnt_settings_label( __( 'Visual Editor', 'ditty-news-ticker' ), __('Use the visual editor to create tick contents', 'ditty-news-ticker') );
122
  $title = mtphr_dnt_settings_label( __( 'Quick Edit Links', 'ditty-news-ticker' ), __('Add quick edit links on the front-end of the site for editors and admins', 'ditty-news-ticker') );
123
  add_settings_field( 'mtphr_dnt_general_settings_edit_links', $title, 'mtphr_dnt_general_settings_edit_links', 'mtphr_dnt_general_settings', 'mtphr_dnt_general_settings_section', array('settings' => $settings) );
124
 
125
+ /* Private Posts */
126
+ $title = mtphr_dnt_settings_label( __( 'Private Ticker Posts', 'ditty-news-ticker' ), __('Make all ticker posts private', 'ditty-news-ticker') );
127
+ add_settings_field( 'mtphr_dnt_general_settings_private_posts', $title, 'mtphr_dnt_general_settings_private_posts', 'mtphr_dnt_general_settings', 'mtphr_dnt_general_settings_section', array('settings' => $settings) );
128
+
129
  /* Custom CSS */
130
  $title = mtphr_dnt_settings_label( __( 'Custom CSS', 'ditty-news-ticker' ), __('Add custom css to style your ticker without modifying any external files', 'ditty-news-ticker') );
131
  add_settings_field( 'mtphr_dnt_general_settings_css', $title, 'mtphr_dnt_general_settings_css', 'mtphr_dnt_general_settings', 'mtphr_dnt_general_settings_section', array('settings' => $settings) );
172
  }
173
  }
174
 
175
+ /* --------------------------------------------------------- */
176
+ /* !Private Posts - 2.2.10 */
177
+ /* --------------------------------------------------------- */
178
+
179
+ if( !function_exists('mtphr_dnt_general_settings_private_posts') ) {
180
+ function mtphr_dnt_general_settings_private_posts( $args ) {
181
+
182
+ $settings = $args['settings'];
183
+ echo '<div id="mtphr_dnt_general_settings_private_posts">';
184
+ echo '<label><input type="checkbox" name="mtphr_dnt_general_settings[private_posts]" value="1" '.checked('1', $settings['private_posts'], false).' /> '.__('Private ticker posts', 'ditty-news-ticker').'</label>';
185
+ echo '</div>';
186
+ }
187
+ }
188
+
189
  /* --------------------------------------------------------- */
190
  /* !CSS - 1.4.0 */
191
  /* --------------------------------------------------------- */
205
 
206
 
207
  /* --------------------------------------------------------- */
208
+ /* !Sanitize the setting fields - 2.2.10 */
209
  /* --------------------------------------------------------- */
210
 
211
  if( !function_exists('mtphr_dnt_general_settings_sanitize') ) {
212
  function mtphr_dnt_general_settings_sanitize( $fields ) {
213
 
214
  $fields['css'] = isset( $fields['css'] ) ? wp_kses_post($fields['css']) : '';
215
+
216
+ // Clear the permalinks
217
+ $settings = mtphr_dnt_general_settings();
218
+ $private_posts = isset( $fields['private_posts'] ) ? esc_attr($fields['private_posts']) : '';
219
+ if ( $settings['private_posts'] != $private_posts ) {
220
+ flush_rewrite_rules( false );
221
+ }
222
 
223
  return $fields;
224
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: metaphorcreations
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FUZKZGAJSBAE6
4
  Tags: ticker, news, news ticker, rotator, data rotator, lists, data
5
  Requires at least: 4.5
6
- Tested up to: 5.3
7
  Stable tag: /trunk/
8
  License: GPL2
9
 
@@ -72,6 +72,9 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
72
 
73
  == Changelog ==
74
 
 
 
 
75
  = 2.2.9 =
76
  * Updated error codes for license connections
77
 
@@ -513,4 +516,4 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
513
 
514
  == Upgrade Notice ==
515
 
516
- Updated error codes for license connections
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FUZKZGAJSBAE6
4
  Tags: ticker, news, news ticker, rotator, data rotator, lists, data
5
  Requires at least: 4.5
6
+ Tested up to: 5.3.2
7
  Stable tag: /trunk/
8
  License: GPL2
9
 
72
 
73
  == Changelog ==
74
 
75
+ = 2.2.10 =
76
+ * Added settings option to make ticker posts private
77
+
78
  = 2.2.9 =
79
  * Updated error codes for license connections
80
 
516
 
517
  == Upgrade Notice ==
518
 
519
+ Added settings option to make ticker posts private