Skip to content

Commit bdf776b

Browse files
committed
chore: sync free from pro and refresh i18n
1 parent cf1bab7 commit bdf776b

15 files changed

Lines changed: 886 additions & 1209 deletions

includes/admin/class-settings.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ public static function taxonomy_search_tom_select(): void {
204204
} else {
205205
wp_send_json_success( array() );
206206
}
207-
208207
$tax = get_taxonomy( $taxonomy );
209208
if ( ! $tax ) {
210209
wp_send_json_success( array() );

includes/admin/js/editor-sections-panel.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,18 @@ let wzkbSectionsNonceMiddlewareAdded = false;
297297
}, [productMeta.join(','), taxonomyProducts.join(','), editPost]);
298298

299299
useEffect(() => {
300-
if (arraysEqual(taxonomySections, sectionMeta)) {
300+
if (arraysEqual(sectionMeta, taxonomySections)) {
301301
return;
302302
}
303303

304+
const latestMeta = getLatestMeta();
304305
editPost({
305-
wzkb_category: sectionMeta,
306+
meta: {
307+
...latestMeta,
308+
_wzkb_section_ids: taxonomySections,
309+
},
306310
});
307-
}, [taxonomySections.join(','), sectionMeta.join(','), editPost]);
311+
}, [sectionMeta.join(','), taxonomySections.join(','), editPost]);
308312

309313
const { items: sectionTerms, isLoading, error } = useSections(productMeta);
310314
const groupedSections = useMemo(

includes/admin/js/editor-sections-panel.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/admin/settings/js/settings-admin-scripts.min.js

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/admin/sidebar.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
* @package WebberZone\Knowledge_Base
66
*/
77

8+
if ( ! defined( 'ABSPATH' ) ) {
9+
exit;
10+
}
11+
812
use WebberZone\Knowledge_Base\Admin\Admin;
913

1014
?>

includes/class-options-api.php

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
namespace WebberZone\Knowledge_Base;
1111

12-
use WebberZone\Knowledge_Base\Util\Hook_Registry;
13-
1412
if ( ! defined( 'WPINC' ) ) {
1513
die;
1614
}
@@ -46,22 +44,13 @@ class Options_API {
4644
*/
4745
private static $settings;
4846

49-
/**
50-
* Initialize hooks for AJAX functionality.
51-
*
52-
* @since 3.0.0
53-
*/
54-
public static function init() {
55-
Hook_Registry::add_action( 'wp_ajax_' . self::FILTER_PREFIX . '_tags_search', array( __CLASS__, 'tags_search' ) );
56-
}
57-
5847
/**
5948
* Get Settings.
6049
*
6150
* Retrieves all plugin settings
6251
*
6352
* @since 3.0.0
64-
* @return array Glue Link settings
53+
* @return array Settings array
6554
*/
6655
public static function get_settings() {
6756
$settings = get_option( self::SETTINGS_OPTION );
@@ -188,7 +177,7 @@ public static function update_settings( array $settings, bool $merge = true, boo
188177
/**
189178
* Remove an option
190179
*
191-
* Removes a Glue Link setting value in both the db and the static variable.
180+
* Removes a setting value in both the db and the static variable.
192181
*
193182
* @since 3.0.0
194183
*
@@ -265,68 +254,4 @@ public static function reset_settings(): bool {
265254

266255
return $did_update;
267256
}
268-
269-
/**
270-
* Function to add an action to search for tags using Ajax.
271-
*
272-
* @since 3.0.0
273-
*
274-
* @return void
275-
*/
276-
public static function tags_search() {
277-
if ( ! isset( $_REQUEST['tax'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
278-
wp_die();
279-
}
280-
281-
$taxonomy = sanitize_key( $_REQUEST['tax'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
282-
$tax = get_taxonomy( $taxonomy );
283-
if ( ! empty( $taxonomy ) ) {
284-
$tax = get_taxonomy( $taxonomy );
285-
if ( ! $tax ) {
286-
wp_die();
287-
}
288-
289-
if ( ! current_user_can( $tax->cap->assign_terms ) ) {
290-
wp_die();
291-
}
292-
}
293-
294-
$s = isset( $_REQUEST['q'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['q'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
295-
296-
$comma = _x( ',', 'tag delimiter', 'knowledgebase' );
297-
if ( ',' !== $comma ) {
298-
$s = str_replace( $comma, ',', $s );
299-
}
300-
if ( false !== strpos( $s, ',' ) ) {
301-
$s = explode( ',', $s );
302-
$s = $s[ count( $s ) - 1 ];
303-
}
304-
$s = trim( $s );
305-
306-
/** This filter has been defined in /wp-admin/includes/ajax-actions.php */
307-
$term_search_min_chars = (int) apply_filters( 'term_search_min_chars', 2, $tax, $s );
308-
309-
/*
310-
* Require $term_search_min_chars chars for matching (default: 2)
311-
* ensure it's a non-negative, non-zero integer.
312-
*/
313-
if ( ( 0 === $term_search_min_chars ) || ( strlen( $s ) < $term_search_min_chars ) ) {
314-
wp_die();
315-
}
316-
317-
$results = get_terms(
318-
array(
319-
'taxonomy' => $taxonomy,
320-
'name__like' => $s,
321-
'fields' => 'names',
322-
'hide_empty' => false,
323-
)
324-
);
325-
326-
echo wp_json_encode( $results );
327-
wp_die();
328-
}
329257
}
330-
331-
// Initialize hooks.
332-
Options_API::init();

includes/frontend/class-display.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ private static function render_product_articles_fallback( $product, $product_id,
380380
$product_articles = new \WP_Query(
381381
array(
382382
'post_type' => 'wz_knowledgebase',
383-
'post_status' => 'publish',
384383
'posts_per_page' => -1,
385384
'ignore_sticky_posts' => true,
386385
'no_found_rows' => true,

includes/frontend/class-media-handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* Media Handler class.
1616
*
17-
* @since 3.5.0
17+
* @since 2.3.0
1818
*/
1919
class Media_Handler {
2020

includes/frontend/class-related.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public static function get_related_articles_query( $args = array() ) {
113113
'no_found_rows' => true,
114114
'post_type' => 'wz_knowledgebase',
115115
'posts_per_page' => $args['numberposts'],
116-
'post_status' => 'publish',
117116
'post__not_in' => $exclude,
118117
'orderby' => 'date',
119118
'order' => 'DESC',

0 commit comments

Comments
 (0)