Changeset 1307114
- Timestamp:
- 12/13/2015 01:44:20 AM (10 years ago)
- Location:
- tablemaster/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (4 diffs)
-
tablemaster.php (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tablemaster/trunk/readme.txt
r1296986 r1307114 5 5 Requires at least: 4.3 6 6 Tested up to: 4.3.1 7 Stable tag: 0.0. 27 Stable tag: 0.0.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 49 49 == Frequently Asked Questions == 50 50 51 This is the second release of TableMaster! There are still no frequently asked questions. I hope that meansthe TableMaster User's Guide has been very helpful to everyone. However, questions will be added here when they are received.51 This is the third release of TableMaster! And, still, there are no frequently asked questions. I hope this means that the TableMaster User's Guide has been very helpful to everyone. However, questions will be added here when they are received. 52 52 53 53 == Upgrade Notice == 54 55 = 0.0.3 = 56 57 This release fixes an issue reported by megadrive16 where the DataTables jQuery plugin default column sorting was overriding the "ORDER BY" clause that was specified by the user with the 'sql' keyword. With this release, you can use the 'default_sort' keyword to disable the default column sorting used by the DataTables jQuery plugin. 54 58 55 59 = 0.0.2 = … … 58 62 59 63 == Changelog == 64 65 = 0.0.3 = 66 67 * Added default_sort keyword to turn off the default column sorting by DataTables. 68 * Added plugin name and plugin version to Settings and Admin constructors. 69 * Added font awesome icons to user's guide when not viewed in Wordpress admin. 60 70 61 71 = 0.0.2 = … … 67 77 68 78 = 0.0.1 = 79 69 80 First release. -
tablemaster/trunk/tablemaster.php
r1297766 r1307114 4 4 * Plugin URI: https://wordpress.org/plugins/tablemaster/ 5 5 * Description: Prints your tables using the DataTables for JQuery Plugin using a simple `[tablemaster]` shortcode. 6 * Version: 0.0. 26 * Version: 0.0.3 7 7 * Author: Valerie Mallder 8 8 * Author URI: http://codehorsesoftware.com … … 10 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt 11 11 */ 12 12 define(TABLEMASTER_PLUGIN_VERSION, '0.0.3'); 13 13 14 14 // Prohibit direct script loading 15 15 defined( 'ABSPATH' ) || die( 'No direct script access allowed!' ); 16 17 $plugin_name = 'tablemaster';18 $plugin_version = '0.0.2';19 16 20 17 /** … … 51 48 define( TABLEMASTER_USER_CSS_URI, get_stylesheet_directory_uri() . '/css/tablemaster.css'); 52 49 53 require( dirname(__FILE__) . '/admin/class-tablemaster-settings.php');54 require( dirname(__FILE__) . '/admin/class-tablemaster-users-guide.php');55 require( dirname(__FILE__) . '/admin/class-tablemaster-admin.php');50 require( dirname(__FILE__) . '/admin/class-tablemaster-settings.php'); 51 require( dirname(__FILE__) . '/admin/class-tablemaster-users-guide.php'); 52 require( dirname(__FILE__) . '/admin/class-tablemaster-admin.php'); 56 53 57 54 //file_exists(dirname(__FILE__) . '/tablemaster-pro.php') AND include dirname(__FILE__) . '/tablemaster-pro.php'; … … 60 57 if (!class_exists('TableMaster')) { 61 58 class TableMaster { 59 60 /** 61 * The ID of this plugin. 62 * 63 * @access private 64 * @var string $plugin_name The ID of this plugin. 65 */ 66 private $plugin_name = "tablemaster"; 67 68 /** 69 * The version of this plugin. 70 * 71 * @access private 72 * @var string $version The current version of this plugin. 73 */ 74 private $version = TABLEMASTER_PLUGIN_VERSION; 62 75 63 76 protected $tables = array(); … … 86 99 "new_window", 87 100 "pre_table_filter", 88 "post_table_filter" 89 ); 101 "post_table_filter", 102 'default_sort' 103 ); 90 104 91 105 protected $valid_buttons = array( … … 95 109 "pdf", 96 110 "print" 97 );111 ); 98 112 99 113 … … 114 128 function __construct() { 115 129 116 TableMaster_Admin::getInstance( ); // Instantiate to initialize117 TableMaster_Settings::getInstance( ); // Instantiate to initialize130 TableMaster_Admin::getInstance( $plugin_name, $plugin_version ); // Instantiate to initialize 131 TableMaster_Settings::getInstance( $plugin_name, $plugin_version ); // Instantiate to initialize 118 132 119 133 register_activation_hook( __FILE__, array( &$this, 'activate' ) ); … … 127 141 */ 128 142 function activate() { 129 TableMaster_Admin::getInstance( )->activate();130 TableMaster_Settings::getInstance( )->activate();143 TableMaster_Admin::getInstance( $plugin_name, $plugin_version )->activate(); 144 TableMaster_Settings::getInstance( $plugin_name, $plugin_version )->activate(); 131 145 } 132 146 … … 135 149 */ 136 150 function deactivate() { 137 TableMaster_Admin::getInstance( )->deactivate();138 TableMaster_Settings::getInstance( )->deactivate();151 TableMaster_Admin::getInstance( $plugin_name, $plugin_version )->deactivate(); 152 TableMaster_Settings::getInstance( $plugin_name, $plugin_version )->deactivate(); 139 153 } 140 154 … … 221 235 */ 222 236 $this->tables[$table_id]['table_id'] = $table_id; 223 $this->tables[$table_id]['settings'] = get_option( TableMaster_Settings::getInstance( )->get_options_name() );237 $this->tables[$table_id]['settings'] = get_option( TableMaster_Settings::getInstance( $this->plugin_name, $this->plugin_version )->get_options_name() ); 224 238 $this->tables[$table_id]['div_tag_id'] = 'tablemaster_wrapper_' . $table_id; 225 239 $this->tables[$table_id]['table_tag_id'] = 'tablemaster_table_' . $table_id; … … 301 315 * Check the thead keyword 302 316 */ 303 if ( array_key_exists('thead', $atts ) && "false" == $atts['thead'] ) { 317 if ( array_key_exists('thead', $atts ) && "true" == $atts['thead'] ) { 318 $this->tables[$table_id]['settings']['thead'] = true; 319 320 } else if ( array_key_exists('thead', $atts ) && "false" == $atts['thead'] ) { 304 321 $this->tables[$table_id]['settings']['thead'] = false; 305 322 } … … 309 326 */ 310 327 if ( array_key_exists('nohead', $atts ) && "true" == $atts['nohead'] ) { 311 $this->tables[$table_id]['settings']['nohead'] = true; 328 $this->tables[$table_id]['settings']['nohead'] = true; 329 330 } else if ( array_key_exists('nohead', $atts ) && "false" == $atts['nohead'] ) { 331 $this->tables[$table_id]['settings']['nohead'] = false; 312 332 } 313 333 … … 316 336 */ 317 337 if ( array_key_exists('tfoot', $atts ) && "true" == $atts['tfoot'] ) { 318 $this->tables[$table_id]['settings']['tfoot'] = true; 338 $this->tables[$table_id]['settings']['tfoot'] = true; 339 340 } else if ( array_key_exists('tfoot', $atts ) && "false" == $atts['tfoot'] ) { 341 $this->tables[$table_id]['settings']['tfoot'] = false; 319 342 } 320 343 … … 337 360 */ 338 361 if ( array_key_exists('datatables', $atts ) && "true" == $atts['datatables'] ) { 339 if ( array_key_exists('thead', $atts ) && "false" == $atts['thead']) {362 if (( array_key_exists('thead', $atts ) && "false" == $atts['thead'] ) || ( false == $this->tables[$table_id]['settings']['thead'] )) { 340 363 return "thead must also be set to true in order to use the Jquery Datatables."; 341 364 } 342 $this->tables[$table_id]['settings']['datatables'] = true; 365 $this->tables[$table_id]['settings']['datatables'] = true; 366 367 } else if ( array_key_exists('datatables', $atts ) && "false" == $atts['datatables'] ) { 368 $this->tables[$table_id]['settings']['datatables'] = false; 343 369 } 344 370 … … 347 373 */ 348 374 if ( array_key_exists('rows', $atts ) && !empty( $atts['rows'] )) { 349 if ( !array_key_exists('datatables', $atts ) || ( array_key_exists('datatables', $atts ) && "false" == $atts['datatables'] )) {375 if (( array_key_exists('datatables', $atts ) && "false" == $atts['datatables'] ) || ( false == $this->tables[$table_id]['settings']['datatables'] )) { 350 376 return "Datatables must also be enabled in order to adjust the number of rows."; 351 377 } … … 357 383 */ 358 384 if ( array_key_exists('buttons', $atts ) && "true" == $atts['buttons'] ) { 359 if ( !array_key_exists('datatables', $atts ) || ( array_key_exists('datatables', $atts ) && "false" == $atts['datatables'] )) {385 if (( array_key_exists('datatables', $atts ) && "false" == $atts['datatables'] ) || ( false == $this->tables[$table_id]['settings']['datatables'] )) { 360 386 return "Datatables must also be enabled in order to add the buttons."; 361 387 } 362 388 $this->tables[$table_id]['settings']['buttons'] = true; 363 } 389 390 } else if ( array_key_exists('buttons', $atts ) && "false" == $atts['buttons'] ) { 391 $this->tables[$table_id]['settings']['buttons'] = false; 392 } 393 364 394 365 395 /* … … 367 397 */ 368 398 if ( array_key_exists('button_list', $atts ) && !empty( $atts['button_list'] )) { 369 if ( !array_key_exists('buttons', $atts ) || ( array_key_exists('buttons', $atts ) && "false" == $atts['buttons'] )) { 399 400 if (( !array_key_exists('buttons', $atts ) || ( array_key_exists('buttons', $atts ) && "false" == $atts['buttons'] )) || 401 ( false == $this->tables[$table_id]['settings']['buttons'] )) { 370 402 return "Datatables must also be enabled in order to add the buttons."; 371 403 } … … 378 410 379 411 /* 412 * Check the default_sort keyword (requires datatables = true, datatables could be set to true by a keyword or set to true in the default settings.) 413 */ 414 if ( array_key_exists('default_sort', $atts ) ) { 415 416 if (( array_key_exists('datatables', $atts ) && "false" == $atts['datatables'] ) || ( false == $this->tables[$table_id]['settings']['datatables'] )) { 417 return "The \'default_sort\' keyword has no effect unless \'datatables\' is enabled."; 418 } 419 420 if ( "true" == $atts['default_sort'] ) { 421 $this->tables[$table_id]['settings']['default_sort'] = true; 422 423 } else if ( "false" == $atts['default_sort'] ) { 424 $this->tables[$table_id]['settings']['default_sort'] = false; 425 } 426 } 427 428 /* 380 429 * Check the nowrap keyword 381 430 */ … … 388 437 */ 389 438 390 if ( array_key_exists('new_window', $atts ) && "false" == $atts['new_window'] ) { 439 if ( array_key_exists('new_window', $atts ) && "true" == $atts['new_window'] ) { 440 $this->tables[$table_id]['settings']['new_window'] = true; 441 442 } else if ( array_key_exists('new_window', $atts ) && "false" == $atts['new_window'] ) { 391 443 $this->tables[$table_id]['settings']['new_window'] = false; 392 444 } 445 393 446 /* 394 447 * Check the col_widths keyword … … 434 487 //$this->tables[$table_id]['sql'] = mysql_real_escape_string( $this->tables[$table_id]['sql'] ); 435 488 } 436 489 //_logMaster( print_r( $this->tables[$table_id], true )); 437 490 return null; 438 491 } … … 717 770 ); 718 771 772 // By default, DataTables will sort the data alphabetically by column 1. If the user 773 // does not want the data sorted that way, they must set default_sort="false". 774 if ( ( false == $t['settings']['default_sort'] ) ) { 775 $datatable_options['aaSorting'] = '"aaSorting":[]'; // disables default sort by column 1 776 } 777 719 778 if( true == $t['settings']['buttons'] ) { 720 779 /* Need to set the button list based on what was entered witih the shortcode */ … … 727 786 $button_list = "["; 728 787 foreach( $button_names as $button ) { 729 //$button_list .= "\'".$button."\', ";730 788 $button_list .= "'".$button."', "; 731 789 } 790 732 791 $button_list = rtrim($button_list); 733 792 $button_list = substr($button_list, 0, -1)."]";
Note: See TracChangeset
for help on using the changeset viewer.