mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- plugin/theme upgrader_package_options
This commit is contained in:
@@ -17,17 +17,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
|
||||
class Admin_Theme_Updater {
|
||||
|
||||
|
||||
/**
|
||||
* When enable this functionality?
|
||||
* @var array
|
||||
*/
|
||||
private $actions = array(
|
||||
'do-theme-upgrade',
|
||||
'update-selected-themes',
|
||||
'update-theme',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Restored themes
|
||||
* @var array
|
||||
@@ -46,10 +35,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $this->actions ) ) {
|
||||
add_filter( 'upgrader_package_options', array( $this, 'upgrader_package_options' ), 40, 1 );
|
||||
add_action( 'upgrader_process_complete', array( $this, 'upgrader_process_complete' ), 40, 2 );
|
||||
}
|
||||
add_filter( 'upgrader_package_options', array( $this, 'upgrader_package_options' ), 40, 1 );
|
||||
add_action( 'upgrader_process_complete', array( $this, 'upgrader_process_complete' ), 40, 2 );
|
||||
}
|
||||
|
||||
|
||||
@@ -65,12 +52,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
|
||||
}
|
||||
|
||||
$dir = opendir( $src );
|
||||
while ( false !== ( $file = readdir( $dir )) ) {
|
||||
while ( false !== ( $file = readdir( $dir ) ) ) {
|
||||
if ( ( $file != '.' ) && ( $file != '..' ) ) {
|
||||
if ( is_dir( $src . DIRECTORY_SEPARATOR . $file ) ) {
|
||||
self::recurse_copy( $src . DIRECTORY_SEPARATOR . $file, $dest . DIRECTORY_SEPARATOR . $file );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
copy( $src . DIRECTORY_SEPARATOR . $file, $dest . DIRECTORY_SEPARATOR . $file );
|
||||
}
|
||||
}
|
||||
@@ -116,6 +102,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
|
||||
$dest = realpath( $um_dir );
|
||||
if ( $src && $dest ) {
|
||||
self::recurse_copy( $src, $dest );
|
||||
error_log( "UM Log. Theme '" . $theme->get( 'template' ) . "' templates restored." );
|
||||
UM()->files()->remove_dir( $src );
|
||||
} else {
|
||||
error_log( "UM Error. Can not restore theme templates." );
|
||||
@@ -157,6 +144,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
|
||||
$dest = realpath( $temp_dir );
|
||||
if ( $src && $dest ) {
|
||||
self::recurse_copy( $src, $dest );
|
||||
error_log( "UM Log. Theme '" . $theme->get( 'template' ) . "' templates saved." );
|
||||
} else {
|
||||
error_log( "UM Error. Can not save theme templates." );
|
||||
}
|
||||
@@ -173,10 +161,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
|
||||
* @return array
|
||||
*/
|
||||
function upgrader_package_options( $options ) {
|
||||
/*if ( ! isset( $options['hook_extra']['type'] ) || 'theme' != $options['hook_extra']['type'] ) {
|
||||
return $options;
|
||||
}*/
|
||||
|
||||
if ( isset( $options['hook_extra'] ) && isset( $options['hook_extra']['theme'] ) ) {
|
||||
$this->save_templates( $options['hook_extra']['theme'] );
|
||||
}
|
||||
@@ -191,10 +175,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
|
||||
* @param array $options
|
||||
*/
|
||||
public function upgrader_process_complete( $WP_Upgrader, $options ) {
|
||||
/*if ( ! isset( $options['type'] ) || 'theme' != $options['type'] ) {
|
||||
return;
|
||||
}*/
|
||||
|
||||
if ( isset( $options['themes'] ) && is_array( $options['themes'] ) ) {
|
||||
foreach ( $options['themes'] as $theme ) {
|
||||
$this->restore_templates( $theme );
|
||||
|
||||
@@ -69,7 +69,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
),
|
||||
'um-messaging/um-messaging.php' => array(
|
||||
'key' => 'messaging',
|
||||
'title' => 'Messaging',
|
||||
'title' => 'Private Messages',
|
||||
),
|
||||
'um-mycred/um-mycred.php' => array(
|
||||
'key' => 'mycred',
|
||||
@@ -81,7 +81,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
),
|
||||
'um-notifications/um-notifications.php' => array(
|
||||
'key' => 'notifications',
|
||||
'title' => 'Notifications',
|
||||
'title' => 'Real-time Notifications',
|
||||
),
|
||||
'um-profile-completeness/um-profile-completeness.php' => array(
|
||||
'key' => 'profile_completeness',
|
||||
@@ -89,7 +89,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
),
|
||||
'um-reviews/um-reviews.php' => array(
|
||||
'key' => 'reviews',
|
||||
'title' => 'Reviews',
|
||||
'title' => 'User Reviews',
|
||||
),
|
||||
'um-social-activity/um-social-activity.php' => array(
|
||||
'key' => 'activity',
|
||||
@@ -109,7 +109,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
),
|
||||
'um-woocommerce/um-woocommerce.php' => array(
|
||||
'key' => 'woocommerce',
|
||||
'title' => 'Woocommerce',
|
||||
'title' => 'WooCommerce',
|
||||
),
|
||||
'um-user-photos/um-user-photos.php' => array(
|
||||
'key' => 'user_photos',
|
||||
@@ -119,6 +119,14 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
'key' => 'private_content',
|
||||
'title' => 'Private Content',
|
||||
),
|
||||
'um-user-bookmarks/um-user-bookmarks.php' => array(
|
||||
'key' => 'user_bookmarks',
|
||||
'title' => 'User Bookmarks',
|
||||
),
|
||||
'um-user-notes/um-user-notes.php' => array(
|
||||
'key' => 'user_notes',
|
||||
'title' => 'User Notes',
|
||||
),
|
||||
);
|
||||
|
||||
$active_um_plugins = array();
|
||||
@@ -186,8 +194,9 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
function um_checklicenses() {
|
||||
$exts = $this->um_get_active_plugins();
|
||||
|
||||
if ( 0 == count( $exts ) )
|
||||
if ( 0 == count( $exts ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
|
||||
@@ -198,13 +207,14 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
);
|
||||
|
||||
$api_params['active_extensions'] = array();
|
||||
|
||||
foreach ( $exts as $slug => $data ) {
|
||||
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug );
|
||||
|
||||
$api_params['active_extensions'][$slug] = array(
|
||||
$api_params['active_extensions'][ $slug ] = array(
|
||||
'slug' => $slug,
|
||||
'license' => $data['license'],
|
||||
'item_name' => str_replace( 'Ultimate Member - ', '', $plugin_data['Name'] ),
|
||||
'item_name' => $data['title'],
|
||||
'version' => $plugin_data['Version']
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,6 +148,8 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
||||
- Fixed $_SERVER usage when WP-CLI using
|
||||
- Extended integration for UM field value
|
||||
- um_user function avoid loop when 'display name' and 'full name' used
|
||||
- Restriction options for Terms and access on front-end
|
||||
- Plugin/Theme upgrader
|
||||
|
||||
* Deprecated:
|
||||
- "Is Account page?" and "Is User page?" options for WPML integration ( because WPML translations works properly )
|
||||
|
||||
Reference in New Issue
Block a user