| @@ -29,8 +29,9 @@ | ||
| 29 | 29 | \Elementor\Controls_Manager::add_tab( |
| 30 | 30 | 'tab_conf', |
| 31 | 31 | esc_html__('Settings', 'wpdirectorykit') |
| 32 | 32 | ); |
| 33 | + | |
| 33 | 34 | |
| 34 | 35 | \Elementor\Controls_Manager::add_tab( |
| 35 | 36 | 'tab_layout', |
| 36 | 37 | esc_html__('Layout', 'wpdirectorykit') |
| @@ -131,9 +132,9 @@ | ||
| 131 | 132 | |
| 132 | 133 | $locations_ids = array(); |
| 133 | 134 | foreach($this->data['settings']['conf_custom_results'] as $location) { |
| 134 | 135 | if(isset($location['location_id']) && !empty($location['location_id'])) { |
| 135 | - $locations_ids [] = $location['location_id']; | |
| 136 | + $locations_ids [] = (int)$location['location_id']; | |
| 136 | 137 | } |
| 137 | 138 | } |
| 138 | 139 | |
| 139 | 140 | /* where in */ |
| @@ -150,12 +151,14 @@ | ||
| 150 | 151 | |
| 151 | 152 | } else { |
| 152 | 153 | $order_by = NULL; |
| 153 | 154 | if(!empty($this->data['settings']['conf_order_by'])) |
| 154 | - $order_by = $this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order']; | |
| 155 | - | |
| 156 | - $this->data['results'] = $this->WMVC->{$controller.'_m'}->get_pagination($this->data['settings']['conf_limit'], NULL, array(), $order_by); | |
| 157 | - | |
| 155 | + $order_by = wdk_esc_sql_order_by($this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order'], $this->WMVC->{$controller.'_m'}->getAllowedOrderBy()); | |
| 156 | + $where = array(); | |
| 157 | + if (!empty($this->data['settings']['only_root_enable']) && $this->data['settings']['only_root_enable'] == 'yes') { | |
| 158 | + $where['('.$this->WMVC->{$controller.'_m'}->_table_name.'.level = 0)'] = NULL; | |
| 159 | + } | |
| 160 | + $this->data['results'] = $this->WMVC->{$controller.'_m'}->get_pagination((!empty($this->data['settings']['conf_limit'])) ? $this->data['settings']['conf_limit'] : NULL, NULL, $where, $order_by); | |
| 158 | 161 | } |
| 159 | 162 | |
| 160 | 163 | $this->data['is_edit_mode']= false; |
| 161 | 164 | if(Plugin::$instance->editor->is_edit_mode()) |
| @@ -160,9 +163,9 @@ | ||
| 160 | 163 | $this->data['is_edit_mode']= false; |
| 161 | 164 | if(Plugin::$instance->editor->is_edit_mode()) |
| 162 | 165 | $this->data['is_edit_mode']= true; |
| 163 | 166 | |
| 164 | - echo $this->view('wdk-locations-grid', $this->data); | |
| 167 | + $this->view('wdk-locations-grid', $this->data, true); | |
| 165 | 168 | } |
| 166 | 169 | |
| 167 | 170 | |
| 168 | 171 | private function generate_controls_conf() { |
| @@ -183,9 +186,9 @@ | ||
| 183 | 186 | $this->add_control( |
| 184 | 187 | 'conf_link', |
| 185 | 188 | [ |
| 186 | 189 | 'label' => __( 'Open results on page', 'wpdirectorykit' ), |
| 187 | - 'type' => \Elementor\Controls_Manager::SELECT, | |
| 190 | + 'type' => \Elementor\Controls_Manager::SELECT2, | |
| 188 | 191 | 'default' => '', |
| 189 | 192 | 'options' => $pages |
| 190 | 193 | ] |
| 191 | 194 | ); |
| @@ -208,20 +211,33 @@ | ||
| 208 | 211 | 'important_note', |
| 209 | 212 | [ |
| 210 | 213 | 'label' => '', |
| 211 | 214 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 212 | - 'raw' => sprintf(__( 'Edit Locations <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_location')), | |
| 215 | + /* translators: 1: URL. */ | |
| 216 | + 'raw' => wdk_sprintf(__( 'Edit Locations <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_location')), | |
| 213 | 217 | 'content_classes' => 'wdk_elementor_hint', |
| 214 | 218 | ] |
| 215 | 219 | ); |
| 216 | 220 | |
| 221 | + $this->add_responsive_control( | |
| 222 | + 'only_root_enable', | |
| 223 | + [ | |
| 224 | + 'label' => esc_html__( 'Show only Root', 'wpdirectorykit' ), | |
| 225 | + 'type' => Controls_Manager::SWITCHER, | |
| 226 | + 'none' => esc_html__( 'No', 'wpdirectorykit' ), | |
| 227 | + 'block' => esc_html__( 'Yes', 'wpdirectorykit' ), | |
| 228 | + 'return_value' => 'yes', | |
| 229 | + 'default' => 'yes', | |
| 230 | + ] | |
| 231 | + ); | |
| 217 | 232 | $this->add_control( |
| 218 | 233 | 'conf_limit', |
| 219 | 234 | [ |
| 220 | 235 | 'label' => __( 'Limit Locations', 'wpdirectorykit' ), |
| 236 | + 'description' => __( 'Set 0 for unlimit', 'wpdirectorykit' ), | |
| 221 | 237 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 222 | - 'min' => 1, | |
| 223 | - 'max' => 50, | |
| 238 | + 'min' => 0, | |
| 239 | + 'max' => 500, | |
| 224 | 240 | 'step' => 1, |
| 225 | 241 | 'default' => 6, |
| 226 | 242 | 'separator' => 'before', |
| 227 | 243 | 'conditions' => [ |
| @@ -472,9 +488,9 @@ | ||
| 472 | 488 | 'min' => 0, |
| 473 | 489 | 'max' => 100, |
| 474 | 490 | ], |
| 475 | 491 | ], |
| 476 | - 'size_units' => [ 'px', 'vw' ], | |
| 492 | + 'size_units' => [ 'px','em', 'vw', '%', 'custom' ], | |
| 477 | 493 | 'default' => [ |
| 478 | 494 | 'size' => 350, |
| 479 | 495 | 'unit' => 'px', |
| 480 | 496 | ], |