Plugin Directory

Changeset 2653102


Ignore:
Timestamp:
01/05/2022 12:16:35 PM (4 years ago)
Author:
addonspress
Message:

2.0.3

Location:
nepali-date-converter
Files:
26 added
4 edited

Legend:

Unmodified
Added
Removed
  • nepali-date-converter/trunk/inc/class/ndc-post-date.php

    r2322536 r2653102  
    4646                'suffix' => 'अगाडि',
    4747            ),
     48            'post_types' => array('post'),
    4849        );
    4950
     
    151152                __( 'Activate Nepali Human Time Diff On', 'nepali-date-converter'),
    152153                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' ),
    153161                'general',
    154162                'ndc_post_date_section'
     
    375383
    376384        /**
     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        /**
    377417         * Callback function of register_setting
    378418         * Initialize from ndc_setting_options
     
    401441            $options['human_time_diff']['single'] = (isset( $options['human_time_diff']['single'] ) );
    402442            $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
    403447            return $options;
    404448        }
     
    552596            }
    553597
     598            /*Post Type Check*/
     599            if( !in_array($post->post_type, $this->options['post_types'])){
     600                return $the_date;
     601            }
     602
    554603            /*for format U
    555604            just change num to nepali and return*/
  • nepali-date-converter/trunk/inc/functions/functions.php

    r2322536 r2653102  
    224224    return apply_filters( 'ndc_human_time_diff', $since, $diff, $from, $to );
    225225}
     226
     227
     228/**
     229 * Get Post Types.
     230 *
     231 * @since 2.1.0
     232 */
     233function 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  
    44Plugin URI: https://www.addonspress.com/wordpress-plugins/nepali-date-converter/
    55Description: Convert English to Nepali Date and Vice Versa and Post Date to Nepali Date.
    6 Version: 2.0.2
     6Version: 2.0.3
    77Author: addonspress
    88Author URI: https://www.addonspress.com/
     
    1717}
    1818/*Define Constants for this plugin*/
    19 define( 'NEPALI_DATE_CONVERTER_VERSION', '2.0.2' );
     19define( 'NEPALI_DATE_CONVERTER_VERSION', '2.0.3' );
    2020define( 'NEPALI_DATE_CONVERTER_PATH', plugin_dir_path( __FILE__ ) );
    2121define( 'NEPALI_DATE_CONVERTER_URL', plugin_dir_url( __FILE__ ) );
  • nepali-date-converter/trunk/readme.txt

    r2518785 r2653102  
    44Tags: 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
    55Requires at least: 4.9
    6 Tested up to: 5.7.1
    7 Stable tag: 2.0.2
     6Tested up to: 5.8.2
     7Stable tag: 2.0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    137137== Changelog ==
    138138
    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 =
    140143* Updated: WordPress version
    141144
Note: See TracChangeset for help on using the changeset viewer.