- notices texts changes;

- remove language notice;
- fixed duplicated "redirect_to" field;
- added compatibility with PHP7.2 (removed deprecated functions and ini variables);
This commit is contained in:
nikitozzzzzzz
2018-11-15 18:53:59 +02:00
parent 986b294aed
commit 819d5333db
12 changed files with 44 additions and 274 deletions
-74
View File
@@ -215,14 +215,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
add_meta_box( 'um-metaboxes-sidebox-2', __( 'User Cache', 'ultimate-member' ), array( &$this, 'user_cache' ), $this->pagehook, 'side', 'core' );
if ( $this->language_avaialable_not_installed() ) {
add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'dl_language' ), $this->pagehook, 'side', 'core' );
} else if ( $this->language_avaialable_installed() ) {
add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'up_language' ), $this->pagehook, 'side', 'core' );
} else if ( $this->language_not_available() ) {
add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'ct_language' ), $this->pagehook, 'side', 'core' );
}
//If there are active and licensed extensions - show metabox for upgrade it
$exts = UM()->plugin_updater()->um_get_active_plugins();
if ( 0 < count( $exts ) ) {
@@ -231,33 +223,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
}
/**
*
*/
function up_language() {
$locale = get_option('WPLANG');
include_once UM()->admin()->templates_path . 'dashboard/language-update.php';
}
/**
*
*/
function dl_language() {
$locale = get_option('WPLANG');
include_once UM()->admin()->templates_path . 'dashboard/language-download.php';
}
/**
*
*/
function ct_language() {
$locale = get_option('WPLANG');
include_once UM()->admin()->templates_path . 'dashboard/language-contrib.php';
}
/**
*
*/
@@ -298,45 +263,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
}
/**
* Language not available
*
* @return bool
*/
function language_not_available() {
$locale = get_option( 'WPLANG' );
if ( $locale && !strstr($locale, 'en_') && !isset( UM()->available_languages[$locale] ) && !file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
return true;
return false;
}
/**
* Language available but not installed
*
* @return bool
*/
function language_avaialable_not_installed() {
$locale = get_option('WPLANG');
if ( $locale && isset( UM()->available_languages[$locale] ) && !file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
return true;
return false;
}
/**
* Language available and installed
*
* @return bool
*/
function language_avaialable_installed() {
$locale = get_option('WPLANG');
if ( $locale && isset( UM()->available_languages[$locale] ) && file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
return true;
return false;
}
/**
* Get a directory size
*
@@ -38,7 +38,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$this->old_extensions_notice();
$this->install_core_page_notice();
$this->exif_extension_notice();
$this->localize_note();
$this->show_update_messages();
$this->check_wrong_install_folder();
$this->admin_notice_opt_in();
@@ -358,45 +357,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
}
/**
* Localization notice
*/
function localize_note() {
$locale = get_option( 'WPLANG' );
if ( ! $locale || strstr( $locale, 'en_' ) ) {
return;
}
if ( file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) ) {
return;
}
$hide_locale_notice = get_option( 'um_hide_locale_notice' );
if ( $hide_locale_notice ) {
return;
}
if ( isset( UM()->available_languages[ $locale ] ) ) {
$download_uri = add_query_arg( 'um_adm_action', 'um_language_downloader' );
$this->add_notice( 'locale', array(
'class' => 'updated',
'message' => '<p>' . sprintf( __( 'Your site language is <strong>%1$s</strong>. Good news! Ultimate Member is already available in <strong>%2$s language</strong>. <a href="%3$s">Download the translation</a> files and start using the plugin in your language now. <a href="%4$s">Hide this notice</a>','ultimate-member'), $locale, UM()->available_languages[ $locale ], $download_uri, add_query_arg( 'um_adm_action', 'um_hide_locale_notice' ) ) . '</p>',
), 40 );
} else {
$this->add_notice( 'locale', array(
'class' => 'updated',
'message' => '<p>' . sprintf( __( 'Ultimate Member has not yet been translated to your language: <strong>%1$s</strong>. If you have translated the plugin you need put these files <code>ultimatemember-%1$s.po and ultimatemember-%1$s.mo</code> in <strong>/wp-content/languages/plugins/</strong> for the plugin to be translated in your language. <a href="%2$s">Hide this notice</a>', 'ultimate-member' ), $locale, add_query_arg( 'um_adm_action', 'um_hide_locale_notice' ) ) . '</p>',
), 40 );
}
}
/**
* Updating users
*/
+20 -11
View File
@@ -1061,19 +1061,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
*/
function sorting_licenses_options( $settings ) {
//sorting licenses
if ( empty( $settings['licenses']['fields'] ) )
if ( empty( $settings['licenses']['fields'] ) ) {
return $settings;
}
$licenses = $settings['licenses']['fields'];
@uasort( $licenses, create_function( '$a,$b', 'return strnatcasecmp($a["label"],$b["label"]);' ) );
@uasort( $licenses, function( $a, $b ) {
return strnatcasecmp( $a["label"], $b["label"] );
} );
$settings['licenses']['fields'] = $licenses;
//sorting extensions
if ( empty( $settings['extensions']['sections'] ) )
if ( empty( $settings['extensions']['sections'] ) ) {
return $settings;
}
$extensions = $settings['extensions']['sections'];
@uasort( $extensions, create_function( '$a,$b', 'return strnatcasecmp($a["title"],$b["title"]);' ) );
@uasort( $extensions, function( $a, $b ) {
return strnatcasecmp( $a["title"], $b["title"] );
} );
$keys = array_keys( $extensions );
if ( $keys[0] != "" ) {
@@ -1082,7 +1088,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
$extensions[$new_key] = $temp;
$extensions[""] = $extensions[$keys[0]];
unset( $extensions[$keys[0]] );
@uasort( $extensions, create_function( '$a,$b', 'return strnatcasecmp($a["title"],$b["title"]);' ) );
@uasort( $extensions, function( $a, $b ) {
return strnatcasecmp( $a["title"], $b["title"] );
} );
}
$settings['extensions']['sections'] = $extensions;
@@ -1099,13 +1107,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
*/
function get_section_fields( $tab, $section ) {
if ( empty( $this->settings_structure[$tab] ) )
if ( empty( $this->settings_structure[ $tab ] ) ) {
return array();
}
if ( ! empty( $this->settings_structure[$tab]['sections'][$section]['fields'] ) ) {
return $this->settings_structure[$tab]['sections'][$section]['fields'];
} elseif ( ! empty( $this->settings_structure[$tab]['fields'] ) ) {
return $this->settings_structure[$tab]['fields'];
if ( ! empty( $this->settings_structure[ $tab ]['sections'][ $section ]['fields'] ) ) {
return $this->settings_structure[ $tab ]['sections'][ $section ]['fields'];
} elseif ( ! empty( $this->settings_structure[ $tab ]['fields'] ) ) {
return $this->settings_structure[ $tab ]['fields'];
}
return array();
@@ -350,36 +350,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
wp_send_json_success( array( 'packages' => $update_versions ) );
}
/**
* Load packages
*/
/*public function packages() {
if ( ! ini_get( 'safe_mode' ) ) {
@set_time_limit(0);
}
$this->set_update_versions();
$um_last_version_upgrade = get_option( 'um_last_version_upgrade' );
$um_last_version_upgrade = ! $um_last_version_upgrade ? '0.0.0' : $um_last_version_upgrade;
foreach ( $this->update_versions as $update_version ) {
if ( version_compare( $update_version, $um_last_version_upgrade, '<=' ) )
continue;
if ( version_compare( $update_version, ultimatemember_version, '>' ) )
continue;
$file_path = $this->packages_dir . $update_version . '.php';
if ( file_exists( $file_path ) ) {
include_once( $file_path );
update_option( 'um_last_version_upgrade', $update_version );
}
}
}*/
/**
* Parse packages dir for packages files