PHP Class Envato_Theme_Setup_Wizard

Exibir arquivo Open project: dtbaker/envato-wp-theme-setup-wizard Class Usage Examples

Public Properties

Property Type Description
$errors
$logs
$site_styles

Protected Properties

Property Type Description
$envato_username Theme author username, used in check for oauth.
$oauth_script Full url to server-script.php (available from https://gist.github.com/dtbaker )
$page_parent string The slug name for the parent menu
$page_slug string The slug name to refer to this menu
$page_url string Complete URL to Setup Wizard
$plugin_path string Relative plugin path
$plugin_url string Relative plugin url for this plugin folder, used when enquing scripts
$step Current Step
$steps Steps for the setup wizard
$tgmpa_instance object TGMPA instance storage
$tgmpa_menu_slug string TGMPA Menu slug
$tgmpa_url string TGMPA Menu url
$theme_name Current theme name, used as namespace in actions.
$version string The class version number.

Public Methods

Method Description
__construct ( ) A dummy constructor to prevent this class from being loaded more than once.
_content_install_settings ( )
_get_json ( $file )
admin_menus ( ) Add admin menus/screens.
admin_redirects ( )
ajax_content ( )
ajax_plugins ( )
cleanFilePath ( string $path ) Helper function Take a path and return it clean
cmpr_strlen ( $a, $b ) return the difference in length between two strings
elementor_post ( $post_id = false )
enqueue_scripts ( )
envato_market_admin_init ( )
envato_market_http_request_args ( $args, $url ) : mixed
envato_setup_color_style ( )
envato_setup_color_style_save ( ) Save logo & design options
envato_setup_customize ( )
envato_setup_default_content ( ) Page setup
envato_setup_default_plugins ( ) Page setup
envato_setup_help_support ( )
envato_setup_introduction ( ) Introduction step
envato_setup_introduction_save ( ) Handles save button from welcome page. This is to perform tasks when the setup wizard has already been run. E.g. reset defaults
envato_setup_logo_design ( ) Logo & Design
envato_setup_logo_design_save ( ) Save logo & design options
envato_setup_ready ( ) Final step
envato_setup_updates ( ) Payments Step
envato_setup_updates_save ( ) Payments Step save
error ( $message )
filter_options ( $options )
get_default_theme_style ( ) Get the default style. Can be overriden by theme init scripts.
get_header_logo_width ( ) Get the default style. Can be overriden by theme init scripts.
get_instance ( ) : Envato_Theme_Setup_Wizard
get_logo_image ( ) Get the default style. Can be overriden by theme init scripts.
get_next_step_link ( )
get_oauth_login_url ( $return ) we can update the token there.
get_step_link ( $step )
get_tgmpa_instanse ( ) Get configured TGMPA instance
init_actions ( ) Setup the hooks, actions and filters.
init_globals ( ) Setup the class globals.
init_wizard_steps ( ) : array Setup steps.
is_possible_upgrade ( ) We determine if the user already has theme content installed. This can happen if swapping from a previous theme or updated the current theme. We change the UI a bit when updating / swapping to a new theme.
is_submenu_page ( )
log ( $message )
render_oauth_login_description_callback ( )
render_oauth_login_fields_callback ( )
set_tgmpa_url ( ) Update $tgmpa_menu_slug and $tgmpa_parent_slug from TGMPA instance
setup_wizard ( ) Show the setup wizard
setup_wizard_content ( ) Output the content for the current step
setup_wizard_footer ( ) Setup Wizard Footer
setup_wizard_header ( ) Setup Wizard Header
setup_wizard_steps ( ) Output the steps
switch_theme ( )
tgmpa_load ( $status )
upgrader_post_install ( $return, $theme ) After a theme update we clear the setup_complete option. This prompts the user to visit the update page again.
vc_post ( $post_id = false )

Private Methods

Method Description
_array_merge_recursive_distinct ( $array1, $array2 ) : mixed
_cleanup_imported_ids ( )
_content_default_get ( )
_content_install_type ( )
_content_install_widgets ( )
_delay_post_process ( $post_type, $post_data )
_elementor_id_import ( &$item, $key )
_fetch_remote_file ( $url, $post )
_get_plugins ( )
_get_sql ( $file )
_handle_delayed_posts ( $last_delay = false )
_handle_post_orphans ( )
_imported_post_id ( $original_id = false, $new_id = false )
_imported_term_id ( $original_term_id, $new_term_id = false )
_manage_oauth_token ( $token )
_parse_gallery_shortcode_content ( $content )
_post_orphans ( $original_id = false, $missing_parent_id = false )
_process_post_data ( $post_type, $post_data, $delayed, $debug = false )

Method Details

__construct() public method

A dummy constructor to prevent this class from being loaded more than once.
See also: Envato_Theme_Setup_Wizard::instance()
Since: 1.1.1
public __construct ( )

_content_install_settings() public method

_get_json() public method

public _get_json ( $file )

admin_menus() public method

Add admin menus/screens.
public admin_menus ( )

admin_redirects() public method

public admin_redirects ( )

ajax_content() public method

public ajax_content ( )

ajax_plugins() public method

public ajax_plugins ( )

cleanFilePath() public static method

Helper function Take a path and return it clean
Since: 1.1.2
public static cleanFilePath ( string $path )
$path string

cmpr_strlen() public method

return the difference in length between two strings
public cmpr_strlen ( $a, $b )

elementor_post() public method

public elementor_post ( $post_id = false )

enqueue_scripts() public method

public enqueue_scripts ( )

envato_market_admin_init() public method

envato_market_http_request_args() public method

public envato_market_http_request_args ( $args, $url ) : mixed
$args
$url
return mixed Filter the WordPress HTTP call args. We do this to find any queries that are using an expired token from an oAuth bounce login. Since these oAuth tokens only last 1 hour we have to hit up our server again for a refresh of that token before using it on the Envato API. Hacky, but only way to do it.

envato_setup_color_style() public method

envato_setup_color_style_save() public method

Save logo & design options

envato_setup_customize() public method

envato_setup_default_content() public method

Page setup

envato_setup_default_plugins() public method

Page setup

envato_setup_help_support() public method

envato_setup_introduction() public method

Introduction step

envato_setup_introduction_save() public method

Handles save button from welcome page. This is to perform tasks when the setup wizard has already been run. E.g. reset defaults
Since: 1.2.5

envato_setup_logo_design() public method

Logo & Design

envato_setup_logo_design_save() public method

Save logo & design options

envato_setup_ready() public method

Final step
public envato_setup_ready ( )

envato_setup_updates() public method

Payments Step

envato_setup_updates_save() public method

Payments Step save

error() public method

public error ( $message )

filter_options() public method

public filter_options ( $options )

get_default_theme_style() public method

Get the default style. Can be overriden by theme init scripts.
See also: Envato_Theme_Setup_Wizard::instance()
Since: 1.1.7

get_header_logo_width() public method

Get the default style. Can be overriden by theme init scripts.
See also: Envato_Theme_Setup_Wizard::instance()
Since: 1.1.9

get_instance() public static method

Since: 1.1.3
public static get_instance ( ) : Envato_Theme_Setup_Wizard
return Envato_Theme_Setup_Wizard

get_logo_image() public method

Get the default style. Can be overriden by theme init scripts.
See also: Envato_Theme_Setup_Wizard::instance()
Since: 1.1.9
public get_logo_image ( )

get_oauth_login_url() public method

we can update the token there.
public get_oauth_login_url ( $return )

get_tgmpa_instanse() public method

Get configured TGMPA instance
Since: 1.1.2
public get_tgmpa_instanse ( )

init_actions() public method

Setup the hooks, actions and filters.
Since: 1.1.1
public init_actions ( )

init_globals() public method

Setup the class globals.
Since: 1.1.1
public init_globals ( )

init_wizard_steps() public method

Setup steps.
Since: 1.1.1
public init_wizard_steps ( ) : array
return array

is_possible_upgrade() public method

We determine if the user already has theme content installed. This can happen if swapping from a previous theme or updated the current theme. We change the UI a bit when updating / swapping to a new theme.
Since: 1.1.8
public is_possible_upgrade ( )

is_submenu_page() public method

public is_submenu_page ( )

log() public method

public log ( $message )

render_oauth_login_description_callback() public method

render_oauth_login_fields_callback() public method

set_tgmpa_url() public method

Update $tgmpa_menu_slug and $tgmpa_parent_slug from TGMPA instance
Since: 1.1.2
public set_tgmpa_url ( )

setup_wizard() public method

Show the setup wizard
public setup_wizard ( )

setup_wizard_content() public method

Output the content for the current step

setup_wizard_header() public method

Setup Wizard Header
public setup_wizard_header ( )

setup_wizard_steps() public method

Output the steps
public setup_wizard_steps ( )

switch_theme() public method

public switch_theme ( )

tgmpa_load() public method

public tgmpa_load ( $status )

upgrader_post_install() public method

After a theme update we clear the setup_complete option. This prompts the user to visit the update page again.
Since: 1.1.8
public upgrader_post_install ( $return, $theme )

vc_post() public method

public vc_post ( $post_id = false )

Property Details

$envato_username protected_oe property

Theme author username, used in check for oauth.
protected $envato_username

$errors public_oe property

public $errors

$logs public_oe property

public $logs

$oauth_script protected_oe property

Full url to server-script.php (available from https://gist.github.com/dtbaker )
protected $oauth_script

$page_parent protected_oe property

The slug name for the parent menu
Since: 1.1.2
protected string $page_parent
return string

$page_slug protected_oe property

The slug name to refer to this menu
Since: 1.1.1
protected string $page_slug
return string

$page_url protected_oe property

Complete URL to Setup Wizard
Since: 1.1.2
protected string $page_url
return string

$plugin_path protected_oe property

Relative plugin path
Since: 1.1.2
protected string $plugin_path
return string

$plugin_url protected_oe property

Relative plugin url for this plugin folder, used when enquing scripts
Since: 1.1.2
protected string $plugin_url
return string

$site_styles public_oe property

Since: 1.1.8
public $site_styles

$step protected_oe property

Current Step
protected $step

$steps protected_oe property

Steps for the setup wizard
protected $steps

$tgmpa_instance protected_oe property

TGMPA instance storage
protected object $tgmpa_instance
return object

$tgmpa_menu_slug protected_oe property

TGMPA Menu slug
protected string $tgmpa_menu_slug
return string

$tgmpa_url protected_oe property

TGMPA Menu url
protected string $tgmpa_url
return string

$theme_name protected_oe property

Current theme name, used as namespace in actions.
protected $theme_name

$version protected_oe property

The class version number.
Since: 1.1.1
protected string $version
return string