- 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
-36
View File
@@ -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
*
-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
@@ -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>
+3 -3
View File
@@ -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>
-33
View File
@@ -65,14 +65,6 @@ if ( ! class_exists( 'UM' ) ) {
public $is_permalinks;
/**
* UM Available Languages
*
* @var array
*/
var $available_languages;
/**
* Main UM Instance
*
@@ -198,31 +190,6 @@ if ( ! class_exists( 'UM' ) ) {
$this->is_filtering = 0;
$this->honeypot = 'request';
$this->available_languages = array(
'en_US' => 'English (US)',
'es_ES' => 'Español',
'es_MX' => 'Español (México)',
'fr_FR' => 'Français',
'it_IT' => 'Italiano',
'de_DE' => 'Deutsch',
'nl_NL' => 'Nederlands',
'pt_BR' => 'Português do Brasil',
'fi_FI' => 'Suomi',
'ro_RO' => 'Română',
'da_DK' => 'Dansk',
'sv_SE' => 'Svenska',
'pl_PL' => 'Polski',
'cs_CZ' => 'Czech',
'el' => 'Greek',
'id_ID' => 'Indonesian',
'zh_CN' => '简体中文',
'ru_RU' => 'Русский',
'tr_TR' => 'Türkçe',
'fa_IR' => 'Farsi',
'he_IL' => 'Hebrew',
'ar' => 'العربية',
);
// textdomain loading
$this->localize();
+7 -11
View File
@@ -12,33 +12,30 @@ function um_browser_url_redirect_to( $args ) {
$url = '';
if ( ! empty( $_REQUEST['redirect_to'] ) ) {
$url = $_REQUEST['redirect_to'];
echo '<input type="hidden" name="redirect_to" id="redirect_to" value="'.esc_url( $url ).'" />';
} elseif ( ! empty( $args['after_login'] ) ) {
switch ( $args['after_login'] ) {
case 'redirect_admin':
$url = admin_url();
break;
case 'redirect_profile':
$url = um_user_profile_url();
break;
case 'redirect_url':
$url = $args['redirect_url'];
break;
case 'refresh':
$url = UM()->permalinks()->get_current_url();
break;
}
}
/**
@@ -66,7 +63,6 @@ function um_browser_url_redirect_to( $args ) {
if ( ! empty( $url ) ) {
echo '<input type="hidden" name="redirect_to" id="redirect_to" value="' . esc_url( $url ) . '" />';
}
}
add_action( 'um_after_form_fields', 'um_browser_url_redirect_to' );
+13 -17
View File
@@ -439,27 +439,25 @@ function um_redirect_home() {
* @param $url
*/
function um_js_redirect( $url ) {
if (headers_sent() || empty( $url )) {
if ( headers_sent() || empty( $url ) ) {
//for blank redirects
if ('' == $url) {
if ( '' == $url ) {
$url = set_url_scheme( '//' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] );
}
$funtext = "echo \"<script data-cfasync='false' type='text/javascript'>window.location = '" . $url . "'</script>\";";
register_shutdown_function( create_function( '', $funtext ) );
register_shutdown_function( function( $url ) {
echo '<script data-cfasync="false" type="text/javascript">window.location = "' . $url . '"</script>';
}, $url );
if (1 < ob_get_level()) {
while (ob_get_level() > 1) {
if ( 1 < ob_get_level() ) {
while ( ob_get_level() > 1 ) {
ob_end_clean();
}
}
?>
<script data-cfasync='false' type="text/javascript">
window.location = '<?php echo $url; ?>';
</script>
<?php
exit;
} ?>
<script data-cfasync='false' type="text/javascript">
window.location = '<?php echo $url; ?>';
</script>
<?php exit;
} else {
wp_redirect( $url );
}
@@ -2509,7 +2507,5 @@ function is_ultimatemember() {
* Maybe set empty time limit
*/
function um_maybe_unset_time_limit() {
if ( ! ini_get( 'safe_mode' ) ) {
@set_time_limit(0);
}
@set_time_limit( 0 );
}
+1 -1
View File
@@ -39,7 +39,7 @@ Read about all of the plugin's features at [Ultimate Member](https://ultimatemem
= Paid Extensions =
Ultimate Member has a range of extensions that allow you to extend the power of the plugin
Ultimate Member has a range of extensions that allow you to extend the power of the plugin. You can purchase all of these extensions at a significant discount with our [All Access Pass](https://ultimatemember.com/pricing/) or you can purchase extensions individually.
* [Private Content](https://ultimatemember.com/extensions/private-content/) - Display private content to logged in users that only they can access
* [Instagram](https://ultimatemember.com/extensions/instagram/) - Allow users to show their Instagram photos on their profile