PluginProbe
WP Data Access – App Builder for Tables, Forms, Dashboards, Charts & Maps / 5.5.87
WP Data Access – App Builder for Tables, Forms, Dashboards, Charts & Maps v5.5.87
5.5.87 5.5.85 5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 All 162 releases
← All changes | WPDataAccess/WPDA.php +26 -7 5.5.81 → 5.5.87 View file →
@@ -19,9 +19,9 @@
19 19 * Class WPDA
20 20 *
21 21 * Plugin default values and settings are managed through this class. Every plugin option has a default value
22 22 * which is maintained in an array together with the option name. Options are only saved in $wpdb->options when
23 - * they are changed. Otherwise the default values are used. After reading option values from $wpdb->options the
23 + * they are changed. Otherwise, the default values are used. After reading option values from $wpdb->options the
24 24 * values are cached as many of them are used in multiple
25 25 * values are cached as many of them are used in multiple
26 26 * places during the processing of a request.
27 27 *
@@ -27,10 +27,12 @@
27 27 *
28 28 * @author Peter Schulz
29 29 * @since 1.0.0
30 30 */
31 - class WPDA {
32 31
32 + // phpcs:disable PluginCheck.CodeAnalysis.Offloading.OffloadedContent
33 + class WPDA {
34 +
33 35 // SAVING SPACE - According to the plugin guidelines it is allowed to include external fonts:
34 36 // https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#8-plugins-may-not-send-executable-code-via-third-party-systems
35 37 const CDN_FONTAWESOME = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/';
36 38 const GOOGLE_CHARTS = 'https://www.gstatic.com/charts/loader.js';
@@ -50,10 +52,10 @@
50 52 // Application options.
51 53 /**
52 54 * Option wpda_version and it's default value
53 55 */
54 - const OPTION_WPDA_VERSION = array( 'wpda_version', '5.5.81' );
55 - const OPTION_WPDA_CLIENT_VERSION = array( 'wpda_client_version', '1.0.79' );
56 + const OPTION_WPDA_VERSION = array( 'wpda_version', '5.5.87' );
57 + const OPTION_WPDA_CLIENT_VERSION = array( 'wpda_client_version', '1.0.85' );
56 58 const OPTION_WPDA_UPGRADED = array( 'wpda_upgraded', false );
57 59 /**
58 60 * Option wpda_setup_error and it's default value
59 61 */
@@ -472,8 +474,10 @@
472 474 wp_die( esc_attr( 'ERROR: ' . $e->getMessage() ) );
473 475 }
474 476 }
475 477
478 + return false;
479 +
476 480 }
477 481
478 482 /**
479 483 * Checks if a table is a WordPress table
@@ -819,8 +823,9 @@
819 823 } else if ( $matches[2] == 'K' ) {
820 824 return $matches[1] * 1024;
821 825 }
822 826 }
827 + return '';
823 828 }
824 829
825 830 public static function get_current_user_id() {
826 831 global $current_user;
@@ -926,9 +931,9 @@
926 931 * $columns['column_default'] => information_schema.tables.column_default
927 932 *
928 933 * @param string $schema_name Schema name (optional)
929 934 * @param string $table_name Table name (optional)
930 - * @param string $columns Array containing table columns
935 + * @param array $columns Array containing table columns
931 936 * @param string $search Search string entered by user
932 937 * @param boolean $is_case_sensitive Case-sensitive search (default = false)
933 938 * @param boolean $is_dt_request Always skip filter for DataTable requests (default = false)
934 939 *
@@ -1147,22 +1152,27 @@
1147 1152 var clipboard = new ClipboardJS('.wpda_shortcode_clipboard');
1148 1153 });
1149 1154 </script>
1150 1155 <style>
1156 + /* noinspection CssUnusedSymbol */
1151 1157 .wpda_shortcode_content {
1152 1158 padding: 0 20px;
1153 1159 }
1160 + /* noinspection CssUnusedSymbol */
1154 1161 .wpda_shortcode_text {
1155 1162 text-align: center;
1156 1163 font-size: 105%;
1157 1164 white-space: nowrap;
1158 1165 }
1166 + /* noinspection CssUnusedSymbol */
1159 1167 .wpda_shortcode_buttons {
1160 1168 text-align: center;
1161 1169 }
1170 + /* noinspection CssUnusedSymbol */
1162 1171 .button.wpda_shortcode_button {
1163 1172 width: 100px !important;
1164 1173 }
1174 + /* noinspection CssUnusedSymbol */
1165 1175 .wpda_shortcode_link {
1166 1176 text-decoration: none;
1167 1177 font-weight: bold;
1168 1178 }
@@ -1241,9 +1251,9 @@
1241 1251 * @param $schema_name string Schema name
1242 1252 * @param $table_name string Table name
1243 1253 * @param $wpda_table_settings string Table settings (query WPDA_Table_Settings_Model)
1244 1254 *
1245 - * @return int row count estimate or -1 if no estimate available
1255 + * @return array row count estimate or -1 if no estimate available
1246 1256 */
1247 1257 public static function get_row_count_estimate( $schema_name, $table_name, $wpda_table_settings ) {
1248 1258 $row_count = null;
1249 1259 $is_estimate = null;
@@ -1703,9 +1713,18 @@
1703 1713 return $rows;
1704 1714 }
1705 1715
1706 1716 public static function current_user_is_admin() {
1707 - return current_user_can( 'manage_options' ) || is_super_admin();
1717 + if (current_user_can( 'manage_options' ) || is_super_admin()) {
1718 + return true;
1719 + }
1720 +
1721 + $user = wp_get_current_user();
1722 + if ( in_array( 'administrator', $user->roles ) ) {
1723 + return true;
1724 + }
1725 +
1726 + return false;
1708 1727 }
1709 1728
1710 1729 }
1711 1730