Changeset 2653102
- Timestamp:
- 01/05/2022 12:16:35 PM (4 years ago)
- Location:
- nepali-date-converter
- Files:
-
- 26 added
- 4 edited
-
tags/2.0.3 (added)
-
tags/2.0.3/inc (added)
-
tags/2.0.3/inc/class (added)
-
tags/2.0.3/inc/class/ndc-frontend.php (added)
-
tags/2.0.3/inc/class/ndc-post-date.php (added)
-
tags/2.0.3/inc/frameworks (added)
-
tags/2.0.3/inc/frameworks/nepali-calendar (added)
-
tags/2.0.3/inc/frameworks/nepali-calendar/nepali_calendar.php (added)
-
tags/2.0.3/inc/functions (added)
-
tags/2.0.3/inc/functions/functions.php (added)
-
tags/2.0.3/inc/hooks (added)
-
tags/2.0.3/inc/hooks/enqueue-scripts.php (added)
-
tags/2.0.3/inc/hooks/wp-ajax.php (added)
-
tags/2.0.3/inc/hooks/wp-footer.php (added)
-
tags/2.0.3/inc/init.php (added)
-
tags/2.0.3/inc/shortcode (added)
-
tags/2.0.3/inc/shortcode/shortcode-nepali-date-converter.php (added)
-
tags/2.0.3/inc/shortcode/shortcode-today-date.php (added)
-
tags/2.0.3/inc/widgets (added)
-
tags/2.0.3/inc/widgets/widget-nepali-date-converter.php (added)
-
tags/2.0.3/inc/widgets/widget-today-date.php (added)
-
tags/2.0.3/index.php (added)
-
tags/2.0.3/languages (added)
-
tags/2.0.3/languages/index.php (added)
-
tags/2.0.3/nepali-date-converter.php (added)
-
tags/2.0.3/readme.txt (added)
-
trunk/inc/class/ndc-post-date.php (modified) (5 diffs)
-
trunk/inc/functions/functions.php (modified) (1 diff)
-
trunk/nepali-date-converter.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nepali-date-converter/trunk/inc/class/ndc-post-date.php
r2322536 r2653102 46 46 'suffix' => 'अगाडि', 47 47 ), 48 'post_types' => array('post'), 48 49 ); 49 50 … … 151 152 __( 'Activate Nepali Human Time Diff On', 'nepali-date-converter'), 152 153 array($this, 'human_time_diff_callback' ), 154 'general', 155 'ndc_post_date_section' 156 ); 157 add_settings_field( 158 'ndc_post_date_options[post_types]', 159 __( 'Post Types Support', 'nepali-date-converter'), 160 array($this, 'post_types_callback' ), 153 161 'general', 154 162 'ndc_post_date_section' … … 375 383 376 384 /** 385 * Callback function of add_settings_field 386 * Initialize from ndc_setting_options 387 * 388 * @since 2.0.3 389 */ 390 public function post_types_callback(){ 391 $post_types = ndc_get_post_types(); 392 $saved_post_types = $this->options['post_types']; 393 if( is_array( $post_types) && !empty( $post_types )){ 394 foreach ( $post_types as $post_type){ 395 ?> 396 <fieldset> 397 <legend class="screen-reader-text"> 398 <span><?php echo esc_html( $post_type['value']) ?></span> 399 </legend> 400 <label for="ndc_post_date_options[post_types][<?php echo esc_attr( $post_type['value']) ?>]"> 401 <input name="ndc_post_date_options[post_types][]" type="checkbox" id="ndc_post_date_options[human_time_diff][<?php echo esc_attr( $post_type['value']) ?>]" value="<?php echo esc_attr( $post_type['value']) ?>" <?php checked( true, in_array($post_type['value'], $saved_post_types)) ?> /> 402 <div class="date-time-text"> 403 <?php echo esc_html( $post_type['label']) ?> 404 </div> 405 </label> 406 </fieldset> 407 <?php 408 } 409 } 410 411 ?> 412 413 <?php 414 } 415 416 /** 377 417 * Callback function of register_setting 378 418 * Initialize from ndc_setting_options … … 401 441 $options['human_time_diff']['single'] = (isset( $options['human_time_diff']['single'] ) ); 402 442 $options['human_time_diff']['suffix'] = sanitize_text_field($options['human_time_diff']['suffix']); 443 444 /*Post Type Support*/ 445 $options['post_types'] = isset( $options['post_types'] )?array_map("sanitize_key",$options['post_types']):array(); 446 403 447 return $options; 404 448 } … … 552 596 } 553 597 598 /*Post Type Check*/ 599 if( !in_array($post->post_type, $this->options['post_types'])){ 600 return $the_date; 601 } 602 554 603 /*for format U 555 604 just change num to nepali and return*/ -
nepali-date-converter/trunk/inc/functions/functions.php
r2322536 r2653102 224 224 return apply_filters( 'ndc_human_time_diff', $since, $diff, $from, $to ); 225 225 } 226 227 228 /** 229 * Get Post Types. 230 * 231 * @since 2.1.0 232 */ 233 function ndc_get_post_types( $args = array( 'public' => true ), $excludes = array(), $includes = array() ) { 234 235 $post_types = get_post_types( 236 $args, 237 'objects' 238 ); 239 $exclude_pt = array( 240 'edd_wish_list', 241 'elementor_library' 242 ); 243 $exclude_pt = array_unique( array_merge( $exclude_pt, $excludes ) ); 244 $exclude_pt = array_diff( $exclude_pt, $includes ); 245 $exclude_pt = apply_filters( 'ndc_get_post_types', $exclude_pt, $excludes, $includes ); 246 247 $options = array(); 248 foreach ( $post_types as $post_type ) { 249 if ( in_array( $post_type->name, $exclude_pt ) ) { 250 continue; 251 } 252 $options[] = array( 253 'value' => $post_type->name, 254 'label' => $post_type->label, 255 ); 256 } 257 return $options; 258 } -
nepali-date-converter/trunk/nepali-date-converter.php
r2518785 r2653102 4 4 Plugin URI: https://www.addonspress.com/wordpress-plugins/nepali-date-converter/ 5 5 Description: Convert English to Nepali Date and Vice Versa and Post Date to Nepali Date. 6 Version: 2.0. 26 Version: 2.0.3 7 7 Author: addonspress 8 8 Author URI: https://www.addonspress.com/ … … 17 17 } 18 18 /*Define Constants for this plugin*/ 19 define( 'NEPALI_DATE_CONVERTER_VERSION', '2.0. 2' );19 define( 'NEPALI_DATE_CONVERTER_VERSION', '2.0.3' ); 20 20 define( 'NEPALI_DATE_CONVERTER_PATH', plugin_dir_path( __FILE__ ) ); 21 21 define( 'NEPALI_DATE_CONVERTER_URL', plugin_dir_url( __FILE__ ) ); -
nepali-date-converter/trunk/readme.txt
r2518785 r2653102 4 4 Tags: nepali post date, post date nepal, nepali date converter, today nepali date, english to nepali date converter, nepali to english date converter, nepali date, date converter, nepali, nepal 5 5 Requires at least: 4.9 6 Tested up to: 5. 7.17 Stable tag: 2.0. 26 Tested up to: 5.8.2 7 Stable tag: 2.0.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 137 137 == Changelog == 138 138 139 = 2.0.1 - 2021-04-21 = 139 = 2.0.3 - 2022-01-05 = 140 * Added: Post Type Support 141 142 = 2.0.2 - 2021-04-21 = 140 143 * Updated: WordPress version 141 144
Note: See TracChangeset
for help on using the changeset viewer.