Commit 08141960 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

Add dashicons to the credentials link

parent ba7216b1
......@@ -42,10 +42,13 @@ var submitUpdateCredentials = function(btn) {
jQuery(tr).find('div.update-credentials-message').html(json['message']);
jQuery(tr).find('div.update-credentials').removeClass('message-fail').addClass('message-success')
jQuery(tr).find('div.update-credentials-form').fadeOut( 500, function() { jQuery(this).remove(); });
jQuery(tr).closest('table').find('a.otup_credentials_link_'+slug).removeClass('dashicons-no').addClass('dashicons-yes');
jQuery(tr).delay(5000).fadeOut(1000, function() { jQuery(this).remove(); });
} else {
jQuery(tr).find('div.update-credentials-message').html(json['message']);
jQuery(tr).find('div.update-credentials').addClass('message-fail').removeClass('message-success');
jQuery(tr).closest('table').find('a.otup_credentials_link_'+slug).removeClass('dashicons-yes').addClass('dashicons-no');
}
},
error: function() {
......
......@@ -26,7 +26,9 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
add_action('admin_print_styles-plugins.php', array($this, 'addCredentialCheckStyles'));
add_filter('plugin_row_meta', array($this, 'displayUpdateCredentialsLink'), 10, 2);
// add_filter('plugin_row_meta', array($this, 'displayUpdateCredentialsLink'), 9, 2);
add_filter('plugin_action_links_'.$this->pluginFile, array($this, 'displayUpdateCredentialsLink'), 9, 2);
add_action( 'wp_ajax_getUpdateCredentialsRow', array( &$this, 'getUpdateCredentialsRow') );
add_action( 'wp_ajax_submitUpdateCredentials', array( &$this, 'submitUpdateCredentials') );
......@@ -99,17 +101,21 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
* @param string $pluginFile
* @return array
*/
public function displayUpdateCredentialsLink($pluginMeta, $pluginFile) {
public function displayUpdateCredentialsLink($links, $pluginFile) {
$isRelevant = ($pluginFile == $this->pluginFile)
|| (!empty($this->muPluginFile) && $pluginFile == $this->muPluginFile);
if ( $isRelevant && current_user_can('update_plugins') ) {
$credentials = $this->getCredentials($this->slug);
$linkText = apply_filters('otup_enter_update_credentials-' . $this->slug, __('Update Credentials', 'oton-updates'));
if ( !empty($linkText) ) {
$pluginMeta[] = sprintf('<a href="#" onClick=\'return showUpdateCredentialsRow(this, "%s", "%s");\' >%s</a>', esc_attr($this->slug), esc_attr(wp_create_nonce( 'otup_enter_update_credentials' )), $linkText);
$iconyesno = $credentials['validated']?'yes':'no';
$link = sprintf('<a href="#" onClick=\'return showUpdateCredentialsRow(this, "%s", "%s");\' class="dashicons-before dashicons-'.$iconyesno.' otup_credentials_link_'.$this->slug.'">%s</a>', esc_attr($this->slug), esc_attr(wp_create_nonce( 'otup_enter_update_credentials' )), $linkText);
array_unshift($links, $link);
}
}
return $pluginMeta;
return $links;
}
......
......@@ -172,7 +172,9 @@ class OpenToolsOrdernumbersBasic {
*/
public function ordernumber_add_settings_link( $links ) {
$link = '<a href="admin.php?page=wc-settings&tab=checkout&section=ordernumber">'. $this->helper->__( 'Settings' ) . '</a>';
array_push( $links, $link );
// Prepend the settings link:
array_unshift( $links, $link );
// $links['settings'] = $link;
return $links;
}
public function ordernumber_plugin_row_meta( $links, $file ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment