| @@ -1,66 +1,63 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace WPDeveloper\BetterDocs\Editors\Elementor; |
| 3 | - | |
| 4 | 3 | use WPDeveloper\BetterDocs\Core\Query; |
| 5 | 4 | |
| 6 | 5 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | - exit; // Exit if accessed directly | |
| 6 | + exit; // Exit if accessed directly | |
| 8 | 7 | } |
| 9 | 8 | |
| 10 | 9 | use WPDeveloper\BetterDocs\Utils\Base; |
| 11 | 10 | |
| 12 | 11 | class Helper extends Base { |
| 13 | - /** | |
| 14 | - * Summary of query | |
| 15 | - * @var Query | |
| 16 | - */ | |
| 17 | - private $query; | |
| 12 | + /** | |
| 13 | + * Summary of query | |
| 14 | + * @var Query | |
| 15 | + */ | |
| 16 | + private $query; | |
| 18 | 17 | |
| 19 | - public function __construct( Query $query ) { | |
| 20 | - $this->query = $query; | |
| 21 | - } | |
| 18 | + public function __construct( Query $query ) { | |
| 19 | + $this->query = $query; | |
| 20 | + } | |
| 22 | 21 | |
| 23 | - public function orderby_options() { | |
| 24 | - $orderby = [ | |
| 25 | - 'ID' => 'Docs ID', | |
| 26 | - 'author' => 'Docs Author', | |
| 27 | - 'title' => 'Title', | |
| 28 | - 'date' => 'Date', | |
| 29 | - 'modified' => 'Last Modified Date', | |
| 30 | - 'parent' => 'Parent Id', | |
| 31 | - 'rand' => 'Random', | |
| 32 | - 'comment_count' => 'Comment Count', | |
| 33 | - 'menu_order' => 'Menu Order', | |
| 34 | - 'betterdocs_order' => 'BetterDocs Order' | |
| 35 | - ]; | |
| 22 | + public function orderby_options() { | |
| 23 | + $orderby = [ | |
| 24 | + 'ID' => 'Docs ID', | |
| 25 | + 'author' => 'Docs Author', | |
| 26 | + 'title' => 'Title', | |
| 27 | + 'date' => 'Date', | |
| 28 | + 'modified' => 'Last Modified Date', | |
| 29 | + 'parent' => 'Parent Id', | |
| 30 | + 'rand' => 'Random', | |
| 31 | + 'comment_count' => 'Comment Count', | |
| 32 | + 'menu_order' => 'Menu Order', | |
| 33 | + 'betterdocs_order' => 'BetterDocs Order' | |
| 34 | + ]; | |
| 36 | 35 | |
| 37 | - return $orderby; | |
| 38 | - } | |
| 36 | + return $orderby; | |
| 37 | + } | |
| 39 | 38 | |
| 40 | - /** | |
| 41 | - * Get Post Categories | |
| 42 | - * | |
| 43 | - * @return array | |
| 44 | - */ | |
| 45 | - public function get_terms( $taxonomy = 'category', $key = 'term_id' ) { | |
| 46 | - $options = []; | |
| 47 | - $terms = get_terms( | |
| 48 | - [ | |
| 49 | - 'taxonomy' => $taxonomy, | |
| 50 | - 'hide_empty' => true | |
| 51 | - ] | |
| 52 | - ); | |
| 39 | + /** | |
| 40 | + * Get Post Categories | |
| 41 | + * | |
| 42 | + * @return array | |
| 43 | + */ | |
| 44 | + public function get_terms( $taxonomy = 'category', $key = 'term_id' ) { | |
| 45 | + $options = []; | |
| 46 | + $terms = get_terms( [ | |
| 47 | + 'taxonomy' => $taxonomy, | |
| 48 | + 'hide_empty' => true | |
| 49 | + ] ); | |
| 53 | 50 | |
| 54 | - if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { | |
| 55 | - foreach ( $terms as $term ) { | |
| 56 | - $options[ $term->{$key} ] = $term->name; | |
| 57 | - } | |
| 58 | - } | |
| 51 | + if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { | |
| 52 | + foreach ( $terms as $term ) { | |
| 53 | + $options[$term->{$key}] = $term->name; | |
| 54 | + } | |
| 55 | + } | |
| 59 | 56 | |
| 60 | - return $options; | |
| 61 | - } | |
| 57 | + return $options; | |
| 58 | + } | |
| 62 | 59 | |
| 63 | - public function get_faq_terms() { | |
| 64 | - return $this->query->get_faq_terms(); | |
| 65 | - } | |
| 60 | + public function get_faq_terms() { | |
| 61 | + return $this->query->get_faq_terms(); | |
| 62 | + } | |
| 66 | 63 | } |