WP Custom Widget area - Version 1.1.5

Version Description

  • delete script bug fix
Download this release

Release Info

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

Code changes from version 1.1.2 to 1.1.5

README.md ADDED
File without changes
README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: krozero
3
  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
4
  Requires at least: 3.0.1
5
  Tested up to: 4.2.2
6
- Stable tag: 1.1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -72,6 +72,18 @@ It allows you to show custom widget areas and menu locations created with this p
72
 
73
  == Changelog ==
74
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  = 1.1.2 =
76
  * database bug fix for v 1.1.0 and 1.1.1
77
 
@@ -103,6 +115,18 @@ It allows you to show custom widget areas and menu locations created with this p
103
 
104
  == Upgrade Notice ==
105
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  = 1.1.2 =
107
  * database bug fix for v 1.1.0 and 1.1.1
108
 
3
  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
4
  Requires at least: 3.0.1
5
  Tested up to: 4.2.2
6
+ Stable tag: 1.1.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
72
 
73
  == Changelog ==
74
 
75
+ = 1.1.5 =
76
+ * delete script bug fix
77
+
78
+ = 1.1.4 =
79
+ * database table upgrade bug fix
80
+ * form and js bug fix
81
+
82
+ = 1.1.3 =
83
+ * widget area bug fix
84
+ * improved user interface
85
+ * easy and simple how to use help guide
86
+
87
  = 1.1.2 =
88
  * database bug fix for v 1.1.0 and 1.1.1
89
 
115
 
116
  == Upgrade Notice ==
117
 
118
+ = 1.1.5 =
119
+ * delete script bug fix
120
+
121
+ = 1.1.4 =
122
+ * database table upgrade bug fix
123
+ * form and js bug fix
124
+
125
+ = 1.1.3 =
126
+ * widget area bug fix
127
+ * improved user interface
128
+ * easy and simple how to use help guide
129
+
130
  = 1.1.2 =
131
  * database bug fix for v 1.1.0 and 1.1.1
132
 
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.1.2
8
  *
9
  * @package Custom_Widget_Area
10
  * @subpackage Custom_Widget_Area/admin
@@ -23,12 +23,13 @@
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.2
32
  * @access private
33
  * @var string $plugin_name The ID of this plugin.
34
  */
@@ -37,7 +38,7 @@ class Custom_Widget_Area_Admin {
37
  /**
38
  * The version of this plugin.
39
  *
40
- * @since 1.1.2
41
  * @access private
42
  * @var string $version The current version of this plugin.
43
  */
@@ -46,7 +47,7 @@ class Custom_Widget_Area_Admin {
46
  /**
47
  * Initialize the class and set its properties.
48
  *
49
- * @since 1.1.2
50
  * @var string $plugin_name The name of this plugin.
51
  * @var string $version The version of this plugin.
52
  */
@@ -57,17 +58,19 @@ class Custom_Widget_Area_Admin {
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(){
71
  add_action( 'wp_ajax_add_cwa', array($this, 'add_cwa'));
72
 
73
  add_action( 'wp_ajax_delete_cwa', array($this, 'delete_cwa'));
@@ -126,7 +129,7 @@ class Custom_Widget_Area_Admin {
126
  $cwa_id = esc_html($_POST['data']['cwa_id']);
127
 
128
 
129
- $row = $wpdb->delete( $table_name, array( 'cwa_id' => $cwa_id ), $where_format = null );
130
  //wp_send_json_success(array('code' => 1, 'message' => $cwa_id.' deleted successfully.'));
131
 
132
  if($row>0)
@@ -146,7 +149,7 @@ class Custom_Widget_Area_Admin {
146
 
147
  $valid = self::checSpecialChar($cwa_id);
148
 
149
- if($valid){
150
 
151
  $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id' AND cwa_type='widget'";
152
 
@@ -167,6 +170,15 @@ class Custom_Widget_Area_Admin {
167
  return true;
168
  }
169
  }
 
 
 
 
 
 
 
 
 
170
  else{
171
  if(empty($id)){
172
  wp_send_json(array('code' => 0, 'message' => 'Invalid id, use [a-z]-[0-9]'));
@@ -255,13 +267,13 @@ class Custom_Widget_Area_Admin {
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
  }
@@ -275,13 +287,13 @@ class Custom_Widget_Area_Admin {
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'));
@@ -296,6 +308,14 @@ class Custom_Widget_Area_Admin {
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]'));
@@ -304,6 +324,7 @@ class Custom_Widget_Area_Admin {
304
  return false;
305
  }
306
  }
 
307
  }
308
  public function get_menu(){
309
  global $wpdb;
@@ -345,7 +366,7 @@ class Custom_Widget_Area_Admin {
345
  return $new_data;
346
  }
347
  public function checSpecialChar($string){
348
- if(!preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬]/', $string)){
349
  return true;
350
  }
351
  else{
@@ -355,7 +376,7 @@ class Custom_Widget_Area_Admin {
355
  /**
356
  * Register the stylesheets for the Dashboard.
357
  *
358
- * @since 1.1.2
359
  */
360
  public function enqueue_styles() {
361
 
@@ -378,7 +399,7 @@ class Custom_Widget_Area_Admin {
378
  /**
379
  * Register the JavaScript for the dashboard.
380
  *
381
- * @since 1.1.2
382
  */
383
  public function enqueue_scripts() {
384
 
@@ -394,7 +415,9 @@ class Custom_Widget_Area_Admin {
394
  * class.
395
  */
396
  wp_enqueue_script( 'tooltip', plugin_dir_url( __FILE__ ) . 'js/jquery.tooltipster.min.js', array( ), $this->version, false );
397
- wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wp-custom-widget-area-admin.js', array( 'jquery', 'tooltip'), $this->version, false );
 
 
398
 
399
  }
400
 
4
  * The dashboard-specific functionality of the plugin.
5
  *
6
  * @link http://example.com
7
+ * @since 1.1.5
8
  *
9
  * @package Custom_Widget_Area
10
  * @subpackage Custom_Widget_Area/admin
23
 
24
  require_once('partials/cwa-admin-display.php');
25
  require_once('partials/cwa-menu-admin-display.php');
26
+ require_once('partials/cwa-help.php');
27
  class Custom_Widget_Area_Admin {
28
 
29
  /**
30
  * The ID of this plugin.
31
  *
32
+ * @since 1.1.5
33
  * @access private
34
  * @var string $plugin_name The ID of this plugin.
35
  */
38
  /**
39
  * The version of this plugin.
40
  *
41
+ * @since 1.1.5
42
  * @access private
43
  * @var string $version The current version of this plugin.
44
  */
47
  /**
48
  * Initialize the class and set its properties.
49
  *
50
+ * @since 1.1.5
51
  * @var string $plugin_name The name of this plugin.
52
  * @var string $version The version of this plugin.
53
  */
58
  $this->plugin_name = $plugin_name;
59
  $this->version = $version;
60
  $this->table_name = $table_name;
61
+ $this->setup_ajax_request();
62
  add_action( 'widgets_init', array($this, 'registerSidebar'));
63
  $this->registerMenuLocations();
64
  }
65
  public function menu_setup(){
66
 
67
+ add_menu_page('CWA Settings', 'CWA Settings', 'administrator', 'custom_widget_area', array($this->view, 'displayView'),''/*plugins_url('/images/icon.png', __FILE__)*/);
68
+ add_submenu_page( 'custom_widget_area', 'Custom Widget Area', 'Custom Widget Area', 'administrator', 'custom_widget_area', array($this->view, 'displayView') );
69
+ add_submenu_page( 'custom_widget_area', 'Menu Locations', 'Menu Locations', 'administrator', 'custom_menu_location', array($this->menuView, 'displayView') );
70
+ add_submenu_page( 'custom_widget_area', 'Help', 'Help', 'manage_options', 'cwa_help', 'help_page');
71
+ //self::setuo_ajax_request();
72
  }
73
+ public function setup_ajax_request(){
74
  add_action( 'wp_ajax_add_cwa', array($this, 'add_cwa'));
75
 
76
  add_action( 'wp_ajax_delete_cwa', array($this, 'delete_cwa'));
129
  $cwa_id = esc_html($_POST['data']['cwa_id']);
130
 
131
 
132
+ $row = $wpdb->delete( $table_name, array( 'cwa_id' => $cwa_id, 'cwa_type' => 'widget' ), $where_format = null );
133
  //wp_send_json_success(array('code' => 1, 'message' => $cwa_id.' deleted successfully.'));
134
 
135
  if($row>0)
149
 
150
  $valid = self::checSpecialChar($cwa_id);
151
 
152
+ if($valid && !empty($cwa_id)){
153
 
154
  $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id' AND cwa_type='widget'";
155
 
170
  return true;
171
  }
172
  }
173
+ elseif (empty($cwa_id)) {
174
+ # code...
175
+ if(empty($id)){
176
+ wp_send_json(array('code' => 0, 'message' => 'Please enter a Widget id '));
177
+ }
178
+ else{
179
+ return false;
180
+ }
181
+ }
182
  else{
183
  if(empty($id)){
184
  wp_send_json(array('code' => 0, 'message' => 'Invalid id, use [a-z]-[0-9]'));
267
  $cwa_id = esc_html($_POST['data']['cwa_id']);
268
 
269
 
270
+ $row = $wpdb->delete( $table_name, array( 'cwa_id' => $cwa_id, 'cwa_type' => 'menu' ), $where_format = null );
271
  //wp_send_json_success(array('code' => 1, 'message' => $cwa_id.' deleted successfully.'));
272
 
273
  if($row>0)
274
  wp_send_json(array('code' => 1, 'message' => $cwa_id.' deleted successfully.'));
275
  else
276
+ wp_send_json(array('code' => 0, 'message' => $row));
277
 
278
  die();
279
  }
287
 
288
  $valid = self::checSpecialChar($cwa_id);
289
 
290
+ if($valid && !empty($cwa_id)){
291
 
292
  $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id' AND cwa_type='menu'";
293
 
294
 
295
  $row = $wpdb->get_row( $sql, 'OBJECT');
296
+ //wp_send_json(!!$cwa_id);die();
297
  if(empty($id)){
298
  if($row)
299
  wp_send_json(array('code' => 0, 'message' => 'Menu Location id already registered'));
308
  return true;
309
  }
310
  }
311
+ elseif(empty($cwa_id)){
312
+ if(empty($id)){
313
+ wp_send_json(array('code' => 0, 'message' => 'Please enter a Menu Location id'));
314
+ }
315
+ else{
316
+ return false;
317
+ }
318
+ }
319
  else{
320
  if(empty($id)){
321
  wp_send_json(array('code' => 0, 'message' => 'Invalid id, use [a-z]-[0-9]'));
324
  return false;
325
  }
326
  }
327
+ die;
328
  }
329
  public function get_menu(){
330
  global $wpdb;
366
  return $new_data;
367
  }
368
  public function checSpecialChar($string){
369
+ if(!preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬ ]/', $string)){
370
  return true;
371
  }
372
  else{
376
  /**
377
  * Register the stylesheets for the Dashboard.
378
  *
379
+ * @since 1.1.5
380
  */
381
  public function enqueue_styles() {
382
 
399
  /**
400
  * Register the JavaScript for the dashboard.
401
  *
402
+ * @since 1.1.5
403
  */
404
  public function enqueue_scripts() {
405
 
415
  * class.
416
  */
417
  wp_enqueue_script( 'tooltip', plugin_dir_url( __FILE__ ) . 'js/jquery.tooltipster.min.js', array( ), $this->version, false );
418
+ wp_enqueue_script( 'hashchange', plugin_dir_url( __FILE__ ) . 'js/jquery.hashchange.min.js', array( ), $this->version, false );
419
+ wp_enqueue_script( 'easytabs', plugin_dir_url( __FILE__ ) . 'js/jquery.easytabs.min.js', array( 'hashchange'), $this->version, false );
420
+ wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wp-custom-widget-area-admin.js', array( 'jquery', 'tooltip', 'easytabs'), $this->version, false );
421
 
422
  }
423
 
admin/css/wp-custom-widget-area-admin.css CHANGED
@@ -125,7 +125,7 @@
125
  }
126
  .how-to{
127
  padding: 2em;
128
- background: #ddd;
129
  border-radius: 5px;
130
  color: #333;
131
  //transition: all 0.5s ease;
@@ -138,7 +138,7 @@
138
  position: absolute;
139
  content: "";
140
  height: 40px;
141
- background: #ddd;
142
  width: 100%;
143
  bottom: 0;
144
  left: 0;
@@ -147,3 +147,54 @@
147
  height: 320px;
148
  }
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
126
  .how-to{
127
  padding: 2em;
128
+ //background: #ddd;
129
  border-radius: 5px;
130
  color: #333;
131
  //transition: all 0.5s ease;
138
  position: absolute;
139
  content: "";
140
  height: 40px;
141
+ //background: #ddd;
142
  width: 100%;
143
  bottom: 0;
144
  left: 0;
147
  height: 320px;
148
  }
149
 
150
+ .tabs li{
151
+ display: inline-block;
152
+ margin-bottom: 0;
153
+ background: #fff;
154
+ border-top: 1px solid #e5e5e5;
155
+ border-left: 1px solid #e5e5e5;
156
+ border-right: 1px solid #e5e5e5;
157
+ }
158
+ .tabs li.active{
159
+ position: relative;
160
+ z-index: 5;
161
+ }
162
+ .tabs{
163
+ margin-bottom: -1px;
164
+ }
165
+ .tabs li a{
166
+ padding: 10px 20px;
167
+ text-decoration: none;
168
+ }
169
+ .cwa .welcome-panel{
170
+ margin-top: 0;
171
+ }
172
+
173
+ .tab-container{
174
+
175
+ }
176
+ .etabs { margin: 0; padding: 0; }
177
+ .tab { display: inline-block; zoom:1; *display:inline; background: #eee; border: solid 1px #e5e5e5 ; border-bottom: none; -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; margin-bottom: 0; }
178
+ .tab a { font-size: 14px; line-height: 2em; display: block; padding: 5px 10px; outline: none; text-decoration: none; }
179
+ .tab.active { background: #fff; position: relative; top: 1px; border-color: #e5e5e5; }
180
+ .tab a.active { font-weight: bold; padding-top: 12px; }
181
+ .tab-container .panel-container { background: #fff; border: solid #666 1px; padding: 10px; -moz-border-radius: 0 4px 4px 4px; -webkit-border-radius: 0 4px 4px 4px; }
182
+ .tab a .dashicons-before:before{
183
+ vertical-align: top;
184
+ font-size: 24px;
185
+ margin-right: 5px;
186
+ }
187
+
188
+ .tab-content{
189
+ border: solid 1px #e5e5e5 ;
190
+ padding: 20px 10px;
191
+ }
192
+
193
+ .help-page img{
194
+ max-width: 1100px;
195
+ width: 100%;
196
+ min-width: 500px;
197
+ }
198
+ .no-data{
199
+ color: #999;
200
+ }
admin/img/help/cwa.png ADDED
Binary file
admin/img/help/cwa_1_advance.png ADDED
Binary file
admin/img/help/cwa_2.png ADDED
Binary file
admin/img/help/cwa_3.png ADDED
Binary file
admin/img/help/cwa_4.png ADDED
Binary file
admin/img/help/cwa_manage_widget.png ADDED
Binary file
admin/img/help/cwa_menu.png ADDED
Binary file
admin/img/help/cwa_menu_1.png ADDED
Binary file
admin/img/help/cwa_menu_3.png ADDED
Binary file
admin/img/help/cwa_menu_4.png ADDED
Binary file
admin/img/help/cwa_menu_admin.png ADDED
Binary file
admin/img/help/cwa_menu_codebase.png ADDED
Binary file
admin/img/help/cwa_menu_shortcode_admin.png ADDED
Binary file
admin/img/help/cwa_widget_codebase.png ADDED
Binary file
admin/img/help/cwa_widget_display.png ADDED
Binary file
admin/img/help/cwa_widget_shortcode_admin.png ADDED
Binary file
admin/img/help/cwa_widget_shortcode_display.png ADDED
Binary file
admin/js/jquery.easytabs.min.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery EasyTabs plugin 3.2.0
3
+ *
4
+ * Copyright (c) 2010-2011 Steve Schwartz (JangoSteve)
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ *
10
+ * Date: Thu May 09 17:30:00 2013 -0500
11
+ */
12
+ (function(a){a.easytabs=function(j,e){var f=this,q=a(j),i={animate:true,panelActiveClass:"active",tabActiveClass:"active",defaultTab:"li:first-child",animationSpeed:"normal",tabs:"> ul > li",updateHash:true,cycle:false,collapsible:false,collapsedClass:"collapsed",collapsedByDefault:true,uiTabs:false,transitionIn:"fadeIn",transitionOut:"fadeOut",transitionInEasing:"swing",transitionOutEasing:"swing",transitionCollapse:"slideUp",transitionUncollapse:"slideDown",transitionCollapseEasing:"swing",transitionUncollapseEasing:"swing",containerClass:"",tabsClass:"",tabClass:"",panelClass:"",cache:true,event:"click",panelContext:q},h,l,v,m,d,t={fast:200,normal:400,slow:600},r;f.init=function(){f.settings=r=a.extend({},i,e);r.bind_str=r.event+".easytabs";if(r.uiTabs){r.tabActiveClass="ui-tabs-selected";r.containerClass="ui-tabs ui-widget ui-widget-content ui-corner-all";r.tabsClass="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all";r.tabClass="ui-state-default ui-corner-top";r.panelClass="ui-tabs-panel ui-widget-content ui-corner-bottom"}if(r.collapsible&&e.defaultTab!==undefined&&e.collpasedByDefault===undefined){r.collapsedByDefault=false}if(typeof(r.animationSpeed)==="string"){r.animationSpeed=t[r.animationSpeed]}a("a.anchor").remove().prependTo("body");q.data("easytabs",{});f.setTransitions();f.getTabs();b();g();w();n();c();q.attr("data-easytabs",true)};f.setTransitions=function(){v=(r.animate)?{show:r.transitionIn,hide:r.transitionOut,speed:r.animationSpeed,collapse:r.transitionCollapse,uncollapse:r.transitionUncollapse,halfSpeed:r.animationSpeed/2}:{show:"show",hide:"hide",speed:0,collapse:"hide",uncollapse:"show",halfSpeed:0}};f.getTabs=function(){var x;f.tabs=q.find(r.tabs),f.panels=a(),f.tabs.each(function(){var A=a(this),z=A.children("a"),y=A.children("a").data("target");A.data("easytabs",{});if(y!==undefined&&y!==null){A.data("easytabs").ajax=z.attr("href")}else{y=z.attr("href")}y=y.match(/#([^\?]+)/)[1];x=r.panelContext.find("#"+y);if(x.length){x.data("easytabs",{position:x.css("position"),visibility:x.css("visibility")});x.not(r.panelActiveClass).hide();f.panels=f.panels.add(x);A.data("easytabs").panel=x}else{f.tabs=f.tabs.not(A);if("console" in window){console.warn("Warning: tab without matching panel for selector '#"+y+"' removed from set")}}})};f.selectTab=function(x,C){var y=window.location,B=y.hash.match(/^[^\?]*/)[0],z=x.parent().data("easytabs").panel,A=x.parent().data("easytabs").ajax;if(r.collapsible&&!d&&(x.hasClass(r.tabActiveClass)||x.hasClass(r.collapsedClass))){f.toggleTabCollapse(x,z,A,C)}else{if(!x.hasClass(r.tabActiveClass)||!z.hasClass(r.panelActiveClass)){o(x,z,A,C)}else{if(!r.cache){o(x,z,A,C)}}}};f.toggleTabCollapse=function(x,y,z,A){f.panels.stop(true,true);if(u(q,"easytabs:before",[x,y,r])){f.tabs.filter("."+r.tabActiveClass).removeClass(r.tabActiveClass).children().removeClass(r.tabActiveClass);if(x.hasClass(r.collapsedClass)){if(z&&(!r.cache||!x.parent().data("easytabs").cached)){q.trigger("easytabs:ajax:beforeSend",[x,y]);y.load(z,function(C,B,D){x.parent().data("easytabs").cached=true;q.trigger("easytabs:ajax:complete",[x,y,C,B,D])})}x.parent().removeClass(r.collapsedClass).addClass(r.tabActiveClass).children().removeClass(r.collapsedClass).addClass(r.tabActiveClass);y.addClass(r.panelActiveClass)[v.uncollapse](v.speed,r.transitionUncollapseEasing,function(){q.trigger("easytabs:midTransition",[x,y,r]);if(typeof A=="function"){A()}})}else{x.addClass(r.collapsedClass).parent().addClass(r.collapsedClass);y.removeClass(r.panelActiveClass)[v.collapse](v.speed,r.transitionCollapseEasing,function(){q.trigger("easytabs:midTransition",[x,y,r]);if(typeof A=="function"){A()}})}}};f.matchTab=function(x){return f.tabs.find("[href='"+x+"'],[data-target='"+x+"']").first()};f.matchInPanel=function(x){return(x&&f.validId(x)?f.panels.filter(":has("+x+")").first():[])};f.validId=function(x){return x.substr(1).match(/^[A-Za-z]+[A-Za-z0-9\-_:\.].$/)};f.selectTabFromHashChange=function(){var y=window.location.hash.match(/^[^\?]*/)[0],x=f.matchTab(y),z;if(r.updateHash){if(x.length){d=true;f.selectTab(x)}else{z=f.matchInPanel(y);if(z.length){y="#"+z.attr("id");x=f.matchTab(y);d=true;f.selectTab(x)}else{if(!h.hasClass(r.tabActiveClass)&&!r.cycle){if(y===""||f.matchTab(m).length||q.closest(y).length){d=true;f.selectTab(l)}}}}}};f.cycleTabs=function(x){if(r.cycle){x=x%f.tabs.length;$tab=a(f.tabs[x]).children("a").first();d=true;f.selectTab($tab,function(){setTimeout(function(){f.cycleTabs(x+1)},r.cycle)})}};f.publicMethods={select:function(x){var y;if((y=f.tabs.filter(x)).length===0){if((y=f.tabs.find("a[href='"+x+"']")).length===0){if((y=f.tabs.find("a"+x)).length===0){if((y=f.tabs.find("[data-target='"+x+"']")).length===0){if((y=f.tabs.find("a[href$='"+x+"']")).length===0){a.error("Tab '"+x+"' does not exist in tab set")}}}}}else{y=y.children("a").first()}f.selectTab(y)}};var u=function(A,x,z){var y=a.Event(x);A.trigger(y,z);return y.result!==false};var b=function(){q.addClass(r.containerClass);f.tabs.parent().addClass(r.tabsClass);f.tabs.addClass(r.tabClass);f.panels.addClass(r.panelClass)};var g=function(){var y=window.location.hash.match(/^[^\?]*/)[0],x=f.matchTab(y).parent(),z;if(x.length===1){h=x;r.cycle=false}else{z=f.matchInPanel(y);if(z.length){y="#"+z.attr("id");h=f.matchTab(y).parent()}else{h=f.tabs.parent().find(r.defaultTab);if(h.length===0){a.error("The specified default tab ('"+r.defaultTab+"') could not be found in the tab set ('"+r.tabs+"') out of "+f.tabs.length+" tabs.")}}}l=h.children("a").first();p(x)};var p=function(z){var y,x;if(r.collapsible&&z.length===0&&r.collapsedByDefault){h.addClass(r.collapsedClass).children().addClass(r.collapsedClass)}else{y=a(h.data("easytabs").panel);x=h.data("easytabs").ajax;if(x&&(!r.cache||!h.data("easytabs").cached)){q.trigger("easytabs:ajax:beforeSend",[l,y]);y.load(x,function(B,A,C){h.data("easytabs").cached=true;q.trigger("easytabs:ajax:complete",[l,y,B,A,C])})}h.data("easytabs").panel.show().addClass(r.panelActiveClass);h.addClass(r.tabActiveClass).children().addClass(r.tabActiveClass)}q.trigger("easytabs:initialised",[l,y])};var w=function(){f.tabs.children("a").bind(r.bind_str,function(x){r.cycle=false;d=false;f.selectTab(a(this));x.preventDefault?x.preventDefault():x.returnValue=false})};var o=function(z,D,E,H){f.panels.stop(true,true);if(u(q,"easytabs:before",[z,D,r])){var A=f.panels.filter(":visible"),y=D.parent(),F,x,C,G,B=window.location.hash.match(/^[^\?]*/)[0];if(r.animate){F=s(D);x=A.length?k(A):0;C=F-x}m=B;G=function(){q.trigger("easytabs:midTransition",[z,D,r]);if(r.animate&&r.transitionIn=="fadeIn"){if(C<0){y.animate({height:y.height()+C},v.halfSpeed).css({"min-height":""})}}if(r.updateHash&&!d){window.location.hash="#"+D.attr("id")}else{d=false}D[v.show](v.speed,r.transitionInEasing,function(){y.css({height:"","min-height":""});q.trigger("easytabs:after",[z,D,r]);if(typeof H=="function"){H()}})};if(E&&(!r.cache||!z.parent().data("easytabs").cached)){q.trigger("easytabs:ajax:beforeSend",[z,D]);D.load(E,function(J,I,K){z.parent().data("easytabs").cached=true;q.trigger("easytabs:ajax:complete",[z,D,J,I,K])})}if(r.animate&&r.transitionOut=="fadeOut"){if(C>0){y.animate({height:(y.height()+C)},v.halfSpeed)}else{y.css({"min-height":y.height()})}}f.tabs.filter("."+r.tabActiveClass).removeClass(r.tabActiveClass).children().removeClass(r.tabActiveClass);f.tabs.filter("."+r.collapsedClass).removeClass(r.collapsedClass).children().removeClass(r.collapsedClass);z.parent().addClass(r.tabActiveClass).children().addClass(r.tabActiveClass);f.panels.filter("."+r.panelActiveClass).removeClass(r.panelActiveClass);D.addClass(r.panelActiveClass);if(A.length){A[v.hide](v.speed,r.transitionOutEasing,G)}else{D[v.uncollapse](v.speed,r.transitionUncollapseEasing,G)}}};var s=function(z){if(z.data("easytabs")&&z.data("easytabs").lastHeight){return z.data("easytabs").lastHeight}var B=z.css("display"),y,x;try{y=a("<div></div>",{position:"absolute",visibility:"hidden",overflow:"hidden"})}catch(A){y=a("<div></div>",{visibility:"hidden",overflow:"hidden"})}x=z.wrap(y).css({position:"relative",visibility:"hidden",display:"block"}).outerHeight();z.unwrap();z.css({position:z.data("easytabs").position,visibility:z.data("easytabs").visibility,display:B});z.data("easytabs").lastHeight=x;return x};var k=function(y){var x=y.outerHeight();if(y.data("easytabs")){y.data("easytabs").lastHeight=x}else{y.data("easytabs",{lastHeight:x})}return x};var n=function(){if(typeof a(window).hashchange==="function"){a(window).hashchange(function(){f.selectTabFromHashChange()})}else{if(a.address&&typeof a.address.change==="function"){a.address.change(function(){f.selectTabFromHashChange()})}}};var c=function(){var x;if(r.cycle){x=f.tabs.index(h);setTimeout(function(){f.cycleTabs(x+1)},r.cycle)}};f.init()};a.fn.easytabs=function(c){var b=arguments;return this.each(function(){var e=a(this),d=e.data("easytabs");if(undefined===d){d=new a.easytabs(this,c);e.data("easytabs",d)}if(d.publicMethods[c]){return d.publicMethods[c](Array.prototype.slice.call(b,1))}})}})(jQuery);
admin/js/jquery.hashchange.min.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery hashchange event - v1.3 - 7/21/2010
3
+ * http://benalman.com/projects/jquery-hashchange-plugin/
4
+ *
5
+ * Copyright (c) 2010 "Cowboy" Ben Alman
6
+ * Dual licensed under the MIT and GPL licenses.
7
+ * http://benalman.com/about/license/
8
+ */
9
+ (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
admin/js/wp-custom-widget-area-admin.js CHANGED
@@ -1,9 +1,3 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
  (function( $ ) {
8
  'use strict';
9
 
@@ -60,7 +54,9 @@
60
  }
61
 
62
  });
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();
@@ -71,9 +67,9 @@
71
  }
72
 
73
  });
74
- $('#cwa-form input[name=cwa_id]').on('change', function(){
75
  var self = this;
76
- checkId(self, $(self).val());
77
  });
78
 
79
 
@@ -88,6 +84,17 @@
88
  reloadCwaTable();
89
  });
90
  });
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  $('#cwa-advance-btn').on('click', function(e){
93
  e.preventDefault();
@@ -115,7 +122,7 @@
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
 
@@ -138,7 +145,11 @@
138
 
139
  });
140
 
141
-
 
 
 
 
142
 
143
 
144
  $('.more').on('click', function(e){
@@ -148,6 +159,10 @@
148
  $(this).html(text);
149
  });
150
 
 
 
 
 
151
  runTooltip();
152
 
153
  });
@@ -166,7 +181,7 @@
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(){
@@ -197,7 +212,7 @@
197
  }
198
  function resetForm(){
199
  $('.cwa-form input[type="text"]' ).val('');
200
- $('.cwa-form cwa-form-message' ).empty();
201
  }
202
  function runTooltip(){
203
  $('.tooltip').tooltipster({
 
 
 
 
 
 
1
  (function( $ ) {
2
  'use strict';
3
 
54
  }
55
 
56
  });
57
+ $('.cwa-form input[name=cancel]').on('click', function(){
58
+ resetForm();
59
+ });
60
  $('#cwa-form input[name=cwa_name]').on('change', function(){
61
  var widget_id = $('#cwa-form input[name=cwa_id]'),
62
  cwaId = $(this).val().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-').replace(/ /g,"-").toLowerCase();
67
  }
68
 
69
  });
70
+ $('#cwa-form input[name=cwa_id]').on('keyup', function(){
71
  var self = this;
72
+ checkId(self, $(self).val(), 'widget');
73
  });
74
 
75
 
84
  reloadCwaTable();
85
  });
86
  });
87
+ $(document).on('click', '.cwa-menu-delete-link', function(e){
88
+ e.preventDefault();
89
+ var id = $(this).data('id');
90
+
91
+ $.post(ajaxurl,{'action': 'delete_menu', 'data': {'cwa_id': id}}, function(data){
92
+ console.log(data);
93
+ showCwaError(data);
94
+
95
+ reloadMenuTable();
96
+ });
97
+ });
98
 
99
  $('#cwa-advance-btn').on('click', function(e){
100
  e.preventDefault();
122
  });
123
  //if(checkId(form_array.cwa_id)){
124
  $.post(ajaxurl,{'action': 'add_menu', 'data': form_array}, function(data){
125
+ //console.log(data);
126
  reloadMenuTable();
127
  showCwaError(data);
128
 
145
 
146
  });
147
 
148
+ $('#cwa-menu-form input[name=cwa_id]').on('keyup', function(){
149
+ console.log("hey");
150
+ var self = this;
151
+ checkId(self, $(self).val(), 'menu');
152
+ });
153
 
154
 
155
  $('.more').on('click', function(e){
159
  $(this).html(text);
160
  });
161
 
162
+
163
+ //tab plugin
164
+ $('#tab-container').easytabs();
165
+
166
  runTooltip();
167
 
168
  });
181
  $(self).next('.cwa-form-message').html("<label class='cwa-success' style='padding-left: 5px;'>"+data.message+"</label>");
182
  }
183
 
184
+ console.log(data);
185
  });
186
  };
187
  function reloadCwaTable(){
212
  }
213
  function resetForm(){
214
  $('.cwa-form input[type="text"]' ).val('');
215
+ $('.cwa-form .cwa-form-message' ).empty();
216
  }
217
  function runTooltip(){
218
  $('.tooltip').tooltipster({
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.1.2
10
  *
11
  * @package Custom_Widget_Area
12
  * @subpackage Custom_Widget_Area/admin/partials
@@ -21,20 +21,28 @@ class CWA_view
21
  {
22
  # code...
23
  }
24
- public function cwa_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( 'Custom widget area', 'wp-custom-widget-area' ); ?></h2>
 
 
 
 
 
 
 
 
 
 
38
 
39
  <div class="welcome-panel custom-wp">
40
  <div class="col col-8">
@@ -42,44 +50,7 @@ class CWA_view
42
  self::widgetForm();
43
  ?>
44
  </div>
45
- <div class="col col-4">
46
- <div class="how-to">
47
- <h3>How to use?</h3>
48
- <p>
49
- <ol class="list">
50
- <li>Create a new Widget area.</li>
51
- <li>Click on the "get code" link.</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 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/>
64
- <h4 style="margin-top: 0;">How to customize widget style?</h4>
65
- <p>
66
- <ol class="list">
67
- <li>Click on the advance link while creating new widget area and add widget class.</li>
68
- <li>Add custom css targeting your widget area class. i.e. <br>
69
- <code>
70
- .mynewwidgetareaclass a{
71
- color: red;
72
- }
73
- </code><br>
74
- at the bottom of your style.css
75
- where ".mynewwidgetareaclass" is your widget area class.
76
- </li>
77
- </ol>
78
- </p>
79
- </div>
80
- </div>
81
 
82
-
83
  </div>
84
  </div>
85
  <div class="cwa-error" style="display:none;">
@@ -170,6 +141,13 @@ class CWA_view
170
  <tbody>
171
  <?php
172
  $count = 1;
 
 
 
 
 
 
 
173
  foreach ($data as $table) {
174
  # code...
175
  ?>
@@ -197,7 +175,7 @@ class CWA_view
197
  public function getWidgetData(){
198
  global $wpdb, $table_name;
199
 
200
- $sql = "SELECT * FROM $table_name";
201
 
202
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
203
  $row = $wpdb->get_results( $sql, 'OBJECT');
6
  * This file is used to markup the public-facing aspects of the plugin.
7
  *
8
  * @link http://example.com
9
+ * @since 1.1.5
10
  *
11
  * @package Custom_Widget_Area
12
  * @subpackage Custom_Widget_Area/admin/partials
21
  {
22
  # code...
23
  }
24
+
 
 
25
  public function displayView(){
26
 
27
 
28
  global $purl;
29
  ?>
30
 
31
+ <div class="wrap cwa">
32
 
33
  <div id="icon-themes" class="icon32"><br /></div>
34
+ <ul class="tabs">
35
+ <li class="active">
36
+ <h3><a href="<?php echo admin_url();?>admin.php?page=custom_widget_area"><?php _e( 'Custom widget area', 'wp-custom-widget-area' ); ?></a></h3>
37
+ </li>
38
+ <li>
39
+ <h3><a href="<?php echo admin_url();?>admin.php?page=custom_menu_location"><?php _e( 'Custom menu location', 'wp-custom-widget-area' ); ?></a></h3>
40
+ </li>
41
+ <li>
42
+ <h3><a href="<?php echo admin_url();?>admin.php?page=cwa_help"><?php _e( 'Help', 'wp-custom-widget-area' ); ?></a></h3>
43
+ </li>
44
+ </ul>
45
+
46
 
47
  <div class="welcome-panel custom-wp">
48
  <div class="col col-8">
50
  self::widgetForm();
51
  ?>
52
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
 
54
  </div>
55
  </div>
56
  <div class="cwa-error" style="display:none;">
141
  <tbody>
142
  <?php
143
  $count = 1;
144
+ if(empty($data)){
145
+ ?>
146
+ <tr>
147
+ <td colspan="8" class="no-data">There is no data. create a new Widget area by filling above form.</td>
148
+ </tr>
149
+ <?php
150
+ }
151
  foreach ($data as $table) {
152
  # code...
153
  ?>
175
  public function getWidgetData(){
176
  global $wpdb, $table_name;
177
 
178
+ $sql = "SELECT * FROM $table_name WHERE cwa_type='widget'";
179
 
180
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
181
  $row = $wpdb->get_results( $sql, 'OBJECT');
admin/partials/cwa-help.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function help_page(){
3
+ global $plugin_url;
4
+ ?>
5
+
6
+
7
+ <div class="wrap cwa">
8
+
9
+ <div id="icon-themes" class="icon32"><br /></div>
10
+ <ul class="tabs">
11
+ <li>
12
+ <h3><a href="<?php echo admin_url();?>admin.php?page=custom_widget_area"><?php _e( 'Custom widget area', 'wp-custom-widget-area' ); ?></a></h3>
13
+ </li>
14
+ <li>
15
+ <h3><a href="<?php echo admin_url();?>admin.php?page=custom_menu_location"><?php _e( 'Custom menu location', 'wp-custom-widget-area' ); ?></a></h3>
16
+ </li>
17
+ <li class="active">
18
+ <h3><a href="<?php echo admin_url();?>admin.php?page=cwa_help"><?php _e( 'Help', 'wp-custom-widget-area' ); ?></a></h3>
19
+ </li>
20
+ </ul>
21
+
22
+
23
+ <div class="welcome-panel custom-wp help-page">
24
+ <div id="tab-container" class="tab-container">
25
+ <ul class='etabs'>
26
+ <li class='tab'><a href="#custom-widget-area"><span class="wp-menu-image dashicons-before dashicons-editor-help"></span>Custom widget area</a></li>
27
+ <li class='tab'><a href="#custom-menu-location"><span class="wp-menu-image dashicons-before dashicons-editor-help"></span>Custom menu location</a></li>
28
+ </ul>
29
+ <div class="tab-content">
30
+ <div id="custom-widget-area">
31
+ <div class="how-to">
32
+ <h2>How to use?</h2>
33
+ <p>
34
+ <ol class="list">
35
+ <li><h4>Create a new Widget area.</h4>
36
+ <br>
37
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_2.png" >
38
+ </li>
39
+ <li><h4>Click on the "get code" link.</h4>
40
+ <br>
41
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_3.png" >
42
+ </li>
43
+ <li><h4>Copy the code</h4>
44
+ <br>
45
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_4.png" >
46
+ </li>
47
+ <li><h4>and Paste it in a wordpress theme where you want to display it.</h4>
48
+ <br>
49
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_widget_codebase.png" >
50
+ </li>
51
+ <li><h4>Go to Dashboard Appearance > widgets and add widgets to widget area.</h4>
52
+ <br>
53
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_manage_widget.png" >
54
+ </li>
55
+ <li><h4>Then reload your site.</h4>
56
+ </li>
57
+ </ol>
58
+ </p>
59
+ <br/>
60
+ <h2 style="margin-top: 0;">How to Use it in page or post content?</h2>
61
+ <p>
62
+ <ol class="list">
63
+ <li><h4>Click on the "get shortcode" link form widget area table below.</h4>
64
+ <br>
65
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_4.png" >
66
+ </li>
67
+ <li><h4>Copy the shortcode and Paste it in a post or page editor where you want to display it.</h4>
68
+ <br>
69
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_widget_shortcode_admin.png" >
70
+ </li>
71
+ <li><h4>Reload your site.</h4>
72
+ </ol>
73
+ </p>
74
+ <br/>
75
+ <h2 style="margin-top: 0;">How to customize widget style?</h2>
76
+ <p>
77
+ <ol class="list">
78
+ <li><h4>Click on the advance link while creating new widget area and add widget class.</h4>
79
+ <br>
80
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_1_advance.png" >
81
+ </li>
82
+ <li><h4>Then add custom css targeting your widget area class. i.e. </h4><br>
83
+ <code>
84
+ .mynewwidgetareaclass a{
85
+ color: red;
86
+ }
87
+ </code><br>
88
+ at the bottom of your style.css
89
+ where ".mynewwidgetareaclass" is your widget area class.
90
+ </li>
91
+ </ol>
92
+ </p>
93
+ </div>
94
+ </div>
95
+ <div id="custom-menu-location">
96
+ <div class="how-to">
97
+ <h3>How to use?</h3>
98
+ <p>
99
+ <ol class="list">
100
+ <li><h4>Create a new Menu Location.</h4>
101
+ <br>
102
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_menu_1.png" ></li>
103
+ <li><h4>Click on the "get code" link from table below.</h4>
104
+ <br>
105
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_menu_3.png" ></li>
106
+ <li><h4>Copy the code and Paste it in a wordpress theme where you want to display it.</h4>
107
+ <br>
108
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_menu_codebase.png" ></li>
109
+ <li><h4>assign menu to the location.</h4>
110
+ <br>
111
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_menu_admin.png" ></li>
112
+ <li><h4>Reload the site.</h4></li>
113
+ </ol>
114
+ </p>
115
+ <br/>
116
+ <h3 style="margin-top: 0;">How to Use it in page or post content?</h3>
117
+ <p>
118
+ <ol class="list">
119
+ <li><h4>Click on the "get shortcode" link form table below.</h4>
120
+ <br>
121
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_menu_4.png" ></li>
122
+ <li><h4>Copy the shortcode and Paste it in a post or page editor where you want to display it.</h4>
123
+ <br>
124
+ <img src="<?php echo $plugin_url;?>/admin/img/help/cwa_menu_shortcode_admin.png" ></li>
125
+ </ol>
126
+ </p>
127
+ <br/>
128
+ <h3 style="margin-top: 0;">How to customize menu style?</h3>
129
+ <p>
130
+ <ol class="list">
131
+ <li><h4>Pass the extra arguments while calling function</h4><br>
132
+ i.e.<br>
133
+ <code>
134
+ wp_nav_menu( array( 'theme_location' => 'footer-location', 'menu_class' => 'Cwa-menu', [arguments] => ['values']... ) );
135
+ </code>
136
+ <br>
137
+ <a href="https://codex.wordpress.org/Function_Reference/wp_nav_menu" target="_blank" > Cick here </a> to know more about available Parameters.
138
+ <br>
139
+ <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>
140
+ </li>
141
+ <li><h4>Make sure you have passed custom menu class options i.e. 'menu_class' like in above code.</h4>
142
+
143
+ <li><h4>Add custom css targeting your menu_class or container_class etc. i.e.</h4> <br>
144
+ <code>
145
+ .Cwa-menu a{
146
+ color: red;
147
+ }
148
+ </code><br>
149
+ at the bottom of your style.css.
150
+ </li>
151
+ </ol>
152
+ </p>
153
+ </div>
154
+ </div>
155
+ </div>
156
+ </div>
157
+ </div>
158
+ </div>
159
+
160
+ <?php
161
+ }
162
+ ?>
admin/partials/cwa-menu-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.1.2
10
  *
11
  * @package Custom_Widget_Area
12
  * @subpackage Custom_Widget_Area/admin/partials
@@ -21,75 +21,35 @@ class Menu_view
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;">
@@ -141,6 +101,13 @@ class Menu_view
141
  <tbody>
142
  <?php
143
  $count = 1;
 
 
 
 
 
 
 
144
  foreach ($data as $table) {
145
  # code...
146
  ?>
@@ -150,7 +117,7 @@ class Menu_view
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++;
6
  * This file is used to markup the public-facing aspects of the plugin.
7
  *
8
  * @link http://example.com
9
+ * @since 1.1.5
10
  *
11
  * @package Custom_Widget_Area
12
  * @subpackage Custom_Widget_Area/admin/partials
21
  {
22
  # code...
23
  }
24
+
 
 
25
  public function displayView(){
26
 
27
 
28
  global $purl;
29
  ?>
30
 
31
+ <div class="wrap cwa">
32
 
33
  <div id="icon-themes" class="icon32"><br /></div>
34
+ <ul class="tabs">
35
+ <li>
36
+ <h3><a href="<?php echo admin_url();?>admin.php?page=custom_widget_area"><?php _e( 'Custom widget area', 'wp-custom-widget-area' ); ?></a></h3>
37
+ </li>
38
+ <li class="active">
39
+ <h3><a href="<?php echo admin_url();?>admin.php?page=custom_menu_location"><?php _e( 'Custom menu location', 'wp-custom-widget-area' ); ?></a></h3>
40
+ </li>
41
+ <li>
42
+ <h3><a href="<?php echo admin_url();?>admin.php?page=cwa_help"><?php _e( 'Help', 'wp-custom-widget-area' ); ?></a></h3>
43
+ </li>
44
+ </ul>
45
+
46
  <div class="welcome-panel custom-wp">
47
  <div class="col col-8">
48
  <?php
49
  self::menuForm();
50
  ?>
51
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
 
53
  </div>
54
  </div>
55
  <div class="cwa-error" style="display:none;">
101
  <tbody>
102
  <?php
103
  $count = 1;
104
+ if(empty($data)){
105
+ ?>
106
+ <tr>
107
+ <td colspan="8" class="no-data">There is no data. create a new Menu location by filling above form.</td>
108
+ </tr>
109
+ <?php
110
+ }
111
  foreach ($data as $table) {
112
  # code...
113
  ?>
117
  <td><?php echo $table->cwa_id; ?></td>
118
 
119
  <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>
120
+ <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-menu-delete-link">Delete</a></td>
121
  </tr>
122
  <?php
123
  $count++;
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.1.2
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.1.2
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.1.2
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.1.2
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.1.2
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.1.2
68
  */
69
  public function __construct() {
70
 
71
  $this->plugin_name = 'wp-custom-widget-area';
72
- $this->version = '1.1.2';
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.1.2
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.1.2
129
  * @access private
130
  */
131
  private function set_locale() {
@@ -141,13 +141,13 @@ class Custom_Widget_Area {
141
  * Register all of the hooks related to the dashboard functionality
142
  * of the plugin.
143
  *
144
- * @since 1.1.2
145
  * @access private
146
  */
147
  private function define_admin_hooks() {
148
 
149
  $plugin_admin = new Custom_Widget_Area_Admin( $this->get_plugin_name(), $this->get_version() );
150
- add_action( 'admin_menu', array($plugin_admin, 'menu_setup'));
151
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
152
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
153
 
@@ -188,7 +188,7 @@ class Custom_Widget_Area {
188
  /**
189
  * Run the loader to execute all of the hooks with WordPress.
190
  *
191
- * @since 1.1.2
192
  */
193
  public function run() {
194
  $this->loader->run();
@@ -198,7 +198,7 @@ class Custom_Widget_Area {
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.2
202
  * @return string The name of the plugin.
203
  */
204
  public function get_plugin_name() {
@@ -208,7 +208,7 @@ class Custom_Widget_Area {
208
  /**
209
  * The reference to the class that orchestrates the hooks with the plugin.
210
  *
211
- * @since 1.1.2
212
  * @return Custom_Widget_Area_Loader Orchestrates the hooks of the plugin.
213
  */
214
  public function get_loader() {
@@ -218,7 +218,7 @@ class Custom_Widget_Area {
218
  /**
219
  * Retrieve the version number of the plugin.
220
  *
221
- * @since 1.1.2
222
  * @return string The version number of the plugin.
223
  */
224
  public function get_version() {
7
  * public-facing side of the site and the dashboard.
8
  *
9
  * @link http://example.com
10
+ * @since 1.1.5
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.5
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.5
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.5
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.5
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.5
68
  */
69
  public function __construct() {
70
 
71
  $this->plugin_name = 'wp-custom-widget-area';
72
+ $this->version = '1.1.5';
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.5
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.5
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.5
145
  * @access private
146
  */
147
  private function define_admin_hooks() {
148
 
149
  $plugin_admin = new Custom_Widget_Area_Admin( $this->get_plugin_name(), $this->get_version() );
150
+ $this->loader->add_action( 'admin_menu', $plugin_admin, 'menu_setup' );
151
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
152
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
153
 
188
  /**
189
  * Run the loader to execute all of the hooks with WordPress.
190
  *
191
+ * @since 1.1.5
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.5
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.5
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.5
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.1.2
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.1.2
19
  * @package Custom_Widget_Area
20
  * @subpackage Custom_Widget_Area/includes
21
  * @author Your Name <email@example.com>
@@ -27,16 +27,14 @@ class Custom_Widget_Area_Activator {
27
  *
28
  * Long Description.
29
  *
30
- * @since 1.1.2
31
  */
32
  public static function activate() {
33
 
34
- self::install_db();
35
-
36
- }
37
-
38
- private function install_db(){
39
- global $wpdb, $kz_db_version, $table_name, $charset_collate;
40
 
41
  if ( ! empty( $wpdb->charset ) ) {
42
  $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
@@ -68,6 +66,8 @@ class Custom_Widget_Area_Activator {
68
  }else{
69
  add_option( 'kz_db_version', $kz_db_version );
70
  }
 
71
  }
72
 
 
73
  }
4
  * Fired during plugin activation
5
  *
6
  * @link http://example.com
7
+ * @since 1.1.5
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.5
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.5
31
  */
32
  public static function activate() {
33
 
34
+ global $wpdb;
35
+ $kz_db_version = '1.1.5';
36
+ $table_name = $wpdb->prefix . 'cwa';
37
+ $charset_collate = '';
 
 
38
 
39
  if ( ! empty( $wpdb->charset ) ) {
40
  $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
66
  }else{
67
  add_option( 'kz_db_version', $kz_db_version );
68
  }
69
+
70
  }
71
 
72
+
73
  }
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.1.2
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.1.2
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.1.2
31
  */
32
  public static function deactivate() {
33
 
4
  * Fired during plugin deactivation
5
  *
6
  * @link http://example.com
7
+ * @since 1.1.5
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.5
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.5
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.1.2
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.1.2
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.1.2
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.1.2
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.1.2
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.5
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.5
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.5
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.5
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.5
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.1.2
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.1.2
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.1.2
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.1.2
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.1.2
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.1.2
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.1.2
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.1.2
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.5
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.5
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.5
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.5
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.5
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.5
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.5
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.5
116
  */
117
  public function run() {
118
 
includes/config.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  /*plugin configs*/
3
- $kz_db_version = '1.1.2';
 
4
  $table_name = $wpdb->prefix . 'cwa';
5
  $charset_collate = '';
6
  ?>
1
  <?php
2
  /*plugin configs*/
3
+ global $wpdb;
4
+ $kz_db_version = '1.1.5';
5
  $table_name = $wpdb->prefix . 'cwa';
6
  $charset_collate = '';
7
  ?>
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.1.2
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.5
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.1.2
20
  * Author: Kishor Khambu
21
  * Author URI: http://kishorkhambu.com.np
22
  * License: GPL-2.0+
@@ -29,7 +29,10 @@
29
  if ( ! defined( 'WPINC' ) ) {
30
  die;
31
  }
 
 
32
  $purl = plugin_dir_url( __FILE__ );
 
33
  require_once plugin_dir_path( __FILE__ ) . 'includes/config.php';
34
  /**
35
  * The code that runs during plugin activation.
@@ -62,58 +65,44 @@ require_once plugin_dir_path( __FILE__ ) . 'includes/class-custom-widget-area.ph
62
  * then kicking off the plugin from this point in the file does
63
  * not affect the page life cycle.
64
  *
65
- * @since 1.1.2
66
  */
67
  function run_plugin_name() {
68
  $plugin = new Custom_Widget_Area();
69
  $plugin->run();
70
 
71
  }
72
- run_plugin_name();
73
 
74
  function cb(){
75
  echo "welcome to first metabox showcase";
76
  }
77
 
78
 
79
- // db fix for new version
80
- /*function db_update(){
81
- global $wpdb;
82
- $table_name = 'wp_cwa';
83
- if( (phpversion() < 5.4 && !!! session_id()) || (phpversion() > 5.3 && !!!session_status() == PHP_SESSION_NONE))
84
- session_start();
85
-
86
- if(!isset($_SESSION['db_update'])){
87
- $row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
88
- WHERE table_name = '$table_name' AND column_name = 'cwa_type'" );
89
-
90
- if(empty($row)){
91
- $wpdb->query("ALTER TABLE $table_name ADD cwa_type varchar (10) ");
92
- $updaterow = $wpdb->get_results( "SELECT id FROM $table_name");
93
- foreach ($updaterow as $data) {
94
- # code...
95
- $up = $wpdb->update($table_name, array('cwa_type'=> 'widget'), array('id'=>$data->id));
96
- }
97
- }
98
- $_SESSION['db_update'] = true;
99
- }
100
-
101
- }
102
-
103
- db_update();*/
104
-
105
 
106
  function myplugin_update_db_check() {
107
  global $kz_db_version, $wpdb, $table_name;
 
 
 
108
  if ( get_site_option( 'kz_db_version' ) != $kz_db_version ) {
109
  Custom_Widget_Area_Activator::activate();
110
- $x = $wpdb->query("ALTER TABLE $table_name ADD cwa_type varchar (10) ");
111
- $updaterow = $wpdb->get_results( "SELECT id FROM $table_name");
112
- foreach ($updaterow as $data) {
113
- # code...
114
- $up = $wpdb->update($table_name, array('cwa_type'=> 'widget'), array('id'=>$data->id));
115
- }
 
 
 
 
 
 
 
116
  }
 
 
117
  }
118
  add_action( 'plugins_loaded', 'myplugin_update_db_check' );
119
 
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.5
20
  * Author: Kishor Khambu
21
  * Author URI: http://kishorkhambu.com.np
22
  * License: GPL-2.0+
29
  if ( ! defined( 'WPINC' ) ) {
30
  die;
31
  }
32
+ $plugin_url = plugins_url('', __FILE__);
33
+
34
  $purl = plugin_dir_url( __FILE__ );
35
+
36
  require_once plugin_dir_path( __FILE__ ) . 'includes/config.php';
37
  /**
38
  * The code that runs during plugin activation.
65
  * then kicking off the plugin from this point in the file does
66
  * not affect the page life cycle.
67
  *
68
+ * @since 1.1.5
69
  */
70
  function run_plugin_name() {
71
  $plugin = new Custom_Widget_Area();
72
  $plugin->run();
73
 
74
  }
75
+
76
 
77
  function cb(){
78
  echo "welcome to first metabox showcase";
79
  }
80
 
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  function myplugin_update_db_check() {
84
  global $kz_db_version, $wpdb, $table_name;
85
+ $current_version = get_site_option( 'kz_db_version' );
86
+ //update_site_option('kz_db_version', '1.0.4'); exit;
87
+ // var_dump($table_name); exit;
88
  if ( get_site_option( 'kz_db_version' ) != $kz_db_version ) {
89
  Custom_Widget_Area_Activator::activate();
90
+ if(!!$current_version && $current_version < '1.1.0'){
91
+ $row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '$table_name' AND column_name = 'cwa_type'" );
92
+ if(empty($row)){
93
+ $x = $wpdb->query("ALTER TABLE $table_name ADD cwa_type varchar (10) ");
94
+ $updaterow = $wpdb->get_results( "SELECT id FROM $table_name");
95
+ foreach ($updaterow as $data) {
96
+ # code...
97
+ $up = $wpdb->update($table_name, array('cwa_type'=> 'widget'), array('id'=>$data->id));
98
+ }
99
+ }
100
+
101
+ }
102
+
103
  }
104
+
105
+ run_plugin_name();
106
  }
107
  add_action( 'plugins_loaded', 'myplugin_update_db_check' );
108