PluginProbe
WP Directory Kit / 1.1.0
WP Directory Kit v1.1.0
1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 1.4.0 1.4.1 All 35 releases
wpdirectorykit / application / models / Settings_m.php

Settings_m.php in WP Directory Kit 1.1.0, at application/models/Settings_m.php

135 lines 7.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // If this file is called directly, abort.
4 if ( ! defined( 'WPINC' ) ) {
5 die;
6 }
7
8 class Settings_m extends Winter_MVC_Model {
9
10 public $_table_name = 'options';
11 public $_order_by = 'option_id';
12 public $_primary_key = 'option_id';
13 public $_own_columns = array();
14 public $_timestamps = TRUE;
15 protected $_primary_filter = 'intval';
16 public $fields_list = NULL;
17
18 public function __construct(){
19 parent::__construct();
20
21 $pages = array('' => __('Not Selected', 'wpdirectorykit'));
22 foreach(get_pages(array('sort_column' => 'post_title')) as $page)
23 {
24 $pages[$page->ID] = $page->post_title.' #'.$page->ID;
25 }
26
27 $WMVC = &wdk_get_instance();
28 $WMVC->model('field_m');
29 $fields_data = $WMVC->field_m->get();
30 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
31 $order_i = 0;
32
33 $fields_list ['section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
34 $fields_list ['post_title'] = esc_html__('WP Title', 'wpdirectorykit');
35 $fields_list ['post_content'] = esc_html__('WP Content', 'wpdirectorykit');
36
37 foreach($fields_data as $field)
38 {
39 if(wmvc_show_data('field_type', $field) == 'SECTION') {
40 $fields_list ['section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --';
41 } else {
42 $fields_list[wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
43 }
44 }
45
46 $this->fields_list = array(
47 array('field' => 'wdk_is_category_enabled', 'field_label' => __('Enable Categories', 'wpdirectorykit'), 'hint' => __('If you don\'t need categories features you can disable that here', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
48 array('field' => 'wdk_is_location_enabled', 'field_label' => __('Enable Locations', 'wpdirectorykit'), 'hint' => __('If you don\'t need location features you can disable that here', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => '', 'class' => ''),
49
50 array('field' => 'wdk_default_lat', 'field_label' => __('Default GPS Position', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'MAP', 'rules' => ''),
51 array('field' => 'wdk_default_lng', 'field_label' => __('Default GPS Longitude', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'INPUTBOX', 'rules' => '', 'class' => 'hidden'),
52
53 array('field' => 'wdk_is_address_enabled', 'field_label' => __('Enable Address', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
54 array('field' => 'wdk_listing_page', 'field_label' => __('Listing Page', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'DROPDOWN', 'rules' => '', 'values' => $pages),
55 array('field' => 'wdk_results_page', 'field_label' => __('Results Page', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for results page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'DROPDOWN', 'rules' => '', 'values' => $pages),
56 array('field' => 'wdk_is_results_page_require', 'field_label' => __('Always use results page', 'wpdirectorykit'), 'hint' => __('Always even if on current page you have results where can be showed', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
57 array('field' => 'wdk_slug_listing_preview_page', 'field_label' => __('Custom Listing Preview Page Slug', 'wpdirectorykit'), 'hint' => __('Slug used for listing preview page, if empty, default will be used', 'wpdirectorykit'), 'field_type' => 'INPUTBOX', 'rules' => ''),
58 array('field' => 'wdk_seo_keywords', 'field_label' => __('SEO Listing Page Keywords', 'wpdirectorykit'), 'hint' => __('Set field for meta tag keywords', 'wpdirectorykit'), 'field_type' => 'DROPDOWN', 'values' => $fields_list, 'rules' => ''),
59 array('field' => 'wdk_seo_description', 'field_label' => __('SEO Listing Page Description', 'wpdirectorykit'), 'hint' => __('Set field for meta tag description', 'wpdirectorykit'), 'field_type' => 'DROPDOWN', 'values' => $fields_list, 'rules' => ''),
60 array('field' => 'wdk_auto_approved', 'field_label' => __('Auto Approve Listings', 'wpdirectorykit'), 'hint' => __('Always auto activate approved listings (all agents listings will be auto activated if agent approved)', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
61 array(
62 'field' => 'wdk_recaptcha_site_key',
63 'field_label' => __('Recaptcha site key', 'wpdirectorykit'),
64 'hint' => __('Please add Recaptcha site and Secret keys for enable recaptcha Add Google Recaptcha site key (use V2 recaptcha key)', 'wpdirectorykit'),
65 'field_type' => 'INPUTBOX',
66 'rules' => '',
67 ),
68
69 array(
70 'field' => 'wdk_recaptcha_secret_key',
71 'field_label' => __('Recaptcha site secret key', 'wpdirectorykit'),
72 'hint' => __('Add Google Recaptcha secret key', 'wpdirectorykit'),
73 'field_type' => 'INPUTBOX',
74 'rules' => '',
75 ),
76 );
77
78
79 }
80
81 /* [START] For dynamic data table */
82
83 public function get_available_fields()
84 {
85 $fields = $this->db->list_fields($this->_table_name);
86
87 return $fields;
88 }
89
90 public function total_lang($where = array())
91 {
92 $this->db->select('COUNT(*) as total_count');
93 $this->db->from($this->_table_name);
94 $this->db->where($where);
95 $this->db->order_by($this->_order_by);
96 $query = $this->db->get();
97 $res = $this->db->results();
98
99 if(isset($res[0]->total_count))
100 return $res[0]->total_count;
101
102 return 0;
103 }
104
105 public function get_pagination_lang($limit, $offset, $where = array())
106 {
107 $this->db->select('*');
108 $this->db->from($this->_table_name);
109 $this->db->where($where);
110 $this->db->limit($limit);
111 $this->db->offset($offset);
112 $this->db->order_by($this->_order_by);
113 $query = $this->db->get();
114
115 if ($this->db->num_rows() > 0)
116 return $this->db->results();
117
118 return array();
119 }
120
121 public function check_deletable($id)
122 {
123 return true;
124 }
125
126 /* [END] For dynamic data table */
127
128
129 /* only admin can edit */
130 public function is_related($item_id, $user_id, $method = 'edit')
131 {
132 return false;
133 }
134 }
135 ?>