mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- 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:
@@ -37,7 +37,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) );
|
||||
add_action( 'um_admin_do_action__manual_upgrades_request', array( &$this, 'manual_upgrades_request' ) );
|
||||
add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) );
|
||||
add_action( 'um_admin_do_action__um_language_downloader', array( &$this, 'um_language_downloader' ) );
|
||||
add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) );
|
||||
add_action( 'um_admin_do_action__um_can_register_notice', array( &$this, 'um_hide_notice' ) );
|
||||
add_action( 'um_admin_do_action__um_hide_exif_notice', array( &$this, 'um_hide_notice' ) );
|
||||
@@ -209,41 +208,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download a language remotely
|
||||
*
|
||||
* @param $action
|
||||
*/
|
||||
function um_language_downloader( $action ) {
|
||||
if ( !is_admin() || !current_user_can('manage_options') ) die();
|
||||
|
||||
$locale = get_option('WPLANG');
|
||||
if ( !$locale ) return;
|
||||
if ( !isset( UM()->available_languages[$locale] ) ) return;
|
||||
|
||||
$path = UM()->files()->upload_basedir;
|
||||
$path = str_replace('/uploads/ultimatemember','',$path);
|
||||
$path = $path . '/languages/plugins/';
|
||||
$path = str_replace('//','/',$path);
|
||||
|
||||
$remote = 'https://ultimatemember.com/wp-content/languages/plugins/ultimatemember-' . $locale . '.po';
|
||||
$remote2 = 'https://ultimatemember.com/wp-content/languages/plugins/ultimatemember-' . $locale . '.mo';
|
||||
|
||||
$remote_tmp = download_url( $remote, $timeout = 300 );
|
||||
copy( $remote_tmp, $path . 'ultimatemember-' . $locale . '.po' );
|
||||
unlink( $remote_tmp );
|
||||
|
||||
$remote2_tmp = download_url( $remote2, $timeout = 300 );
|
||||
copy( $remote2_tmp, $path . 'ultimatemember-' . $locale . '.mo' );
|
||||
unlink( $remote2_tmp );
|
||||
|
||||
$url = remove_query_arg('um_adm_action', UM()->permalinks()->get_current_url() );
|
||||
$url = add_query_arg('update','language_updated',$url);
|
||||
exit( wp_redirect($url) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action to hide notices in admin
|
||||
*
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<p>
|
||||
<?php printf( __( 'Ultimate Member is available in your language: <strong>%1$s (%2$s)</strong>.', 'ultimate-member' ), UM()->available_languages[ $locale ], $locale ); ?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="<?php echo add_query_arg( 'um_adm_action', 'um_language_downloader' ); ?>" class="button">
|
||||
<?php _e( 'Download Translation', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
@@ -1,9 +0,0 @@
|
||||
<p>
|
||||
<?php printf( __( 'You are currently using Ultimate Member in your language: <strong>%1$s (%2$s)</strong>.', 'ultimate-member' ), UM()->available_languages[ $locale ], $locale ); ?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="<?php echo add_query_arg( 'um_adm_action', 'um_language_downloader' ); ?>" class="button">
|
||||
<?php _e( 'Force Update Translation', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
@@ -162,11 +162,11 @@ $free['terms-conditions'] = array(
|
||||
|
||||
<div class="wp-filter um-admin-notice um-filter">
|
||||
<div class="alignleft">
|
||||
<strong>Core Extensions Bundle</strong> – Check out our extensions bundle which includes all extensions at a significant discount.
|
||||
<?php _e( '<strong>All Access Pass</strong> – Get access to all Ultimate Member extensions at a significant discount with our All Access Pass.', 'ultimate-member' ) ?>
|
||||
</div>
|
||||
<div class="alignright">
|
||||
<a href="https://ultimatemember.com/core-extensions-bundle/" class="button button-primary" target="_blank">
|
||||
<?php _e( 'View our Extensions Bundle', 'ultimate-member' ) ?>
|
||||
<a href="https://ultimatemember.com/pricing/" class="button button-primary" target="_blank">
|
||||
<?php _e( 'View Pricing', 'ultimate-member' ) ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user