Table Maker - Version 1.0

Version Description

  • Initial release
Download this release

Release Info

Developer wpsoul
Plugin Icon 128x128 Table Maker
Version 1.0
Comparing to
See all releases

Version 1.0

css/style.css ADDED
@@ -0,0 +1 @@
 
0
- webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
1
 
1
+ @font-face { font-family: 'wpsm-icons'; src: url('../font/wpsm-icons.eot?-jgkfsj'); src: url('../font/wpsm-icons.eot?#iefix-jgkfsj') format('embedded-opentype'), url('../font/wpsm-icons.woff?-jgkfsj') format('woff'), url('../font/wpsm-icons.ttf?-jgkfsj') format('truetype'), url('../font/wpsm-icons.svg?-jgkfsj#wpsm-icons') format('svg'); font-weight: normal; font-style: normal; }
 
2
 
css/table-maker.css ADDED
@@ -0,0 +1 @@
 
0
  * jQuery UI CSS Framework 1.11.1
1
  * http://jqueryui.com
2
  *
3
  * Copyright 2014 jQuery Foundation and other contributors
4
  * Released under the MIT license.
5
  * http://jquery.org/license
6
  *
7
  * http://api.jqueryui.com/category/theming/
8
  */
9
- ---------------------------------*/
10
- ---------------------------------*/
11
- ---------------------------------*/
12
- ---------------------------------*/
1
+ .wrap h2 { margin-bottom: 10px; }
2
  * jQuery UI CSS Framework 1.11.1
3
  * http://jqueryui.com
4
  *
5
  * Copyright 2014 jQuery Foundation and other contributors
6
  * Released under the MIT license.
7
  * http://jquery.org/license
8
  *
9
  * http://api.jqueryui.com/category/theming/
10
  */
 
 
 
 
font/wpsm-icons.eot ADDED
Binary file
font/wpsm-icons.svg ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by IcoMoon</metadata>
5
+ <defs>
6
+ <font id="wpsm-icons" horiz-adv-x="512">
7
+ <font-face units-per-em="512" ascent="480" descent="-32" />
8
+ <missing-glyph horiz-adv-x="512" />
9
+ <glyph unicode="&#x20;" d="" horiz-adv-x="256" />
10
+ <glyph unicode="&#xe600;" d="M404.505 281.549h-46.106v35.84c0 74.163-34.151 117.76-102.4 117.76-68.224 0-102.4-43.597-102.4-117.76v-35.84h-51.2c-14.131 0-25.6-16.563-25.6-30.72v-199.68c0-14.080 10.983-29.159 24.371-33.459l30.617-9.907c13.389-4.327 35.865-7.859 49.971-7.859h148.48c14.080 0 36.582 3.533 49.971 7.859l30.618 9.907c13.414 4.301 24.371 19.379 24.371 33.459v199.68c0 14.157-16.563 30.72-30.695 30.72zM204.8 327.629c0 36.992 20.429 56.32 51.2 56.32 30.797 0 51.2-19.328 51.2-56.32v-46.080h-102.4v46.080z" />
11
+ <glyph unicode="&#xe601;" d="M440.038 380.135c-42.803 39.296-112.205 39.296-155.008 0l-29.030-26.675-29.056 26.675c-42.803 39.296-112.179 39.296-154.982 0-48.154-44.186-48.154-115.815 0-160.026l184.038-168.909 184.039 168.909c48.154 44.211 48.154 115.84 0 160.026z" />
12
+ <glyph unicode="&#xe602;" d="M256 455.68l61.133-172.083h164.147l-133.939-101.069 47.872-177.408-139.213 106.342-139.213-106.342 47.872 177.408-133.939 101.069h164.147z" />
13
+ <glyph unicode="&#xe603;" d="M212.352 51.2c-11.136 0-21.683 5.197-28.441 14.157l-91.495 120.781c-11.904 15.719-8.806 38.093 6.912 49.997 15.744 11.929 38.093 8.806 49.997-6.912l60.185-79.463 151.347 242.97c10.419 16.717 32.435 21.837 49.178 11.418 16.717-10.394 21.837-32.435 11.392-49.152l-178.765-286.976c-6.221-10.010-16.947-16.281-28.697-16.793-0.537-0.026-1.075-0.026-1.613-0.026z" />
14
+ <glyph unicode="&#xe604;" d="M367.334 149.709l-70.605 80.691 70.605 80.691c12.007 12.007 12.007 31.463 0 43.443s-31.462 11.981-43.443 0l-67.891-77.593-67.865 77.568c-12.006 12.006-31.463 12.006-43.443 0s-11.981-31.463 0-43.443l70.579-80.666-70.605-80.691c-11.981-12.007-11.981-31.411 0-43.392 12.006-12.007 31.463-12.007 43.443 0l67.891 77.543 67.865-77.543c12.007-12.007 31.462-12.007 43.443 0s12.007 31.385 0.026 43.392z" />
15
+ <glyph unicode="&#xe605;" d="M252.851 465.894c-130.048-1.741-234.087-108.595-232.345-238.669 1.741-129.997 108.595-234.061 238.643-232.32s234.087 108.595 232.346 238.669c-1.715 130.022-108.595 234.061-238.643 232.32zM278.963 387.405c23.936 0 31.002-13.875 31.002-29.773 0-19.84-15.897-38.195-43.008-38.195-22.681 0-33.459 11.418-32.819 30.259 0 15.897 13.312 37.709 44.825 37.709zM217.575 83.2c-16.358 0-28.339 9.933-16.896 53.606l18.765 77.415c3.251 12.416 3.789 17.383 0 17.383-4.889 0-26.137-8.576-38.707-17.024l-8.166 13.389c39.808 33.229 85.581 52.736 105.19 52.736 16.358 0 19.072-19.354 10.906-49.127l-21.504-81.408c-3.789-14.387-2.151-19.353 1.639-19.353 4.889 0 20.992 5.939 36.813 18.381l9.241-12.416c-38.681-38.681-80.896-53.581-97.28-53.581z" />
16
+ <glyph unicode="&#xe606;" d="M499.507 26.061l-228.045 400.154c-3.149 5.53-9.063 8.935-15.463 8.935s-12.288-3.405-15.463-8.935l-228.019-400.154c-3.098-5.427-3.046-12.058 0.128-17.433s9.011-8.678 15.309-8.678h456.064c6.247 0 12.109 3.303 15.309 8.678 3.175 5.376 3.226 12.007 0.179 17.433zM284.16 51.149h-56.32v51.2h56.32v-51.2zM284.16 140.749h-56.32v153.6h56.32v-153.6z" />
17
+ <glyph unicode="&#xe607;" d="M481.28 283.597h-164.173l-61.133 172.083-61.107-172.083h-164.147l133.913-101.069-47.872-177.408 139.213 106.342 139.213-106.342-47.872 177.408 133.965 101.069zM255.975 161.689l-77.107-64.025 31.795 91.187-72.986 58.88 90.137-2.56 28.135 103.424 28.16-103.424 90.137 2.56-72.986-58.88 31.821-91.187-77.107 64.025z" />
18
+ </font></defs></svg>
font/wpsm-icons.ttf ADDED
Binary file
font/wpsm-icons.woff ADDED
Binary file
img/cross.png ADDED
Binary file
img/editor_badge.png ADDED
Binary file
img/editor_badge.psd ADDED
Binary file
img/editor_hor_badge.png ADDED
Binary file
img/icon.png ADDED
Binary file
inc/class-wpsm-db-table.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'WPINC' ) ) {
4
+ die;
5
+ }
6
+
7
+ class WPSM_DB_Table
8
+ {
9
+ private $db;
10
+
11
+ function __construct()
12
+ {
13
+ global $wpdb;
14
+ $this->db = $wpdb;
15
+ $this->table_name = "wpsm_tables";
16
+ $this->db_version = "1.0";
17
+ }
18
+
19
+ public static function get_instance(){
20
+ static $instance = null;
21
+ if($instance == null){
22
+ $instance = new WPSM_DB_Table();
23
+ }
24
+ return $instance;
25
+ }
26
+
27
+ public function create_table(){
28
+ $current_version = get_option('wpsm_db_table_version');
29
+ if($current_version && $current_version == $this->db_version && $this->db->get_var("SHOW TABLES LIKE '$this->table_name'") == $this->table_name){
30
+ return;
31
+ }
32
+
33
+ $sql = "
34
+ CREATE TABLE $this->table_name (
35
+ id MEDIUMINT(9) NOT NULL AUTO_INCREMENT,
36
+ name TINYTEXT NOT NULL,
37
+ rows MEDIUMINT(9) NOT NULL,
38
+ cols MEDIUMINT(9) NOT NULL,
39
+ subs TINYTEXT NOT NULL,
40
+ color TINYTEXT NOT NULL,
41
+ responsive tinyint(1) NOT NULL DEFAULT '0',
42
+ tvalues LONGTEXT NOT NULL,
43
+ UNIQUE KEY id (id)
44
+ );
45
+ ";
46
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
47
+ dbDelta( $sql );
48
+ update_option('wpsm_db_table_version', $this->db_version);
49
+ }
50
+
51
+ public function add($name, $rows, $cols, $subs, $color, $responsive, $tvalues){
52
+ $name = wp_strip_all_tags(wp_unslash($name));
53
+ $rows = intval(wp_unslash($rows));
54
+ $cols = intval(wp_unslash($cols));
55
+ $subs = strval(wp_unslash($subs));
56
+ $color = strval(wp_unslash($color));
57
+ $responsive = intval(wp_unslash($responsive));
58
+ $tvalues = $this->serialize(wp_unslash($tvalues));
59
+
60
+ $result = $this->db->insert( $this->table_name, array('name' => $name, 'rows' => $rows, 'cols' => $cols, 'subs' => $subs, 'color' => $color, 'responsive' => $responsive, 'tvalues' => $tvalues ) );
61
+ if($result)
62
+ return $this->db->insert_id;
63
+ return false;
64
+ }
65
+
66
+ public function update($id, $name, $rows, $cols, $subs, $color, $responsive, $tvalues){
67
+ $name = wp_strip_all_tags(wp_unslash($name));
68
+ $rows = intval(wp_unslash($rows));
69
+ $cols = intval(wp_unslash($cols));
70
+ $subs = strval(wp_unslash($subs));
71
+ $color = strval(wp_unslash($color));
72
+ $responsive = intval(wp_unslash($responsive));
73
+ $tvalues = $this->serialize(wp_unslash($tvalues));
74
+
75
+ return $this->db->update( $this->table_name, array('name' => $name, 'rows' => $rows, 'cols' => $cols, 'subs' => $subs, 'color' => $color, 'responsive' => $responsive, 'tvalues' => $tvalues ), array( 'id' => $id ) );
76
+ }
77
+
78
+ public function drop_table() {
79
+ $query = "DROP TABLE $this->table_name";
80
+ return $this->db->query($query);
81
+ }
82
+
83
+ public function delete($id){
84
+ if(is_array($id))
85
+ $id = sprintf('(%s)', implode(',', $id));
86
+ else {
87
+ $id = sprintf('(%d)', $id);
88
+ }
89
+
90
+ $query = "DELETE FROM $this->table_name WHERE id IN $id";
91
+ return $this->db->query($query);
92
+ }
93
+
94
+ public function get($id){
95
+ if( is_array($id) ){
96
+ $id = sprintf('(%s)', implode(',', $id));
97
+ }
98
+ else {
99
+ $id = sprintf('(%d)', $id);
100
+ }
101
+ $row = $this->db->get_row("SELECT * FROM $this->table_name WHERE id IN $id", ARRAY_A);
102
+ if($row){
103
+ $row['tvalues'] = $this->unserialize($row['tvalues']);
104
+ }
105
+ return $row;
106
+ }
107
+
108
+ public function get_page_items($curr_page, $per_page){
109
+ $start = (($curr_page-1)*$per_page);
110
+ $query = "SELECT * FROM $this->table_name ORDER BY id DESC LIMIT $start, $per_page";
111
+ return $this->db->get_results( $query, ARRAY_A );
112
+ }
113
+
114
+ public function get_count(){
115
+ $count = $this->db->get_var("SELECT COUNT(*) FROM $this->table_name");
116
+ return isset($count)?$count:0;
117
+ }
118
+
119
+ private function serialize($item){
120
+ return base64_encode(serialize($item));
121
+ }
122
+
123
+ private function unserialize($item){
124
+ return unserialize(base64_decode($item));
125
+ }
126
+ }
127
+
128
+ ?>
inc/class-wpsm-list-table.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'WPINC' ) ) {
4
+ die;
5
+ }
6
+
7
+ if(!class_exists('WP_List_Table')){
8
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
9
+ }
10
+
11
+ class WPSM_List_Table extends WP_List_Table {
12
+
13
+ private $db;
14
+
15
+ public function __construct(){
16
+
17
+ $this->load_dependencies();
18
+
19
+ $this->db = WPSM_DB_Table::get_instance();
20
+
21
+ global $status, $page;
22
+
23
+ parent::__construct( array(
24
+ 'singular' => 'table',
25
+ 'plural' => 'tables',
26
+ 'ajax' => false,
27
+ 'screen' => $_REQUEST['page']
28
+ ) );
29
+ }
30
+
31
+ function load_dependencies(){
32
+ require_once( 'class-wpsm-db-table.php' );
33
+ }
34
+
35
+ function get_columns(){
36
+ $columns = array(
37
+ 'cb' => '<input type="checkbox" />',
38
+ 'id' => __('ID', 'wpsm-tableplugin'),
39
+ 'name' => __('Name', 'wpsm-tableplugin'),
40
+ 'rows' => __('Rows', 'wpsm-tableplugin'),
41
+ 'cols' => __('Columns', 'wpsm-tableplugin'),
42
+ 'subs' => __('Sub-headers', 'wpsm-tableplugin')
43
+ );
44
+ return $columns;
45
+ }
46
+
47
+ function column_default($item, $column_name){
48
+ return stripslashes($item[$column_name]);
49
+ }
50
+
51
+ function column_name($item){
52
+ //Build row actions
53
+ $actions = array(
54
+ 'edit' => sprintf('<a href="?page=%s&action=%s&table=%s">%s</a>', $_REQUEST['page'],'edit',$item['id'], __('Edit', 'wpsm-tableplugin') )
55
+ );
56
+
57
+ //Return the title contents
58
+ return sprintf('%1$s %2$s',
59
+ /*$1%s*/ stripslashes($item['name']),
60
+ /*$2%s*/ $this->row_actions($actions)
61
+ );
62
+ }
63
+
64
+ function column_cb($item){
65
+ return sprintf(
66
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
67
+ /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie")
68
+ /*$2%s*/ $item['id'] //The value of the checkbox should be the record's id
69
+ );
70
+ }
71
+
72
+ function get_bulk_actions() {
73
+ $actions = array(
74
+ 'delete' => __('Delete', 'wpsm-tableplugin')
75
+ );
76
+ return $actions;
77
+ }
78
+
79
+ function prepare_items() {
80
+ $per_page = 25;
81
+ $hidden = array();
82
+ $columns = $this->get_columns();
83
+ $sortable = array();
84
+ $curr_page = $this->get_pagenum();
85
+
86
+ $total_items = $this->db->get_count();
87
+ $data = $this->db->get_page_items($curr_page, $per_page);
88
+
89
+ $this->items = $data;
90
+ $this->_column_headers = array($columns, $hidden, $sortable);
91
+
92
+ $this->set_pagination_args( array(
93
+ 'total_items' => $total_items,
94
+ 'per_page' => $per_page,
95
+ 'total_pages' => ceil($total_items/$per_page)
96
+ ) );
97
+ }
98
+
99
+ function show(){
100
+ ?>
101
+ <form method="GET">
102
+ <input type="hidden" name="page" value="<?php echo $_GET['page'] ?>">
103
+ <?php
104
+ $this->prepare_items();
105
+ $this->display();
106
+ ?>
107
+ </form>
108
+ <?php
109
+ }
110
+ }
inc/class-wpsm-table-maker.php ADDED
@@ -0,0 +1,425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'WPINC' ) ) {
4
+ die;
5
+ }
6
+
7
+ class WPSM_Table_Maker
8
+ {
9
+ private $version;
10
+
11
+ private $page_slug;
12
+
13
+ private $page_hook;
14
+
15
+ private $base_url;
16
+
17
+ private $db;
18
+
19
+ function __construct($_version, $_base_url = false ) {
20
+ $this->load_dependencies();
21
+
22
+ $this->version = $_version;
23
+ $this->page_slug = 'wpsm_table_maker';
24
+
25
+ $this->db = WPSM_DB_Table::get_instance();
26
+
27
+ add_action( 'admin_menu', array($this, 'add_menu_items') );
28
+ add_action( 'admin_enqueue_scripts', array($this, 'backend_enqueue') );
29
+ add_action( 'admin_init', array($this, 'handle_requests') );
30
+ add_action( 'admin_notices', array($this, 'admin_notices') );
31
+ add_shortcode( 'wpsm_comparison_table', array($this, 'comparison_table_callback') );
32
+ add_action( 'init', array($this, 'wpsm_table_frontend_scripts') );
33
+ add_action( 'wp_enqueue_scripts', array($this, 'wpsm_table_frontend_styles') );
34
+
35
+ if(!$_base_url)
36
+ $this->base_url = plugins_url( '', dirname(__FILE__) );
37
+ else
38
+ $this->base_url = $_base_url;
39
+ }
40
+
41
+ private function load_dependencies(){
42
+ require_once 'class-wpsm-list-table.php';
43
+ require_once 'class-wpsm-db-table.php';
44
+ }
45
+
46
+ public function add_menu_items() {
47
+ $this->page_hook = add_menu_page( __('Table Maker', 'wpsm-tableplugin'), __('Table Maker', 'wpsm-tableplugin'), 'manage_options', $this->page_slug, array($this, 'print_page'), $this->base_url . "/img/icon.png" );
48
+ }
49
+
50
+ public function wpsm_table_frontend_scripts() {
51
+ wp_register_script( 'table-maker-front', $this->base_url . '/js/table-maker-front.js', array('jquery'), $this->version, true );
52
+ wp_register_script( 'jquery-stacktable', $this->base_url . '/js/stacktable.js', array('jquery'), '0.1.0', true );
53
+
54
+ }
55
+
56
+ public function wpsm_table_frontend_styles() {
57
+ wp_enqueue_style( "wpsm-comptable-styles", plugins_url( "css/style.css" , dirname(__FILE__) ), null, $this->version, "all" );
58
+ }
59
+
60
+ public function backend_enqueue($hook) {
61
+ if( $this->page_hook != $hook )
62
+ return;
63
+ wp_enqueue_style( 'wpsm-stylesheet', $this->base_url . '/css/table-maker.css', false, $this->version, 'all' );
64
+ wp_enqueue_script( 'wpsm-comptable-script', $this->base_url . '/js/table-maker.js', array('jquery'), $this->version );
65
+ wp_enqueue_script( 'jquery-ui-dialog' );
66
+ wp_enqueue_script('jquery-effects-bounce');
67
+ if (function_exists('wp_enqueue_media')) {wp_enqueue_media();}
68
+
69
+ $wpsm_js_strings = array(
70
+ 'placeholder' => __('Click to edit', 'wpsm-tableplugin'),
71
+ 'resize_error' => __('Please enter valid numbers', 'wpsm-tableplugin'),
72
+ 'only_one' => __('Please fill only one field', 'wpsm-tableplugin'),
73
+ 'insert_error_row' => __('Please specify number less than existing rows count', 'wpsm-tableplugin'),
74
+ 'insert_error_col' => __('Please specify number less than existing cols count', 'wpsm-tableplugin'),
75
+ 'switch_error' => __('Please enter valid numbers between 1 and', 'wpsm-tableplugin')
76
+ );
77
+ wp_localize_script( 'wpsm-comptable-script', 'wpsm_js_strings', $wpsm_js_strings );
78
+ }
79
+
80
+ public function print_page() {
81
+ ?>
82
+ <div class="wrap">
83
+ <?php
84
+ if(isset($_GET['action']) && $_GET['action'] == 'add'){
85
+ echo sprintf( '<h2>%s <a class="add-new-h2" href="%s">%s</a></h2>', __('Add Table', 'wpsm-tableplugin'), admin_url('admin.php?page='.$this->page_slug), __('View All', 'wpsm-tableplugin') );
86
+ $this->create_ui();
87
+ }
88
+ elseif(isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['table']) && is_numeric($_GET['table'])){
89
+ echo sprintf( '<h2>%s <a class="add-new-h2" href="%s">%s</a></h2>', __('Edit Table', 'wpsm-tableplugin'), admin_url('admin.php?page='.$this->page_slug), __('View All', 'wpsm-tableplugin') );
90
+ $table = $this->db->get($_GET['table']);
91
+ if($table)
92
+ $this->create_ui($table);
93
+ }
94
+ else{
95
+ echo sprintf( '<h2>%s <a class="add-new-h2" href="%s">%s</a></h2>', __('Tables', 'wpsm-tableplugin'), admin_url('admin.php?page='.$this->page_slug.'&action=add'), __('Add New', 'wpsm-tableplugin') );
96
+ $list_table = new WPSM_List_Table();
97
+ $list_table->show();
98
+ }
99
+ ?>
100
+ </div>
101
+ <?php
102
+ }
103
+
104
+ private function create_ui($table = false){
105
+ $table_id = $table ? $table['id'] : '';
106
+ $name = $table ? $table['name'] : '';
107
+ $rows = $table ? $table['rows'] : 4;
108
+ $cols = $table ? $table['cols'] : 4;
109
+ $subs = $table ? $table['subs'] : '';
110
+ $color = $table ? $table['color'] : 'default';
111
+ $responsive = $table ? $table['responsive'] : '';
112
+ $curr_values = $table ? $table['tvalues'] : '';
113
+ $col_span = $cols;
114
+ $sub_array = explode(',', $subs);
115
+ ?>
116
+ <form autocomplete="off" method="POST" class="wpsm-form">
117
+ <input type="text" class="wpsm-comptable-title" placeholder="<?php _e('Table Name', 'wpsm-tableplugin'); ?>" name="table_name" value="<?php echo esc_attr($name); ?>" required="required" />
118
+ <input type="hidden" class="wpsm-rows" value="<?php echo esc_attr($rows); ?>" name="table_rows" />
119
+ <input type="hidden" class="wpsm-cols" value="<?php echo esc_attr($cols); ?>" name="table_cols" />
120
+ <input type="hidden" class="wpsm-subs" value="<?php echo esc_attr($subs); ?>" name="table_subs" />
121
+ <div class="wpsm-options">
122
+ <p class="description">
123
+ <input type="checkbox" name="table_respon" id="wpsm_respon" class="checkbox" value="1" <?php if($responsive) echo 'checked="checked"'; ?> /><label for="wpsm_respon"> - <?php _e('enable responsive stack style for mobile devices','wpsm-tableplugin'); ?></label>
124
+ </p>
125
+ <div class="wpsm-controls">
126
+ <button id="wpsm-comptable-resize-btn" type="button" class="button"><?php _e('Resize Table', 'wpsm-tableplugin') ?></button>
127
+ <button id="wpsm-row-switcher-btn" type="button" class="button"><?php _e('Switch Rows', 'wpsm-tableplugin') ?></button>
128
+ <button id="wpsm-col-switcher-btn" type="button" class="button"><?php _e('Switch Cols', 'wpsm-tableplugin') ?></button>
129
+ <button id="wpsm-comptable-addnew-btn" type="button" class="button"><?php _e('Add Inside', 'wpsm-tableplugin') ?></button>
130
+ <button id="wpsm-comptable-remove-btn" type="button" class="button"><?php _e('Remove', 'wpsm-tableplugin') ?></button>
131
+ <select id="wpsm-colors" name="table_color" class="wpsm-select-color">
132
+ <option value="default" <?php if($color == 'default') echo 'selected'; ?>><?php _e('Grey', 'wpsm-tableplugin') ;?></option>
133
+ <option value="black" <?php if($color == 'black') echo 'selected'; ?>><?php _e('Black', 'wpsm-tableplugin') ;?></option>
134
+ <option value="yellow" <?php if($color == 'yellow') echo 'selected'; ?>><?php _e('Yellow', 'wpsm-tableplugin') ;?></option>
135
+ <option value="blue" <?php if($color == 'blue') echo 'selected'; ?>><?php _e('Blue', 'wpsm-tableplugin') ;?></option>
136
+ <option value="red" <?php if($color == 'red') echo 'selected'; ?>><?php _e('Red', 'wpsm-tableplugin') ;?></option>
137
+ <option value="green" <?php if($color == 'green') echo 'selected'; ?>><?php _e('Green', 'wpsm-tableplugin') ;?></option>
138
+ <option value="orange" <?php if($color == 'orange') echo 'selected'; ?>><?php _e('Orange', 'wpsm-tableplugin') ;?></option>
139
+ <option value="purple" <?php if($color == 'purple') echo 'selected'; ?>><?php _e('Purple', 'wpsm-tableplugin') ;?></option>
140
+ </select>
141
+ </div>
142
+ </div>
143
+ <div class="wpsm_comptable_admin_description">
144
+ <div class="wpsm_comptable_shortcode_echo">
145
+ [wpsm_comparison_table id="<?php echo $table_id; ?>" class=""]
146
+ </div>
147
+ <div class="wpsm_comptable_shortcode_hidden">
148
+ [wpsm_comparison_table id="<?php echo $table_id; ?>" class="<span id='wpsm_comp_shortcode_firsthover'></span><span id='wpsm_comp_shortcode_calign'></span>"]
149
+ </div>
150
+ <p class="description">
151
+ <input type="checkbox" id="wpsm_first_col_hover_check" /><label for="wpsm_first_col_hover_check"> - <?php _e('Add "mark the first column" class to shortcode', 'wpsm-tableplugin'); ?></label>&nbsp;&nbsp;
152
+ <input type="checkbox" id="wpsm_calign_check" /><label for="wpsm_calign_check"> - <?php _e('Add "center text align" class to shortcode', 'wpsm-tableplugin'); ?></label>
153
+ </p>
154
+ </div>
155
+ <table class="wpsm-comptable">
156
+ <thead class="wpsm-thead">
157
+ <tr>
158
+ <?php for ($j=1; $j <= $cols; $j++): ?>
159
+ <th><input placeholder="<?php _e('Click to edit', 'wpsm-tableplugin') ?>" type="text" name="table_values[0][<?php echo $j; ?>]" value="<?php echo isset($curr_values[0][$j]) ? esc_attr($curr_values[0][$j]) : ''; ?>" /></th>
160
+ <?php endfor; ?>
161
+ </tr>
162
+ </thead>
163
+ <tbody class="wpsm-tbody">
164
+ <?php for ($i=1; $i <= $rows; $i++): ?>
165
+ <?php echo in_array($i, $sub_array) ? '<tr class="subheader">' : '<tr>'; ?>
166
+ <?php for ($j=1; $j <= $cols; $j++): ?>
167
+ <?php echo in_array($i, $sub_array) ? '<td colspan="'.$col_span.'">' : '<td>'; ?>
168
+ <?php if ($j==1) {echo '<span class="num_row_wpsm_table">'.$i.'</span>' ;} ;?>
169
+ <textarea placeholder="<?php _e('Click to edit', 'wpsm-tableplugin') ?>" type="text" name="table_values[<?php echo $i; ?>][<?php echo $j; ?>]" ><?php echo isset($curr_values[$i][$j]) ? esc_attr($curr_values[$i][$j]) : ''; ?></textarea>
170
+
171
+ </td>
172
+ <?php if(in_array($i, $sub_array)) break; ?>
173
+ <?php endfor; ?>
174
+ </tr>
175
+ <?php endfor; ?>
176
+ </tbody>
177
+ </table>
178
+ <div class="wpsm_comptable_description">
179
+ <span class="wpsm_comptable_info_span">&#8505;</span>
180
+ <?php _e('Each cell supports html and shortcodes. ', 'wpsm-tableplugin'); ?>
181
+ <br/>
182
+ <?php $placeholders = array('tick', 'cross', 'info', 'warning', 'heart', 'lock', 'star', 'star-empty'); ?>
183
+ <?php _e('To add icons you can use these placeholders: ', 'wpsm-tableplugin'); foreach($placeholders as $p){ echo "<strong>%".strtoupper($p)."%</strong>&nbsp;&nbsp;&nbsp;"; } ?>
184
+ <?php echo '<br/><br/>'; echo ' <strong>%COL-CHOICE% &nbsp;&nbsp; %COL-CHOICE-IMAGE% &nbsp;&nbsp; %ROW-CHOICE% &nbsp;&nbsp; %ROW-CHOICE-IMAGE%</strong>'; _e(' makes row or col as featured.', 'wpsm-tableplugin'); ?>
185
+ <?php if( function_exists('wpsm_shortcode_button') ) {
186
+ echo '<br/><br/>';
187
+ _e('Useful shortcodes:', 'wpsm-tableplugin');
188
+ echo '<br/><br/>';
189
+ echo '<strong>[wpsm_button color="green" size="big" link="" icon="" target="_blank" rel="nofollow"]Button[/wpsm_button]</strong><br/>';
190
+ _e('Possible color attribute:', 'wpsm-tableplugin'); echo ' orange, blue, green, black, rosy, brown, pink, purple, gold, teal. <br/>'; _e('Possible sizes:', 'wpsm-tableplugin'); echo ' small, medium, big, giant. <br/>'; _e('Possible icons:', 'wpsm-tableplugin'); echo ' download, check-circle, link, map-marker, star, heart, save, check-circle. ';
191
+ echo '<br/><br/>';
192
+ echo '<strong>[wpsm_numcircle num="1" style="2"]</strong><br/>';
193
+ _e('Nembered circle. Place number in', 'wpsm-tableplugin'); echo ' num';
194
+ echo '<br/><br/>';
195
+ echo '<strong>[wpsm_highlight color="yellow"]Content[/wpsm_highlight]</strong><br/>';
196
+ _e('Possible colors: ', 'wpsm-tableplugin'); echo ' yellow, blue, red, green, black';
197
+ echo '<br/><br/>';
198
+ echo '<strong>[wpsm_bar title="Design" percentage="60" color="#fb7203"]</strong><br/>';
199
+ _e('Animated bar. You can use any color', 'wpsm-tableplugin');
200
+ echo '<br/><br/>';
201
+ echo '<strong>[wpsm_is_user]Content[/wpsm_is_user]</strong><br/>';
202
+ _e('Shows content only for logged users', 'wpsm-tableplugin');
203
+ echo '<br/><br/>';
204
+ echo '<strong>[wpsm_is_guest]Content[/wpsm_is_guest]</strong><br/>';
205
+ _e('Shows content only for not logged users', 'wpsm-tableplugin');
206
+
207
+ }
208
+ ?>
209
+ </div>
210
+ <div class="wpsm_table_helper_image">
211
+ <img src="" class="wpsm_table_helper_preview_image" alt="" style="max-width: 80px" width="80" height="80" />
212
+ <strong><?php _e('Image Helper', 'wpsm-tableplugin'); ?></strong>
213
+ <p class="description"><?php _e('Upload or choose image here and copy code to table', 'wpsm-tableplugin'); ?></p>
214
+ <input type="text" size="70" class="wpsm_table_helper_upload_image" value="" />
215
+ <a href="#" class="wpsm_table_helper_upload_image_button button" rel=""><?php _e('Choose Image', 'wpsm-tableplugin'); ?></a>
216
+ <small>&nbsp;<a href="#" class="wpsm_table_helper_clear_image_button button">X</a></small>
217
+ <br /><br />
218
+
219
+ </div>
220
+
221
+ <div class="clear"></div>
222
+ <?php
223
+ if($table) {
224
+ echo '<p class="submit">';
225
+ submit_button( __('Save Changes', 'wpsm-plugin'), 'primary', 'wpsm-save-changes', false );
226
+ echo ' ';
227
+ submit_button( __('Dublicate Table', 'wpsm-plugin'), 'primary', 'wpsm-create-table', false );
228
+ echo '</p>';
229
+ } else {
230
+ submit_button( __('Create Table', 'wpsm-plugin'), 'primary', 'wpsm-create-table', true );
231
+ }
232
+ ?>
233
+ </form>
234
+
235
+ <div id="wpsm-comptable-resize-dialog" class="wpsm-dialog" title="<?php _e('Change Table Size', 'wpsm-tableplugin') ?>">
236
+ <div class="wpsm-dialog-error"></div>
237
+ <?php _e('Cols', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-col-count" />
238
+ <?php _e('Rows', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-row-count" />
239
+ <?php _e('Sub-header Rows (e.g.1,3,6)', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-sub-array" />
240
+ <button class="button button-primary"><?php _e('Apply', 'wpsm-tableplugin') ?></button>
241
+ </div>
242
+
243
+ <div id="wpsm-row-switcher-dialog" class="wpsm-dialog" title="Switch Rows">
244
+ <div class="wpsm-dialog-error"></div>
245
+ <?php _e('Row 1', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-row1" />
246
+ <?php _e('Row 2', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-row2" />
247
+ <button class="button button-primary"><?php _e('Switch', 'wpsm-tableplugin') ?></button>
248
+ </div>
249
+
250
+ <div id="wpsm-col-switcher-dialog" class="wpsm-dialog" title="Switch Columns">
251
+ <div class="wpsm-dialog-error"></div>
252
+ <?php _e('Col 1', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-col1" />
253
+ <?php _e('Col 2', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-col2" />
254
+ <button class="button button-primary"><?php _e('Switch', 'wpsm-tableplugin') ?></button>
255
+ </div>
256
+
257
+ <div id="wpsm-comptable-addnew-dialog" class="wpsm-dialog" title="<?php _e('Add Empty Row/Column', 'wpsm-tableplugin') ?>">
258
+ <div class="wpsm-dialog-error"></div>
259
+ <?php _e('Add empty col after (number)', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-col-after" />
260
+ <?php _e('Add empty row after (number)', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-row-after" />
261
+ <button class="button button-primary"><?php _e('Apply', 'wpsm-tableplugin') ?></button>
262
+ </div>
263
+
264
+ <div id="wpsm-comptable-remove-dialog" class="wpsm-dialog" title="<?php _e('Delete Row/Column', 'wpsm-tableplugin') ?>">
265
+ <div class="wpsm-dialog-error"></div>
266
+ <?php _e('Remove col (number)', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-col-remove" />
267
+ <?php _e('Remove row (number)', 'wpsm-tableplugin') ?>: <input type="text" class="wpsm-row-remove" />
268
+ <button class="button button-primary"><?php _e('Apply', 'wpsm-tableplugin') ?></button>
269
+ </div>
270
+
271
+ <?php
272
+ }
273
+
274
+ private function is_plugin_page(){
275
+ if( !is_admin() || !isset($_GET['page']) || $this->page_slug != $_GET['page'] || (!isset($_GET['action']) && !isset($_GET['action2'])) )
276
+ return false;
277
+ return true;
278
+ }
279
+
280
+ public function handle_requests(){
281
+ if( !$this->is_plugin_page() )
282
+ return;
283
+
284
+ if(isset($_GET['action2']) && $_GET['action2'] != -1 && $_GET['action'] == -1)
285
+ $_GET['action'] = $_GET['action2'];
286
+
287
+ if($_GET['action'] == 'add' && isset($_POST['wpsm-create-table'])){
288
+ if (!isset ($_POST['table_respon'])) {$_POST['table_respon'] = '';}
289
+ $result = $this->db->add( $_POST['table_name'], $_POST['table_rows'], $_POST['table_cols'], $_POST['table_subs'], $_POST['table_color'], $_POST['table_respon'], $_POST['table_values'] );
290
+ if($result){
291
+ $sendback = add_query_arg( array( 'page' => $_GET['page'], 'action' => 'edit', 'table' => $result, 'added' => true ), '' );
292
+ wp_redirect($sendback);
293
+ }
294
+ }
295
+
296
+ if($_GET['action'] == 'edit' && isset($_POST['wpsm-save-changes']) && isset($_GET['table'])){
297
+ if (!isset ($_POST['table_respon'])) {$_POST['table_respon'] = '';}
298
+ $result = $this->db->update( $_GET['table'], $_POST['table_name'], $_POST['table_rows'], $_POST['table_cols'], $_POST['table_subs'], $_POST['table_color'], $_POST['table_respon'], $_POST['table_values'] );
299
+ $sendback = add_query_arg( array( 'page' => $_GET['page'], 'action' => 'edit', 'table' => $_GET['table'], 'updated' => $result ), '' );
300
+ wp_redirect($sendback);
301
+ }
302
+
303
+ if($_GET['action'] == 'edit' && isset($_POST['wpsm-create-table'])){
304
+ if (!isset ($_POST['table_respon'])) {$_POST['table_respon'] = '';}
305
+ $result = $this->db->add( $_POST['table_name'], $_POST['table_rows'], $_POST['table_cols'], $_POST['table_subs'], $_POST['table_color'], $_POST['table_respon'], $_POST['table_values'] );
306
+ if($result){
307
+ $sendback = add_query_arg( array( 'page' => $_GET['page'], 'action' => 'edit', 'table' => $result, 'added' => true ), '' );
308
+ wp_redirect($sendback);
309
+ }
310
+ }
311
+
312
+ if($_GET['action'] == 'delete' && isset($_GET['table']) && is_array($_GET['table']) ){
313
+ $result = $this->db->delete( $_GET['table'] );
314
+ $sendback = add_query_arg( array( 'page' => $_GET['page'], 'deleted' => $result ), '' );
315
+ wp_redirect($sendback);
316
+ }
317
+ }
318
+
319
+ public function admin_notices(){
320
+ if( !$this->is_plugin_page() )
321
+ return;
322
+
323
+ $format = '<div class="updated"><p>%s</p></div>';
324
+
325
+ if(isset($_GET['added']) && $_GET['added']):
326
+ echo sprintf($format, __('The table has been created successfully!', 'wpsm-tableplugin') );
327
+ elseif(isset($_GET['updated']) && $_GET['updated']):
328
+ echo sprintf($format, __('The table has been updated successfully!', 'wpsm-tableplugin') );
329
+ elseif(isset($_GET['deleted']) && $_GET['deleted']):
330
+ echo sprintf($format, __('The table has been deleted successfully!', 'wpsm-tableplugin') );
331
+ endif;
332
+ }
333
+
334
+ function comparison_table_callback( $atts ){
335
+
336
+ $atts = shortcode_atts(
337
+ array(
338
+ 'id' => false,
339
+ 'color' => '',
340
+ 'class' => ''
341
+ ), $atts );
342
+
343
+ if(!$atts['id']){
344
+ _e("Please specify the table ID", 'wpsm-tableplugin');
345
+ return;
346
+ }
347
+
348
+ $table = $this->db->get($atts['id']);
349
+ if(!$table)
350
+ return;
351
+
352
+ ob_start();
353
+ wp_enqueue_script('table-maker-front');
354
+ wp_enqueue_script('jquery-columnhover');
355
+ ?>
356
+ <?php if($table['responsive']) wp_enqueue_script('jquery-stacktable'); ?>
357
+ <div class="wpsm-comptable-wrap">
358
+ <table id="wpsm-table-<?php echo $atts['id'];?>" class="wpsm-comptable<?php echo ' '. $atts['class'].'' ; ?><?php if($table['responsive']) echo ' wpsm-comptable-responsive'; ?>">
359
+ <?php $change_color = ($atts['color']) ? $atts['color'] : $table['color'] ; ?>
360
+ <thead class="wpsm-thead<?php echo ' wpsm-thead-'. $change_color; ?>">
361
+ <tr>
362
+ <?php for ($j=1; $j <= $table['cols']; $j++): ?>
363
+ <?php if ($j==1 && $table['tvalues'][0][1] =='') :?>
364
+ <th class="placeholder wpsm-placeholder"></th>
365
+ <?php else :?>
366
+ <th><?php echo $this->replace_placeholders($table['tvalues'][0][$j]); ?></th>
367
+ <?php endif;?>
368
+
369
+ <?php endfor; ?>
370
+ </tr>
371
+ </thead>
372
+ <tbody class="wpsm-tbody">
373
+ <?php for($i=1; $i <= $table['rows']; $i++): ?>
374
+ <?php $sub_array = explode(',', $table['subs']); ?>
375
+ <?php echo in_array($i, $sub_array) ? '<tr class="subheader">' : '<tr>'; ?>
376
+ <?php for ($j=1; $j <= $table['cols']; $j++): ?>
377
+ <?php echo in_array($i, $sub_array) ? '<td colspan="'.$table['cols'].'">' : '<td>'; ?>
378
+ <?php if (!empty ($table['tvalues'][$i][$j])):?>
379
+ <?php $table_cell_echo = $this->replace_placeholders($table['tvalues'][$i][$j]); ?>
380
+ <?php echo do_shortcode($table_cell_echo); ?>
381
+ <?php endif;?>
382
+ </td>
383
+ <?php if(in_array($i, $sub_array)) break; ?>
384
+ <?php endfor; ?>
385
+ </tr>
386
+ <?php endfor; ?>
387
+ </tbody>
388
+ </table>
389
+ </div>
390
+ <?php
391
+ return ob_get_clean();
392
+ }
393
+
394
+ public function replace_placeholders($str){
395
+ $values = array();
396
+ $values['tick'] = '<i class="wpsm-icon-tick"></i>';
397
+ $values['cross'] = '<i class="wpsm-icon-cross"></i>';
398
+ $values['info'] = '<i class="wpsm-icon-info"></i>';
399
+ $values['warning'] = '<i class="wpsm-icon-warning"></i>';
400
+ $values['heart'] = '<i class="wpsm-icon-heart"></i>';
401
+ $values['lock'] = '<i class="wpsm-icon-lock"></i>';
402
+ $values['star'] = '<i class="wpsm-icon-star"></i>';
403
+ $values['star-empty'] = '<i class="wpsm-icon-star-empty"></i>';
404
+ $values['col-choice'] = '<span class="badge_div_col"></span>';
405
+ $values['col-choice-image'] = '<span class="badge_div_col badge_div_col_img"></span>';
406
+ $values['row-choice'] = '<span class="badge_div_row"></span>';
407
+ $values['row-choice-image'] = '<span class="badge_div_row badge_div_col_img"></span>';
408
+
409
+ foreach ($values as $key => $value) {
410
+ $str = str_replace('%'.strtoupper($key).'%', $value, $str);
411
+ }
412
+ return $str;
413
+ }
414
+
415
+ public function initialize()
416
+ {
417
+ $this->db->create_table();
418
+ }
419
+
420
+ public function rollback()
421
+ {
422
+ $table = WPSM_DB_Table::get_instance();
423
+ $table->drop_table();
424
+ }
425
+ }
js/stacktable.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * stacktable.js
3
+ * Author & copyright (c) 2012: John Polacek
4
+ * CardTable by: Justin McNally (2015)
5
+ * Dual MIT & GPL license
6
+ *
7
+ * Page: http://johnpolacek.github.com/stacktable.js
8
+ * Repo: https://github.com/johnpolacek/stacktable.js/
9
+ *
10
+ * jQuery plugin for stacking tables on small screens
11
+ * Requires jQuery version 1.7 or above
12
+ *
13
+ */
14
+ !function(t){t.fn.cardtable=function(a){var d=this,e={id:"stacktable small-only",hideOriginal:!0,headIndex:0},s=t.extend({},e,a);return a&&a.headIndex?headIndex=a.headIndex:headIndex=0,d.each(function(){if($table=t(this),!$table.hasClass("stacktable")){var a=t(this).prop("class"),d=t("<div></div>");"undefined"!=typeof s.myClass&&d.addClass(s.myClass);var e="";$table.addClass("stacktable large-only"),$caption=$table.find("caption").clone(),$topRow=$table.find("tr").eq(0),$table.find("tbody tr").each(function(d,l){headMarkup="",bodyMarkup="",tr_class=t(this).prop("class"),t(this).find("td,th").each(function(a,d){""!==t(this).html()&&(bodyMarkup+='<tr class="'+tr_class+'">',$topRow.find("td,th").eq(a).html()?bodyMarkup+='<td class="st-key">'+$topRow.find("td,th").eq(a).html()+"</td>":bodyMarkup+='<td class="st-key"></td>',bodyMarkup+='<td class="st-val '+t(this).prop("class")+'">'+t(this).html()+"</td>",bodyMarkup+="</tr>")}),e+='<table class=" '+a+" "+s.id+'"><tbody>'+headMarkup+bodyMarkup+"</tbody></table>"}),$table.find("tfoot tr td").each(function(d,l){""!==t.trim(t(l).text())&&(e+='<table class="'+a+" "+s.id+'"><tbody><tr><td>'+t(l).html()+"</td></tr></tbody></table>")}),d.prepend($caption),d.append(t(e)),$table.before(d),s.hideOriginal||$table.show()}})},t.fn.stacktable=function(a){var d=this,e={id:"stacktable small-only",hideOriginal:!0,headIndex:0},s=t.extend({},e,a);return a&&a.headIndex?headIndex=a.headIndex:headIndex=0,d.each(function(){var a=t(this).prop("class"),d=t('<table class="'+a+" "+s.id+'"><tbody></tbody></table>');"undefined"!=typeof s.myClass&&d.addClass(s.myClass);var e="";$table=t(this),$table.addClass("stacktable large-only"),$caption=$table.find("caption").clone(),$topRow=$table.find("tr").eq(0),$table.find("tr").each(function(a,d){headMarkup="",bodyMarkup="",tr_class=t(this).prop("class"),0===a?e+='<tr class=" '+tr_class+' "><th class="st-head-row st-head-row-main" colspan="2">'+t(this).find("th,td").eq(headIndex).html()+"</th></tr>":(t(this).find("td,th").each(function(a,d){a===headIndex?headMarkup='<tr class="'+tr_class+'"><th class="st-head-row" colspan="2">'+t(this).html()+"</th></tr>":""!==t(this).html()&&(bodyMarkup+='<tr class="'+tr_class+'">',$topRow.find("td,th").eq(a).html()?bodyMarkup+='<td class="st-key">'+$topRow.find("td,th").eq(a).html()+"</td>":bodyMarkup+='<td class="st-key"></td>',bodyMarkup+='<td class="st-val '+t(this).prop("class")+'">'+t(this).html()+"</td>",bodyMarkup+="</tr>")}),e+=headMarkup+bodyMarkup)}),d.prepend($caption),d.append(t(e)),$table.before(d),s.hideOriginal||$table.show()})},t.fn.stackcolumns=function(a){var d=this,e={id:"stacktable small-only",hideOriginal:!0},s=t.extend({},e,a);return d.each(function(){$table=t(this);var a=$table.find("tr").eq(0).find("td,th").length;if(!(3>a)){var d=t('<table class="'+s.id+'"></table>');"undefined"!=typeof s.myClass&&d.addClass(s.myClass),$table.addClass("stacktable large-only");for(var e=t("<tbody></tbody>"),l=1;a>l;)$table.find("tr").each(function(a,d){var s=t("<tr></tr>");0===a&&s.addClass("st-head-row st-head-row-main"),first=t(this).find("td,th").eq(0).clone().addClass("st-key");var n=l;if(t(this).find("*[colspan]").length){var i=0;t(this).find("td,th").each(function(a,d){var e=t(this).attr("colspan");return e?(e=parseInt(e,10),n-=e-1,i+e>l&&(n+=i+e-l-1),i+=e):i++,i>l?!1:void 0})}second=t(this).find("td,th").eq(n).clone().addClass("st-val").removeAttr("colspan"),s.append(first,second),e.append(s)}),++l;d.append(t(e)),$table.before(d),s.hideOriginal||$table.show()}})}}(jQuery);
js/table-maker-front.js ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ $('.wpsm-comptable').columnHover({eachCell:true, hoverClass:'betterhover', includeSpans:false}); // cross hover column and row
3
+
4
+ $('.wpsm-comptable').each(function(){
5
+ var badge_col = $(this).find('.badge_div_col').closest('td');
6
+ var selected_cols = badge_col.parent().children().index(badge_col) + 1;
7
+ $(this).find('tr > td:nth-child('+selected_cols+')').addClass('editor_selected_col');
8
+ $(this).find('tr > th:nth-child('+selected_cols+')').addClass('editor_selected_col');
9
+
10
+ var selected_rows = $(this).find('tr').index($('.badge_div_row').closest('tr'));
11
+ if (selected_rows != -1) {
12
+ $(this).find('tr:eq('+selected_rows+')').addClass('editor_selected_row');
13
+ //$(this).find('tr:eq('+selected_rows+')').prev().addClass('editor_prev_selected_row');
14
+ }
15
+
16
+ });
17
+
18
+ $('.wpsm-comptable-responsive').each(function(){
19
+ $(this).stacktable();
20
+ });
21
+
22
+ });
23
+ /*
24
+ * jQuery columnHover plugin
25
+ * Version: 0.1.1
26
+ *
27
+ * Copyright (c) 2007 Roman Weich
28
+ * http://p.sohei.org
29
+ *
30
+ * Dual licensed under the MIT and GPL licenses
31
+ * (This means that you can choose the license that best suits your project, and use it accordingly):
32
+ * http://www.opensource.org/licenses/mit-license.php
33
+ * http://www.gnu.org/licenses/gpl.html
34
+ */
35
+ !function(e){var o=function(e){for(var o=e.rows,n=o.length,r=[],l=0;n>l;l++)for(var a=o[l].cells,t=a.length,s=0;t>s;s++){var i=a[s],c=i.rowSpan||1,h=i.colSpan||1,d=-1;r[l]||(r[l]=[]);for(var f=r[l];f[++d];);i.realIndex=d;for(var u=l;l+c>u;u++){r[u]||(r[u]=[]);for(var v=r[u],C=d;d+h>C;C++)v[C]=1}}};e.fn.columnHover=function(n){var r=e.extend({hoverClass:"hover",eachCell:!1,includeSpans:!0,ignoreCols:[]},n),l=function(o,n,l){var a=n[o.realIndex],t=0;if(-1==e(r.ignoreCols).index(o.realIndex+1)){for(;++t<o.colSpan;)a=a.concat(n[o.realIndex+t]);l?e(a).addClass(r.hoverClass):e(a).removeClass(r.hoverClass)}},a=function(e,o){e.bind("mouseover",function(){l(this,o,!0)}).bind("mouseout",function(){l(this,o,!1)})};return this.each(function(){var n,l,t,s,i,c,h,d,f=[],u=this;if(u.tBodies&&u.tBodies.length&&u.tHead&&r.hoverClass.length){for(o(u),s=0;s<u.tBodies.length;s++)for(n=u.tBodies[s],i=0;i<n.rows.length;i++)for(l=n.rows[i],c=0;c<l.cells.length;c++)if(t=l.cells[c],r.includeSpans||!(t.colSpan>1)){for(d=r.includeSpans?t.colSpan:1;--d>=0;)h=t.realIndex+d,f[h]||(f[h]=[]),f[h].push(t);r.eachCell&&a(e(t),f)}a(e("td, th",u.tHead),f),r.eachCell&&u.tFoot&&a(e("td, th",u.tFoot),f)}})}}(jQuery);
js/table-maker.js ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function ($) {
2
+ var field_name_prefix = 'table_values';
3
+
4
+ function get_effective(curr, index) {
5
+ if(!index)
6
+ return curr;
7
+
8
+ if(curr == index[0])
9
+ return index[1];
10
+ else if(curr == index[1])
11
+ return index[0];
12
+ else
13
+ return curr;
14
+ }
15
+
16
+ function get_curr_row_count(){
17
+ return parseInt($('.wpsm-rows').val());
18
+ }
19
+
20
+ function get_curr_col_count(){
21
+ return parseInt($('.wpsm-cols').val());
22
+ }
23
+
24
+ function get_curr_sub_array(){
25
+ return $('.wpsm-subs').val();
26
+ }
27
+
28
+ function is_valid_num(x){
29
+ if(parseInt(x) == x && x > 0)
30
+ return true;
31
+ return false;
32
+ }
33
+
34
+ function is_valid_row(x){
35
+ if(is_valid_num(x) && parseInt(x) <= get_curr_row_count())
36
+ return true;
37
+ return false;
38
+ }
39
+
40
+ function is_valid_col(x){
41
+ if(is_valid_num(x) && parseInt(x) <= get_curr_col_count())
42
+ return true;
43
+ return false;
44
+ }
45
+
46
+ function in_array(value, array) {
47
+ for(var i=0; i<array.length; i++){
48
+ if(value == array[i]) return true;
49
+ }
50
+ return false;
51
+ }
52
+
53
+ function rebuildTable(switch_rows, switch_cols){
54
+ switch_rows = (typeof switch_rows !== 'undefined') ? switch_rows : false;
55
+ switch_cols = (typeof switch_cols !== 'undefined') ? switch_cols : false;
56
+ var row_count = $('.wpsm-rows').val();
57
+ var col_count = $('.wpsm-cols').val();
58
+ var sub_array = $('.wpsm-subs').val();
59
+ sub_array = sub_array.split( ',' );
60
+
61
+ var table = $('.wpsm-comptable');
62
+ var effective_row, effective_col;
63
+
64
+ var table_html = '<thead><tr>';
65
+ for(var i = 1; i <= col_count; i++){
66
+ effective_col = get_effective(i, switch_cols);
67
+ var selector = 'input[name="'+field_name_prefix+'[0]['+effective_col+']"]';
68
+ var curr_val = ( $(selector).val() ) ? $(selector).val() : '';
69
+ table_html += '<th><input name="'+field_name_prefix+'[0]['+i+']" value="'+curr_val+'" placeholder="'+wpsm_js_strings.placeholder+'" /></th>';
70
+ }
71
+ table_html += '</tr></thead><tbody>';
72
+
73
+ for(var i = 1; i <= row_count; i++){
74
+
75
+ table_html += in_array(i, sub_array) ? '<tr class="subheader">' : '<tr>';
76
+
77
+ for(var j = 1; j <= col_count; j++){
78
+
79
+ effective_row = get_effective(i, switch_rows);
80
+ effective_col = get_effective(j, switch_cols);
81
+
82
+ var selector = 'textarea[name="'+field_name_prefix+'['+effective_row+']['+effective_col+']"]';
83
+ var curr_val = ( $(selector).val() ) ? $(selector).val() : '';
84
+ var col_span = col_count;
85
+
86
+ table_html += in_array(i, sub_array) ? '<td colspan="'+col_span+'">' : '<td>';
87
+ if (j == 1) {
88
+ table_html += '<span class="num_row_wpsm_table">'+i+'</span>';
89
+ }
90
+ table_html += '<textarea name="'+field_name_prefix+'['+i+']['+j+']" placeholder="'+wpsm_js_strings.placeholder+'">'+curr_val+'</textarea></td>';
91
+ if(in_array(i, sub_array)) break;
92
+ }
93
+ table_html += '</tr>';
94
+
95
+ }
96
+ table_html += '</tbody>';
97
+ table.html(table_html);
98
+ }
99
+
100
+ //Table resize dialog
101
+
102
+ $('#wpsm-comptable-resize-btn').click(function(e) {
103
+ $( "#wpsm-comptable-resize-dialog" ).dialog({
104
+ modal:true,
105
+ draggable: false,
106
+ open: function(e, ui) {
107
+ $(this).children('.wpsm-row-count').val(get_curr_row_count());
108
+ $(this).children('.wpsm-col-count').val(get_curr_col_count());
109
+ $(this).children('.wpsm-sub-array').val(get_curr_sub_array());
110
+ $(this).children('.wpsm-dialog-error').hide();
111
+ }
112
+ });
113
+ });
114
+
115
+ $('#wpsm-comptable-resize-dialog button').click(function(e) {
116
+ var row_count = $(this).siblings('.wpsm-row-count').val();
117
+ var col_count = $(this).siblings('.wpsm-col-count').val();
118
+ var sub_array = $(this).siblings('.wpsm-sub-array').val();
119
+ var error_cont = $(this).siblings('.wpsm-dialog-error').first();
120
+ if(is_valid_num(row_count) && is_valid_num(col_count)){
121
+ error_cont.hide();
122
+ $('.wpsm-rows').val(row_count);
123
+ $('.wpsm-cols').val(col_count);
124
+ $('.wpsm-subs').val(sub_array);
125
+ rebuildTable();
126
+ $('#wpsm-comptable-resize-dialog').dialog("close");
127
+ }
128
+ else{
129
+ error_cont.html(wpsm_js_strings.resize_error).show().effect( "bounce" );
130
+ }
131
+ });
132
+
133
+ //Switch Rows Dialog
134
+
135
+ $('#wpsm-row-switcher-btn').click(function(e) {
136
+ $( "#wpsm-row-switcher-dialog" ).dialog({
137
+ modal:true,
138
+ draggable: false,
139
+ open: function(e, ui) {
140
+ $(this).children('input[type="text"]').val('');
141
+ $(this).children('.wpsm-dialog-error').hide();
142
+ }
143
+ });
144
+ });
145
+
146
+ $( "#wpsm-row-switcher-dialog button" ).click(function(e) {
147
+ var row_1 = $(this).siblings('.wpsm-row1').val();
148
+ var row_2 = $(this).siblings('.wpsm-row2').val();
149
+ var error_cont = $(this).siblings('.wpsm-dialog-error').first();
150
+ if(is_valid_row(row_1) && is_valid_row(row_2)){
151
+ error_cont.hide();
152
+ rebuildTable([row_1, row_2], false);
153
+ $( "#wpsm-row-switcher-dialog" ).dialog("close");
154
+ }
155
+ else{
156
+ error_cont.html(wpsm_js_strings.switch_error + ' ' + get_curr_row_count()).show().effect( "bounce" );
157
+ }
158
+ });
159
+
160
+ //Switch Cols Dialog
161
+
162
+ $('#wpsm-col-switcher-btn').click(function(e) {
163
+ $( "#wpsm-col-switcher-dialog" ).dialog({
164
+ modal:true,
165
+ draggable: false,
166
+ open: function(e, ui) {
167
+ $(this).children('input[type="text"]').val('');
168
+ $(this).children('.wpsm-dialog-error').hide();
169
+ }
170
+ });
171
+ });
172
+
173
+ $( "#wpsm-col-switcher-dialog button" ).click(function(e) {
174
+ var col_1 = $(this).siblings('.wpsm-col1').val();
175
+ var col_2 = $(this).siblings('.wpsm-col2').val();
176
+ var error_cont = $(this).siblings('.wpsm-dialog-error').first();
177
+ if(is_valid_col(col_1) && is_valid_col(col_2)){
178
+ error_cont.hide();
179
+ rebuildTable(false, [col_1, col_2]);
180
+ $( "#wpsm-col-switcher-dialog" ).dialog("close");
181
+ }
182
+ else{
183
+ error_cont.html(wpsm_js_strings.switch_error + ' ' + get_curr_col_count()).show().effect( "bounce" );
184
+ }
185
+ });
186
+
187
+ //Table add empty dialog
188
+
189
+ $('#wpsm-comptable-addnew-btn').click(function(e) {
190
+ $( "#wpsm-comptable-addnew-dialog" ).dialog({
191
+ modal:true,
192
+ draggable: false,
193
+ open: function(e, ui) {
194
+ $(this).children('input[type="text"]').val('');
195
+ $(this).children('.wpsm-dialog-error').hide();
196
+ }
197
+ });
198
+ });
199
+
200
+ $('#wpsm-comptable-addnew-dialog button').click(function(e) {
201
+ var row_after = $(this).siblings('.wpsm-row-after').val();
202
+ var col_after = $(this).siblings('.wpsm-col-after').val();
203
+ var col_count = get_curr_col_count();
204
+ var row_count = get_curr_row_count();
205
+ var sub_array = $('.wpsm-subs').val();
206
+ sub_array = sub_array.split( ',' );
207
+ var error_cont = $(this).siblings('.wpsm-dialog-error').first();
208
+
209
+ if(is_valid_col(col_after) || is_valid_row(row_after)){
210
+ error_cont.hide();
211
+
212
+ if (row_after && col_after) {
213
+ error_cont.html(wpsm_js_strings.only_one).show().effect( "bounce" );
214
+ return;
215
+ }
216
+
217
+ if (row_after) {
218
+ if (row_after < row_count) {
219
+ // Increment indexes of all rows after row_after
220
+ var row_index = row_insert_index = parseInt(row_after) + 1;
221
+ for(row_index; row_index <= row_count; row_index++){
222
+ var row_tr_index = $('.wpsm-comptable tr:eq('+row_index+') textarea');
223
+ row_increment = parseInt(row_index) + 1;
224
+ row_tr_index.each(function(i){
225
+ i++;
226
+ $(this).attr('name', field_name_prefix+'['+row_increment+']['+i+']');
227
+ });
228
+ }
229
+ // Add empty row
230
+ table_html = '<tr>';
231
+ for(var j = 1; j <= col_count; j++){
232
+ table_html += '<td><textarea name="'+field_name_prefix+'['+row_insert_index+']['+j+']" placeholder="'+wpsm_js_strings.placeholder+'"></textarea></td>';
233
+ }
234
+ table_html += '</tr>';
235
+ $('.wpsm-comptable tr:eq('+row_insert_index+')').before(table_html);
236
+ // Increment hidden input value
237
+ $('.wpsm-rows').val(row_count + 1);
238
+ // Rebuild sub headers
239
+ var subheaderarray = [];
240
+ $.each(sub_array, function(index, value) {
241
+ if (parseInt(value) >= row_insert_index) {
242
+ subheaderarray.push(parseInt(value) + 1);
243
+ }
244
+ else {
245
+ subheaderarray.push(parseInt(value));
246
+ }
247
+ });
248
+ subheaderarray = subheaderarray.join(',');
249
+ $('.wpsm-subs').val(subheaderarray);
250
+ // Close popup
251
+ $('#wpsm-comptable-addnew-dialog').dialog("close");
252
+ // Rebuild values
253
+ $('.num_row_wpsm_table').remove();
254
+ for (var num_index = 1; num_index <= row_count+1; num_index++) {
255
+ $('.wpsm-comptable tr:eq('+num_index+') > td:nth-child(1)').prepend('<span class="num_row_wpsm_table">'+num_index+'</span>');
256
+ }
257
+
258
+ }
259
+ else{
260
+ error_cont.html(wpsm_js_strings.insert_error_row).show().effect( "bounce" );
261
+ }
262
+ }
263
+
264
+ if (col_after) {
265
+ if (col_after < col_count) {
266
+ for(var j = 1; j <= row_count; j++){
267
+ // Increment indexes of all cols after col_after
268
+ var col_index = col_insert_index = parseInt(col_after) + 1;
269
+ for(col_index; col_index <= col_count; col_index++){
270
+ var col_td_index = $('.wpsm-comptable tr:eq('+j+') > td:nth-child('+col_index+') textarea');
271
+ col_increment = parseInt(col_index) + 1;
272
+ col_td_index.each(function(){
273
+ $(this).attr('name', field_name_prefix+'['+j+']['+col_increment+']');
274
+ });
275
+ $('.wpsm-comptable tr > th:nth-child('+col_index+') input').attr('name', field_name_prefix+'[0]['+col_increment+']');
276
+ }
277
+
278
+ var col_td_foreach = $('.wpsm-comptable tr:eq('+j+') > td:nth-child('+col_insert_index+')');
279
+ table_html = '<td><textarea name="'+field_name_prefix+'['+j+']['+col_insert_index+']" placeholder="'+wpsm_js_strings.placeholder+'"></textarea></td>';
280
+ col_td_foreach.before(table_html);
281
+
282
+ }
283
+ // Add empty col
284
+ $('.wpsm-comptable tr > th:nth-child('+col_insert_index+')').before('<th><input name="'+field_name_prefix+'[0]['+col_insert_index+']" value="" placeholder="'+wpsm_js_strings.placeholder+'" /></th>');
285
+
286
+ // Increment hidden input value and close
287
+ $('.wpsm-cols').val(col_count + 1);
288
+ $('#wpsm-comptable-addnew-dialog').dialog("close");
289
+ $('.wpsm-comptable tr.subheader').each(function(){
290
+ $(this).find('td').attr('colspan', col_count + 1)
291
+ });
292
+ }
293
+ else{
294
+ error_cont.html(wpsm_js_strings.insert_error_col).show().effect( "bounce" );
295
+ }
296
+ }
297
+
298
+ }
299
+ else{
300
+ error_cont.html(wpsm_js_strings.resize_error).show().effect( "bounce" );
301
+ }
302
+ });
303
+
304
+
305
+ //Table remove dialog
306
+
307
+ $('#wpsm-comptable-remove-btn').click(function(e) {
308
+ $( "#wpsm-comptable-remove-dialog" ).dialog({
309
+ modal:true,
310
+ draggable: false,
311
+ open: function(e, ui) {
312
+ $(this).children('input[type="text"]').val('');
313
+ $(this).children('.wpsm-dialog-error').hide();
314
+ }
315
+ });
316
+ });
317
+
318
+ $('#wpsm-comptable-remove-dialog button').click(function(e) {
319
+ var row_remove = $(this).siblings('.wpsm-row-remove').val();
320
+ var col_remove = $(this).siblings('.wpsm-col-remove').val();
321
+ var col_count = get_curr_col_count();
322
+ var row_count = get_curr_row_count();
323
+ var error_cont = $(this).siblings('.wpsm-dialog-error').first();
324
+ var sub_array = $('.wpsm-subs').val();
325
+ sub_array = sub_array.split( ',' );
326
+
327
+ if(is_valid_col(col_remove) || is_valid_row(row_remove)){
328
+ error_cont.hide();
329
+
330
+ if (row_remove && col_remove) {
331
+ error_cont.html(wpsm_js_strings.only_one).show().effect( "bounce" );
332
+ return;
333
+ }
334
+
335
+ if (row_remove) {
336
+ if (row_remove < row_count) {
337
+ // Reduce indexes of all rows after row_remove
338
+ var row_index = parseInt(row_remove) + 1;
339
+ var row_remove_index = parseInt(row_remove);
340
+ for(row_index; row_index <= row_count; row_index++){
341
+ var row_tr_index = $('.wpsm-comptable tr:eq('+row_index+') textarea');
342
+ row_reduce = parseInt(row_index) - 1;
343
+ row_tr_index.each(function(i){
344
+ i++;
345
+ $(this).attr('name', field_name_prefix+'['+row_reduce+']['+i+']');
346
+ });
347
+ }
348
+ // Remove row
349
+ $('.wpsm-comptable tr:eq('+row_remove_index+')').remove();
350
+
351
+ // Reduce hidden input value, recreate subheaders and close popup
352
+ $('.wpsm-rows').val(row_count - 1);
353
+
354
+ var subheaderarray = [];
355
+ $.each(sub_array, function(index, value) {
356
+ if (parseInt(value) > row_remove_index) {
357
+ subheaderarray.push(parseInt(value) - 1);
358
+ }
359
+ else if (parseInt(value) == row_remove_index) {
360
+ }
361
+ else {
362
+ subheaderarray.push(parseInt(value));
363
+ }
364
+ });
365
+ subheaderarray = subheaderarray.join(',');
366
+ $('.wpsm-subs').val(subheaderarray);
367
+
368
+ $('#wpsm-comptable-remove-dialog').dialog("close");
369
+
370
+ $('.num_row_wpsm_table').remove();
371
+ for (var num_index = 1; num_index <= row_count-1; num_index++) {
372
+ $('.wpsm-comptable tr:eq('+num_index+') > td:nth-child(1)').prepend('<span class="num_row_wpsm_table">'+num_index+'</span>');
373
+ }
374
+
375
+ }
376
+ else{ //if removed row is last
377
+ var row_remove_index = parseInt(row_remove);
378
+ $('.wpsm-comptable tr:eq('+row_remove_index+')').remove();
379
+ $('.wpsm-rows').val(row_count - 1);
380
+ var subheaderarray = [];
381
+ $.each(sub_array, function(index, value) {
382
+ if (parseInt(value) > row_remove_index) {
383
+ subheaderarray.push(parseInt(value) - 1);
384
+ }
385
+ else if (parseInt(value) == row_remove_index) {
386
+ }
387
+ else {
388
+ subheaderarray.push(parseInt(value));
389
+ }
390
+ });
391
+ subheaderarray = subheaderarray.join(',');
392
+ $('.wpsm-subs').val(subheaderarray);
393
+ $('#wpsm-comptable-remove-dialog').dialog("close");
394
+ $('.num_row_wpsm_table').remove();
395
+ for (var num_index = 1; num_index <= row_count-1; num_index++) {
396
+ $('.wpsm-comptable tr:eq('+num_index+') > td:nth-child(1)').prepend('<span class="num_row_wpsm_table">'+num_index+'</span>');
397
+ }
398
+ }
399
+ }
400
+
401
+ if (col_remove) {
402
+ if (col_remove < col_count) {
403
+ for(var j = 1; j <= row_count; j++){
404
+ // Reduce indexes of all cols after col_remove
405
+ var col_index = parseInt(col_remove) + 1;
406
+ var col_remove_index = parseInt(col_remove);
407
+ for(col_index; col_index <= col_count; col_index++){
408
+ var col_td_index = $('.wpsm-comptable tr:eq('+j+') > td:nth-child('+col_index+') textarea');
409
+ col_reduce = parseInt(col_index) - 1;
410
+ col_td_index.each(function(){
411
+ $(this).attr('name', field_name_prefix+'['+j+']['+col_reduce+']');
412
+ });
413
+ $('.wpsm-comptable tr > th:nth-child('+col_index+') input').attr('name', field_name_prefix+'[0]['+col_reduce+']');
414
+ }
415
+
416
+ var col_td_foreach = $('.wpsm-comptable tr:eq('+j+'):not(.subheader) > td:nth-child('+col_remove_index+')');
417
+ col_td_foreach.remove();
418
+
419
+ }
420
+ // Remove col in header
421
+ $('.wpsm-comptable tr > th:nth-child('+col_remove_index+')').remove();
422
+
423
+ // Reduce hidden input value and close
424
+ $('.wpsm-cols').val(col_count - 1);
425
+ $('#wpsm-comptable-remove-dialog').dialog("close");
426
+ $('.wpsm-comptable tr.subheader').each(function(){
427
+ $(this).find('td').attr('colspan', col_count - 1)
428
+ });
429
+ $('.num_row_wpsm_table').remove();
430
+ for (var num_index = 1; num_index <= row_count; num_index++) {
431
+ $('.wpsm-comptable tr:eq('+num_index+') > td:nth-child(1)').prepend('<span class="num_row_wpsm_table">'+num_index+'</span>');
432
+ }
433
+ }
434
+ else{
435
+ var col_remove_index = parseInt(col_remove);
436
+ for(var j = 1; j <= row_count; j++){
437
+ var col_td_foreach = $('.wpsm-comptable tr:eq('+j+'):not(.subheader) > td:nth-child('+col_remove_index+')');
438
+ col_td_foreach.remove();
439
+ }
440
+ $('.wpsm-comptable tr > th:nth-child('+col_remove_index+')').remove();
441
+ $('.wpsm-cols').val(col_count - 1);
442
+ $('#wpsm-comptable-remove-dialog').dialog("close");
443
+ $('.wpsm-comptable tr.subheader').each(function(){
444
+ $(this).find('td').attr('colspan', col_count - 1)
445
+ });
446
+ }
447
+ }
448
+
449
+ }
450
+ else{
451
+ error_cont.html(wpsm_js_strings.resize_error).show().effect( "bounce" );
452
+ }
453
+ });
454
+
455
+
456
+ //Shortcode helper
457
+
458
+ $('#wpsm_first_col_hover_check').click(function() {
459
+ if ($(this).is(':checked')) {
460
+ $('#wpsm_comp_shortcode_firsthover').html('hover-col1 ');
461
+ }
462
+ else {
463
+ $('#wpsm_comp_shortcode_firsthover').html('');
464
+ }
465
+ var shortcode_strip_tags = $('.wpsm_comptable_shortcode_hidden').text();
466
+ $('.wpsm_comptable_shortcode_echo').html(shortcode_strip_tags);
467
+ });
468
+
469
+ $('#wpsm_calign_check').click(function() {
470
+ if ($(this).is(':checked')) {
471
+ $('#wpsm_comp_shortcode_calign').html('center-table-align');
472
+ }
473
+ else {
474
+ $('#wpsm_comp_shortcode_calign').html('');
475
+ }
476
+ var shortcode_strip_tags = $('.wpsm_comptable_shortcode_hidden').text();
477
+ $('.wpsm_comptable_shortcode_echo').html(shortcode_strip_tags);
478
+ });
479
+
480
+ //Image helper
481
+ var imageFrame;jQuery(".wpsm_table_helper_upload_image_button").click(function(e){e.preventDefault();return $self=jQuery(e.target),$div=$self.closest("div.wpsm_table_helper_image"),imageFrame?void imageFrame.open():(imageFrame=wp.media({title:"Choose Image",multiple:!1,library:{type:"image"},button:{text:"Use This Image"}}),imageFrame.on("select",function(){selection=imageFrame.state().get("selection"),selection&&selection.each(function(e){console.log(e);{var t=e.attributes.sizes.full.url;e.id}$div.find(".wpsm_table_helper_preview_image").attr("src",t),$div.find(".wpsm_table_helper_upload_image").val('<img src ="'+t+'" alt="" />')})}),void imageFrame.open())}),jQuery(".wpsm_table_helper_clear_image_button").click(function(){var e='';return jQuery(this).parent().siblings(".wpsm_table_helper_upload_image").val(""),jQuery(this).parent().siblings(".wpsm_table_helper_preview_image").attr("src",e),!1});
482
+
483
+
484
+ });
languages/table-maker.pot ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: wpsm-tableplugin\n"
4
+ "POT-Creation-Date: 2015-11-14 21:55+0200\n"
5
+ "PO-Revision-Date: 2015-11-14 21:55+0200\n"
6
+ "Last-Translator: Sizam themes <sizamtheme@gmail.com>\n"
7
+ "Language-Team: Wpsoul <sizamtheme@gmail.com>\n"
8
+ "Language: en\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.6.10\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;_n_noop:1,2\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+
19
+ #: ../inc/class-wpsm-list-table.php:38
20
+ msgid "ID"
21
+ msgstr ""
22
+
23
+ #: ../inc/class-wpsm-list-table.php:39
24
+ msgid "Name"
25
+ msgstr ""
26
+
27
+ #: ../inc/class-wpsm-list-table.php:40 ../inc/class-wpsm-table-maker.php:238
28
+ msgid "Rows"
29
+ msgstr ""
30
+
31
+ #: ../inc/class-wpsm-list-table.php:41
32
+ msgid "Columns"
33
+ msgstr ""
34
+
35
+ #: ../inc/class-wpsm-list-table.php:42
36
+ msgid "Sub-headers"
37
+ msgstr ""
38
+
39
+ #: ../inc/class-wpsm-list-table.php:54
40
+ msgid "Edit"
41
+ msgstr ""
42
+
43
+ #: ../inc/class-wpsm-list-table.php:74
44
+ msgid "Delete"
45
+ msgstr ""
46
+
47
+ #: ../inc/class-wpsm-table-maker.php:47
48
+ msgid "Table Maker"
49
+ msgstr ""
50
+
51
+ #: ../inc/class-wpsm-table-maker.php:70 ../inc/class-wpsm-table-maker.php:159
52
+ #: ../inc/class-wpsm-table-maker.php:169
53
+ msgid "Click to edit"
54
+ msgstr ""
55
+
56
+ #: ../inc/class-wpsm-table-maker.php:71
57
+ msgid "Please enter valid numbers"
58
+ msgstr ""
59
+
60
+ #: ../inc/class-wpsm-table-maker.php:72
61
+ msgid "Please fill only one field"
62
+ msgstr ""
63
+
64
+ #: ../inc/class-wpsm-table-maker.php:73
65
+ msgid "Please specify number less than existing rows count"
66
+ msgstr ""
67
+
68
+ #: ../inc/class-wpsm-table-maker.php:74
69
+ msgid "Please specify number less than existing cols count"
70
+ msgstr ""
71
+
72
+ #: ../inc/class-wpsm-table-maker.php:75
73
+ msgid "Please enter valid numbers between 1 and"
74
+ msgstr ""
75
+
76
+ #: ../inc/class-wpsm-table-maker.php:85
77
+ msgid "Add Table"
78
+ msgstr ""
79
+
80
+ #: ../inc/class-wpsm-table-maker.php:85 ../inc/class-wpsm-table-maker.php:89
81
+ msgid "View All"
82
+ msgstr ""
83
+
84
+ #: ../inc/class-wpsm-table-maker.php:89
85
+ msgid "Edit Table"
86
+ msgstr ""
87
+
88
+ #: ../inc/class-wpsm-table-maker.php:95
89
+ msgid "Tables"
90
+ msgstr ""
91
+
92
+ #: ../inc/class-wpsm-table-maker.php:95
93
+ msgid "Add New"
94
+ msgstr ""
95
+
96
+ #: ../inc/class-wpsm-table-maker.php:117
97
+ msgid "Table Name"
98
+ msgstr ""
99
+
100
+ #: ../inc/class-wpsm-table-maker.php:123
101
+ msgid "enable responsive stack style for mobile devices"
102
+ msgstr ""
103
+
104
+ #: ../inc/class-wpsm-table-maker.php:126
105
+ msgid "Resize Table"
106
+ msgstr ""
107
+
108
+ #: ../inc/class-wpsm-table-maker.php:127
109
+ msgid "Switch Rows"
110
+ msgstr ""
111
+
112
+ #: ../inc/class-wpsm-table-maker.php:128
113
+ msgid "Switch Cols"
114
+ msgstr ""
115
+
116
+ #: ../inc/class-wpsm-table-maker.php:129
117
+ msgid "Add Inside"
118
+ msgstr ""
119
+
120
+ #: ../inc/class-wpsm-table-maker.php:130
121
+ msgid "Remove"
122
+ msgstr ""
123
+
124
+ #: ../inc/class-wpsm-table-maker.php:132
125
+ msgid "Grey"
126
+ msgstr ""
127
+
128
+ #: ../inc/class-wpsm-table-maker.php:133
129
+ msgid "Black"
130
+ msgstr ""
131
+
132
+ #: ../inc/class-wpsm-table-maker.php:134
133
+ msgid "Yellow"
134
+ msgstr ""
135
+
136
+ #: ../inc/class-wpsm-table-maker.php:135
137
+ msgid "Blue"
138
+ msgstr ""
139
+
140
+ #: ../inc/class-wpsm-table-maker.php:136
141
+ msgid "Red"
142
+ msgstr ""
143
+
144
+ #: ../inc/class-wpsm-table-maker.php:137
145
+ msgid "Green"
146
+ msgstr ""
147
+
148
+ #: ../inc/class-wpsm-table-maker.php:138
149
+ msgid "Orange"
150
+ msgstr ""
151
+
152
+ #: ../inc/class-wpsm-table-maker.php:139
153
+ msgid "Purple"
154
+ msgstr ""
155
+
156
+ #: ../inc/class-wpsm-table-maker.php:151
157
+ msgid "Add \"mark the first column\" class to shortcode"
158
+ msgstr ""
159
+
160
+ #: ../inc/class-wpsm-table-maker.php:152
161
+ msgid "Add \"center text align\" class to shortcode"
162
+ msgstr ""
163
+
164
+ #: ../inc/class-wpsm-table-maker.php:180
165
+ msgid "Each cell supports html and shortcodes. "
166
+ msgstr ""
167
+
168
+ #: ../inc/class-wpsm-table-maker.php:183
169
+ msgid "To add icons you can use these placeholders: "
170
+ msgstr ""
171
+
172
+ #: ../inc/class-wpsm-table-maker.php:184
173
+ msgid " makes row or col as featured."
174
+ msgstr ""
175
+
176
+ #: ../inc/class-wpsm-table-maker.php:187
177
+ msgid "Useful shortcodes:"
178
+ msgstr ""
179
+
180
+ #: ../inc/class-wpsm-table-maker.php:190
181
+ msgid "Possible color attribute:"
182
+ msgstr ""
183
+
184
+ #: ../inc/class-wpsm-table-maker.php:190
185
+ msgid "Possible sizes:"
186
+ msgstr ""
187
+
188
+ #: ../inc/class-wpsm-table-maker.php:190
189
+ msgid "Possible icons:"
190
+ msgstr ""
191
+
192
+ #: ../inc/class-wpsm-table-maker.php:193
193
+ msgid "Nembered circle. Place number in"
194
+ msgstr ""
195
+
196
+ #: ../inc/class-wpsm-table-maker.php:196
197
+ msgid "Possible colors: "
198
+ msgstr ""
199
+
200
+ #: ../inc/class-wpsm-table-maker.php:199
201
+ msgid "Animated bar. You can use any color"
202
+ msgstr ""
203
+
204
+ #: ../inc/class-wpsm-table-maker.php:202
205
+ msgid "Shows content only for logged users"
206
+ msgstr ""
207
+
208
+ #: ../inc/class-wpsm-table-maker.php:205
209
+ msgid "Shows content only for not logged users"
210
+ msgstr ""
211
+
212
+ #: ../inc/class-wpsm-table-maker.php:212
213
+ msgid "Image Helper"
214
+ msgstr ""
215
+
216
+ #: ../inc/class-wpsm-table-maker.php:213
217
+ msgid "Upload or choose image here and copy code to table"
218
+ msgstr ""
219
+
220
+ #: ../inc/class-wpsm-table-maker.php:215
221
+ msgid "Choose Image"
222
+ msgstr ""
223
+
224
+ #: ../inc/class-wpsm-table-maker.php:225
225
+ msgid "Save Changes"
226
+ msgstr ""
227
+
228
+ #: ../inc/class-wpsm-table-maker.php:227
229
+ msgid "Dublicate Table"
230
+ msgstr ""
231
+
232
+ #: ../inc/class-wpsm-table-maker.php:230
233
+ msgid "Create Table"
234
+ msgstr ""
235
+
236
+ #: ../inc/class-wpsm-table-maker.php:235
237
+ msgid "Change Table Size"
238
+ msgstr ""
239
+
240
+ #: ../inc/class-wpsm-table-maker.php:237
241
+ msgid "Cols"
242
+ msgstr ""
243
+
244
+ #: ../inc/class-wpsm-table-maker.php:239
245
+ msgid "Sub-header Rows (e.g.1,3,6)"
246
+ msgstr ""
247
+
248
+ #: ../inc/class-wpsm-table-maker.php:240 ../inc/class-wpsm-table-maker.php:261
249
+ #: ../inc/class-wpsm-table-maker.php:268
250
+ msgid "Apply"
251
+ msgstr ""
252
+
253
+ #: ../inc/class-wpsm-table-maker.php:245
254
+ msgid "Row 1"
255
+ msgstr ""
256
+
257
+ #: ../inc/class-wpsm-table-maker.php:246
258
+ msgid "Row 2"
259
+ msgstr ""
260
+
261
+ #: ../inc/class-wpsm-table-maker.php:247 ../inc/class-wpsm-table-maker.php:254
262
+ msgid "Switch"
263
+ msgstr ""
264
+
265
+ #: ../inc/class-wpsm-table-maker.php:252
266
+ msgid "Col 1"
267
+ msgstr ""
268
+
269
+ #: ../inc/class-wpsm-table-maker.php:253
270
+ msgid "Col 2"
271
+ msgstr ""
272
+
273
+ #: ../inc/class-wpsm-table-maker.php:257
274
+ msgid "Add Empty Row/Column"
275
+ msgstr ""
276
+
277
+ #: ../inc/class-wpsm-table-maker.php:259
278
+ msgid "Add empty col after (number)"
279
+ msgstr ""
280
+
281
+ #: ../inc/class-wpsm-table-maker.php:260
282
+ msgid "Add empty row after (number)"
283
+ msgstr ""
284
+
285
+ #: ../inc/class-wpsm-table-maker.php:264
286
+ msgid "Delete Row/Column"
287
+ msgstr ""
288
+
289
+ #: ../inc/class-wpsm-table-maker.php:266
290
+ msgid "Remove col (number)"
291
+ msgstr ""
292
+
293
+ #: ../inc/class-wpsm-table-maker.php:267
294
+ msgid "Remove row (number)"
295
+ msgstr ""
296
+
297
+ #: ../inc/class-wpsm-table-maker.php:326
298
+ msgid "The table has been created successfully!"
299
+ msgstr ""
300
+
301
+ #: ../inc/class-wpsm-table-maker.php:328
302
+ msgid "The table has been updated successfully!"
303
+ msgstr ""
304
+
305
+ #: ../inc/class-wpsm-table-maker.php:330
306
+ msgid "The table has been deleted successfully!"
307
+ msgstr ""
308
+
309
+ #: ../inc/class-wpsm-table-maker.php:344
310
+ msgid "Please specify the table ID"
311
+ msgstr ""
312
+
313
+ #~ msgid ""
314
+ #~ "This option panel is built using <a href=\"http://vafpress.com/vafpress-"
315
+ #~ "framework\">Vafpress Framework %s</a> powered by <a href=\"http://"
316
+ #~ "vafpress.com\">Vafpress</a>"
317
+ #~ msgstr " "
readme.txt ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Table Maker ===
2
+ Contributors: wpsoul
3
+ Tags: responsive tables, pricing tables, comparison tables, wordpress tables, table maker, top list table, pricing table maker, table generator, price comparison
4
+ Donate link: http://wpsoul.com/
5
+ Requires at least: 3.0
6
+ Tested up to: 4.3.3
7
+ Stable tag: trunk
8
+ License: License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Create awesome responsive comparison tables.
12
+
13
+ == Description ==
14
+ Plugin helps you to create different comparison tables. It has some unique functions which allow you to use plugin to create different type of awesome tables: comparison tables, TOP tables, specification tables, etc. Table looks awesome with adding data as rows and as columns.
15
+
16
+ [Demo of some tables of plugin](https://wpsoul.com/responsive-comparison-table-wordpress/)
17
+
18
+ **How it works:**
19
+
20
+ [youtube https://www.youtube.com/watch?v=Z4r6TzWv8gU]
21
+
22
+ **Features:**
23
+
24
+ * Responsive option (stacks)
25
+ * Predefined icons
26
+ * Rows or cols lines
27
+ * Option to mark first column for specification labels
28
+ * Option to add labels and featured row and cols
29
+ * Works with shortcodes
30
+ * Option to add subheaders
31
+ * Option to choose color of header
32
+ * Great and simple design
33
+ * Option to upload and use images
34
+ * Optional center aligning
35
+
36
+ **How it works:**
37
+
38
+ [youtube https://www.youtube.com/watch?v=Z4r6TzWv8gU]
39
+
40
+ If you like this plugin please give it a good rating.
41
+
42
+ == Installation ==
43
+ 1. Use WordPress' plugin installer to install the plugin.
44
+ 2. Go to the admin panel and click on the Table Maker menu item.
45
+ 3. To create your first table click on the 'Add New' button.
46
+ 4. Once the table is ready add it to any post or page using the `[wpsm_comparison_table id="1"]` shortcode.
47
+
48
+ == Screenshots ==
49
+
50
+ 1. Overview of interface
51
+ 2. Table example
52
+ 3. How it looks on mobile
53
+
54
+ == Changelog ==
55
+ = 1.0 =
56
+ * Initial release
table-maker.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Table Maker
4
+ Plugin URI:
5
+ Description: Create tables with just a few clicks.
6
+ Version: 1.0
7
+ Author: Wpsoul
8
+ Author URI: https://wpsoul.com
9
+ License: GPL2
10
+ Text Domain: wpsm-tableplugin
11
+ Domain Path: /languages/
12
+ */
13
+
14
+ if ( ! defined( 'WPINC' ) ) {
15
+ die;
16
+ }
17
+
18
+ require_once plugin_dir_path( __FILE__ ) . 'inc/class-wpsm-table-maker.php';
19
+
20
+ function wpsm_run_table_maker() {
21
+ $plugin_instance = new WPSM_Table_Maker('1.0');
22
+ register_activation_hook( __FILE__, array($plugin_instance, 'initialize') );
23
+ register_uninstall_hook( __FILE__, array('WPSM_Table_Maker', 'rollback') );
24
+ }
25
+
26
+ wpsm_run_table_maker();
27
+
28
+ function wpsm_get_table($id)
29
+ {
30
+ $db = WPSM_DB_Table::get_instance();
31
+ $table = $db->get($id);
32
+ return $table['tvalues'];
33
+ }
34
+
35
+ function wpsm_load_plugin_textdomain() {
36
+ load_plugin_textdomain( 'wpsm-tableplugin', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
37
+ }
38
+ add_action( 'plugins_loaded', 'wpsm_load_plugin_textdomain' );
39
+
40
+ ?>