upskill-event-manager/wordpress-dev/wordpress/wp-content/plugins/astra-pro-sites/classes/class-astra-pro-sites-white-label.php
bengizmo d1509b3d60 feat(dev-env): implement backup-based development workflow
This commit introduces a more reliable and consistent approach to setting up
the development environment using backups:

- Add setup-from-backup.sh script for environment setup from existing backups
- Standardize script naming and organization
- Move obsolete scripts to bin/obsolete directory
- Update documentation with new workflow instructions
- Create migration guide for transitioning to new workflow
- Update Memory Bank with workflow improvements

The new workflow provides:
- More reliable environment setup
- Faster setup process
- Offline development capability
- Consistent development environments across team members

Breaking changes:
- setup-dev.sh is replaced by setup-from-backup.sh
- sync-and-setup.sh is replaced by separate scripts
- verify-with-wpcli.sh is no longer used

Migration path is documented in MIGRATION_GUIDE.md
2025-03-26 11:26:18 -03:00

130 lines
2.8 KiB
PHP

<?php
/**
* Astra Pro Sites White Label
*
* @package Astra Pro Sites
* @since 1.0.0
*/
if ( ! class_exists( 'Astra_Pro_Sites_White_Label' ) ) :
/**
* Astra_Pro_Sites_White_Label
*
* @since 1.0.0
*/
class Astra_Pro_Sites_White_Label {
/**
* Instance
*
* @since 4.0.4
* @access private
* @var object Class object.
*/
private static $instance = null;
/**
* Initiator
*
* @since 4.0.4
* @return mixed
*/
public static function set_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct() {
add_filter( 'all_plugins', array( $this, 'plugins_page' ) );
}
/**
* Get value of single key from option array.
*
* @since 1.0.0
* @param string $type Option type.
* @param string $key Option key.
* @param string $default Default value if key not found.
* @return mixed Return stored option value.
*/
public static function get_option( $type = '', $key = '', $default = null ) {
if ( ! class_exists( 'Astra_Ext_White_Label_Markup' ) ) {
return $default;
}
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_white_label' ) ) {
return $default;
}
$value = Astra_Ext_White_Label_Markup::get_white_label( $type, $key );
if ( ! empty( $value ) ) {
return $value;
}
return $default;
}
/**
* White labels the plugins page.
*
* @param array<string, array<string, mixed>> $plugins Plugins Array.
* @return array<string, array<string, mixed>>
*/
public function plugins_page( $plugins ) {
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_white_label' ) ) {
return $plugins;
}
if ( ! isset( $plugins[ ASTRA_PRO_SITES_BASE ] ) ) {
return $plugins;
}
// Set White Labels.
$name = self::get_option( 'astra-sites', 'name' );
$description = self::get_option( 'astra-sites', 'description' );
$author = self::get_option( 'astra-agency', 'author' );
$author_uri = self::get_option( 'astra-agency', 'author_url' );
if ( ! empty( $name ) ) {
$plugins[ ASTRA_PRO_SITES_BASE ]['Name'] = $name;
// Remove Plugin URI if Agency White Label name is set.
$plugins[ ASTRA_PRO_SITES_BASE ]['PluginURI'] = '';
}
if ( ! empty( $description ) ) {
$plugins[ ASTRA_PRO_SITES_BASE ]['Description'] = $description;
}
if ( ! empty( $author ) ) {
$plugins[ ASTRA_PRO_SITES_BASE ]['Author'] = $author;
}
if ( ! empty( $author_uri ) ) {
$plugins[ ASTRA_PRO_SITES_BASE ]['AuthorURI'] = $author_uri;
}
return $plugins;
}
}
/**
* Kicking this off by calling 'set_instance()' method
*/
Astra_Pro_Sites_White_Label::set_instance();
endif;