WP Custom Widget area - Version 1.1.0

Version Description

  • added new menu location feature
  • design update
Download this release

Release Info

Developer krozero199
Plugin Icon wp plugin WP Custom Widget area
Version 1.1.0
Comparing to
See all releases

Code changes from version 1.0.4 to 1.1.0

README.txt CHANGED
@@ -1,18 +1,22 @@
1
  === Plugin Name ===
2
  Contributors: krozero
3
  Donate link: http://kishorkhambu.com.np/donation
4
- Tags: widget area, custom widget area, widget, simple widget area, custom sidebar, dynamic sidebar
5
  Requires at least: 3.0.1
6
  Tested up to: 4.2.2
7
- Stable tag: 1.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Create a Custom widget area or sidebar easily.
 
 
12
 
13
  == Description ==
14
 
15
- A Wordpress Plugin to create a custom widget areas or sidebar easily. It allows user to create multiple widget areas from admin panel and allows to use it anywhere like in theme sidebar or in any page/post content.
 
 
16
 
17
 
18
  == Installation ==
@@ -23,11 +27,11 @@ A Wordpress Plugin to create a custom widget areas or sidebar easily. It allows
23
 
24
  == Frequently Asked Questions ==
25
 
26
- = How to use it? =
27
 
28
- 1. create a custom widget area.
29
- 2. copy the code form "get code" Link
30
- 3. paste into wordpress theme where you want to display it
31
 
32
  = How to Use it in page or post content? =
33
  1. Click on the "get shortcode" link form widget area table below.
@@ -39,12 +43,40 @@ A Wordpress Plugin to create a custom widget areas or sidebar easily. It allows
39
  .mynewwidgetareaclass a{ color: red; }
40
  at the bottom of your style.css where ".mynewwidgetareaclass" is your widget area class.
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  == Screenshots ==
43
 
44
- 1. /assets/screenshot-1.png
 
 
45
 
46
  == Changelog ==
47
 
 
 
 
 
48
  = 1.0.4 =
49
  * 4.2 compatible
50
 
@@ -66,6 +98,10 @@ A Wordpress Plugin to create a custom widget areas or sidebar easily. It allows
66
 
67
  == Upgrade Notice ==
68
 
 
 
 
 
69
  = 1.0.4 =
70
  * 4.2 compatible
71
 
1
  === Plugin Name ===
2
  Contributors: krozero
3
  Donate link: http://kishorkhambu.com.np/donation
4
+ Tags: widget area, custom widget area, widget, simple widget area, custom sidebar, dynamic sidebar, menu, menus, custom menu, custom menu locations, menu location, menu area
5
  Requires at least: 3.0.1
6
  Tested up to: 4.2.2
7
+ Stable tag: 1.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+
12
+ A very simple way to create a custom widget area, sidebars and menu locations for your wordpress site.
13
+
14
 
15
  == Description ==
16
 
17
+ A Wordpress Plugin that makes it very simple and easy to create a custom widget areas, sidebars and Menu locations. With the help of this plugin you can create multiple custom widget areas, menu locations and use it whereever you want to show in your site.
18
+
19
+ It allows you to show custom widget areas and menu locations created with this plugin in any part of your site (i.e, as sidebars, bottom widget areas , in header and plus with this plugin now you can also show it in your pages and posts contents.) There's two way of using this plugins. To show it in posts or pages content use shortcode link "Get shortcode" and for other like to show as sidebars etc. use code link "Get code".
20
 
21
 
22
  == Installation ==
27
 
28
  == Frequently Asked Questions ==
29
 
30
+ = How to use custom widget area? =
31
 
32
+ 1. Create a new Widget area.
33
+ 2. Click on the "get code" link.
34
+ 3. Copy the code and Paste it in a wordpress theme where you want to display it.
35
 
36
  = How to Use it in page or post content? =
37
  1. Click on the "get shortcode" link form widget area table below.
43
  .mynewwidgetareaclass a{ color: red; }
44
  at the bottom of your style.css where ".mynewwidgetareaclass" is your widget area class.
45
 
46
+
47
+ = How to use menu locations? =
48
+ 1. Create a new Menu Location.
49
+ 2. Click on the "get code" link from table below.
50
+ 3. Copy the code and Paste it in a wordpress theme where you want to display it.
51
+
52
+ = How to Use it in page or post content? =
53
+ 1. Click on the "get shortcode" link form table below.
54
+ 2. Copy the shortcode and Paste it in a post or page editor where you want to display it.
55
+
56
+ = How to customize menu style? =
57
+ 1. Pass the extra arguments while calling function
58
+ i.e.
59
+ wp_nav_menu( array( 'theme_location' => 'footer-location', 'menu_class' => 'Cwa-menu', [arguments] => ['values']... ) );
60
+ Cick here to know more about available Parameters.
61
+ [Note: for shortcode pass arguments like [menu theme_location='footer-location' 'menu_class'='Cwa-menu' [arguments]=[values]...]
62
+ 2. Make sure you have passed custom menu class options i.e. 'menu_class' like in above code.
63
+ 3. Add custom css targeting your menu_class or container_class etc. i.e.
64
+ .Cwa-menu a{ color: red; }
65
+ at the bottom of your style.css.
66
+
67
+
68
  == Screenshots ==
69
 
70
+ 1. /assets/widget-area-1.png
71
+ 2. /assets/widget-area-2.png
72
+ 3. /assets/menu-location-1.png
73
 
74
  == Changelog ==
75
 
76
+ = 1.1.0 =
77
+ * added new menu location feature
78
+ * design update
79
+
80
  = 1.0.4 =
81
  * 4.2 compatible
82
 
98
 
99
  == Upgrade Notice ==
100
 
101
+ = 1.1.0 =
102
+ * added new menu location feature
103
+ * design update
104
+
105
  = 1.0.4 =
106
  * 4.2 compatible
107
 
admin/class-wp-custom-widget-area-admin.php CHANGED
@@ -4,7 +4,7 @@
4
  * The dashboard-specific functionality of the plugin.
5
  *
6
  * @link http://example.com
7
- * @since 1.0.4
8
  *
9
  * @package Custom_Widget_Area
10
  * @subpackage Custom_Widget_Area/admin
@@ -22,12 +22,13 @@
22
  */
23
 
24
  require_once('partials/cwa-admin-display.php');
 
25
  class Custom_Widget_Area_Admin {
26
 
27
  /**
28
  * The ID of this plugin.
29
  *
30
- * @since 1.0.4
31
  * @access private
32
  * @var string $plugin_name The ID of this plugin.
33
  */
@@ -36,7 +37,7 @@ class Custom_Widget_Area_Admin {
36
  /**
37
  * The version of this plugin.
38
  *
39
- * @since 1.0.4
40
  * @access private
41
  * @var string $version The current version of this plugin.
42
  */
@@ -45,22 +46,25 @@ class Custom_Widget_Area_Admin {
45
  /**
46
  * Initialize the class and set its properties.
47
  *
48
- * @since 1.0.4
49
  * @var string $plugin_name The name of this plugin.
50
  * @var string $version The version of this plugin.
51
  */
52
  public function __construct( $plugin_name, $version ) {
53
  global $table_name, $wpdb;
54
  $this->view = new CWA_View();
 
55
  $this->plugin_name = $plugin_name;
56
  $this->version = $version;
57
  $this->table_name = $table_name;
58
  $this->setuo_ajax_request();
59
  add_action( 'widgets_init', array($this, 'registerSidebar'));
 
60
  }
61
  public function menu_setup(){
62
 
63
  add_menu_page('CWA Settings', 'CWA Settings', 'administrator', __FILE__, array($this->view, 'cwa_settings_page'),''/*plugins_url('/images/icon.png', __FILE__)*/);
 
64
  self::setuo_ajax_request();
65
  }
66
  public function setuo_ajax_request(){
@@ -71,8 +75,18 @@ class Custom_Widget_Area_Admin {
71
  //add_action( 'wp_ajax_get_cwa', array($this, 'get_cwa'));
72
  add_action( 'wp_ajax_reloadTable', array($this->view , 'widgetTable'));
73
 
 
 
 
 
 
 
 
 
74
 
75
  }
 
 
76
  public function add_cwa(){
77
 
78
  global $table_name, $wpdb;
@@ -87,6 +101,7 @@ class Custom_Widget_Area_Admin {
87
  //echo "id: " .$this->check_cwa_id($new_data['cwa_id']);
88
  if($this->check_cwa_id($new_data['cwa_id'])){
89
  $new_data['last_updated'] = date('Y-m-d');
 
90
  //var_dump($new_data);
91
  $row = $wpdb->replace( $table_name, $new_data );
92
 
@@ -133,7 +148,7 @@ class Custom_Widget_Area_Admin {
133
 
134
  if($valid){
135
 
136
- $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id'";
137
 
138
 
139
  $row = $wpdb->get_row( $sql, 'OBJECT');
@@ -165,13 +180,13 @@ class Custom_Widget_Area_Admin {
165
  global $wpdb;
166
  $cwa_id = $_POST['data']['cwa_id'];
167
  //var_dump($cwa_id);
168
- $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id'";
169
  $row = $wpdb->get_row( $sql, 'OBJECT');
170
  wp_send_json($row);
171
  }
172
  public function getall_cwa(){
173
  global $wpdb;
174
- $sql = "SELECT * FROM $this->table_name";
175
  $row = $wpdb->get_results( $sql, 'OBJECT');
176
  return $row;
177
  }
@@ -196,6 +211,130 @@ class Custom_Widget_Area_Admin {
196
  'after_title' => '</'.$row->cwa_widget_header_wrapper.'>',
197
  ) );
198
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  public function validatePost(){
200
  $data =$_POST['data'];
201
  $new_data = array();
@@ -216,7 +355,7 @@ class Custom_Widget_Area_Admin {
216
  /**
217
  * Register the stylesheets for the Dashboard.
218
  *
219
- * @since 1.0.4
220
  */
221
  public function enqueue_styles() {
222
 
@@ -239,7 +378,7 @@ class Custom_Widget_Area_Admin {
239
  /**
240
  * Register the JavaScript for the dashboard.
241
  *
242
- * @since 1.0.4
243
  */
244
  public function enqueue_scripts() {
245
 
4
  * The dashboard-specific functionality of the plugin.
5
  *
6
  * @link http://example.com
7
+ * @since 1.1.0
8
  *
9
  * @package Custom_Widget_Area
10
  * @subpackage Custom_Widget_Area/admin
22
  */
23
 
24
  require_once('partials/cwa-admin-display.php');
25
+ require_once('partials/cwa-menu-admin-display.php');
26
  class Custom_Widget_Area_Admin {
27
 
28
  /**
29
  * The ID of this plugin.
30
  *
31
+ * @since 1.1.0
32
  * @access private
33
  * @var string $plugin_name The ID of this plugin.
34
  */
37
  /**
38
  * The version of this plugin.
39
  *
40
+ * @since 1.1.0
41
  * @access private
42
  * @var string $version The current version of this plugin.
43
  */
46
  /**
47
  * Initialize the class and set its properties.
48
  *
49
+ * @since 1.1.0
50
  * @var string $plugin_name The name of this plugin.
51
  * @var string $version The version of this plugin.
52
  */
53
  public function __construct( $plugin_name, $version ) {
54
  global $table_name, $wpdb;
55
  $this->view = new CWA_View();
56
+ $this->menuView = new Menu_View();
57
  $this->plugin_name = $plugin_name;
58
  $this->version = $version;
59
  $this->table_name = $table_name;
60
  $this->setuo_ajax_request();
61
  add_action( 'widgets_init', array($this, 'registerSidebar'));
62
+ $this->registerMenuLocations();
63
  }
64
  public function menu_setup(){
65
 
66
  add_menu_page('CWA Settings', 'CWA Settings', 'administrator', __FILE__, array($this->view, 'cwa_settings_page'),''/*plugins_url('/images/icon.png', __FILE__)*/);
67
+ add_submenu_page( __FILE__, 'Menu Locations', 'Menu Locations', 'administrator', 'manage_options', array($this->menuView, 'menu_settings_page') );
68
  self::setuo_ajax_request();
69
  }
70
  public function setuo_ajax_request(){
75
  //add_action( 'wp_ajax_get_cwa', array($this, 'get_cwa'));
76
  add_action( 'wp_ajax_reloadTable', array($this->view , 'widgetTable'));
77
 
78
+ // Menu Location settings
79
+ add_action( 'wp_ajax_add_menu', array($this, 'add_menu'));
80
+
81
+ add_action( 'wp_ajax_delete_menu', array($this, 'delete_menu'));
82
+ add_action( 'wp_ajax_check_menu_id', array($this, 'check_menu_id'));
83
+ //add_action( 'wp_ajax_get_cwa', array($this, 'get_cwa'));
84
+ add_action( 'wp_ajax_reloadMenuTable', array($this->menuView , 'MenuTable'));
85
+
86
 
87
  }
88
+
89
+ /* Widget functions start */
90
  public function add_cwa(){
91
 
92
  global $table_name, $wpdb;
101
  //echo "id: " .$this->check_cwa_id($new_data['cwa_id']);
102
  if($this->check_cwa_id($new_data['cwa_id'])){
103
  $new_data['last_updated'] = date('Y-m-d');
104
+ $new_data['cwa_type'] = "widget";
105
  //var_dump($new_data);
106
  $row = $wpdb->replace( $table_name, $new_data );
107
 
148
 
149
  if($valid){
150
 
151
+ $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id' AND cwa_type='widget'";
152
 
153
 
154
  $row = $wpdb->get_row( $sql, 'OBJECT');
180
  global $wpdb;
181
  $cwa_id = $_POST['data']['cwa_id'];
182
  //var_dump($cwa_id);
183
+ $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id' AND cwa_type='widget'";
184
  $row = $wpdb->get_row( $sql, 'OBJECT');
185
  wp_send_json($row);
186
  }
187
  public function getall_cwa(){
188
  global $wpdb;
189
+ $sql = "SELECT * FROM $this->table_name WHERE cwa_type='widget'";
190
  $row = $wpdb->get_results( $sql, 'OBJECT');
191
  return $row;
192
  }
211
  'after_title' => '</'.$row->cwa_widget_header_wrapper.'>',
212
  ) );
213
  }
214
+
215
+ /* Widget functions end */
216
+
217
+
218
+ /* Menu functions start */
219
+ public function add_menu(){
220
+
221
+ global $table_name, $wpdb;
222
+ $wpdb->show_errors();
223
+ //get parameter $x = $_POST['x'];
224
+ $data = $_POST['data'];
225
+ //echo "hello : your test is successfull!!!";
226
+ //var_dump($_POST);
227
+ //var_export($table_name);
228
+ if($data['cwa_name'] !== '' && $data['cwa_id'] !== '' ){
229
+ $new_data = $this->validatePost();
230
+ //echo "id: " .$this->check_cwa_id($new_data['cwa_id']);
231
+ if($this->check_menu_id($new_data['cwa_id'])){
232
+ $new_data['last_updated'] = date('Y-m-d');
233
+ $new_data['cwa_type'] = "menu";
234
+ //var_dump($new_data);
235
+ $row = $wpdb->replace( $table_name, $new_data );
236
+
237
+ if($row){
238
+ wp_send_json(array('code'=>1, 'message' => $new_data['cwa_id'].' created successfully.'));
239
+ }
240
+ }
241
+ else{
242
+ wp_send_json(array('code' => 0, 'message' => 'Menu Location id already registered'));
243
+
244
+ }
245
+ }
246
+ else{
247
+ wp_send_json(array('code' => 0, 'message' => 'Menu Location name or id not defined'));
248
+ }
249
+ die(); // this is required to terminate immediately and return a proper response
250
+ }
251
+
252
+ public function delete_menu(){
253
+ global $table_name, $wpdb;
254
+ $wpdb->show_errors();
255
+ $cwa_id = esc_html($_POST['data']['cwa_id']);
256
+
257
+
258
+ $row = $wpdb->delete( $table_name, array( 'cwa_id' => $cwa_id ), $where_format = null );
259
+ //wp_send_json_success(array('code' => 1, 'message' => $cwa_id.' deleted successfully.'));
260
+
261
+ if($row>0)
262
+ wp_send_json(array('code' => 1, 'message' => $cwa_id.' deleted successfully.'));
263
+ else
264
+ wp_send_json(array('code' => 0, 'message' => 'Error accured!.'));
265
+
266
+ die();
267
+ }
268
+ public function check_menu_id($id=null){
269
+ global $wpdb;
270
+
271
+ if(empty($id))
272
+ $cwa_id = $_POST['data']['cwa_id'];
273
+ else
274
+ $cwa_id = $id;
275
+
276
+ $valid = self::checSpecialChar($cwa_id);
277
+
278
+ if($valid){
279
+
280
+ $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id' AND cwa_type='menu'";
281
+
282
+
283
+ $row = $wpdb->get_row( $sql, 'OBJECT');
284
+
285
+ if(empty($id)){
286
+ if($row)
287
+ wp_send_json(array('code' => 0, 'message' => 'Menu Location id already registered'));
288
+ else
289
+ wp_send_json(array('code' => 1, 'message' => 'Menu Location id available'));
290
+ die();
291
+ }
292
+ else{
293
+ if($row)
294
+ return false;
295
+ else
296
+ return true;
297
+ }
298
+ }
299
+ else{
300
+ if(empty($id)){
301
+ wp_send_json(array('code' => 0, 'message' => 'Invalid id, use [a-z]-[0-9]'));
302
+ }
303
+ else{
304
+ return false;
305
+ }
306
+ }
307
+ }
308
+ public function get_menu(){
309
+ global $wpdb;
310
+ $cwa_id = $_POST['data']['cwa_id'];
311
+ //var_dump($cwa_id);
312
+ $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id' AND cwa_type='menu'";
313
+ $row = $wpdb->get_row( $sql, 'OBJECT');
314
+ wp_send_json($row);
315
+ }
316
+ public function getall_menu(){
317
+ global $wpdb;
318
+ $sql = "SELECT * FROM $this->table_name WHERE cwa_type='menu'";
319
+ $row = $wpdb->get_results( $sql, 'OBJECT');
320
+ return $row;
321
+ }
322
+
323
+ public function registerMenuLocations(){
324
+ $data = $this->getall_menu();
325
+ //var_dump($data);
326
+ foreach ($data as $row) {
327
+ # code...
328
+ $this->createMenuLocaiton($row);
329
+ }
330
+
331
+ }
332
+ public function createMenuLocaiton($row){
333
+
334
+ register_nav_menu( $row->cwa_id, __($row->cwa_name, 'wp_custom_widget_area' ) );
335
+ }
336
+ /* Menu functions end */
337
+
338
  public function validatePost(){
339
  $data =$_POST['data'];
340
  $new_data = array();
355
  /**
356
  * Register the stylesheets for the Dashboard.
357
  *
358
+ * @since 1.1.0
359
  */
360
  public function enqueue_styles() {
361
 
378
  /**
379
  * Register the JavaScript for the dashboard.
380
  *
381
+ * @since 1.1.0
382
  */
383
  public function enqueue_scripts() {
384
 
admin/css/wp-custom-widget-area-admin.css CHANGED
@@ -79,17 +79,30 @@
79
  text-align: left;
80
  }
81
  .cwa-table>thead tr{
82
- background-color: #999;
83
  color: #fff;
84
  }
 
 
 
 
 
 
 
85
  .cwa-table th:first-child, .cwa-table td:first-child{
86
  padding-left: 15px;
 
 
 
 
 
87
  }
88
  .cwa-table th:last-child, .cwa-table td:last-child{
89
  padding-right: 15px;
90
  }
91
  .cwa-table>tbody tr:nth-child(even){
92
- background-color: rgba(0, 0, 0, 0.1);
 
93
  }
94
 
95
  .cwa-btn{
@@ -111,9 +124,26 @@
111
  cursor: pointer;
112
  }
113
  .how-to{
114
- padding: 10px;
115
  background: #ddd;
116
  border-radius: 5px;
117
  color: #333;
118
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
 
79
  text-align: left;
80
  }
81
  .cwa-table>thead tr{
82
+ background-color: #167F92;
83
  color: #fff;
84
  }
85
+ .cwa-table th{
86
+ border-left: 1px solid #fff;
87
+
88
+ }
89
+ .cwa-table th, .cwa-table td {
90
+ padding: 0.5em 1em;
91
+ }
92
  .cwa-table th:first-child, .cwa-table td:first-child{
93
  padding-left: 15px;
94
+ border-left: 0;
95
+ text-align: center;
96
+ }
97
+ .cwa-table td{
98
+ border-left: 1px solid #D9E4E6;
99
  }
100
  .cwa-table th:last-child, .cwa-table td:last-child{
101
  padding-right: 15px;
102
  }
103
  .cwa-table>tbody tr:nth-child(even){
104
+ //background-color: rgba(0, 0, 0, 0.1);
105
+ background-color: #EAF3F3;
106
  }
107
 
108
  .cwa-btn{
124
  cursor: pointer;
125
  }
126
  .how-to{
127
+ padding: 2em;
128
  background: #ddd;
129
  border-radius: 5px;
130
  color: #333;
131
+ //transition: all 0.5s ease;
132
+ overflow: hidden;
133
+ height: 100%;
134
+ position: relative;
135
+ }
136
+ .how-to:after {
137
+ display: block;
138
+ position: absolute;
139
+ content: "";
140
+ height: 40px;
141
+ background: #ddd;
142
+ width: 100%;
143
+ bottom: 0;
144
+ left: 0;
145
+ }
146
+ .show-less{
147
+ height: 320px;
148
  }
149
+
admin/js/wp-custom-widget-area-admin.js CHANGED
@@ -50,7 +50,7 @@
50
  });
51
  //if(checkId(form_array.cwa_id)){
52
  $.post(ajaxurl,{'action': 'add_cwa', 'data': form_array}, function(data){
53
- console.log(data);
54
  reloadCwaTable();
55
  showCwaError(data);
56
 
@@ -63,11 +63,11 @@
63
 
64
  $('#cwa-form input[name=cwa_name]').on('change', function(){
65
  var widget_id = $('#cwa-form input[name=cwa_id]'),
66
- cwaId = $(this).val().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-').replace(/ /g,"-");
67
 
68
  if(widget_id.val() === ''){
69
  widget_id.val(cwaId);
70
- checkId(widget_id,cwaId);
71
  }
72
 
73
  });
@@ -82,7 +82,7 @@
82
  var id = $(this).data('id');
83
 
84
  $.post(ajaxurl,{'action': 'delete_cwa', 'data': {'cwa_id': id}}, function(data){
85
- console.log(data);
86
  showCwaError(data);
87
 
88
  reloadCwaTable();
@@ -99,6 +99,55 @@
99
  $(this).text('Advanced');
100
  });
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  runTooltip();
103
 
104
  });
@@ -107,8 +156,8 @@
107
  window.xt = arr;
108
  return true;
109
  }
110
- function checkId(self, cwa_id){
111
- $.post(ajaxurl,{'action': 'check_cwa_id', 'data': {'cwa_id': cwa_id}}, function(data){
112
  //console.log(data);
113
  if(data.code === 0){
114
  $(self).next('.cwa-form-message').html("<label class='cwa-warning' style='padding-left: 5px;'>"+data.message+"</label>");
@@ -117,7 +166,7 @@
117
  $(self).next('.cwa-form-message').html("<label class='cwa-success' style='padding-left: 5px;'>"+data.message+"</label>");
118
  }
119
 
120
- console.log(data);
121
  });
122
  };
123
  function reloadCwaTable(){
@@ -128,10 +177,18 @@
128
  //console.log(data);
129
  });
130
  }
 
 
 
 
 
 
 
 
131
  function showCwaError(obj){
132
 
133
  var type = (obj.code === 0)? "cwa-warning" : "cwa-success" ;
134
- console.log(obj.code === 0);
135
  var message = obj.message;
136
  $('.cwa-error').html(message).addClass(type).fadeIn();
137
  setTimeout(function(){
50
  });
51
  //if(checkId(form_array.cwa_id)){
52
  $.post(ajaxurl,{'action': 'add_cwa', 'data': form_array}, function(data){
53
+ //console.log(data);
54
  reloadCwaTable();
55
  showCwaError(data);
56
 
63
 
64
  $('#cwa-form input[name=cwa_name]').on('change', function(){
65
  var widget_id = $('#cwa-form input[name=cwa_id]'),
66
+ cwaId = $(this).val().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-').replace(/ /g,"-").toLowerCase();
67
 
68
  if(widget_id.val() === ''){
69
  widget_id.val(cwaId);
70
+ checkId(widget_id,cwaId, 'widget');
71
  }
72
 
73
  });
82
  var id = $(this).data('id');
83
 
84
  $.post(ajaxurl,{'action': 'delete_cwa', 'data': {'cwa_id': id}}, function(data){
85
+ //console.log(data);
86
  showCwaError(data);
87
 
88
  reloadCwaTable();
99
  $(this).text('Advanced');
100
  });
101
 
102
+ /* menu scripts starts*/
103
+ $('#cwa-menu-form').on('submit', function(e){
104
+ e.preventDefault();
105
+
106
+ var flag = validateForm($(this).serializeArray());
107
+ if(flag){
108
+ //console.log();
109
+ var form_array = {};
110
+ $(this).serializeArray().map(function(item){
111
+ var vl = [];
112
+ if(item.value!==null)
113
+ form_array[item.name] = item.value;
114
+
115
+ });
116
+ //if(checkId(form_array.cwa_id)){
117
+ $.post(ajaxurl,{'action': 'add_menu', 'data': form_array}, function(data){
118
+ console.log(data);
119
+ reloadMenuTable();
120
+ showCwaError(data);
121
+
122
+ resetForm();
123
+ });
124
+ //}
125
+ }
126
+
127
+ });
128
+
129
+ $('#cwa-menu-form input[name=cwa_name]').on('change', function(){
130
+
131
+ var menu_id = $('#cwa-menu-form input[name=cwa_id]'),
132
+ cwaId = $(this).val().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-').replace(/ /g,"-").toLowerCase();
133
+ //console.log(menu_id.val());
134
+ if(menu_id.val() === ''){
135
+ menu_id.val(cwaId);
136
+ checkId(menu_id,cwaId, 'menu');
137
+ }
138
+
139
+ });
140
+
141
+
142
+
143
+
144
+ $('.more').on('click', function(e){
145
+ e.preventDefault();
146
+ $(this).parent().toggleClass('show-less');
147
+ var text = ($(this).html() == "Less")? "Read more" : "Less";
148
+ $(this).html(text);
149
+ });
150
+
151
  runTooltip();
152
 
153
  });
156
  window.xt = arr;
157
  return true;
158
  }
159
+ function checkId(self, cwa_id, type){
160
+ $.post(ajaxurl,{'action': (type=='widget')?'check_cwa_id': 'check_menu_id', 'data': {'cwa_id': cwa_id}}, function(data){
161
  //console.log(data);
162
  if(data.code === 0){
163
  $(self).next('.cwa-form-message').html("<label class='cwa-warning' style='padding-left: 5px;'>"+data.message+"</label>");
166
  $(self).next('.cwa-form-message').html("<label class='cwa-success' style='padding-left: 5px;'>"+data.message+"</label>");
167
  }
168
 
169
+ //console.log(data);
170
  });
171
  };
172
  function reloadCwaTable(){
177
  //console.log(data);
178
  });
179
  }
180
+ function reloadMenuTable(){
181
+ $.post(ajaxurl,{'action': 'reloadMenuTable'}, function(data){
182
+
183
+ $('#cwa-table-wrap').html(data);
184
+ runTooltip();
185
+ //console.log(data);
186
+ });
187
+ }
188
  function showCwaError(obj){
189
 
190
  var type = (obj.code === 0)? "cwa-warning" : "cwa-success" ;
191
+ //console.log(obj.code === 0);
192
  var message = obj.message;
193
  $('.cwa-error').html(message).addClass(type).fadeIn();
194
  setTimeout(function(){
admin/partials/cwa-admin-display.php CHANGED
@@ -6,7 +6,7 @@
6
  * This file is used to markup the public-facing aspects of the plugin.
7
  *
8
  * @link http://example.com
9
- * @since 1.0.4
10
  *
11
  * @package Custom_Widget_Area
12
  * @subpackage Custom_Widget_Area/admin/partials
@@ -57,7 +57,7 @@ class CWA_view
57
  <p>
58
  <ol class="list">
59
  <li>Click on the "get shortcode" link form widget area table below.</li>
60
- <li>Copy the shortcode and Paste it in a post or page editor in which you want it to display it.</li>
61
  </ol>
62
  </p>
63
  <br/>
6
  * This file is used to markup the public-facing aspects of the plugin.
7
  *
8
  * @link http://example.com
9
+ * @since 1.1.0
10
  *
11
  * @package Custom_Widget_Area
12
  * @subpackage Custom_Widget_Area/admin/partials
57
  <p>
58
  <ol class="list">
59
  <li>Click on the "get shortcode" link form widget area table below.</li>
60
+ <li>Copy the shortcode and Paste it in a post or page editor where you want to display it.</li>
61
  </ol>
62
  </p>
63
  <br/>
admin/partials/cwa-menu-admin-display.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Provide a dashboard view for the plugin
5
+ *
6
+ * This file is used to markup the public-facing aspects of the plugin.
7
+ *
8
+ * @link http://example.com
9
+ * @since 1.1.0
10
+ *
11
+ * @package Custom_Widget_Area
12
+ * @subpackage Custom_Widget_Area/admin/partials
13
+ */
14
+ /**
15
+ *
16
+ */
17
+ class Menu_view
18
+ {
19
+
20
+ public function __construct()
21
+ {
22
+ # code...
23
+ }
24
+ public function menu_settings_page(){
25
+ add_action( 'add_meta_boxes', self::displayView());
26
+ }
27
+ public function displayView(){
28
+
29
+
30
+ global $purl;
31
+ ?>
32
+
33
+ <div class="wrap">
34
+
35
+ <div id="icon-themes" class="icon32"><br /></div>
36
+
37
+ <h2><?php _e( 'Menu Locations', 'wp-custom-widget-area' ); ?></h2>
38
+
39
+ <div class="welcome-panel custom-wp">
40
+ <div class="col col-8">
41
+ <?php
42
+ self::menuForm();
43
+ ?>
44
+ </div>
45
+ <div class="col col-4">
46
+ <div class="how-to show-less">
47
+ <h3>How to use?</h3>
48
+ <p>
49
+ <ol class="list">
50
+ <li>Create a new Menu Location.</li>
51
+ <li>Click on the "get code" link from table below.</li>
52
+ <li>Copy the code and Paste it in a wordpress theme where you want to display it.</li>
53
+ </ol>
54
+ </p>
55
+ <br/>
56
+ <h4 style="margin-top: 0;">How to Use it in page or post content?</h4>
57
+ <p>
58
+ <ol class="list">
59
+ <li>Click on the "get shortcode" link form table below.</li>
60
+ <li>Copy the shortcode and Paste it in a post or page editor where you want to display it.</li>
61
+ </ol>
62
+ </p>
63
+ <br/>
64
+ <h4 style="margin-top: 0;">How to customize menu style?</h4>
65
+ <p>
66
+ <ol class="list">
67
+ <li>Pass the extra arguments while calling function<br>
68
+ i.e.<br>
69
+ <code>
70
+ wp_nav_menu( array( 'theme_location' => 'footer-location', 'menu_class' => 'Cwa-menu', [arguments] => ['values']... ) );
71
+ </code>
72
+ <br>
73
+ <a href="https://codex.wordpress.org/Function_Reference/wp_nav_menu" target="_blank" > Cick here </a> to know more about available Parameters.
74
+ <br>
75
+ <pre style="word-wrap: break-word;">[Note: for shortcode pass arguments like <code>[menu theme_location='footer-location' 'menu_class'='Cwa-menu' [arguments]=[values]...]</code></pre>
76
+ </li>
77
+ <li>Make sure you have passed custom menu class options i.e. 'menu_class' like in above code.</li>
78
+ <li>Add custom css targeting your menu_class or container_class etc. i.e. <br>
79
+ <code>
80
+ .Cwa-menu a{
81
+ color: red;
82
+ }
83
+ </code><br>
84
+ at the bottom of your style.css.
85
+ </li>
86
+ </ol>
87
+ </p>
88
+ <a href="#" style="position: absolute; left: 48%; bottom: 0; z-index: 5;" class="more">Read more</a>
89
+ </div>
90
+ </div>
91
+
92
+
93
+ </div>
94
+ </div>
95
+ <div class="cwa-error" style="display:none;">
96
+
97
+ </div>
98
+ <div id="cwa-table-wrap">
99
+ <?php
100
+ self::menuTable();
101
+ ?>
102
+ </div>
103
+ <?php
104
+ }
105
+ public function menuForm(){
106
+ ?>
107
+ <form class="cwa-form" method="post" action="" id="cwa-menu-form">
108
+ <input type="hidden" name="id">
109
+ <div class="basic">
110
+ <div class="cwa-form-row">
111
+ <label class="cwa-form-label">Name </label><input type="text" name="cwa_name" placeholder="Menu location name" required> <span class="cwa-form-message"></span>
112
+ </div>
113
+ <div class="cwa-form-row">
114
+ <label class="cwa-form-label">Theme location (Id) </label><input type="text" name="cwa_id" placeholder="Menu location id" required><span class="cwa-form-message"></span>
115
+ </div>
116
+
117
+
118
+ </div>
119
+ <div class="cwa-form-row">
120
+ <label class="cwa-form-label"> </label><input type="submit" name="create" value="Create" class="cwa-btn cwa-btn-primary"> <input type="reset" value="Cancel" name="cancel" class="cwa-btn cwa-btn-danger">
121
+ </div>
122
+ </form>
123
+
124
+ <?php
125
+ }
126
+ public function menuTable(){
127
+ $data = self::getMenuData();
128
+ //var_dump($data);
129
+ ?>
130
+ <table class="cwa-table responstable">
131
+ <thead>
132
+ <tr>
133
+ <th>Sn</th>
134
+ <th width='30%' >Name</th>
135
+ <th width='30%'>Theme location (Id) </th>
136
+
137
+ <th></th>
138
+ <th></th>
139
+ </tr>
140
+ </thead>
141
+ <tbody>
142
+ <?php
143
+ $count = 1;
144
+ foreach ($data as $table) {
145
+ # code...
146
+ ?>
147
+ <tr>
148
+ <td><?php echo $count ?></td>
149
+ <td><?php echo $table->cwa_name; ?></td>
150
+ <td><?php echo $table->cwa_id; ?></td>
151
+
152
+ <td><a href="#get_shortcode" data-id="<?php echo $table->cwa_id; ?>" class="cwa-detail-link tooltip" title="[menu theme_location='<?php echo $table->cwa_id; ?>']">Get shortcode</a> </td>
153
+ <td><a href="#get_code" data-id="<?php echo $table->cwa_id; ?>" class="cwa-detail-link tooltip" title="wp_nav_menu( array( 'theme_location' => '<?php echo $table->cwa_id; ?>' ) );">Get code</a> / <a href="#delete" data-id="<?php echo $table->cwa_id; ?>" class="cwa-delete-link">Delete</a></td>
154
+ </tr>
155
+ <?php
156
+ $count++;
157
+ }
158
+ ?>
159
+ </tbody>
160
+ </table>
161
+ <?php
162
+ if(isset($_POST['action']))
163
+ die();
164
+ }
165
+
166
+ public function getMenuData(){
167
+ global $wpdb, $table_name;
168
+
169
+ $sql = "SELECT * FROM $table_name WHERE cwa_type='menu'";
170
+
171
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
172
+ $row = $wpdb->get_results( $sql, 'OBJECT');
173
+ return $row;
174
+ }
175
+
176
+ }
177
+ ?>
assets/menu-location-1.png ADDED
Binary file
assets/screenshot-1.png DELETED
Binary file
assets/widget-area-1.png ADDED
Binary file
assets/widget-area-2.png ADDED
Binary file
includes/class-custom-widget-area.php CHANGED
@@ -7,7 +7,7 @@
7
  * public-facing side of the site and the dashboard.
8
  *
9
  * @link http://example.com
10
- * @since 1.0.4
11
  *
12
  * @package Custom_Widget_Area
13
  * @subpackage Custom_Widget_Area/includes
@@ -22,7 +22,7 @@
22
  * Also maintains the unique identifier of this plugin as well as the current
23
  * version of the plugin.
24
  *
25
- * @since 1.0.4
26
  * @package Custom_Widget_Area
27
  * @subpackage Custom_Widget_Area/includes
28
  * @author Your Name <email@example.com>
@@ -33,7 +33,7 @@ class Custom_Widget_Area {
33
  * The loader that's responsible for maintaining and registering all hooks that power
34
  * the plugin.
35
  *
36
- * @since 1.0.4
37
  * @access protected
38
  * @var Custom_Widget_Area_Loader $loader Maintains and registers all hooks for the plugin.
39
  */
@@ -42,7 +42,7 @@ class Custom_Widget_Area {
42
  /**
43
  * The unique identifier of this plugin.
44
  *
45
- * @since 1.0.4
46
  * @access protected
47
  * @var string $plugin_name The string used to uniquely identify this plugin.
48
  */
@@ -51,7 +51,7 @@ class Custom_Widget_Area {
51
  /**
52
  * The current version of the plugin.
53
  *
54
- * @since 1.0.4
55
  * @access protected
56
  * @var string $version The current version of the plugin.
57
  */
@@ -64,12 +64,12 @@ class Custom_Widget_Area {
64
  * Load the dependencies, define the locale, and set the hooks for the Dashboard and
65
  * the public-facing side of the site.
66
  *
67
- * @since 1.0.4
68
  */
69
  public function __construct() {
70
 
71
  $this->plugin_name = 'wp-custom-widget-area';
72
- $this->version = '1.0.4';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
@@ -91,7 +91,7 @@ class Custom_Widget_Area {
91
  * Create an instance of the loader which will be used to register the hooks
92
  * with WordPress.
93
  *
94
- * @since 1.0.4
95
  * @access private
96
  */
97
  private function load_dependencies() {
@@ -125,7 +125,7 @@ class Custom_Widget_Area {
125
  * Uses the Custom_Widget_Area_i18n class in order to set the domain and to register the hook
126
  * with WordPress.
127
  *
128
- * @since 1.0.4
129
  * @access private
130
  */
131
  private function set_locale() {
@@ -141,7 +141,7 @@ class Custom_Widget_Area {
141
  * Register all of the hooks related to the dashboard functionality
142
  * of the plugin.
143
  *
144
- * @since 1.0.4
145
  * @access private
146
  */
147
  private function define_admin_hooks() {
@@ -155,6 +155,7 @@ class Custom_Widget_Area {
155
 
156
  private function register_shortcode() {
157
  add_shortcode( 'cwa', array($this, 'cwa_short') );
 
158
  //exit;
159
 
160
  }
@@ -168,10 +169,26 @@ class Custom_Widget_Area {
168
  return $output;
169
  }
170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  /**
172
  * Run the loader to execute all of the hooks with WordPress.
173
  *
174
- * @since 1.0.4
175
  */
176
  public function run() {
177
  $this->loader->run();
@@ -181,7 +198,7 @@ class Custom_Widget_Area {
181
  * The name of the plugin used to uniquely identify it within the context of
182
  * WordPress and to define internationalization functionality.
183
  *
184
- * @since 1.0.4
185
  * @return string The name of the plugin.
186
  */
187
  public function get_plugin_name() {
@@ -191,7 +208,7 @@ class Custom_Widget_Area {
191
  /**
192
  * The reference to the class that orchestrates the hooks with the plugin.
193
  *
194
- * @since 1.0.4
195
  * @return Custom_Widget_Area_Loader Orchestrates the hooks of the plugin.
196
  */
197
  public function get_loader() {
@@ -201,7 +218,7 @@ class Custom_Widget_Area {
201
  /**
202
  * Retrieve the version number of the plugin.
203
  *
204
- * @since 1.0.4
205
  * @return string The version number of the plugin.
206
  */
207
  public function get_version() {
7
  * public-facing side of the site and the dashboard.
8
  *
9
  * @link http://example.com
10
+ * @since 1.1.0
11
  *
12
  * @package Custom_Widget_Area
13
  * @subpackage Custom_Widget_Area/includes
22
  * Also maintains the unique identifier of this plugin as well as the current
23
  * version of the plugin.
24
  *
25
+ * @since 1.1.0
26
  * @package Custom_Widget_Area
27
  * @subpackage Custom_Widget_Area/includes
28
  * @author Your Name <email@example.com>
33
  * The loader that's responsible for maintaining and registering all hooks that power
34
  * the plugin.
35
  *
36
+ * @since 1.1.0
37
  * @access protected
38
  * @var Custom_Widget_Area_Loader $loader Maintains and registers all hooks for the plugin.
39
  */
42
  /**
43
  * The unique identifier of this plugin.
44
  *
45
+ * @since 1.1.0
46
  * @access protected
47
  * @var string $plugin_name The string used to uniquely identify this plugin.
48
  */
51
  /**
52
  * The current version of the plugin.
53
  *
54
+ * @since 1.1.0
55
  * @access protected
56
  * @var string $version The current version of the plugin.
57
  */
64
  * Load the dependencies, define the locale, and set the hooks for the Dashboard and
65
  * the public-facing side of the site.
66
  *
67
+ * @since 1.1.0
68
  */
69
  public function __construct() {
70
 
71
  $this->plugin_name = 'wp-custom-widget-area';
72
+ $this->version = '1.1.0';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
91
  * Create an instance of the loader which will be used to register the hooks
92
  * with WordPress.
93
  *
94
+ * @since 1.1.0
95
  * @access private
96
  */
97
  private function load_dependencies() {
125
  * Uses the Custom_Widget_Area_i18n class in order to set the domain and to register the hook
126
  * with WordPress.
127
  *
128
+ * @since 1.1.0
129
  * @access private
130
  */
131
  private function set_locale() {
141
  * Register all of the hooks related to the dashboard functionality
142
  * of the plugin.
143
  *
144
+ * @since 1.1.0
145
  * @access private
146
  */
147
  private function define_admin_hooks() {
155
 
156
  private function register_shortcode() {
157
  add_shortcode( 'cwa', array($this, 'cwa_short') );
158
+ add_shortcode( 'menu', array($this, 'menu_short') );
159
  //exit;
160
 
161
  }
169
  return $output;
170
  }
171
 
172
+ public function menu_short($attr){
173
+ //var_dump($attr);
174
+ $args = array();
175
+ foreach ($attr as $key => $value) {
176
+ # code...
177
+ $args[$key] = $value;
178
+ }
179
+ $args['fallback_cb'] = isset($args['fallback_cb'])? $args['fallback_cb'] : false ;
180
+
181
+ ob_start();
182
+ wp_nav_menu( $args );
183
+ $output = ob_get_contents();
184
+ ob_end_clean();
185
+ return $output;
186
+ }
187
+
188
  /**
189
  * Run the loader to execute all of the hooks with WordPress.
190
  *
191
+ * @since 1.1.0
192
  */
193
  public function run() {
194
  $this->loader->run();
198
  * The name of the plugin used to uniquely identify it within the context of
199
  * WordPress and to define internationalization functionality.
200
  *
201
+ * @since 1.1.0
202
  * @return string The name of the plugin.
203
  */
204
  public function get_plugin_name() {
208
  /**
209
  * The reference to the class that orchestrates the hooks with the plugin.
210
  *
211
+ * @since 1.1.0
212
  * @return Custom_Widget_Area_Loader Orchestrates the hooks of the plugin.
213
  */
214
  public function get_loader() {
218
  /**
219
  * Retrieve the version number of the plugin.
220
  *
221
+ * @since 1.1.0
222
  * @return string The version number of the plugin.
223
  */
224
  public function get_version() {
includes/class-wp-custom-widget-area-activator.php CHANGED
@@ -4,7 +4,7 @@
4
  * Fired during plugin activation
5
  *
6
  * @link http://example.com
7
- * @since 1.0.4
8
  *
9
  * @package Custom_Widget_Area
10
  * @subpackage Custom_Widget_Area/includes
@@ -15,7 +15,7 @@
15
  *
16
  * This class defines all code necessary to run during the plugin's activation.
17
  *
18
- * @since 1.0.4
19
  * @package Custom_Widget_Area
20
  * @subpackage Custom_Widget_Area/includes
21
  * @author Your Name <email@example.com>
@@ -27,7 +27,7 @@ class Custom_Widget_Area_Activator {
27
  *
28
  * Long Description.
29
  *
30
- * @since 1.0.4
31
  */
32
  public static function activate() {
33
 
@@ -58,6 +58,7 @@ class Custom_Widget_Area_Activator {
58
  cwa_widget_wrapper varchar(25),
59
  cwa_widget_header_class text,
60
  cwa_widget_header_wrapper varchar(25),
 
61
  last_updated date NOT NULL,
62
  UNIQUE KEY id (id)
63
  ) $charset_collate;";
4
  * Fired during plugin activation
5
  *
6
  * @link http://example.com
7
+ * @since 1.1.0
8
  *
9
  * @package Custom_Widget_Area
10
  * @subpackage Custom_Widget_Area/includes
15
  *
16
  * This class defines all code necessary to run during the plugin's activation.
17
  *
18
+ * @since 1.1.0
19
  * @package Custom_Widget_Area
20
  * @subpackage Custom_Widget_Area/includes
21
  * @author Your Name <email@example.com>
27
  *
28
  * Long Description.
29
  *
30
+ * @since 1.1.0
31
  */
32
  public static function activate() {
33
 
58
  cwa_widget_wrapper varchar(25),
59
  cwa_widget_header_class text,
60
  cwa_widget_header_wrapper varchar(25),
61
+ cwa_type varchar(10),
62
  last_updated date NOT NULL,
63
  UNIQUE KEY id (id)
64
  ) $charset_collate;";
includes/class-wp-custom-widget-area-deactivator.php CHANGED
@@ -4,7 +4,7 @@
4
  * Fired during plugin deactivation
5
  *
6
  * @link http://example.com
7
- * @since 1.0.4
8
  *
9
  * @package Custom_Widget_Area
10
  * @subpackage Custom_Widget_Area/includes
@@ -15,7 +15,7 @@
15
  *
16
  * This class defines all code necessary to run during the plugin's deactivation.
17
  *
18
- * @since 1.0.4
19
  * @package Custom_Widget_Area
20
  * @subpackage Custom_Widget_Area/includes
21
  * @author Your Name <email@example.com>
@@ -27,7 +27,7 @@ class Custom_Widget_Area_Deactivator {
27
  *
28
  * Long Description.
29
  *
30
- * @since 1.0.4
31
  */
32
  public static function deactivate() {
33
 
4
  * Fired during plugin deactivation
5
  *
6
  * @link http://example.com
7
+ * @since 1.1.0
8
  *
9
  * @package Custom_Widget_Area
10
  * @subpackage Custom_Widget_Area/includes
15
  *
16
  * This class defines all code necessary to run during the plugin's deactivation.
17
  *
18
+ * @since 1.1.0
19
  * @package Custom_Widget_Area
20
  * @subpackage Custom_Widget_Area/includes
21
  * @author Your Name <email@example.com>
27
  *
28
  * Long Description.
29
  *
30
+ * @since 1.1.0
31
  */
32
  public static function deactivate() {
33
 
includes/class-wp-custom-widget-area-i18n.php CHANGED
@@ -7,7 +7,7 @@
7
  * so that its ready for translation.
8
  *
9
  * @link http://example.com
10
- * @since 1.0.4
11
  *
12
  * @package Custom_Widget_Area
13
  * @subpackage Custom_Widget_Area/includes
@@ -19,7 +19,7 @@
19
  * Loads and defines the internationalization files for this plugin
20
  * so that its ready for translation.
21
  *
22
- * @since 1.0.4
23
  * @package Custom_Widget_Area
24
  * @subpackage Custom_Widget_Area/includes
25
  * @author Your Name <email@example.com>
@@ -29,7 +29,7 @@ class Custom_Widget_Area_i18n {
29
  /**
30
  * The domain specified for this plugin.
31
  *
32
- * @since 1.0.4
33
  * @access private
34
  * @var string $domain The domain identifier for this plugin.
35
  */
@@ -38,7 +38,7 @@ class Custom_Widget_Area_i18n {
38
  /**
39
  * Load the plugin text domain for translation.
40
  *
41
- * @since 1.0.4
42
  */
43
  public function load_plugin_textdomain() {
44
 
@@ -53,7 +53,7 @@ class Custom_Widget_Area_i18n {
53
  /**
54
  * Set the domain equal to that of the specified domain.
55
  *
56
- * @since 1.0.4
57
  * @param string $domain The domain that represents the locale of this plugin.
58
  */
59
  public function set_domain( $domain ) {
7
  * so that its ready for translation.
8
  *
9
  * @link http://example.com
10
+ * @since 1.1.0
11
  *
12
  * @package Custom_Widget_Area
13
  * @subpackage Custom_Widget_Area/includes
19
  * Loads and defines the internationalization files for this plugin
20
  * so that its ready for translation.
21
  *
22
+ * @since 1.1.0
23
  * @package Custom_Widget_Area
24
  * @subpackage Custom_Widget_Area/includes
25
  * @author Your Name <email@example.com>
29
  /**
30
  * The domain specified for this plugin.
31
  *
32
+ * @since 1.1.0
33
  * @access private
34
  * @var string $domain The domain identifier for this plugin.
35
  */
38
  /**
39
  * Load the plugin text domain for translation.
40
  *
41
+ * @since 1.1.0
42
  */
43
  public function load_plugin_textdomain() {
44
 
53
  /**
54
  * Set the domain equal to that of the specified domain.
55
  *
56
+ * @since 1.1.0
57
  * @param string $domain The domain that represents the locale of this plugin.
58
  */
59
  public function set_domain( $domain ) {
includes/class-wp-custom-widget-area-loader.php CHANGED
@@ -4,7 +4,7 @@
4
  * Register all actions and filters for the plugin
5
  *
6
  * @link http://example.com
7
- * @since 1.0.4
8
  *
9
  * @package Custom_Widget_Area
10
  * @subpackage Custom_Widget_Area/includes
@@ -26,7 +26,7 @@ class Custom_Widget_Area_Loader {
26
  /**
27
  * The array of actions registered with WordPress.
28
  *
29
- * @since 1.0.4
30
  * @access protected
31
  * @var array $actions The actions registered with WordPress to fire when the plugin loads.
32
  */
@@ -35,7 +35,7 @@ class Custom_Widget_Area_Loader {
35
  /**
36
  * The array of filters registered with WordPress.
37
  *
38
- * @since 1.0.4
39
  * @access protected
40
  * @var array $filters The filters registered with WordPress to fire when the plugin loads.
41
  */
@@ -44,7 +44,7 @@ class Custom_Widget_Area_Loader {
44
  /**
45
  * Initialize the collections used to maintain the actions and filters.
46
  *
47
- * @since 1.0.4
48
  */
49
  public function __construct() {
50
 
@@ -56,7 +56,7 @@ class Custom_Widget_Area_Loader {
56
  /**
57
  * Add a new action to the collection to be registered with WordPress.
58
  *
59
- * @since 1.0.4
60
  * @var string $hook The name of the WordPress action that is being registered.
61
  * @var object $component A reference to the instance of the object on which the action is defined.
62
  * @var string $callback The name of the function definition on the $component.
@@ -70,7 +70,7 @@ class Custom_Widget_Area_Loader {
70
  /**
71
  * Add a new filter to the collection to be registered with WordPress.
72
  *
73
- * @since 1.0.4
74
  * @var string $hook The name of the WordPress filter that is being registered.
75
  * @var object $component A reference to the instance of the object on which the filter is defined.
76
  * @var string $callback The name of the function definition on the $component.
@@ -85,7 +85,7 @@ class Custom_Widget_Area_Loader {
85
  * A utility function that is used to register the actions and hooks into a single
86
  * collection.
87
  *
88
- * @since 1.0.4
89
  * @access private
90
  * @var array $hooks The collection of hooks that is being registered (that is, actions or filters).
91
  * @var string $hook The name of the WordPress filter that is being registered.
@@ -112,7 +112,7 @@ class Custom_Widget_Area_Loader {
112
  /**
113
  * Register the filters and actions with WordPress.
114
  *
115
- * @since 1.0.4
116
  */
117
  public function run() {
118
 
4
  * Register all actions and filters for the plugin
5
  *
6
  * @link http://example.com
7
+ * @since 1.1.0
8
  *
9
  * @package Custom_Widget_Area
10
  * @subpackage Custom_Widget_Area/includes
26
  /**
27
  * The array of actions registered with WordPress.
28
  *
29
+ * @since 1.1.0
30
  * @access protected
31
  * @var array $actions The actions registered with WordPress to fire when the plugin loads.
32
  */
35
  /**
36
  * The array of filters registered with WordPress.
37
  *
38
+ * @since 1.1.0
39
  * @access protected
40
  * @var array $filters The filters registered with WordPress to fire when the plugin loads.
41
  */
44
  /**
45
  * Initialize the collections used to maintain the actions and filters.
46
  *
47
+ * @since 1.1.0
48
  */
49
  public function __construct() {
50
 
56
  /**
57
  * Add a new action to the collection to be registered with WordPress.
58
  *
59
+ * @since 1.1.0
60
  * @var string $hook The name of the WordPress action that is being registered.
61
  * @var object $component A reference to the instance of the object on which the action is defined.
62
  * @var string $callback The name of the function definition on the $component.
70
  /**
71
  * Add a new filter to the collection to be registered with WordPress.
72
  *
73
+ * @since 1.1.0
74
  * @var string $hook The name of the WordPress filter that is being registered.
75
  * @var object $component A reference to the instance of the object on which the filter is defined.
76
  * @var string $callback The name of the function definition on the $component.
85
  * A utility function that is used to register the actions and hooks into a single
86
  * collection.
87
  *
88
+ * @since 1.1.0
89
  * @access private
90
  * @var array $hooks The collection of hooks that is being registered (that is, actions or filters).
91
  * @var string $hook The name of the WordPress filter that is being registered.
112
  /**
113
  * Register the filters and actions with WordPress.
114
  *
115
+ * @since 1.1.0
116
  */
117
  public function run() {
118
 
includes/config.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*plugin configs*/
3
- $kz_db_version = '1.0.4';
4
  $table_name = $wpdb->prefix . 'cwa';
5
  $charset_collate = '';
6
  ?>
1
  <?php
2
  /*plugin configs*/
3
+ $kz_db_version = '1.1.0';
4
  $table_name = $wpdb->prefix . 'cwa';
5
  $charset_collate = '';
6
  ?>
uninstall.php CHANGED
@@ -20,7 +20,7 @@
20
  * https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
21
  *
22
  * @link http://example.com
23
- * @since 1.0.4
24
  *
25
  * @package Custom_Widget_Area
26
  */
20
  * https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
21
  *
22
  * @link http://example.com
23
+ * @since 1.1.0
24
  *
25
  * @package Custom_Widget_Area
26
  */
wp-custom-widget-area.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: WP Custom Widget area
17
  * Plugin URI: http://kishorkhambu.com.np/plugins/
18
  * Description: A wordpress plugin to create custom dynamic widget area.
19
- * Version: 1.0.4
20
  * Author: Kishor Khambu
21
  * Author URI: http://kishorkhambu.com.np
22
  * License: GPL-2.0+
@@ -60,7 +60,7 @@ require_once plugin_dir_path( __FILE__ ) . 'includes/class-custom-widget-area.ph
60
  * then kicking off the plugin from this point in the file does
61
  * not affect the page life cycle.
62
  *
63
- * @since 1.0.4
64
  */
65
  function run_plugin_name() {
66
  $plugin = new Custom_Widget_Area();
16
  * Plugin Name: WP Custom Widget area
17
  * Plugin URI: http://kishorkhambu.com.np/plugins/
18
  * Description: A wordpress plugin to create custom dynamic widget area.
19
+ * Version: 1.1.0
20
  * Author: Kishor Khambu
21
  * Author URI: http://kishorkhambu.com.np
22
  * License: GPL-2.0+
60
  * then kicking off the plugin from this point in the file does
61
  * not affect the page life cycle.
62
  *
63
+ * @since 1.1.0
64
  */
65
  function run_plugin_name() {
66
  $plugin = new Custom_Widget_Area();