Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ jobs:
- name: composer install
run: composer install
- name: PHPCS check
run: ./vendor/bin/phpcs .
run: composer lint
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"bjeavons/zxcvbn-php": "^1.0"
},
"require-dev": {
"10up/phpcs-composer": "dev-trunk"
"10up/phpcs-composer": "^3.0"
},
"scripts": {
"lint": "phpcs --extensions=php --warning-severity=8 -s .",
"lint-fix": "phpcbf ."
"lint": "./vendor/bin/phpcs --standard=phpcs.xml",
"lint-fix": "./vendor/bin/phpcbf --standard=phpcs.xml"
},
"config": {
"allow-plugins": {
Expand Down
23 changes: 10 additions & 13 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion includes/classes/API/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function restrict_rest_api_ui() {
* @param int $user_id User ID
* @return bool Whether the given user can access the REST API
*/
public function can_access_rest_api( $user_id = 0 ) {
public function can_access_rest_api( $user_id = 0 ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
global $wp;

$route = '';
Expand Down
6 changes: 3 additions & 3 deletions includes/classes/AdminCustomizations/Customizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function setup() {
add_filter( 'admin_footer_text', [ $this, 'filter_admin_footer_text' ] );
add_action( 'admin_bar_menu', [ $this, 'add_about_menu' ], 11 );
add_action( 'admin_menu', [ $this, 'register_admin_pages' ] );
add_filter( 'admin_title', [ $this, 'admin_title_fix' ], 10, 2 );
add_filter( 'admin_title', [ $this, 'admin_title_fix' ], 10, 1 );
}

/**
Expand All @@ -43,10 +43,10 @@ public function register_admin_pages() {
* Because of the empty page parent, the title doesn't get output as expected.
*
* @param string $admin_title The page title, with extra context added.
* @param string $title The original page title.
*
* @return string The altered page title.
*/
public function admin_title_fix( $admin_title, $title ) {
public function admin_title_fix( $admin_title ) {
$screen = get_current_screen();

wp_enqueue_style( '10up-admin', plugins_url( '/dist/css/admin.css', TENUP_EXPERIENCE_FILE ), array(), TENUP_EXPERIENCE_VERSION );
Expand Down
8 changes: 4 additions & 4 deletions includes/classes/Comments/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function diable_comments_setting_field_output() {
checked( $disable_comments, true );
disabled( $this->is_ui_disabled() );
?>
/>
/>
<label for="tenup-disable-comments-yes">
<?php esc_html_e( 'Yes', 'tenup' ); ?>
</label><br>
Expand All @@ -129,7 +129,7 @@ public function diable_comments_setting_field_output() {
checked( $disable_comments, false );
disabled( $this->is_ui_disabled() );
?>
/>
/>
<label for="tenup-disable-comments-no">
<?php esc_html_e( 'No', 'tenup' ); ?>
</label>
Expand Down Expand Up @@ -157,13 +157,13 @@ public function disable_comments_settings() {
checked( $disable_comments, true );
disabled( $this->is_ui_disabled() );
?>
type="radio" id="tenup_disable_comments_yes" value="yes"> <label for="tenup_disable_comments_yes"><?php esc_html_e( 'Yes', 'tenup' ); ?></label><br>
type="radio" id="tenup_disable_comments_yes" value="yes"> <label for="tenup_disable_comments_yes"><?php esc_html_e( 'Yes', 'tenup' ); ?></label><br>
<input name="tenup_disable_comments"
<?php
checked( $disable_comments, false );
disabled( $this->is_ui_disabled() );
?>
type="radio" id="tenup_disable_comments_no" value="no"> <label for="tenup_disable_comments_no"><?php esc_html_e( 'No', 'tenup' ); ?></label>
type="radio" id="tenup_disable_comments_no" value="no"> <label for="tenup_disable_comments_no"><?php esc_html_e( 'No', 'tenup' ); ?></label>
</td>
</tr>
</tbody>
Expand Down
22 changes: 14 additions & 8 deletions includes/classes/Plugins/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function setup() {
add_action( 'install_plugins_pre_beta', [ $this, 'add_admin_notice' ] );
add_action( 'install_plugins_pre_search', [ $this, 'add_admin_notice' ] );
add_action( 'install_plugins_pre_dashboard', [ $this, 'add_admin_notice' ] );
add_filter( 'plugin_row_meta', [ $this, 'plugin_meta' ], 100, 4 );
add_filter( 'plugin_row_meta', [ $this, 'plugin_meta' ], 100, 2 );
add_action( 'admin_head-plugins.php', [ $this, 'plugin_deactivation_warning' ] );

/**
Expand Down Expand Up @@ -129,12 +129,10 @@ public function plugin_install_warning() {
* including the version, author,
* author URI, and plugin URI.
* @param string $plugin_file Path to the plugin file, relative to the plugins directory.
* @param array $plugin_data An array of plugin data.
* @param string $status Status of the plugin. Defaults are 'All', 'Active',
* 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
* 'Drop-ins', 'Search'.
*
* @return array
*/
public function plugin_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
public function plugin_meta( $plugin_meta, $plugin_file ) {
if ( '10up-experience/10up-experience.php' !== $plugin_file ) {
return $plugin_meta;
}
Expand Down Expand Up @@ -221,7 +219,11 @@ public function set_custom_update_notification( $file, $plugin_data ) {
'strong' => array(),
);

// @var WP_Plugins_List_Table $wp_list_table
/**
* WP Plugins List Table
*
* @var WP_Plugins_List_Table $wp_list_table
*/
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );

if ( is_network_admin() ) {
Expand All @@ -240,6 +242,7 @@ public function set_custom_update_notification( $file, $plugin_data ) {
);

printf(
// translators: %s is the plugin name
esc_html__( 'There is a new version of %s available. ' ),
wp_kses( $plugin_data['Name'], $plugins_allowedtags )
);
Expand All @@ -252,11 +255,13 @@ public function set_custom_update_notification( $file, $plugin_data ) {

if ( empty( $url ) ) {
printf(
// translators: %s is the new version number
esc_html__( 'Version number is %s.' ),
esc_html( $response->new_version )
);
} else {
printf(
// translators: %1$s is the plugin URL, %2$s is the new version number
'<a href="%1$s" target="_blank">' . esc_html__( 'View version %2$s details.' ) . '</a>',
esc_url( $url ),
esc_html( $response->new_version )
Expand Down Expand Up @@ -326,10 +331,11 @@ public function set_plugin_update_totals( $update_data ) {
if ( ! empty( $update_plugins->response ) ) {
$counts['plugins'] = count( $update_plugins->response );
$plugins_title = sprintf(
// translators: %d is the number of plugin updates
_n( '%d Plugin Update', '%d Plugin Updates', intval( $counts['plugins'] ) ),
intval( $counts['plugins'] )
);
$titles = ! empty( $titles ) ? $titles . ', ' . esc_attr( $plugins_title ) : esc_attr( $plugins_title );
$titles = ! empty( $titles ) ? $titles . ', ' . esc_attr( $plugins_title ) : esc_attr( $plugins_title );
}
$counts['total'] = $counts['total'] + $counts['plugins'];

Expand Down
2 changes: 1 addition & 1 deletion includes/classes/SSO/SSO.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public function process_client_login() {
TENUPSSO_PROXY_URL
);

wp_redirect( $proxy_url );
wp_redirect( $proxy_url ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect
exit;
}
}
Expand Down
2 changes: 1 addition & 1 deletion includes/classes/SupportMonitor/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function maybe_add_log_entry( $url, $message, $response_code ) {
$max_size = apply_filters( 'tenup_support_monitor_max_debug_log_size', 1048576 );

// If the log is larger than 1mb, remove the oldest entry
while ( mb_strlen( serialize( (array) $log ), '8bit' ) > $max_size ) {
while ( mb_strlen( serialize( (array) $log ), '8bit' ) > $max_size ) { // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
array_pop( $log );
}
}
Expand Down
6 changes: 3 additions & 3 deletions includes/classes/SupportMonitor/Monitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,9 @@ public function get_packages() {
'slug' => 'wordpress',
],
[
'name' => 'PHP',
'type' => 'system',
'slug' => 'php',
'name' => 'PHP',
'type' => 'system',
'slug' => 'php',
'version' => $this->get_php_version(),
],
];
Expand Down
26 changes: 26 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
<?xml version="1.0"?>
<ruleset name="Project Rules">
<!-- Include all files -->
<file>.</file>

<!-- Use the 10up ruleset -->
<rule ref="10up-Default">
<exclude name="WordPress.Security.NonceVerification.Missing" />
<exclude name="WordPress.Security.NonceVerification.Recommended" />
<exclude name="WordPress.Security.ValidatedSanitizedInput.MissingUnslash" />
</rule>

<!-- Don't scan these directories -->
<exclude-pattern>.git</exclude-pattern>
<exclude-pattern>.github</exclude-pattern>
<exclude-pattern>.husky</exclude-pattern>
<exclude-pattern>assets</exclude-pattern>
<exclude-pattern>dist</exclude-pattern>
<exclude-pattern>node_modules</exclude-pattern>
<exclude-pattern>vendor</exclude-pattern>

<!-- Show sniff and progress -->
<arg value="sp"/>

<!-- Show results with colors. Disable if working on Windows -->
<arg name="colors"/>

<!-- Strip the file paths down to the relevant bit -->
<arg name="basepath" value="."/>

<!-- Limit to PHP -->
<arg name="extensions" value="php"/>
</ruleset>
Loading