refactor: clean up imports

This commit is contained in:
Ben Goldsworthy 2021-05-22 18:16:31 +01:00
parent 7135811d15
commit a6aa8e7fe2
13 changed files with 257 additions and 204 deletions

View file

@ -10,7 +10,12 @@ declare(strict_types=1);
namespace footnotes\general;
use footnotes\includes as Includes;
use footnotes\includes\{Footnotes, Convert, Settings};
use const footnotes\includes\settings\general\ReferenceContainerSettingsGroup\{
FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE,
FOOTNOTES_PAGE_LAYOUT_SUPPORT
};
/**
* Class provide all public-facing functionality of the plugin.
@ -56,7 +61,7 @@ class General {
* The footnote parser.
*
* @since 1.5.0
* @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* @since 2.8.0 Moved from {@see Footnotes} to {@see General}.
* @todo Review null init.
*
* @var Parser $task The Plugin task.
@ -67,7 +72,7 @@ class General {
* Flag for using tooltips.
*
* @since 2.4.0
* @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* @since 2.8.0 Moved from {@see Footnotes} to {@see General}.
*
* @var bool $tooltips_enabled Whether tooltips are enabled or not.
*/
@ -77,7 +82,7 @@ class General {
* Allows to determine whether alternative tooltips are enabled.
*
* @since 2.1.1
* @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* @since 2.8.0 Moved from {@see Footnotes} to {@see General}.
*
* @var bool
*/
@ -87,7 +92,7 @@ class General {
* Allows to determine whether AMP compatibility mode is enabled.
*
* @since 2.6.0
* @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* @since 2.8.0 Moved from {@see Footnotes} to {@see General}.
*
* @var bool
*/
@ -97,7 +102,7 @@ class General {
* Allows to determine the script mode among jQuery or plain JS.
*
* @since 2.5.6
* @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* @since 2.8.0 Moved from {@see Footnotes} to {@see General}.
*
* @var string js to use plain JavaScript, jquery to use jQuery.
*/
@ -118,10 +123,10 @@ class General {
$this->load_dependencies();
// Set conditions re-used for stylesheet enqueuing and in class/task.php.
self::$amp_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) );
self::$tooltips_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) );
self::$alternative_tooltips_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) );
self::$script_mode = Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE );
self::$amp_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) );
self::$tooltips_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) );
self::$alternative_tooltips_enabled = Convert::to_bool( Settings::instance()->get( Settings::FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) );
self::$script_mode = Settings::instance()->get( 'foo'/*FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE*/ );
}
/**
@ -157,7 +162,7 @@ class General {
*
* @since 1.5.0
* @since 2.5.5 Change stylesheet schema.
* @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* @since 2.8.0 Moved from {@see Footnotes} to {@see General}.
*/
public function enqueue_styles(): void {
if ( PRODUCTION_ENV ) {
@ -183,7 +188,7 @@ class General {
}
// Set basic responsive page layout mode for use in stylesheet name.
$page_layout_option = Includes\Settings::instance()->get( Includes\Settings::FOOTNOTES_PAGE_LAYOUT_SUPPORT );
$page_layout_option = Settings::instance()->get( FOOTNOTES_PAGE_LAYOUT_SUPPORT );
switch ( $page_layout_option ) {
case 'reference-container':
$layout_mode = '1';
@ -236,7 +241,7 @@ class General {
* @since 2.0.0 Add jQueryUI dependency.
* @since 2.1.2 Add jQuery Tools dependency.
* @since 2.5.6 Add jQuery dependency.
* @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* @since 2.8.0 Moved from {@see Footnotes} to {@see General}.
*/
public function enqueue_scripts(): void {
/*
@ -285,7 +290,7 @@ class General {
* Register the widget(s) for the public-facing side of the site.
*
* @since 1.5.0
* @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* @since 2.8.0 Moved from {@see Footnotes} to {@see General}.
*/
public function register_widgets(): void {
register_widget( $this->reference_container_widget );