Skip to content

Commit 46e8cc7

Browse files
committed
phpcs
1 parent d1d7a43 commit 46e8cc7

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

phpcs.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
<rule ref="WordPress.WP.I18n">
9999
<properties>
100100
<property name="text_domain" type="array">
101-
<element value="aaa-option-optimizer"/>
101+
<element value="aaa-meta-optimizer"/>
102102
</property>
103103
</properties>
104104
</rule>

src/class-admin-page.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@ public function render_admin_page() {
209209
global $wpdb;
210210
$meta_optimizer = get_option( 'meta_optimizer', [ 'used_meta_fields' => [] ] );
211211

212-
$all_meta_keys = $wpdb->get_results( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta}", ARRAY_A );
212+
$all_meta_keys = $wpdb->get_results( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta}", ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
213213
$all_meta_keys = wp_list_pluck( $all_meta_keys, 'meta_key' );
214214

215-
$unused_options = [];
215+
$unused_options = [];
216216

217217
// Get the meta fields that aren't used.
218218
foreach ( $all_meta_keys as $option ) {
@@ -263,7 +263,7 @@ public function render_admin_page() {
263263
<label class="label" for="tab-2"><?php esc_html_e( 'Fetched meta fields', 'aaa-meta-optimizer' ); ?></label>
264264
<div class="panel">
265265
<?php
266-
if ( ! empty( $meta_optimizer['used_meta_fields']) ) {
266+
if ( ! empty( $meta_optimizer['used_meta_fields'] ) ) {
267267
echo '<h2 id="used-meta-fields">' . esc_html__( 'Used meta fields', 'aaa-meta-optimizer' ) . '</h2>';
268268
echo '<p>' . esc_html__( 'The following meta fields are being fetched.', 'aaa-meta-optimizer' );
269269
echo '<table style="width:100%;" id="used_not_autoloaded_table" class="aaa_option_table">';

src/class-map-plugin-to-options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ public function get_plugin_name( string $option ): string {
4444
}
4545
}
4646

47-
return __( 'Unknown', 'aaa-option-optimizer' );
47+
return __( 'Unknown', 'aaa-meta-optimizer' );
4848
}
4949
}

src/class-plugin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,16 @@ public function monitor_meta_field_accesses( $tag ) {
102102

103103
// Check if the tag is related to an option access.
104104
if ( strpos( $tag, 'get_post_metadata' ) === 0 ) {
105-
$args = func_get_args(); // Get all arguments passed to the hook.
105+
$args = func_get_args(); // phpcs:ignore -- Get all arguments passed to the hook.
106106
$meta_key = $args[3];
107107
$this->add_meta_field_usage( $meta_key );
108108
}
109109
}
110110

111111
/**
112-
* Add an option to the list of used options if it's not already there.
112+
* Add a meta field to the list of used meta fields if it's not already there.
113113
*
114-
* @param string $option_name Name of the option being accessed.
114+
* @param string $meta_key Name of the meta field being accessed.
115115
*
116116
* @return void
117117
*/
@@ -125,7 +125,7 @@ protected function add_meta_field_usage( $meta_key ) {
125125
}
126126

127127
/**
128-
* Update the 'meta_optimizer' option with the list of used options at the end of the page load.
128+
* Update the 'meta_optimizer' option with the list of used meta fields at the end of the page load.
129129
*
130130
* @return void
131131
*/

0 commit comments

Comments
 (0)