@@ -48,14 +48,14 @@ class CBXChangelogAdmin {
4848 private $ version ;
4949
5050
51- private $ settings_api ;
51+ private $ settings ;
5252 protected $ plugin_basename ;
5353
5454 /**
5555 * Initialize the class and set its properties.
5656 *
57- * @param string $plugin_name The name of this plugin.
58- * @param string $version The version of this plugin.
57+ * @param string $plugin_name The name of this plugin.
58+ * @param string $version The version of this plugin.
5959 *
6060 * @since 1.0.0
6161 *
@@ -71,18 +71,18 @@ public function __construct( $plugin_name, $version ) {
7171 $ this ->plugin_basename = plugin_basename ( plugin_dir_path ( __DIR__ ) . $ plugin_name . '.php ' );
7272
7373 //get instance of setting api
74- $ this ->settings_api = new CBXChangelogSettings ();
74+ $ this ->settings = new CBXChangelogSettings ();
7575 }//end of constructor
7676
7777 /**
7878 * settings
7979 */
8080 public function setting_init () {
8181 //set the settings
82- $ this ->settings_api ->set_sections ( $ this ->get_settings_sections () );
83- $ this ->settings_api ->set_fields ( $ this ->get_settings_fields () );
82+ $ this ->settings ->set_sections ( $ this ->get_settings_sections () );
83+ $ this ->settings ->set_fields ( $ this ->get_settings_fields () );
8484 //initialize settings
85- $ this ->settings_api ->admin_init ();
85+ $ this ->settings ->admin_init ();
8686 }//end setting_init
8787
8888 /**
@@ -109,7 +109,7 @@ public function get_settings_fields() {
109109 * @since 3.7.0
110110 */
111111 public function init_post_types () {
112- //$setting = $this->settings_api ;
112+ //$setting = $this->settings ;
113113
114114 $ post_type = 'cbxchangelog ' ;
115115 $ post_slug = 'cbxchangelog ' ;
@@ -182,7 +182,7 @@ public function menu_settings() {
182182 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
183183 echo cbxchangelog_get_template_html ( 'admin/settings.php ' , [
184184 'admin_ref ' => $ this ,
185- 'settings ' => $ this ->settings_api
185+ 'settings ' => $ this ->settings
186186 ] );
187187 }//end menu_settings
188188
@@ -235,7 +235,7 @@ public function changelog_metabox_display( $post ) {
235235 echo cbxchangelog_get_template_html ( 'admin/metabox_changelogs.php ' ,
236236 [
237237 'admin_ref ' => $ this ,
238- 'settings ' => $ this ->settings_api ,
238+ 'settings ' => $ this ->settings ,
239239 'post_id ' => $ post_id ,
240240 'post_type ' => $ post_type ,
241241 'post ' => $ post ,
@@ -258,7 +258,7 @@ public function shortcode_metabox_display( $post ) {
258258 echo cbxchangelog_get_template_html ( 'admin/metabox_shortcode.php ' ,
259259 [
260260 'admin_ref ' => $ this ,
261- 'settings ' => $ this ->settings_api ,
261+ 'settings ' => $ this ->settings ,
262262 'post_id ' => $ post_id ,
263263 'post_type ' => $ post_type ,
264264 ]
@@ -409,10 +409,11 @@ public function metabox_save( $post_id, $post, $update ) {
409409 if ( isset ( $ _POST ['cbxchangelog_extra ' ] ) && is_array ( $ _POST ['cbxchangelog_extra ' ] ) && sizeof ( $ _POST ['cbxchangelog_extra ' ] ) > 0 ) {
410410 $ extras = isset ( $ _POST ['cbxchangelog_extra ' ] ) ? wp_unslash ( $ _POST ['cbxchangelog_extra ' ] ) : []; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
411411
412- $ extras ['show_url ' ] = isset ( $ extras ['show_url ' ] ) ? intval ( $ extras ['show_url ' ] ) : 1 ;
413- $ extras ['show_label ' ] = isset ( $ extras ['show_label ' ] ) ? intval ( $ extras ['show_label ' ] ) : 1 ;
414- $ extras ['show_date ' ] = isset ( $ extras ['show_date ' ] ) ? intval ( $ extras ['show_date ' ] ) : 1 ;
415- $ extras ['relative_date ' ] = isset ( $ extras ['relative_date ' ] ) ? intval ( $ extras ['relative_date ' ] ) : 0 ;
412+ $ extras ['show_url ' ] = isset ( $ extras ['show_url ' ] ) ? absint ( $ extras ['show_url ' ] ) : 1 ;
413+ $ extras ['show_label ' ] = isset ( $ extras ['show_label ' ] ) ? absint ( $ extras ['show_label ' ] ) : 1 ;
414+ $ extras ['group_label ' ] = isset ( $ extras ['group_label ' ] ) ? absint ( $ extras ['group_label ' ] ) : 0 ;
415+ $ extras ['show_date ' ] = isset ( $ extras ['show_date ' ] ) ? absint ( $ extras ['show_date ' ] ) : 1 ;
416+ $ extras ['relative_date ' ] = isset ( $ extras ['relative_date ' ] ) ? absint ( $ extras ['relative_date ' ] ) : 0 ;
416417 $ extras ['layout ' ] = isset ( $ extras ['layout ' ] ) ? sanitize_text_field ( wp_unslash ( $ extras ['layout ' ] ) ) : 'prepros ' ;
417418 $ extras ['order ' ] = isset ( $ extras ['order ' ] ) ? sanitize_text_field ( wp_unslash ( $ extras ['order ' ] ) ) : 'desc ' ;
418419 $ extras ['orderby ' ] = isset ( $ extras ['orderby ' ] ) ? sanitize_text_field ( wp_unslash ( $ extras ['orderby ' ] ) ) : 'order ' ; //'order' == 'default'
@@ -634,23 +635,23 @@ public function enqueue_scripts( $hook ) {
634635
635636 wp_localize_script ( 'cbxchangelog-edit ' , 'cbxchangelog_edit ' , apply_filters ( 'cbxchangelog_edit_localize_script ' ,
636637 [
637- 'deleteconfirm ' => esc_html__ ( 'Are you sure? ' , 'cbxchangelog ' ),
638- 'deleteconfirm_desc ' => esc_html__ ( 'Are you sure to delete this item? ' , 'cbxchangelog ' ),
639- 'deleteconfirm_all_releases ' => esc_html__ ( 'Note: This process can not be undone. This process is going to delete all releases for this post/article. When done this window will reload. ' , 'cbxchangelog ' ),
640- 'deleteconfirmok ' => esc_html__ ( 'Sure ' , 'cbxchangelog ' ),
641- 'deleteconfirmcancel ' => esc_html__ ( 'Oh! No ' , 'cbxchangelog ' ),
642- 'deletelastitem ' => esc_html__ ( 'This only feature can not be deleted. Either edit or delete the total release. ' , 'cbxchangelog ' ),
643- 'copycmds ' => [
638+ 'deleteconfirm ' => esc_html__ ( 'Are you sure? ' , 'cbxchangelog ' ),
639+ 'deleteconfirm_desc ' => esc_html__ ( 'Are you sure to delete this item? ' , 'cbxchangelog ' ),
640+ 'deleteconfirm_all_releases ' => esc_html__ ( 'Note: This process can not be undone. This process is going to delete all releases for this post/article. When done this window will reload. ' , 'cbxchangelog ' ),
641+ 'deleteconfirmok ' => esc_html__ ( 'Sure ' , 'cbxchangelog ' ),
642+ 'deleteconfirmcancel ' => esc_html__ ( 'Oh! No ' , 'cbxchangelog ' ),
643+ 'deletelastitem ' => esc_html__ ( 'This only feature can not be deleted. Either edit or delete the total release. ' , 'cbxchangelog ' ),
644+ 'copycmds ' => [
644645 'copy ' => esc_html__ ( 'Copy ' , 'cbxchangelog ' ),
645646 'copied ' => esc_html__ ( 'Copied ' , 'cbxchangelog ' ),
646647 'copy_tip ' => esc_html__ ( 'Click to copy ' , 'cbxchangelog ' ),
647648 'copied_tip ' => esc_html__ ( 'Copied to clipboard ' , 'cbxchangelog ' ),
648649 ],
649- 'placeholder ' => [
650+ 'placeholder ' => [
650651 'select ' => esc_html__ ( 'Please Select ' , 'cbxchangelog ' ),
651652 'search ' => esc_html__ ( 'Search... ' , 'cbxchangelog ' ),
652653 ],
653- 'pickr_i18n ' => [
654+ 'pickr_i18n ' => [
654655 // Strings visible in the UI
655656 'ui:dialog ' => esc_html__ ( 'color picker dialog ' , 'cbxchangelog ' ),
656657 'btn:toggle ' => esc_html__ ( 'toggle color picker dialog ' , 'cbxchangelog ' ),
@@ -669,7 +670,7 @@ public function enqueue_scripts( $hook ) {
669670 'aria:hue ' => esc_html__ ( 'hue selection slider ' , 'cbxchangelog ' ),
670671 'aria:opacity ' => esc_html__ ( 'selection slider ' , 'cbxchangelog ' ),
671672 ],
672- 'awn_options ' => [
673+ 'awn_options ' => [
673674 'tip ' => esc_html__ ( 'Tip ' , 'cbxchangelog ' ),
674675 'info ' => esc_html__ ( 'Info ' , 'cbxchangelog ' ),
675676 'success ' => esc_html__ ( 'Success ' , 'cbxchangelog ' ),
@@ -680,7 +681,7 @@ public function enqueue_scripts( $hook ) {
680681 'confirmOk ' => esc_html__ ( 'OK ' , 'cbxchangelog ' ),
681682 'confirmCancel ' => esc_html__ ( 'Cancel ' , 'cbxchangelog ' )
682683 ],
683- 'validation ' => [
684+ 'validation ' => [
684685 'required ' => esc_html__ ( 'This field is required. ' , 'cbxchangelog ' ),
685686 'remote ' => esc_html__ ( 'Please fix this field. ' , 'cbxchangelog ' ),
686687 'email ' => esc_html__ ( 'Please enter a valid email address. ' , 'cbxchangelog ' ),
@@ -698,12 +699,12 @@ public function enqueue_scripts( $hook ) {
698699 'min ' => esc_html__ ( 'Please enter a value greater than or equal to {0}. ' , 'cbxchangelog ' ),
699700 'recaptcha ' => esc_html__ ( 'Please check the captcha. ' , 'cbxchangelog ' ),
700701 ],
701- 'lang ' => get_user_locale (),
702+ 'lang ' => get_user_locale (),
702703 //'import_modal' => $import_modal_html,
703704 //'import_modal_progress' => '<p>' . esc_html__( 'Please wait, importing', 'cbxchangelog' ) . '</p>',
704- 'nonce ' => wp_create_nonce ( 'cbxchangelog_nonce ' ),
705- 'ajaxurl ' => admin_url ( 'admin-ajax.php ' ),
706- 'resync ' => [
705+ 'nonce ' => wp_create_nonce ( 'cbxchangelog_nonce ' ),
706+ 'ajaxurl ' => admin_url ( 'admin-ajax.php ' ),
707+ 'resync ' => [
707708 'confirm ' => esc_html__ ( 'Are you sure to resync? ' , 'cbxchangelog ' ),
708709 'confirm_desc ' => esc_html__ ( 'Note: This process can not be undone. Resync(top to bottom) will resync release no/ID with changelog index as seen in admin edit screen. First item id will be 1, 2nd will be 2 and so on. When done, this screen will reload. ' , 'cbxchangelog ' ),
709710 'confirm_desc_alt ' => esc_html__ ( 'Note: This process can not be undone. Resync(bottom to top) will resync release no/ID with changelog index as seen in admin edit screen. Last item id will be 1, 2nd from last will be 2 and so on. When done, this screen will reload. ' , 'cbxchangelog ' ),
@@ -827,7 +828,7 @@ public function enqueue_scripts( $hook ) {
827828 /**
828829 * Show action links on the plugin screen.
829830 *
830- * @param mixed $links Plugin Action links.
831+ * @param mixed $links Plugin Action links.
831832 *
832833 * @return array
833834 */
@@ -845,10 +846,10 @@ public function plugin_action_links( $links ) {
845846 *
846847 * @access public
847848 *
848- * @param array $links_array An array of the plugin's metadata
849- * @param string $plugin_file_name Path to the plugin file
850- * @param array $plugin_data An array of plugin data
851- * @param string $status Status of the plugin
849+ * @param array $links_array An array of the plugin's metadata
850+ * @param string $plugin_file_name Path to the plugin file
851+ * @param array $plugin_data An array of plugin data
852+ * @param string $status Status of the plugin
852853 *
853854 * @return array $links_array
854855 */
@@ -977,7 +978,7 @@ public function custom_message_after_plugin_row_proaddon( $plugin_file, $plugin_
977978 }
978979
979980 $ pro_addon_version = CBXChangelogHelper::get_any_plugin_version ( 'cbxchangelogpro/cbxchangelogpro.php ' );
980- $ pro_latest_version = '1.1.6 ' ;
981+ $ pro_latest_version = '1.1.7 ' ;
981982
982983
983984 if ( $ pro_addon_version != '' && version_compare ( $ pro_addon_version , $ pro_latest_version , '< ' ) ) {
@@ -1016,7 +1017,6 @@ public function plugin_activate_upgrade_notices() {
10161017
10171018 // Check the transient to see if we've just activated the plugin
10181019 if ( get_transient ( 'cbxchangelog_activated_notice ' ) ) {
1019-
10201020 echo '<div class="notice notice-success is-dismissible" style="border-color: #2153cc !important;"> ' ;
10211021
10221022 /* translators: 1. Plugin version */
@@ -1160,17 +1160,19 @@ public function init_changelog_shortcode_block() {
11601160 $ vendors_path_part = CBXCHANGELOG_ROOT_PATH . 'assets/vendors/ ' ;
11611161
11621162
1163- $ setting = $ this ->settings_api ;
1164- $ show_label_default = intval ( $ setting ->get_field ( 'show_label ' , 'cbxchangelog_general ' , 1 ) );
1165- $ show_date_default = intval ( $ setting ->get_field ( 'show_date ' , 'cbxchangelog_general ' , 1 ) );
1166- $ show_url_default = intval ( $ setting ->get_field ( 'show_url ' , 'cbxchangelog_general ' , 1 ) );
1167- $ relative_date_default = intval ( $ setting ->get_field ( 'relative_date ' , 'cbxchangelog_general ' , 0 ) );
1163+ $ setting = $ this ->settings ;
1164+ $ show_label_default = absint ( $ setting ->get_field ( 'show_label ' , 'cbxchangelog_general ' , 1 ) );
1165+ $ show_date_default = absint ( $ setting ->get_field ( 'show_date ' , 'cbxchangelog_general ' , 1 ) );
1166+ $ show_url_default = absint ( $ setting ->get_field ( 'show_url ' , 'cbxchangelog_general ' , 1 ) );
1167+ $ group_label_default = absint ( $ setting ->get_field ( 'group_label ' , 'cbxchangelog_general ' , 0 ) );
1168+ $ relative_date_default = absint ( $ setting ->get_field ( 'relative_date ' , 'cbxchangelog_general ' , 0 ) );
11681169
11691170 $ layout = $ setting ->get_field ( 'layout ' , 'cbxchangelog_general ' , 'prepros ' );
11701171
11711172 $ show_label_default = ( $ show_label_default ) ? 'true ' : '' ;
11721173 $ show_date_default = ( $ show_date_default ) ? 'true ' : '' ;
11731174 $ show_url_default = ( $ show_url_default ) ? 'true ' : '' ;
1175+ $ group_label_default = ( $ group_label_default ) ? 'true ' : '' ;
11741176 $ relative_date_default = ( $ relative_date_default ) ? 'true ' : '' ;
11751177
11761178 $ order_options = [];
@@ -1264,6 +1266,7 @@ public function init_changelog_shortcode_block() {
12641266 'show_label ' => esc_html__ ( 'Show Label ' , 'cbxchangelog ' ),
12651267 'show_date ' => esc_html__ ( 'Show Date ' , 'cbxchangelog ' ),
12661268 'show_url ' => esc_html__ ( 'Show Url ' , 'cbxchangelog ' ),
1269+ 'group_label ' => esc_html__ ( 'Group Label ' , 'cbxchangelog ' ),
12671270 'relative_date ' => esc_html__ ( 'Show Relative Date ' , 'cbxchangelog ' ),
12681271 'layout ' => esc_html__ ( 'Choose layout ' , 'cbxchangelog ' ),
12691272 'layout_options ' => $ layout_options ,
@@ -1309,6 +1312,10 @@ public function init_changelog_shortcode_block() {
13091312 'type ' => 'string ' ,
13101313 'default ' => $ show_url_default ,
13111314 ],
1315+ 'group_label ' => [
1316+ 'type ' => 'string ' ,
1317+ 'default ' => $ group_label_default ,
1318+ ],
13121319 'relative_date ' => [
13131320 'type ' => 'string ' ,
13141321 'default ' => $ relative_date_default ,
@@ -1364,6 +1371,10 @@ public function cbxchangelog_block_render( $attr ) {
13641371 //$params['show_url'] = ( $params['show_url'] == 'true' ) ? 1 : 0;
13651372 $ params ['show_url ' ] = CBXChangelogHelper::block_editor_true_meta_empty ( $ params ['show_url ' ] );
13661373
1374+ $ params ['group_label ' ] = isset ( $ attr ['group_label ' ] ) ? $ attr ['group_label ' ] : 'true ' ;
1375+ //$params['group_label'] = ( $params['group_label'] == 'true' ) ? 1 : 0;
1376+ $ params ['group_label ' ] = CBXChangelogHelper::block_editor_true_meta_empty ( $ params ['group_label ' ] );
1377+
13671378 $ params ['relative_date ' ] = isset ( $ attr ['relative_date ' ] ) ? $ attr ['relative_date ' ] : 'true ' ;
13681379 //$params['relative_date'] = ( $params['relative_date'] == 'true' ) ? 1 : 0;
13691380 $ params ['relative_date ' ] = CBXChangelogHelper::block_editor_true_meta_empty ( $ params ['relative_date ' ] );
0 commit comments