Skip to content
Snippets Groups Projects
Commit 167246cc authored by Grzegorz Rola's avatar Grzegorz Rola
Browse files

Merge branch 'feature/wp-nonce' into 'master'

Feature/wp nonce

See merge request !16
parents b9517207 19a1917d
No related branches found
No related tags found
1 merge request!16Feature/wp nonce
Pipeline #9169 passed with stages
in 47 seconds
## [3.0.4] - 2019-09-20
### Fixed
- Fixed missing wp_nonce_url function
## [3.0.3] - 2019-09-20 ## [3.0.3] - 2019-09-20
### Fixed ### Fixed
- Fixed "" in translation - Fixed "" in translation
......
...@@ -310,10 +310,11 @@ if ( ! class_exists( 'WPDesk_Basic_Requirement_Checker' ) ) { ...@@ -310,10 +310,11 @@ if ( ! class_exists( 'WPDesk_Basic_Requirement_Checker' ) ) {
* @return string * @return string
*/ */
private function prepare_plugin_repository_install_url( $plugin_info ) { private function prepare_plugin_repository_install_url( $plugin_info ) {
$slug = basename( $plugin_info[ self::PLUGIN_INFO_KEY_NAME ] ); $slug = basename( $plugin_info[ self::PLUGIN_INFO_KEY_NAME ] );
$install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), $install_url = self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug );
'install-plugin_' . $slug ); if ( function_exists( 'wp_nonce_url' ) ) {
$install_url = wp_nonce_url( $install_url, 'install-plugin_' . $slug );
}
add_filter( 'plugins_api', function ( $api, $action, $args ) use ( $plugin_info, $slug ) { add_filter( 'plugins_api', function ( $api, $action, $args ) use ( $plugin_info, $slug ) {
if ( 'plugin_information' !== $action || if ( 'plugin_information' !== $action ||
false !== $api || false !== $api ||
...@@ -351,7 +352,10 @@ if ( ! class_exists( 'WPDesk_Basic_Requirement_Checker' ) ) { ...@@ -351,7 +352,10 @@ if ( ! class_exists( 'WPDesk_Basic_Requirement_Checker' ) ) {
$this->get_text_domain() ), array( 'a' => array( 'href' => array() ) ) ), $this->get_text_domain() ), array( 'a' => array( 'href' => array() ) ) ),
$this->plugin_name, $nice_name, esc_url( $install_url ), $nice_name ) ); $this->plugin_name, $nice_name, esc_url( $install_url ), $nice_name ) );
} }
$activate_url = 'plugins.php?action=activate&plugin=' . urlencode( $plugin_info[ self::PLUGIN_INFO_KEY_NAME ] ) . '&plugin_status=all&paged=1&s&_wpnonce=' . urlencode( wp_create_nonce( 'activate-plugin_' . $name ) ); $activate_url = 'plugins.php?action=activate&plugin=' . urlencode( $plugin_info[ self::PLUGIN_INFO_KEY_NAME ] ) . '&plugin_status=all&paged=1&s';
if ( function_exists( 'wp_create_nonce' ) ) {
$activate_url .= '&_wpnonce=' . urlencode( wp_create_nonce( 'activate-plugin_' . $name ) );
}
return $this->prepare_notice_message( sprintf( wp_kses( __( 'The &#8220;%s&#8221; plugin requires activating %s plugin. <a href="%s">Activate %s →</a>', return $this->prepare_notice_message( sprintf( wp_kses( __( 'The &#8220;%s&#8221; plugin requires activating %s plugin. <a href="%s">Activate %s →</a>',
$this->get_text_domain() ), array( 'a' => array( 'href' => array() ) ) ), $this->get_text_domain() ), array( 'a' => array( 'href' => array() ) ) ),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment