← All changes
|
WPDataAccess/Data_Publisher/WPDA_Publisher_Form.php
+30
-29
5.5.29
→
5.5.85
View file →
| @@ -107,9 +107,9 @@ | ||
| 107 | 107 | 'pub_cpt_format' => __( 'Field labels', 'wp-data-access' ), |
| 108 | 108 | ); |
| 109 | 109 | $this->check_table_type = false; |
| 110 | 110 | $this->title = 'Data Tables'; |
| 111 | - $args['help_url'] = 'https://wpdataaccess.com/docs/data-tables/data-tables-getting-started/'; | |
| 111 | + $args['help_url'] = 'https://docs.legacy.wpdataaccess.com/docs/data-tables-getting-started/'; | |
| 112 | 112 | parent::__construct( |
| 113 | 113 | $schema_name, |
| 114 | 114 | $table_name, |
| 115 | 115 | $wpda_list_columns, |
| @@ -118,9 +118,9 @@ | ||
| 118 | 118 | // Get available databases. |
| 119 | 119 | $schema_names = WPDA_Dictionary_Lists::get_db_schemas(); |
| 120 | 120 | foreach ( $schema_names as $schema_name ) { |
| 121 | 121 | array_push( $this->databases, $schema_name['schema_name'] ); |
| 122 | - //phpcs:ignore - 8.1 proof | |
| 122 | + // phpcs:ignore -- 8.1 proof | |
| 123 | 123 | } |
| 124 | 124 | // Add scripts and styles. |
| 125 | 125 | WPDA_Data_Tables::enqueue_styles_and_script(); |
| 126 | 126 | } |
| @@ -142,9 +142,9 @@ | ||
| 142 | 142 | title="Test" |
| 143 | 143 | > |
| 144 | 144 | <i class="fas fa-bug wpda_icon_on_button"></i> |
| 145 | 145 | <?php |
| 146 | - echo __( 'Test', 'wp-data-access' ); | |
| 146 | + echo esc_attr__( 'Test', 'wp-data-access' ); | |
| 147 | 147 | ?> |
| 148 | 148 | </a> |
| 149 | 149 | <?php |
| 150 | 150 | $this->show_shortcode( $pub_id ); |
| @@ -192,9 +192,9 @@ | ||
| 192 | 192 | // Prepare selection for column pub_column_names. |
| 193 | 193 | if ( $form_item->get_item_name() === 'pub_column_names' ) { |
| 194 | 194 | $title = __( 'Select columns shown in data table', 'wp-data-access' ); |
| 195 | 195 | $form_item->set_item_hide_icon( true ); |
| 196 | - $form_item->set_item_js( 'jQuery("#pub_column_names").parent().parent().find("td.icon").append("<a id=\'select_columns\' class=\'button wpda_tooltip\' href=\'javascript:void(0)\' title=\'' . $title . '\' onclick=\'select_columns()\'>' . '<i class=\'fas fa-list wpda_icon_on_button\'></i> ' . __( 'Select', 'wp-data-access' ) . '</a>");' ); | |
| 196 | + $form_item->set_item_js( 'jQuery("#pub_column_names").parent().parent().find("td.icon").append("<a id=\'select_columns\' class=\'button wpda_tooltip\' href=\'javascript:void(0)\' title=\'' . esc_attr( $title ) . '\' onclick=\'select_columns()\'>' . '<i class=\'fas fa-list wpda_icon_on_button\'></i> ' . __( 'Select', 'wp-data-access' ) . '</a>");' ); | |
| 197 | 197 | } |
| 198 | 198 | // Prepare column label settings. |
| 199 | 199 | if ( $form_item->get_item_name() === 'pub_format' ) { |
| 200 | 200 | $title = __( 'Define columns for data table (not necessary if already defined in Data Explorer table settings)', 'wp-data-access' ); |
| @@ -199,9 +199,9 @@ | ||
| 199 | 199 | if ( $form_item->get_item_name() === 'pub_format' ) { |
| 200 | 200 | $title = __( 'Define columns for data table (not necessary if already defined in Data Explorer table settings)', 'wp-data-access' ); |
| 201 | 201 | $form_item->set_item_hide_icon( true ); |
| 202 | 202 | $form_item->set_item_class( 'hide_item' ); |
| 203 | - $form_item->set_item_js( 'jQuery("#pub_format").parent().parent().find("td.data").append("<a id=\'format_columns\' class=\'button wpda_tooltip\' href=\'javascript:void(0)\' title=\'' . $title . '\' onclick=\'format_columns()\'>' . '<i class=\'fas fa-tag wpda_icon_on_button\'></i> ' . __( 'Click to define column labels', 'wp-data-access' ) . '</a>");' ); | |
| 203 | + $form_item->set_item_js( 'jQuery("#pub_format").parent().parent().find("td.data").append("<a id=\'format_columns\' class=\'button wpda_tooltip\' href=\'javascript:void(0)\' title=\'' . esc_attr( $title ) . '\' onclick=\'format_columns()\'>' . '<i class=\'fas fa-tag wpda_icon_on_button\'></i> ' . __( 'Click to define column labels', 'wp-data-access' ) . '</a>");' ); | |
| 204 | 204 | } |
| 205 | 205 | if ( 'pub_responsive_popup_title' === $form_item->get_item_name() || 'pub_responsive_cols' === $form_item->get_item_name() || 'pub_responsive_type' === $form_item->get_item_name() || 'pub_responsive_modal_hyperlinks' === $form_item->get_item_name() || 'pub_responsive_icon' === $form_item->get_item_name() || 'pub_flat_scrollx' === $form_item->get_item_name() ) { |
| 206 | 206 | $form_item->set_hide_item_init( true ); |
| 207 | 207 | } |
| @@ -318,9 +318,9 @@ | ||
| 318 | 318 | $table_columns = WPDA_List_Columns_Cache::get_list_columns( $schema_name, $table_name ); |
| 319 | 319 | $columns = array(); |
| 320 | 320 | foreach ( $table_columns->get_table_columns() as $table_column ) { |
| 321 | 321 | array_push( $columns, $table_column['column_name'] ); |
| 322 | - //phpcs:ignore - 8.1 proof | |
| 322 | + // phpcs:ignore -- 8.1 proof | |
| 323 | 323 | } |
| 324 | 324 | $column_labels = $table_columns->get_table_column_headers(); |
| 325 | 325 | $json_editing = WPDA::get_option( WPDA::OPTION_DP_JSON_EDITING ); |
| 326 | 326 | $wpda_table_settings_db = WPDA_Table_Settings_Model::query( $table_name, $schema_name ); |
| @@ -331,9 +331,9 @@ | ||
| 331 | 331 | $hyperlink_label = ( isset( $hyperlink->hyperlink_label ) ? $hyperlink->hyperlink_label : '' ); |
| 332 | 332 | $hyperlink_html = ( isset( $hyperlink->hyperlink_html ) ? $hyperlink->hyperlink_html : '' ); |
| 333 | 333 | if ( $hyperlink_label !== '' && $hyperlink_html !== '' ) { |
| 334 | 334 | array_push( $this->hyperlinks, $hyperlink_label ); |
| 335 | - //phpcs:ignore - 8.1 proof | |
| 335 | + // phpcs:ignore -- 8.1 proof | |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | } |
| @@ -661,10 +661,11 @@ | ||
| 661 | 661 | var hyperlinks = []; |
| 662 | 662 | <?php |
| 663 | 663 | if ( null !== $this->hyperlinks && is_array( $this->hyperlinks ) ) { |
| 664 | 664 | foreach ( $this->hyperlinks as $hyperlink ) { |
| 665 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 665 | 666 | echo "hyperlinks.push('{$hyperlink}');"; |
| 666 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 667 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 667 | 668 | } |
| 668 | 669 | } |
| 669 | 670 | ?> |
| 670 | 671 | |
| @@ -704,9 +705,9 @@ | ||
| 704 | 705 | |
| 705 | 706 | function select_columns() { |
| 706 | 707 | if (!(Array.isArray(table_columns) && table_columns.length)) { |
| 707 | 708 | alert("<?php |
| 708 | - echo __( 'To select columns you need to save your data table first', 'wp-data-access' ); | |
| 709 | + echo esc_attr__( 'To select columns you need to save your data table first', 'wp-data-access' ); | |
| 709 | 710 | ?>"); |
| 710 | 711 | return; |
| 711 | 712 | } |
| 712 | 713 | |
| @@ -802,9 +803,9 @@ | ||
| 802 | 803 | |
| 803 | 804 | function format_cpt_columns() { |
| 804 | 805 | if (!(Array.isArray(cpt_fields) && cpt_fields.length)) { |
| 805 | 806 | alert("<?php |
| 806 | - echo __( 'To format columns you need to save your data table first', 'wp-data-access' ); | |
| 807 | + echo esc_attr__( 'To format columns you need to save your data table first', 'wp-data-access' ); | |
| 807 | 808 | ?>"); |
| 808 | 809 | return; |
| 809 | 810 | } |
| 810 | 811 | |
| @@ -818,12 +819,12 @@ | ||
| 818 | 819 | let dialog_table = jQuery('<table></table>'); |
| 819 | 820 | dialog_table.append( |
| 820 | 821 | jQuery('<tr></tr>').append( |
| 821 | 822 | jQuery('<th style="text-align:left;"><?php |
| 822 | - echo __( 'Field Name', 'wp-data-access' ); | |
| 823 | + echo esc_attr__( 'Field Name', 'wp-data-access' ); | |
| 823 | 824 | ?></th>'), |
| 824 | 825 | jQuery('<th style="text-align:left;"><?php |
| 825 | - echo __( 'Field Label', 'wp-data-access' ); | |
| 826 | + echo esc_attr__( 'Field Label', 'wp-data-access' ); | |
| 826 | 827 | ?></th>'), |
| 827 | 828 | ) |
| 828 | 829 | ); |
| 829 | 830 | |
| @@ -886,9 +887,9 @@ | ||
| 886 | 887 | |
| 887 | 888 | function format_columns() { |
| 888 | 889 | if (!(Array.isArray(table_columns) && table_columns.length)) { |
| 889 | 890 | alert("<?php |
| 890 | - echo __( 'To format columns you need to save your data table first', 'wp-data-access' ); | |
| 891 | + echo esc_attr__( 'To format columns you need to save your data table first', 'wp-data-access' ); | |
| 891 | 892 | ?>"); |
| 892 | 893 | return; |
| 893 | 894 | } |
| 894 | 895 | |
| @@ -912,12 +913,12 @@ | ||
| 912 | 913 | var dialog_table = jQuery('<table></table>'); |
| 913 | 914 | dialog_table.append( |
| 914 | 915 | jQuery('<tr></tr>').append( |
| 915 | 916 | jQuery('<th style="text-align:left;"><?php |
| 916 | - echo __( 'Column Name', 'wp-data-access' ); | |
| 917 | + echo esc_attr__( 'Column Name', 'wp-data-access' ); | |
| 917 | 918 | ?></th>'), |
| 918 | 919 | jQuery('<th style="text-align:left;"><?php |
| 919 | - echo __( 'Column Label', 'wp-data-access' ); | |
| 920 | + echo esc_attr__( 'Column Label', 'wp-data-access' ); | |
| 920 | 921 | ?></th>'), |
| 921 | 922 | ) |
| 922 | 923 | ); |
| 923 | 924 | |
| @@ -1059,10 +1060,9 @@ | ||
| 1059 | 1060 | function test_publication() { |
| 1060 | 1061 | jQuery.ajax({ |
| 1061 | 1062 | type: "POST", |
| 1062 | 1063 | url: "<?php |
| 1063 | - echo admin_url( 'admin-ajax.php?action=wpda_test_publication' ); | |
| 1064 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1064 | + echo esc_url( admin_url( 'admin-ajax.php?action=wpda_test_publication' ) ); | |
| 1065 | 1065 | ?>", |
| 1066 | 1066 | data: { |
| 1067 | 1067 | wpnonce: "<?php |
| 1068 | 1068 | echo esc_attr( wp_create_nonce( "wpda-publication-{$pub_id}" ) ); |
| @@ -1127,9 +1127,9 @@ | ||
| 1127 | 1127 | <div id="wpda_publication_<?php |
| 1128 | 1128 | echo esc_attr( $pub_id ); |
| 1129 | 1129 | ?>" |
| 1130 | 1130 | title="<?php |
| 1131 | - echo __( 'Shortcode', 'wp-data-access' ); | |
| 1131 | + echo esc_attr__( 'Shortcode', 'wp-data-access' ); | |
| 1132 | 1132 | ?>" |
| 1133 | 1133 | style="display:none" |
| 1134 | 1134 | > |
| 1135 | 1135 | <p class="wpda_shortcode_content"> |
| @@ -1148,13 +1148,13 @@ | ||
| 1148 | 1148 | data-clipboard-text='[wpdataaccess pub_id="<?php |
| 1149 | 1149 | echo esc_attr( $pub_id ); |
| 1150 | 1150 | ?>"]' |
| 1151 | 1151 | onclick="jQuery.notify('<?php |
| 1152 | - echo __( 'Shortcode successfully copied to clipboard!' ); | |
| 1152 | + echo esc_attr__( 'Shortcode successfully copied to clipboard!', 'wp-data-access' ); | |
| 1153 | 1153 | ?>','info')" |
| 1154 | 1154 | > |
| 1155 | 1155 | <?php |
| 1156 | - echo __( 'Copy', 'wp-data-access' ); | |
| 1156 | + echo esc_attr__( 'Copy', 'wp-data-access' ); | |
| 1157 | 1157 | ?> |
| 1158 | 1158 | </button> |
| 1159 | 1159 | <button class="button button-primary wpda_shortcode_button" |
| 1160 | 1160 | type="button" |
| @@ -1160,9 +1160,9 @@ | ||
| 1160 | 1160 | type="button" |
| 1161 | 1161 | onclick="jQuery('.ui-dialog-content').dialog('close')" |
| 1162 | 1162 | > |
| 1163 | 1163 | <?php |
| 1164 | - echo __( 'Close', 'wp-data-access' ); | |
| 1164 | + echo esc_attr__( 'Close', 'wp-data-access' ); | |
| 1165 | 1165 | ?> |
| 1166 | 1166 | </button> |
| 1167 | 1167 | </p> |
| 1168 | 1168 | <?php |
| @@ -1170,10 +1170,9 @@ | ||
| 1170 | 1170 | ?> |
| 1171 | 1171 | <p> |
| 1172 | 1172 | Shortcode wpdataaccess is not enabled for all output types. |
| 1173 | 1173 | <a href="<?php |
| 1174 | - echo admin_url( 'options-general.php' ); | |
| 1175 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1174 | + echo esc_url( admin_url( 'options-general.php' ) ); | |
| 1176 | 1175 | ?>?page=wpdataaccess" class="wpda_shortcode_link">» Manage settings</a> |
| 1177 | 1176 | </p> |
| 1178 | 1177 | <?php |
| 1179 | 1178 | } |
| @@ -1181,9 +1180,9 @@ | ||
| 1181 | 1180 | </div> |
| 1182 | 1181 | <a href="javascript:void(0)" |
| 1183 | 1182 | class="button view wpda_tooltip" |
| 1184 | 1183 | title="<?php |
| 1185 | - echo __( 'Get shortcode', 'wp-data-access' ); | |
| 1184 | + echo esc_attr__( 'Get shortcode', 'wp-data-access' ); | |
| 1186 | 1185 | ?>" |
| 1187 | 1186 | onclick="jQuery('#wpda_publication_<?php |
| 1188 | 1187 | echo esc_attr( $pub_id ); |
| 1189 | 1188 | ?>').dialog()" |
| @@ -1190,9 +1189,9 @@ | ||
| 1190 | 1189 | > |
| 1191 | 1190 | <span style="white-space:nowrap"> |
| 1192 | 1191 | <i class="fas fa-code wpda_icon_on_button"></i> |
| 1193 | 1192 | <?php |
| 1194 | - echo __( 'Shortcode', 'wp-data-access' ); | |
| 1193 | + echo esc_attr__( 'Shortcode', 'wp-data-access' ); | |
| 1195 | 1194 | ?> |
| 1196 | 1195 | </span> |
| 1197 | 1196 | </a> |
| 1198 | 1197 | <?php |
| @@ -1295,14 +1294,14 @@ | ||
| 1295 | 1294 | <div id="data_publisher_test_header_<?php |
| 1296 | 1295 | echo esc_attr( $pub_id ); |
| 1297 | 1296 | ?>"> |
| 1298 | 1297 | <span><strong><?php |
| 1299 | - echo __( 'Test', 'wp-data-access' ); | |
| 1298 | + echo esc_attr__( 'Test', 'wp-data-access' ); | |
| 1300 | 1299 | ?> (pub_id=<?php |
| 1301 | 1300 | echo esc_attr( $pub_id ); |
| 1302 | 1301 | ?> |
| 1303 | 1302 | - <?php |
| 1304 | - echo __( 'data table looks different on your website', 'wp-data-access' ); | |
| 1303 | + echo esc_attr__( 'data table looks different on your website', 'wp-data-access' ); | |
| 1305 | 1304 | ?>) |
| 1306 | 1305 | </strong></span> |
| 1307 | 1306 | <span class="button" style="float:right;" |
| 1308 | 1307 | onclick="jQuery('#data_publisher_test_container_<?php |
| @@ -1311,10 +1310,11 @@ | ||
| 1311 | 1310 | echo esc_attr( $pub_id ); |
| 1312 | 1311 | ?>').remove();">x</span><br/> |
| 1313 | 1312 | </div> |
| 1314 | 1313 | <?php |
| 1314 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 1315 | 1315 | echo $publication; |
| 1316 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1316 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 1317 | 1317 | ?> |
| 1318 | 1318 | </div> |
| 1319 | 1319 | <script type='text/javascript'> |
| 1320 | 1320 | jQuery("#data_publisher_test_container_<?php |
| @@ -1321,10 +1321,11 @@ | ||
| 1321 | 1321 | echo esc_attr( $pub_id ); |
| 1322 | 1322 | ?>").appendTo("#wpbody-content"); |
| 1323 | 1323 | </script> |
| 1324 | 1324 | <?php |
| 1325 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 1325 | 1326 | echo ob_get_clean(); |
| 1326 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1327 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 1327 | 1328 | wp_die(); |
| 1328 | 1329 | } |
| 1329 | 1330 | |
| 1330 | 1331 | } |