Skip to content

Commit

Permalink
Update dev lib
Browse files Browse the repository at this point in the history
And fix most PHPCS issues detected.
  • Loading branch information
JDGrimes committed Mar 13, 2017
1 parent a4da124 commit 8fca730
Show file tree
Hide file tree
Showing 19 changed files with 121 additions and 98 deletions.
1 change: 0 additions & 1 deletion .coveralls.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ php:
env:
- TRAVISCI_RUN=codesniff
- TRAVISCI_RUN=phpunit WP_VERSION=master WORDPOINTS_VERSION=master
- TRAVISCI_RUN=phpunit WP_VERSION=master WORDPOINTS_VERSION=stable
- TRAVISCI_RUN=phpunit WP_VERSION=4.7 WORDPOINTS_VERSION=master
- TRAVISCI_RUN=phpunit WP_VERSION=4.7 WORDPOINTS_VERSION=stable
- TRAVISCI_RUN=phpunit WP_VERSION=4.6 WORDPOINTS_VERSION=master
- TRAVISCI_RUN=phpunit WP_VERSION=4.6 WORDPOINTS_VERSION=stable

sudo: false

Expand Down Expand Up @@ -70,6 +74,9 @@ script:
- phpunit-uninstall
- phpunit-ms-uninstall
- phpunit-ms-network-uninstall
- WORDPOINTS_ONLY_UNINSTALL_MODULE=1 phpunit-uninstall
- WORDPOINTS_ONLY_UNINSTALL_MODULE=1 phpunit-ms-uninstall
- WORDPOINTS_ONLY_UNINSTALL_MODULE=1 phpunit-ms-network-uninstall
- phpunit-ajax
- phpunit-ms-ajax
- phpunit-ms-network-ajax
Expand Down
2 changes: 1 addition & 1 deletion dev-lib
Submodule dev-lib updated 124 files
4 changes: 2 additions & 2 deletions src/admin/includes/apis/edd-software-licensing.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public function hooks() {
*/
public function admin_enqueue_scripts() {

if ( isset( $_GET['page'] ) && 'wordpoints_modules' === $_GET['page'] ) {
if ( isset( $_GET['page'] ) && 'wordpoints_modules' === $_GET['page'] ) { // WPCS: CSRF OK.
wp_enqueue_style(
'wordpointsorg-admin-modules'
, wordpoints_modules_url(
Expand Down Expand Up @@ -363,7 +363,7 @@ public function wordpoints_modules_list_table_items( $modules ) {

} // End if ( activating license ) elseif ( deactivating license ).

} // End foreach ( $modules['all'] as $module ).
} // End foreach ( module ).

return $modules;
}
Expand Down
2 changes: 2 additions & 0 deletions src/admin/includes/class-bulk-module-upgrader-skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class WordPointsOrg_Bulk_Module_Upgrader_Skin extends Bulk_Upgrader_Skin {
public function add_strings() {

parent::add_strings();

// translators: 1. Module Name; 2. Count of update; 3. Total number of updates being installed.
$this->upgrader->strings['skin_before_update_header'] = __( 'Updating Module %1$s (%2$d/%3$d)', 'wordpointsorg' );
}

Expand Down
4 changes: 2 additions & 2 deletions src/admin/includes/class-module-upgrader-skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function after() {

if ( ! empty( $this->module ) && ! is_wp_error( $this->result ) && $this->module_active ) {

$url = wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_configure&tab=modules&action=activate-module&networkwide=' . $this->module_network_active . '&module=' . urlencode( $this->module ) ), "activate-module_{$this->module}" );
$url = wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_configure&tab=modules&action=activate-module&networkwide=' . $this->module_network_active . '&module=' . rawurlencode( $this->module ) ), "activate-module_{$this->module}" );

?>

Expand All @@ -123,7 +123,7 @@ public function after() {
public function get_module_update_actions() {

$update_actions = array(
'activate_module' => '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=activate&amp;module=' . urlencode( $this->module ) ), "activate-module_{$this->module}" ) ) . '" target="_parent">' . esc_html__( 'Activate Module', 'wordpointsorg' ) . '</a>',
'activate_module' => '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=activate&amp;module=' . rawurlencode( $this->module ) ), "activate-module_{$this->module}" ) ) . '" target="_parent">' . esc_html__( 'Activate Module', 'wordpointsorg' ) . '</a>',
'modules_page' => '<a href="' . esc_url( self_admin_url( 'admin.php?page=wordpoints_modules' ) ) . '" target="_parent">' . esc_html__( 'Return to Modules page', 'wordpointsorg' ) . '</a>',
);

Expand Down
6 changes: 4 additions & 2 deletions src/admin/includes/class-module-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ private function upgrade_strings() {
'no_package' => __( 'Update package not available.', 'wordpointsorg' ),
'no_channel' => __( 'That module cannot be updated, because there is no channel specified to receive updates through.', 'wordpointsorg' ),
'api_not_found' => __( 'That module cannot be updated, because there is no API installed that can communicate with that channel.', 'wordpointsorg' ),
// translators: Update package URL.
'downloading_package' => sprintf( __( 'Downloading update from %s&#8230;', 'wordpointsorg' ), '<span class="code">%s</span>' ),
'unpack_package' => __( 'Unpacking the update&#8230;', 'wordpointsorg' ),
'remove_old' => __( 'Removing the old version of the module&#8230;', 'wordpointsorg' ),
Expand All @@ -108,6 +109,7 @@ private function install_strings() {

$install_strings = array(
'no_package' => __( 'Install package not available.', 'wordpointsorg' ),
// translators: Module package URL.
'downloading_package' => sprintf( __( 'Downloading install package from %s&#8230;', 'wordpointsorg' ), '<span class="code">%s</span>' ),
'unpack_package' => __( 'Unpacking the package&#8230;', 'wordpointsorg' ),
'installing_package' => __( 'Installing the module&#8230;', 'wordpointsorg' ),
Expand Down Expand Up @@ -264,7 +266,7 @@ public function bulk_upgrade( $modules, $args = array() ) {

return $results;

} // function bulk_upgrade()
} // End public function bulk_upgrade().

/**
* Set up before running an upgrade.
Expand Down Expand Up @@ -361,7 +363,7 @@ protected function _upgrade( $module_file ) {
)
);

} // function _upgrade()
} // End protected function _upgrade().

/**
* Clean up after an upgrade.
Expand Down
33 changes: 23 additions & 10 deletions src/admin/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function wordpointsorg_update_modules() {
new WordPointsOrg_Bulk_Module_Upgrader_Skin(
array(
'nonce' => 'bulk-update-modules',
'url' => 'update.php?action=update-selected-wordpoints-modules&amp;modules=' . urlencode( implode( ',', $modules ) ),
'url' => 'update.php?action=update-selected-wordpoints-modules&amp;modules=' . rawurlencode( implode( ',', $modules ) ),
)
)
);
Expand All @@ -308,7 +308,7 @@ function wordpointsorg_upgrade_module() {
}

$module = ( isset( $_REQUEST['module'] ) )
? sanitize_text_field( wp_unslash( $_REQUEST['module'] ) )
? sanitize_text_field( wp_unslash( $_REQUEST['module'] ) ) // WPCS: CSRF OK.
: '';

check_admin_referer( 'upgrade-module_' . $module );
Expand All @@ -326,7 +326,7 @@ function wordpointsorg_upgrade_module() {
array(
'title' => $title,
'nonce' => 'upgrade-module_' . $module,
'url' => 'update.php?action=wordpoints-upgrade-module&module=' . urlencode( $module ),
'url' => 'update.php?action=wordpoints-upgrade-module&module=' . rawurlencode( $module ),
'module' => $module,
)
)
Expand Down Expand Up @@ -359,7 +359,7 @@ function wordpointsorg_update_selected_modules() {
$modules = array();
}

$url = self_admin_url( 'update.php?action=update-selected-wordpoints-modules&amp;modules=' . urlencode( implode( ',', $modules ) ) );
$url = self_admin_url( 'update.php?action=update-selected-wordpoints-modules&amp;modules=' . rawurlencode( implode( ',', $modules ) ) );
$url = wp_nonce_url( $url, 'bulk-update-modules' );

$parent_file = 'admin.php';
Expand Down Expand Up @@ -468,6 +468,7 @@ function wordpointsorg_add_upgrade_modules_list_table( $modules ) {
*/
function wordpointsorg_module_upgrades_filter_link( $text, $count ) {

// translators: Number of available updates.
return _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', (int) $count, 'wordpointsorg' );
}
add_filter( 'wordpoints_modules_status_link_text-upgrade', 'wordpointsorg_module_upgrades_filter_link', 10, 2 );
Expand Down Expand Up @@ -581,7 +582,7 @@ function wordpointsorg_module_update_row( $file, $module_data ) {
);

$details_url = admin_url(
'update.php?action=wordpoints-iframe-module-changelog&module=' . urlencode( $file )
'update.php?action=wordpoints-iframe-module-changelog&module=' . rawurlencode( $file )
);

?>
Expand All @@ -596,6 +597,7 @@ function wordpointsorg_module_update_row( $file, $module_data ) {
if ( ! current_user_can( 'update_wordpoints_modules' ) ) {
printf(
wp_kses(
// translators: 1. Module name; 2. Details URL; 3. Module name; 4. New version number.
__( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.', 'wordpointsorg' )
, array( 'a' => array( 'href' => array(), 'class' => array(), 'title' => array() ) )
)
Expand All @@ -607,6 +609,7 @@ function wordpointsorg_module_update_row( $file, $module_data ) {
} else {
printf(
wp_kses(
// translators: 1. Module name; 2. Details URL; 3. Module name; 4. New version number; 5. Update URL.
__( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'wordpointsorg' )
, array( 'a' => array( 'href' => array(), 'class' => array(), 'title' => array() ) )
)
Expand Down Expand Up @@ -659,11 +662,11 @@ function wordpointsorg_iframe_module_changelog() {
wp_die( esc_html__( 'Sorry, you are not allowed to update modules for this site.', 'wordpointsorg' ), '', array( 'response' => 403 ) );
}

if ( empty( $_GET['module'] ) ) {
if ( empty( $_GET['module'] ) ) { // WPCS: CSRF OK.
wp_die( esc_html__( 'No module supplied.', 'wordpointsorg' ), '', array( 'response' => 200 ) );
}

$module_file = sanitize_text_field( urldecode( wp_unslash( $_GET['module'] ) ) ); // WPCS: sanitization OK.
$module_file = sanitize_text_field( rawurldecode( wp_unslash( $_GET['module'] ) ) ); // WPCS: CSRF, sanitization OK.

$modules = wordpoints_get_modules();

Expand Down Expand Up @@ -777,9 +780,19 @@ function wordpoints_list_module_updates() {
<p>
<strong><?php echo esc_html( $module_data['name'] ); ?></strong>
<br />
<?php echo esc_html( sprintf( __( 'You have version %1$s installed. Update to %2$s.', 'wordpointsorg' ), $module_data['version'], $module_data['new_version'] ) ); ?>
<a href="<?php echo esc_url( self_admin_url( 'update.php?action=wordpoints-iframe-module-changelog&module=' . urlencode( $module_file ) . '&TB_iframe=true&width=640&height=662' ) ); ?>" class="thickbox" title="<?php echo esc_attr( $module_data['name'] ); ?>">
<?php echo esc_html( sprintf( __( 'View version %1$s details.', 'wordpointsorg' ), $module_data['new_version'] ) ); ?>
<?php

// translators: 1. Installed version number; 2. Update version number.
echo esc_html( sprintf( __( 'You have version %1$s installed. Update to %2$s.', 'wordpointsorg' ), $module_data['version'], $module_data['new_version'] ) );

?>
<a href="<?php echo esc_url( self_admin_url( 'update.php?action=wordpoints-iframe-module-changelog&module=' . rawurlencode( $module_file ) . '&TB_iframe=true&width=640&height=662' ) ); ?>" class="thickbox" title="<?php echo esc_attr( $module_data['name'] ); ?>">
<?php

// translators: Version number.
echo esc_html( sprintf( __( 'View version %1$s details.', 'wordpointsorg' ), $module_data['new_version'] ) );

?>
</a>
</p>
</td>
Expand Down
1 change: 1 addition & 0 deletions src/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ function wordpoints_module_update_counts( $update_data ) {
$update_data['counts']['wordpoints_modules'] = count( $module_updates['response'] );

$title = sprintf(
// translators: Number of updates.
_n(
'%d WordPoints Module Update'
, '%d WordPoints Module Updates'
Expand Down
Loading

0 comments on commit 8fca730

Please sign in to comment.