Skip to content

Commit

Permalink
Deprecating unused Lock Options classes and methods
Browse files Browse the repository at this point in the history
- WP_Auth0_Lock_Options class
- WP_Auth0_Lock10_Options::get_lock_classname()
- WP_Auth0_Lock10_Options::isPasswordlessEnable()
- WP_Auth0_Lock10_Options::get_lock_show_method()
- WP_Auth0_Lock10_Options::get_custom_css()
- WP_Auth0_Lock10_Options::get_custom_js()
- WP_Auth0_Lock10_Options::can_show()
- WP_Auth0_Lock10_Options::get_cdn_url()
- WP_Auth0_Lock10_Options::get_wordpress_login_enabled()
- WP_Auth0_Lock10_Options::set_#_mode()
- WP_Auth0_Lock10_Options::modal_button_name()
- WP_Auth0_Lock10_Options::get_custom_#_fields()
- WP_Auth0_Lock10_Options::has_custom_#_fields()
  • Loading branch information
joshcanhelp committed Apr 26, 2018
1 parent 2621683 commit 16bbd1d
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 4 deletions.
88 changes: 85 additions & 3 deletions lib/WP_Auth0_Lock10_Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,40 @@ public function __construct( $extended_settings = array() ) {
$this->extended_settings = $extended_settings;
}

// TODO: Deprecate - class name is set in a specific template
/**
* @deprecated 3.6.0 - Not used, determined in wp-content/plugins/auth0/assets/js/lock-init.js
*
* @return string
*/
public function get_lock_classname() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
if ( $this->_get_boolean( $this->wp_options->get( 'passwordless_enabled' ) ) ) {
return 'Auth0LockPasswordless';
} else {
return 'Auth0Lock';
}
}

// TODO: Deprecate - specific templates choose passwordless or not
/**
* @deprecated 3.6.0 - Not used
*
* @return bool
*/
public function isPasswordlessEnable() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
return $this->_get_boolean( $this->wp_options->get( 'passwordless_enabled' ) );
}

// TODO: Deprecate - passwordless_method is no longer a valid way to load passwordless
/**
* @deprecated 3.6.0 - Not used, invalid way to display Passwordless in new library
*
* @return string
*/
public function get_lock_show_method() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
return 'show';
}

Expand All @@ -49,15 +67,36 @@ public function get_sso() {
return $this->_get_boolean( $this->wp_options->get( 'sso' ) );
}

/**
* @deprecated 3.6.0 - Not used, use WP_Auth0_Options::Instance->get( 'custom_css' ) instead
*
* @return string
*/
public function get_custom_css() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
return $this->wp_options->get( 'custom_css' );
}

/**
* @deprecated 3.6.0 - Not used, use WP_Auth0_Options::Instance->get( 'custom_js' ) instead
*
* @return string
*/
public function get_custom_js() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
return $this->wp_options->get( 'custom_js' );
}

/**
* @deprecated 3.6.0 - Not used, call WP_Auth0::ready() instead
*
* @return string
*/
public function can_show() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
return WP_Auth0::ready();
}

Expand All @@ -69,19 +108,40 @@ public function get_domain() {
return $this->wp_options->get( 'domain' );
}

/**
* @deprecated 3.6.0 - Not used, use WP_Auth0_Options::Instance->get( 'cdn_url' ) instead
*
* @return string
*/
public function get_cdn_url() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
return $this->wp_options->get( 'cdn_url' );
}

/**
* @deprecated 3.6.0 - Not used, use (bool) WP_Auth0_Options::Instance->get( 'wordpress_login_enabled' ) instead
*
* @return string
*/
public function get_wordpress_login_enabled() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
return $this->_get_boolean( $this->wp_options->get( 'wordpress_login_enabled' ) );
}

public function get_auth0_implicit_workflow() {
return $this->_get_boolean( $this->wp_options->get( 'auth0_implicit_workflow' ) );
}

/**
* @deprecated 3.6.0 - Not used
*
* @param bool $enabled - disallow logins?
*/
public function set_#_mode( $enabled ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
$this->#_mode = $enabled;
}

Expand All @@ -93,7 +153,14 @@ public function show_as_modal() {
return isset( $this->extended_settings['show_as_modal'] ) && $this->extended_settings['show_as_modal'];
}

/**
* @deprecated 3.6.0 - Not used
*
* @return mixed|string
*/
public function modal_button_name() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
$name = 'Login';
if ( isset( $this->extended_settings['modal_trigger_name'] ) && $this->extended_settings['modal_trigger_name'] != '' ) {
$name = $this->extended_settings['modal_trigger_name'];
Expand Down Expand Up @@ -183,7 +250,14 @@ protected function build_settings( $settings ) {
return $options_obj;
}

/**
* @deprecated 3.6.0 - Not used
*
* @return mixed|string
*/
public function get_custom_#_fields() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
$fields = $this->wp_options->get('custom_#_fields');

if (trim($fields) === '') {
Expand All @@ -192,7 +266,15 @@ public function get_custom_#_fields() {

return $fields;
}

/**
* @deprecated 3.6.0 - Not used
*
* @return mixed|string
*/
public function has_custom_#_fields() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
return $this->wp_options->get('custom_#_fields');
}

Expand Down
16 changes: 15 additions & 1 deletion lib/WP_Auth0_Lock_Options.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
<?php
// TODO: Deprecate - previously used for passwordless

/**
* Class WP_Auth0_Lock_Options.
*
* @deprecated 3.6.0 - Outdated, use WP_Auth0_Lock10_Options
*/
class WP_Auth0_Lock_Options {

protected $wp_options;
protected $extended_settings;

protected $#_mode = false;

/**
* WP_Auth0_Lock_Options constructor.
*
* @deprecated 3.6.0 - Outdated, use WP_Auth0_Lock10_Options
*
* @param array $extended_settings
*/
public function __construct( $extended_settings = array() ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Class %s is deprecated.', 'wp-auth0' ), __CLASS__ ), E_USER_DEPRECATED );
$this->wp_options = WP_Auth0_Options::Instance();
$this->extended_settings = $extended_settings;
}
Expand Down

0 comments on commit 16bbd1d

Please # to comment.