Changeset 1201891
- Timestamp:
- 07/19/2015 11:23:03 AM (11 years ago)
- Location:
- wp-custom-widget-area/trunk
- Files:
-
- 1 deleted
- 14 edited
-
README.txt (modified) (3 diffs)
-
admin/class-wp-custom-widget-area-admin.php (modified) (14 diffs)
-
admin/css/wp-custom-widget-area-admin.css (modified) (2 diffs)
-
admin/js/wp-custom-widget-area-admin.js (modified) (5 diffs)
-
admin/jspkg-archive (deleted)
-
admin/partials/cwa-admin-display.php (modified) (3 diffs)
-
admin/partials/cwa-menu-admin-display.php (modified) (3 diffs)
-
includes/class-custom-widget-area.php (modified) (13 diffs)
-
includes/class-wp-custom-widget-area-activator.php (modified) (4 diffs)
-
includes/class-wp-custom-widget-area-deactivator.php (modified) (3 diffs)
-
includes/class-wp-custom-widget-area-i18n.php (modified) (5 diffs)
-
includes/class-wp-custom-widget-area-loader.php (modified) (8 diffs)
-
includes/config.php (modified) (1 diff)
-
uninstall.php (modified) (1 diff)
-
wp-custom-widget-area.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-custom-widget-area/trunk/README.txt
r1201275 r1201891 4 4 Requires at least: 3.0.1 5 5 Tested up to: 4.2.2 6 Stable tag: 1.1. 36 Stable tag: 1.1.4 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 73 73 == Changelog == 74 74 75 = 1.1.4 = 76 * database table upgrade bug fix 77 * form and js bug fix 78 75 79 = 1.1.3 = 76 80 * widget area bug fix … … 109 113 == Upgrade Notice == 110 114 115 = 1.1.4 = 116 * database table upgrade bug fix 117 * form and js bug fix 118 111 119 = 1.1.3 = 112 120 * widget area bug fix -
wp-custom-widget-area/trunk/admin/class-wp-custom-widget-area-admin.php
r1201274 r1201891 5 5 * 6 6 * @link http://example.com 7 * @since 1.1. 37 * @since 1.1.4 8 8 * 9 9 * @package Custom_Widget_Area … … 30 30 * The ID of this plugin. 31 31 * 32 * @since 1.1. 332 * @since 1.1.4 33 33 * @access private 34 34 * @var string $plugin_name The ID of this plugin. … … 39 39 * The version of this plugin. 40 40 * 41 * @since 1.1. 341 * @since 1.1.4 42 42 * @access private 43 43 * @var string $version The current version of this plugin. … … 48 48 * Initialize the class and set its properties. 49 49 * 50 * @since 1.1. 350 * @since 1.1.4 51 51 * @var string $plugin_name The name of this plugin. 52 52 * @var string $version The version of this plugin. … … 65 65 public function menu_setup(){ 66 66 67 add_menu_page('CWA Settings', 'CWA Settings', 'administrator', 'custom_widget_area', array($this->view, ' cwa_settings_page'),''/*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, ' cwa_settings_page') );69 add_submenu_page( 'custom_widget_area', 'Menu Locations', 'Menu Locations', 'administrator', 'custom_menu_location', array($this->menuView, ' menu_settings_page') );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 70 add_submenu_page( 'custom_widget_area', 'Help', 'Help', 'manage_options', 'cwa_help', 'help_page'); 71 71 //self::setuo_ajax_request(); … … 150 150 $valid = self::checSpecialChar($cwa_id); 151 151 152 if($valid ){152 if($valid && !empty($cwa_id)){ 153 153 154 154 $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id' AND cwa_type='widget'"; … … 170 170 return true; 171 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 } 172 181 } 173 182 else{ … … 279 288 $valid = self::checSpecialChar($cwa_id); 280 289 281 if($valid ){290 if($valid && !empty($cwa_id)){ 282 291 283 292 $sql = "SELECT * FROM $this->table_name WHERE cwa_id='$cwa_id' AND cwa_type='menu'"; … … 285 294 286 295 $row = $wpdb->get_row( $sql, 'OBJECT'); 287 296 //wp_send_json(!!$cwa_id);die(); 288 297 if(empty($id)){ 289 298 if($row) … … 300 309 } 301 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 } 302 319 else{ 303 320 if(empty($id)){ … … 308 325 } 309 326 } 327 die; 310 328 } 311 329 public function get_menu(){ … … 349 367 } 350 368 public function checSpecialChar($string){ 351 if(!preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬ ]/', $string)){369 if(!preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬ ]/', $string)){ 352 370 return true; 353 371 } … … 359 377 * Register the stylesheets for the Dashboard. 360 378 * 361 * @since 1.1. 3379 * @since 1.1.4 362 380 */ 363 381 public function enqueue_styles() { … … 382 400 * Register the JavaScript for the dashboard. 383 401 * 384 * @since 1.1. 3402 * @since 1.1.4 385 403 */ 386 404 public function enqueue_scripts() { -
wp-custom-widget-area/trunk/admin/css/wp-custom-widget-area-admin.css
r1201274 r1201891 161 161 } 162 162 .tabs{ 163 margin-bottom: 0;163 margin-bottom: -1px; 164 164 } 165 165 .tabs li a{ … … 196 196 min-width: 500px; 197 197 } 198 198 .no-data{ 199 color: #999; 200 } -
wp-custom-widget-area/trunk/admin/js/wp-custom-widget-area-admin.js
r1201274 r1201891 1 2 3 4 5 6 7 1 (function( $ ) { 8 2 'use strict'; … … 72 66 73 67 }); 74 $('#cwa-form input[name=cwa_id]').on(' change', function(){68 $('#cwa-form input[name=cwa_id]').on('keyup', function(){ 75 69 var self = this; 76 checkId(self, $(self).val() );70 checkId(self, $(self).val(), 'widget'); 77 71 }); 78 72 … … 150 144 }); 151 145 152 146 $('#cwa-menu-form input[name=cwa_id]').on('keyup', function(){ 147 console.log("hey"); 148 var self = this; 149 checkId(self, $(self).val(), 'menu'); 150 }); 153 151 154 152 … … 182 180 } 183 181 184 //console.log(data);182 console.log(data); 185 183 }); 186 184 }; … … 213 211 function resetForm(){ 214 212 $('.cwa-form input[type="text"]' ).val(''); 215 $('.cwa-form cwa-form-message' ).empty();213 $('.cwa-form .cwa-form-message' ).empty(); 216 214 } 217 215 function runTooltip(){ -
wp-custom-widget-area/trunk/admin/partials/cwa-admin-display.php
r1201274 r1201891 7 7 * 8 8 * @link http://example.com 9 * @since 1.1. 39 * @since 1.1.4 10 10 * 11 11 * @package Custom_Widget_Area … … 22 22 # code... 23 23 } 24 public function cwa_settings_page(){ 25 add_action( 'add_meta_boxes', self::displayView()); 26 } 24 27 25 public function displayView(){ 28 26 … … 144 142 <?php 145 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 } 146 151 foreach ($data as $table) { 147 152 # code... -
wp-custom-widget-area/trunk/admin/partials/cwa-menu-admin-display.php
r1201274 r1201891 7 7 * 8 8 * @link http://example.com 9 * @since 1.1. 39 * @since 1.1.4 10 10 * 11 11 * @package Custom_Widget_Area … … 22 22 # code... 23 23 } 24 public function menu_settings_page(){ 25 add_action( 'add_meta_boxes', self::displayView()); 26 } 24 27 25 public function displayView(){ 28 26 … … 104 102 <?php 105 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 } 106 111 foreach ($data as $table) { 107 112 # code... -
wp-custom-widget-area/trunk/includes/class-custom-widget-area.php
r1201274 r1201891 8 8 * 9 9 * @link http://example.com 10 * @since 1.1. 310 * @since 1.1.4 11 11 * 12 12 * @package Custom_Widget_Area … … 23 23 * version of the plugin. 24 24 * 25 * @since 1.1. 325 * @since 1.1.4 26 26 * @package Custom_Widget_Area 27 27 * @subpackage Custom_Widget_Area/includes … … 34 34 * the plugin. 35 35 * 36 * @since 1.1. 336 * @since 1.1.4 37 37 * @access protected 38 38 * @var Custom_Widget_Area_Loader $loader Maintains and registers all hooks for the plugin. … … 43 43 * The unique identifier of this plugin. 44 44 * 45 * @since 1.1. 345 * @since 1.1.4 46 46 * @access protected 47 47 * @var string $plugin_name The string used to uniquely identify this plugin. … … 52 52 * The current version of the plugin. 53 53 * 54 * @since 1.1. 354 * @since 1.1.4 55 55 * @access protected 56 56 * @var string $version The current version of the plugin. … … 65 65 * the public-facing side of the site. 66 66 * 67 * @since 1.1. 367 * @since 1.1.4 68 68 */ 69 69 public function __construct() { 70 70 71 71 $this->plugin_name = 'wp-custom-widget-area'; 72 $this->version = '1.1. 3';72 $this->version = '1.1.4'; 73 73 74 74 $this->load_dependencies(); … … 92 92 * with WordPress. 93 93 * 94 * @since 1.1. 394 * @since 1.1.4 95 95 * @access private 96 96 */ … … 126 126 * with WordPress. 127 127 * 128 * @since 1.1. 3128 * @since 1.1.4 129 129 * @access private 130 130 */ … … 142 142 * of the plugin. 143 143 * 144 * @since 1.1. 3144 * @since 1.1.4 145 145 * @access private 146 146 */ … … 189 189 * Run the loader to execute all of the hooks with WordPress. 190 190 * 191 * @since 1.1. 3191 * @since 1.1.4 192 192 */ 193 193 public function run() { … … 199 199 * WordPress and to define internationalization functionality. 200 200 * 201 * @since 1.1. 3201 * @since 1.1.4 202 202 * @return string The name of the plugin. 203 203 */ … … 209 209 * The reference to the class that orchestrates the hooks with the plugin. 210 210 * 211 * @since 1.1. 3211 * @since 1.1.4 212 212 * @return Custom_Widget_Area_Loader Orchestrates the hooks of the plugin. 213 213 */ … … 219 219 * Retrieve the version number of the plugin. 220 220 * 221 * @since 1.1. 3221 * @since 1.1.4 222 222 * @return string The version number of the plugin. 223 223 */ -
wp-custom-widget-area/trunk/includes/class-wp-custom-widget-area-activator.php
r1201274 r1201891 5 5 * 6 6 * @link http://example.com 7 * @since 1.1. 37 * @since 1.1.4 8 8 * 9 9 * @package Custom_Widget_Area … … 16 16 * This class defines all code necessary to run during the plugin's activation. 17 17 * 18 * @since 1.1. 318 * @since 1.1.4 19 19 * @package Custom_Widget_Area 20 20 * @subpackage Custom_Widget_Area/includes … … 28 28 * Long Description. 29 29 * 30 * @since 1.1. 330 * @since 1.1.4 31 31 */ 32 32 public static function activate() { 33 33 34 self::install_db(); 35 36 } 37 38 private function install_db(){ 39 global $wpdb, $kz_db_version, $table_name, $charset_collate; 34 global $wpdb; 35 $kz_db_version = '1.1.4'; 36 $table_name = $wpdb->prefix . 'cwa'; 37 $charset_collate = ''; 40 38 41 39 if ( ! empty( $wpdb->charset ) ) { … … 69 67 add_option( 'kz_db_version', $kz_db_version ); 70 68 } 69 71 70 } 72 71 72 73 73 } -
wp-custom-widget-area/trunk/includes/class-wp-custom-widget-area-deactivator.php
r1201274 r1201891 5 5 * 6 6 * @link http://example.com 7 * @since 1.1. 37 * @since 1.1.4 8 8 * 9 9 * @package Custom_Widget_Area … … 16 16 * This class defines all code necessary to run during the plugin's deactivation. 17 17 * 18 * @since 1.1. 318 * @since 1.1.4 19 19 * @package Custom_Widget_Area 20 20 * @subpackage Custom_Widget_Area/includes … … 28 28 * Long Description. 29 29 * 30 * @since 1.1. 330 * @since 1.1.4 31 31 */ 32 32 public static function deactivate() { -
wp-custom-widget-area/trunk/includes/class-wp-custom-widget-area-i18n.php
r1201274 r1201891 8 8 * 9 9 * @link http://example.com 10 * @since 1.1. 310 * @since 1.1.4 11 11 * 12 12 * @package Custom_Widget_Area … … 20 20 * so that its ready for translation. 21 21 * 22 * @since 1.1. 322 * @since 1.1.4 23 23 * @package Custom_Widget_Area 24 24 * @subpackage Custom_Widget_Area/includes … … 30 30 * The domain specified for this plugin. 31 31 * 32 * @since 1.1. 332 * @since 1.1.4 33 33 * @access private 34 34 * @var string $domain The domain identifier for this plugin. … … 39 39 * Load the plugin text domain for translation. 40 40 * 41 * @since 1.1. 341 * @since 1.1.4 42 42 */ 43 43 public function load_plugin_textdomain() { … … 54 54 * Set the domain equal to that of the specified domain. 55 55 * 56 * @since 1.1. 356 * @since 1.1.4 57 57 * @param string $domain The domain that represents the locale of this plugin. 58 58 */ -
wp-custom-widget-area/trunk/includes/class-wp-custom-widget-area-loader.php
r1201274 r1201891 5 5 * 6 6 * @link http://example.com 7 * @since 1.1. 37 * @since 1.1.4 8 8 * 9 9 * @package Custom_Widget_Area … … 27 27 * The array of actions registered with WordPress. 28 28 * 29 * @since 1.1. 329 * @since 1.1.4 30 30 * @access protected 31 31 * @var array $actions The actions registered with WordPress to fire when the plugin loads. … … 36 36 * The array of filters registered with WordPress. 37 37 * 38 * @since 1.1. 338 * @since 1.1.4 39 39 * @access protected 40 40 * @var array $filters The filters registered with WordPress to fire when the plugin loads. … … 45 45 * Initialize the collections used to maintain the actions and filters. 46 46 * 47 * @since 1.1. 347 * @since 1.1.4 48 48 */ 49 49 public function __construct() { … … 57 57 * Add a new action to the collection to be registered with WordPress. 58 58 * 59 * @since 1.1. 359 * @since 1.1.4 60 60 * @var string $hook The name of the WordPress action that is being registered. 61 61 * @var object $component A reference to the instance of the object on which the action is defined. … … 71 71 * Add a new filter to the collection to be registered with WordPress. 72 72 * 73 * @since 1.1. 373 * @since 1.1.4 74 74 * @var string $hook The name of the WordPress filter that is being registered. 75 75 * @var object $component A reference to the instance of the object on which the filter is defined. … … 86 86 * collection. 87 87 * 88 * @since 1.1. 388 * @since 1.1.4 89 89 * @access private 90 90 * @var array $hooks The collection of hooks that is being registered (that is, actions or filters). … … 113 113 * Register the filters and actions with WordPress. 114 114 * 115 * @since 1.1. 3115 * @since 1.1.4 116 116 */ 117 117 public function run() { -
wp-custom-widget-area/trunk/includes/config.php
r1201274 r1201891 1 1 <?php 2 2 /*plugin configs*/ 3 $kz_db_version = '1.1.3'; 3 global $wpdb; 4 $kz_db_version = '1.1.4'; 4 5 $table_name = $wpdb->prefix . 'cwa'; 5 6 $charset_collate = ''; -
wp-custom-widget-area/trunk/uninstall.php
r1201274 r1201891 21 21 * 22 22 * @link http://example.com 23 * @since 1.1. 323 * @since 1.1.4 24 24 * 25 25 * @package Custom_Widget_Area -
wp-custom-widget-area/trunk/wp-custom-widget-area.php
r1201274 r1201891 17 17 * Plugin URI: http://kishorkhambu.com.np/plugins/ 18 18 * Description: A wordpress plugin to create custom dynamic widget area. 19 * Version: 1.1. 319 * Version: 1.1.4 20 20 * Author: Kishor Khambu 21 21 * Author URI: http://kishorkhambu.com.np … … 66 66 * not affect the page life cycle. 67 67 * 68 * @since 1.1. 368 * @since 1.1.4 69 69 */ 70 70 function run_plugin_name() { … … 73 73 74 74 } 75 run_plugin_name(); 75 76 76 77 77 function cb(){ … … 80 80 81 81 82 // db fix for new version83 /*function db_update(){84 global $wpdb;85 $table_name = 'wp_cwa';86 if( (phpversion() < 5.4 && !!! session_id()) || (phpversion() > 5.3 && !!!session_status() == PHP_SESSION_NONE))87 session_start();88 89 if(!isset($_SESSION['db_update'])){90 $row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS91 WHERE table_name = '$table_name' AND column_name = 'cwa_type'" );92 93 if(empty($row)){94 $wpdb->query("ALTER TABLE $table_name ADD cwa_type varchar (10) ");95 $updaterow = $wpdb->get_results( "SELECT id FROM $table_name");96 foreach ($updaterow as $data) {97 # code...98 $up = $wpdb->update($table_name, array('cwa_type'=> 'widget'), array('id'=>$data->id));99 }100 }101 $_SESSION['db_update'] = true;102 }103 104 }105 106 db_update();*/107 108 82 109 83 function myplugin_update_db_check() { 110 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; 111 88 if ( get_site_option( 'kz_db_version' ) != $kz_db_version ) { 112 89 Custom_Widget_Area_Activator::activate(); 113 $x = $wpdb->query("ALTER TABLE $table_name ADD cwa_type varchar (10) "); 114 $updaterow = $wpdb->get_results( "SELECT id FROM $table_name"); 115 foreach ($updaterow as $data) { 116 # code... 117 $up = $wpdb->update($table_name, array('cwa_type'=> 'widget'), array('id'=>$data->id)); 118 } 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 119 103 } 104 105 run_plugin_name(); 120 106 } 121 107 add_action( 'plugins_loaded', 'myplugin_update_db_check' );
Note: See TracChangeset
for help on using the changeset viewer.