PluginProbe
Filter Everything — WordPress & WooCommerce Filters / 1.9.7
Filter Everything — WordPress & WooCommerce Filters v1.9.7
1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2.2 1.9.2.1 trunk 1.2.1 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.1 1.4.4 1.4.5 1.4.8 1.4.9 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 All 52 releases
← All changes | src/wpc-api.php +24 -5 1.2.41.9.7 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2
3 -if ( ! defined('WPINC') ) {
4 - wp_die();
3 +if ( ! defined('ABSPATH') ) {
4 + exit;
5 5 }
6 6
7 7 // SEO API
8 8 /**
@@ -9,8 +9,21 @@
9 9 * @param string $key title|description|h1|text
10 10 * @return string|false Needed seo data
11 11 */
12 12 function flrt_get_seo_data($key = 'title' ){
13 + if( ! did_action('wp') ){
14 + _doing_it_wrong(
15 + 'flrt_get_seo_data',
16 + sprintf(
17 + /* translators: %s: rest_api_init */
18 + esc_html__( 'Please, do not call the "%s" function before the "wp" action', 'filter-everything' ),
19 + 'flrt_get_seo_data'
20 + ),
21 + '4.6'
22 + );
23 + return false;
24 + }
25 +
13 26 $possibleValues = array(
14 27 'title' => 'seoTitle',
15 28 'description' => 'metaDescription',
16 29 'h1' => 'h1',
@@ -55,9 +68,8 @@
55 68 } else if ( $all ){
56 69 $count = count( $em->getAlreadyFilteredPostIds( $setid ) );
57 70 }
58 71
59 -
60 72 return $count;
61 73 }
62 74
63 75 // Selected filter chips
@@ -87,7 +99,14 @@
87 99 * related with current page
88 100 * or empty array if there are no filters
89 101 */
90 102 function flrt_get_page_related_filters(){
91 - $em = \FilterEverything\Filter\Container::instance()->getEntityManager();
92 - return $em->getSetsRelatedFilters();
103 + /**
104 + * @todo add check to hook if
105 + */
106 + if( ! did_action( 'pre_get_posts' ) ) {
107 + _doing_it_wrong( __FUNCTION__, esc_html__('This function should not be called before the pre_get_posts hook has fired.', 'filter-everything'), '1.7.16' );
108 + } else{
109 + $em = \FilterEverything\Filter\Container::instance()->getEntityManager();
110 + return $em->getSetsRelatedFilters();
111 + }
93 112 }