refactor: namespace everything

This commit is contained in:
Ben Goldsworthy 2021-05-01 21:34:46 +01:00
parent 6683c0b169
commit ce41cd8353
21 changed files with 939 additions and 839 deletions

View file

@ -1,33 +1,37 @@
<?php <?php
/** /**
* Admin: Footnotes_Admin class * Admin: Admin class
* *
* The Admin. subpackage is initialised at runtime by the {@see Footnotes_Admin} * The Admin. subpackage is initialised at runtime by the {@see Admin}
* class, which draws in the {@see Footnotes_WYSIWYG} class for WYSIWYG editor * class, which draws in the {@see WYSIWYG} class for WYSIWYG editor
* integration and the {@see footnotes\admin_layout} subpackage for rendering * integration and the {@see footnotes\admin\layout} subpackage for rendering
* dashboard pages. * dashboard pages.
* *
* @package footnotes\admin * @package footnotes
* @since 2.8.0 * @since 2.8.0
*/ */
namespace footnotes\admin;
use footnotes\includes as Includes;
/** /**
* Class provide all admin-specific functionality of the plugin. * Class provide all admin-specific functionality of the plugin.
* *
* Defines the plugin name, version, and enqueues all admin-specific stylesheets * Defines the plugin name, version, and enqueues all admin-specific stylesheets
* and JavaScript. * and JavaScript.
* *
* @package footnotes\admin * @package footnotes
* @since 2.8.0 * @since 2.8.0
*/ */
class Footnotes_Admin { class Admin {
/** /**
* The ID of this plugin. * The ID of this plugin.
* *
* @access private * @access private
* @since 2.8.0 * @since 2.8.0
* @see Footnotes::$plugin_name * @see Includes\Footnotes::$plugin_name
* @var string $plugin_name The ID of this plugin. * @var string $plugin_name The ID of this plugin.
*/ */
private $plugin_name; private $plugin_name;
@ -37,7 +41,7 @@ class Footnotes_Admin {
* *
* @access private * @access private
* @since 2.8.0 * @since 2.8.0
* @see Footnotes::$version * @see Includes\Footnotes::$version
* @var string $version The current version of this plugin. * @var string $version The current version of this plugin.
*/ */
private $version; private $version;
@ -46,7 +50,7 @@ class Footnotes_Admin {
* The WYSIWYG editor integration object. * The WYSIWYG editor integration object.
* *
* @since 2.8.0 * @since 2.8.0
* @var Footnotes_WYSIWYG $wysiwyg The WYSIWYG editor integration object. * @var WYSIWYG $wysiwyg The WYSIWYG editor integration object.
*/ */
public $wysiwyg; public $wysiwyg;
@ -73,8 +77,8 @@ class Footnotes_Admin {
* Includes the following files that provide the admin-specific functionality * Includes the following files that provide the admin-specific functionality
* of this plugin: * of this plugin:
* *
* - {@see Footnotes_WYSIWYG}: Provides plugin integration with the WYSIWYG editor. * - {@see WYSIWYG}: Provides plugin integration with the WYSIWYG editor.
* - {@see Footnotes_Layout_Settings}: Defines the plugin dashboard page(s). * - {@see layout\Settings}: Defines the plugin dashboard page(s).
* *
* @access private * @access private
* *
@ -84,16 +88,16 @@ class Footnotes_Admin {
/** /**
* The class responsible for WYSIWYG editor integration. * The class responsible for WYSIWYG editor integration.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-footnotes-wysiwyg.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wysiwyg.php';
$this->wysiwyg = new Footnotes_WYSIWYG( $this->plugin_name ); $this->wysiwyg = new WYSIWYG( $this->plugin_name );
/** /**
* The class responsible for constructing the plugin dashboard page(s). * The class responsible for constructing the plugin dashboard page(s).
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/layout/class-footnotes-layout-init.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/layout/class-init.php';
new Footnotes_Layout_Init( $this->plugin_name ); new layout\Init( $this->plugin_name );
} }
/** /**
@ -140,21 +144,20 @@ class Footnotes_Admin {
/** /**
* Appends the Plugin links for display in the dashboard Plugins page. * Appends the Plugin links for display in the dashboard Plugins page.
* *
* @param string[] $links The default set of links to display. * @param string[] $plugin_links The default set of links to display.
* @return string[] The full set of links to display. * @return string[] The full set of links to display.
* *
* @since 1.5.0 * @since 1.5.0
* @since 2.8.0 Moved from `Footnotes_Hooks` class to `Footnotes_Admin`. * @since 2.8.0 Moved from `Hooks` class to `Admin`.
*/ */
public function footnotes_action_links( array $links ): array { public function action_links( array $plugin_links ): array {
// Append link to the WordPress Plugin page. // Append link to the WordPress Plugin page.
$links[] = sprintf( '<a href="https://wordpress.org/support/plugin/footnotes" target="_blank">%s</a>', __( 'Support', 'footnotes' ) ); $plugin_links[] = sprintf( '<a href="https://wordpress.org/support/plugin/footnotes" target="_blank">%s</a>', __( 'Support', 'footnotes' ) );
// Append link to the settings page. // Append link to the settings page.
$links[] = sprintf( '<a href="%s">%s</a>', esc_url( admin_url( 'options-general.php?page=footnotes' ) ), __( 'Settings', 'footnotes' ) ); $plugin_links[] = sprintf( '<a href="%s">%s</a>', esc_url( admin_url( 'options-general.php?page=footnotes' ) ), __( 'Settings', 'footnotes' ) );
// Append link to the PayPal donate function. // Append link to the PayPal donate function.
$links[] = sprintf( '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6Z6CZDW8PPBBJ" target="_blank">%s</a>', __( 'Donate', 'footnotes' ) ); $plugin_links[] = sprintf( '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6Z6CZDW8PPBBJ" target="_blank">%s</a>', __( 'Donate', 'footnotes' ) );
return $plugin_links;
return $links;
} }
} }

View file

@ -1,25 +1,29 @@
<?php <?php
/** /**
* Admin: Footnotes_WYSIWYG class * Admin: WYSIWYG class
* *
* The Admin. subpackage is initialised at runtime by the {@see Footnotes_Admin} * The Admin. subpackage is initialised at runtime by the {@see Admin}
* class, which draws in the {@see Footnotes_WYSIWYG} class for WYSIWYG editor * class, which draws in the {@see WYSIWYG} class for WYSIWYG editor
* integration and the {@see footnotes\admin_layout} subpackage for rendering * integration and the {@see footnotes\admin_layout} subpackage for rendering
* dashboard pages. * dashboard pages.
* *
* @package footnotes\admin * @package footnotes
* @since 1.5.0 * @since 1.5.0
* @since 2.8.0 Rename file from `wysiwyg.php` to `class-footnotes-wysiwyg.php`, * @since 2.8.0 Rename file from `wysiwyg.php` to `class-footnotes-wysiwyg.php`,
* move from `class/` sub-directory to `admin/`. * move from `class/` sub-directory to `admin/`.
*/ */
namespace footnotes\admin;
use footnotes\includes as Includes;
/** /**
* Class providing WYSIWYG editor intergration for the plugin. * Class providing WYSIWYG editor intergration for the plugin.
* *
* @package footnotes\admin * @package footnotes
* @since 1.5.0 * @since 1.5.0
*/ */
class Footnotes_WYSIWYG { class WYSIWYG {
/** /**
* The ID of this plugin. * The ID of this plugin.
@ -64,7 +68,7 @@ class Footnotes_WYSIWYG {
* @since 1.5.0 * @since 1.5.0
*/ */
public static function new_plain_text_editor_button() { public static function new_plain_text_editor_button() {
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'editor-button' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'editor-button' );
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo $l_obj_template->get_content(); echo $l_obj_template->get_content();
// phpcs:enable // phpcs:enable
@ -92,11 +96,11 @@ class Footnotes_WYSIWYG {
*/ */
public static function ajax_callback() { public static function ajax_callback() {
// Get start and end tag for the footnotes short code. // Get start and end tag for the footnotes short code.
$l_str_starting_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START ); $l_str_starting_tag = Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START );
$l_str_ending_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END ); $l_str_ending_tag = Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END );
if ( 'userdefined' === $l_str_starting_tag || 'userdefined' === $l_str_ending_tag ) { if ( 'userdefined' === $l_str_starting_tag || 'userdefined' === $l_str_ending_tag ) {
$l_str_starting_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); $l_str_starting_tag = Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED );
$l_str_ending_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); $l_str_ending_tag = Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED );
} }
echo wp_json_encode( echo wp_json_encode(
array( array(

View file

@ -1,29 +1,32 @@
<?php // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.EscapeOutput.OutputNotEscaped <?php // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.EscapeOutput.OutputNotEscaped
/** /**
* Admin. Layouts: Footnotes_Layout_Engine class * Admin. Layouts: Engine class
* *
* The Admin. Layouts subpackage is composed of the {@see Footnotes_Layout_Engine} * The Admin. Layouts subpackage is composed of the {@see Engine}
* abstract class, which is extended by the {@see Footnotes_Layout_Settings} * abstract class, which is extended by the {@see Settings}
* sub-class. The subpackage is initialised at runtime by the {@see * sub-class. The subpackage is initialised at runtime by the {@see
* Footnotes_Layout_Init} class. * Init} class.
* *
* @package footnotes\admin_layout * @package footnotes
* @since 1.5.0 * @since 1.5.0
* @since 2.8.0 Rename file from `layout.php` to `class-footnotes-layout-engine.php`, * @since 2.8.0 Rename file from `layout.php` to `class-footnotes-layout-engine.php`,
* rename `dashboard/` sub-directory to `layout/`. * rename `dashboard/` sub-directory to `layout/`.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'layout/class-footnotes-layout-init.php'; namespace footnotes\admin\layout;
use footnotes\includes as Includes;
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'layout/class-init.php';
/** /**
* Class to be extended by page layout sub-classes. * Class to be extended by page layout sub-classes.
* *
* @abstract * @abstract
*
* @package footnotes\admin_layout * @package footnotes
* @since 1.5.0 * @since 1.5.0
*/ */
abstract class Footnotes_Layout_Engine { abstract class Engine {
/** /**
* The ID of this plugin. * The ID of this plugin.
@ -177,20 +180,20 @@ abstract class Footnotes_Layout_Engine {
public function register_sub_page() { public function register_sub_page() {
global $submenu; global $submenu;
if ( array_key_exists( plugin_basename( Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG ), $submenu ) ) { if ( array_key_exists( plugin_basename( Init::C_STR_MAIN_MENU_SLUG ), $submenu ) ) {
foreach ( $submenu[ plugin_basename( Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG ) ] as $l_arr_sub_menu ) { foreach ( $submenu[ plugin_basename( Init::C_STR_MAIN_MENU_SLUG ) ] as $l_arr_sub_menu ) {
if ( plugin_basename( Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() ) === $l_arr_sub_menu[2] ) { if ( plugin_basename( Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() ) === $l_arr_sub_menu[2] ) {
remove_submenu_page( Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() ); remove_submenu_page( Init::C_STR_MAIN_MENU_SLUG, Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() );
} }
} }
} }
$this->a_str_sub_page_hook = add_submenu_page( $this->a_str_sub_page_hook = add_submenu_page(
Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, Init::C_STR_MAIN_MENU_SLUG,
$this->get_sub_page_title(), $this->get_sub_page_title(),
$this->get_sub_page_title(), $this->get_sub_page_title(),
'manage_options', 'manage_options',
Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug(), Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug(),
array( $this, 'display_content' ) array( $this, 'display_content' )
); );
} }
@ -244,7 +247,7 @@ abstract class Footnotes_Layout_Engine {
* @access private * @access private
* *
* @since 1.5.0 * @since 1.5.0
* @todo Move to {@see Footnotes_Admin}. * @todo Move to {@see Includes\Admin}.
*/ */
private function append_scripts() { private function append_scripts() {
wp_enqueue_script( 'postbox' ); wp_enqueue_script( 'postbox' );
@ -286,7 +289,7 @@ abstract class Footnotes_Layout_Engine {
echo sprintf( echo sprintf(
'<a class="nav-tab%s" href="?page=%s&t=%s">%s</a>', '<a class="nav-tab%s" href="?page=%s&t=%s">%s</a>',
( $l_str_id === $l_arr_active_section['id'] ) ? ' nav-tab-active' : '', ( $l_str_id === $l_arr_active_section['id'] ) ? ' nav-tab-active' : '',
Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, Init::C_STR_MAIN_MENU_SLUG,
$l_str_id, $l_str_id,
$l_arr_description['title'] $l_arr_description['title']
); );
@ -342,7 +345,7 @@ abstract class Footnotes_Layout_Engine {
$l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $this->a_arr_sections ); $l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $this->a_arr_sections );
$l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ]; $l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ];
foreach ( Footnotes_Settings::instance()->get_defaults( $l_arr_active_section['container'] ) as $l_str_key => $l_mixed_value ) { foreach ( Includes\Settings::instance()->get_defaults( $l_arr_active_section['container'] ) as $l_str_key => $l_mixed_value ) {
if ( array_key_exists( $l_str_key, $_POST ) ) { if ( array_key_exists( $l_str_key, $_POST ) ) {
$l_arr_new_settings[ $l_str_key ] = wp_unslash( $_POST[ $l_str_key ] ); $l_arr_new_settings[ $l_str_key ] = wp_unslash( $_POST[ $l_str_key ] );
} else { } else {
@ -351,7 +354,7 @@ abstract class Footnotes_Layout_Engine {
} }
} }
// Update settings. // Update settings.
return Footnotes_Settings::instance()->save_options( $l_arr_active_section['container'], $l_arr_new_settings ); return Includes\Settings::instance()->save_options( $l_arr_active_section['container'], $l_arr_new_settings );
} }
// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
@ -388,7 +391,7 @@ abstract class Footnotes_Layout_Engine {
$p_arr_return = array(); $p_arr_return = array();
$p_arr_return['id'] = sprintf( '%s', $p_str_setting_key_name ); $p_arr_return['id'] = sprintf( '%s', $p_str_setting_key_name );
$p_arr_return['name'] = sprintf( '%s', $p_str_setting_key_name ); $p_arr_return['name'] = sprintf( '%s', $p_str_setting_key_name );
$p_arr_return['value'] = esc_attr( Footnotes_Settings::instance()->get( $p_str_setting_key_name ) ); $p_arr_return['value'] = esc_attr( Includes\Settings::instance()->get( $p_str_setting_key_name ) );
return $p_arr_return; return $p_arr_return;
} }
@ -484,7 +487,7 @@ abstract class Footnotes_Layout_Engine {
'<input type="checkbox" name="%s" id="%s" %s/>', '<input type="checkbox" name="%s" id="%s" %s/>',
$l_arr_data['name'], $l_arr_data['name'],
$l_arr_data['id'], $l_arr_data['id'],
Footnotes_Convert::to_bool( $l_arr_data['value'] ) ? 'checked="checked"' : '' Includes\Convert::to_bool( $l_arr_data['value'] ) ? 'checked="checked"' : ''
); );
} }

View file

@ -1,25 +1,28 @@
<?php // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized <?php // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
/** /**
* Admin. Layouts: Footnotes_Layout_Init class * Admin. Layouts: Init class
* *
* The Admin. Layouts subpackage is composed of the {@see Footnotes_Layout_Engine} * The Admin. Layouts subpackage is composed of the {@see Engine}
* abstract class, which is extended by the {@see Footnotes_Layout_Settings} * abstract class, which is extended by the {@see Settings}
* sub-class. The subpackage is initialised at runtime by the {@see * sub-class. The subpackage is initialised at runtime by the {@see
* Footnotes_Layout_Init} class. * Init} class.
* *
* @package footnotes\admin_layout * @package footnotes
* @since 1.5.0 * @since 1.5.0
* @since 2.8.0 Rename file from `init.php` to `class-footnotes-layout-init.php`, * @since 2.8.0 Rename file from `init.php` to `class-footnotes-layout-init.php`,
* rename `dashboard/` sub-directory to `layout/`. * rename `dashboard/` sub-directory to `layout/`.
*/ */
namespace footnotes\admin\layout;
use footnotes\includes as Includes;
/** /**
* Class to initialise all defined page layouts. * Class to initialise all defined page layouts.
* *
* @package footnotes\admin_layout * @package footnotes
* @since 1.5.0 * @since 1.5.0
*/ */
class Footnotes_Layout_Init { class Init {
/** /**
* The ID of this plugin. * The ID of this plugin.
@ -43,7 +46,7 @@ class Footnotes_Layout_Init {
/** /**
* Contains the settings page. * Contains the settings page.
* *
* @var Footnotes_Layout_Settings * @var Settings
* *
* @since 1.5.0 * @since 1.5.0
*/ */
@ -62,7 +65,7 @@ class Footnotes_Layout_Init {
$this->load_dependencies(); $this->load_dependencies();
$this->settings_page = new Footnotes_Layout_Settings( $this->plugin_name ); $this->settings_page = new Settings( $this->plugin_name );
// Register hooks/actions. // Register hooks/actions.
add_action( 'admin_menu', array( $this, 'register_options_submenu' ) ); add_action( 'admin_menu', array( $this, 'register_options_submenu' ) );
@ -77,9 +80,9 @@ class Footnotes_Layout_Init {
* *
* Include the following files that make up the plugin: * Include the following files that make up the plugin:
* *
* - {@see Footnotes_Config}: defines plugin constants; * - {@see Includes\Config}: defines plugin constants;
* - {@see Footnotes_Settings}: defines configurable plugin settings; and * - {@see Includes\Settings}: defines configurable plugin settings; and
* - {@see Footnotes_Layout_Settings}: defines the plugin settings page. * - {@see Settings}: defines the plugin settings page.
* *
* @access private * @access private
* *
@ -89,17 +92,17 @@ class Footnotes_Layout_Init {
/** /**
* Defines plugin constants. * Defines plugin constants.
*/ */
require_once plugin_dir_path( dirname( __FILE__, 2 ) ) . 'includes/class-footnotes-config.php'; require_once plugin_dir_path( dirname( __FILE__, 2 ) ) . 'includes/class-config.php';
/** /**
* Defines configurable plugin settings. * Defines configurable plugin settings.
*/ */
require_once plugin_dir_path( dirname( __FILE__, 2 ) ) . 'includes/class-footnotes-settings.php'; require_once plugin_dir_path( dirname( __FILE__, 2 ) ) . 'includes/class-settings.php';
/** /**
* Represents the plugin settings dashboard page. * Represents the plugin settings dashboard page.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'layout/class-footnotes-layout-settings.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'layout/class-settings.php';
} }
/** /**
@ -108,7 +111,7 @@ class Footnotes_Layout_Init {
* @since 1.5.0 * @since 1.5.0
*/ */
public function initialize_settings() { public function initialize_settings() {
Footnotes_Settings::instance()->register_settings(); Includes\Settings::instance()->register_settings();
$this->settings_page->register_sections(); $this->settings_page->register_sections();
} }
@ -122,7 +125,7 @@ class Footnotes_Layout_Init {
add_submenu_page( add_submenu_page(
'options-general.php', 'options-general.php',
'footnotes Settings', 'footnotes Settings',
Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, Includes\Config::C_STR_PLUGIN_PUBLIC_NAME,
'manage_options', 'manage_options',
self::C_STR_MAIN_MENU_SLUG, self::C_STR_MAIN_MENU_SLUG,
array( $this->settings_page, 'display_content' ) array( $this->settings_page, 'display_content' )

View file

@ -1,11 +1,11 @@
<?php // phpcs:disable Squiz.Commenting.FileComment.Missing <?php // phpcs:disable Squiz.Commenting.FileComment.Missing
/** /**
* Admin. Layouts: Footnotes_Layout_Settings class * Admin. Layouts: Settings class
* *
* The Admin. Layouts subpackage is composed of the {@see Footnotes_Layout_Engine} * The Admin. Layouts subpackage is composed of the {@see Engine}
* abstract class, which is extended by the {@see Footnotes_Layout_Settings} * abstract class, which is extended by the {@see Settings}
* sub-class. The subpackage is initialised at runtime by the {@see * sub-class. The subpackage is initialised at runtime by the {@see
* Footnotes_Layout_Init} class. * Init} class.
* *
* @package footnotes\admin_layout * @package footnotes\admin_layout
* @since 1.5.0 * @since 1.5.0
@ -13,20 +13,23 @@
* rename `dashboard/` sub-directory to `layout/`. * rename `dashboard/` sub-directory to `layout/`.
*/ */
namespace footnotes\admin\layout;
use footnotes\includes as Includes;
/** /**
* Provides the abstract class to be extended for page layouts. * Provides the abstract class to be extended for page layouts.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'layout/class-footnotes-layout-engine.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'layout/class-engine.php';
/** /**
* Class to initialise all defined page layouts. * Class to initialise all defined page layouts.
* *
* @package footnotes
* @since 1.5.0 * @since 1.5.0
* @package footnotes\admin_layout
* *
* @see Footnotes_Layout_Engine * @see Engine
*/ */
class Footnotes_Layout_Settings extends Footnotes_Layout_Engine { class Settings extends Engine {
/** /**
* Initialize the class and set its properties. * Initialize the class and set its properties.
@ -67,13 +70,13 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
* @return string * @return string
*/ */
protected function get_sub_page_title() { protected function get_sub_page_title() {
return Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME; return Includes\Config::C_STR_PLUGIN_PUBLIC_NAME;
} }
/** /**
* Returns an array of all registered sections for the sub-page. * Returns an array of all registered sections for the sub-page.
* *
* @see Footnotes_Layout_Engine::add_section() For more information on the * @see Engine::add_section() For more information on the
* section array format. * section array format.
* @return array[] All of the registered sections. * @return array[] All of the registered sections.
* *
@ -99,7 +102,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
/** /**
* Returns an array of all registered meta boxes for each section of the sub-page. * Returns an array of all registered meta boxes for each section of the sub-page.
* *
* @see Footnotes_Layout_Engine::add_meta_box() For more information on the * @see Engine::add_meta_box() For more information on the
* meta box array format. * meta box array format.
* @return array[] All of the registered meta boxes. * @return array[] All of the registered meta boxes.
* *
@ -116,7 +119,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
$l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'hard-links', __( 'URL fragment ID configuration', 'footnotes' ), 'hard_links' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'hard-links', __( 'URL fragment ID configuration', 'footnotes' ), 'hard_links' );
$l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'reference-container', __( 'Reference container', 'footnotes' ), 'reference_container' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'reference-container', __( 'Reference container', 'footnotes' ), 'reference_container' );
$l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'excerpts', __( 'Footnotes in excerpts', 'footnotes' ), 'excerpts' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'excerpts', __( 'Footnotes in excerpts', 'footnotes' ), 'excerpts' );
$l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'love', Footnotes_Config::C_STR_PLUGIN_HEADING_NAME . '&nbsp;' . Footnotes_Config::C_STR_LOVE_SYMBOL_HEADING, 'love' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'settings', 'love', Includes\Config::C_STR_PLUGIN_HEADING_NAME . '&nbsp;' . Includes\Config::C_STR_LOVE_SYMBOL_HEADING, 'love' );
$l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'hyperlink-arrow', __( 'Backlink symbol', 'footnotes' ), 'hyperlink_arrow' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'hyperlink-arrow', __( 'Backlink symbol', 'footnotes' ), 'hyperlink_arrow' );
$l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'superscript', __( 'Referrers', 'footnotes' ), 'superscript' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'superscript', __( 'Referrers', 'footnotes' ), 'superscript' );
@ -128,13 +131,13 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
$l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-truncation', __( 'Tooltip truncation', 'footnotes' ), 'mouseover_box_truncation' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-truncation', __( 'Tooltip truncation', 'footnotes' ), 'mouseover_box_truncation' );
$l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-text', __( 'Tooltip text', 'footnotes' ), 'mouseover_box_text' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-text', __( 'Tooltip text', 'footnotes' ), 'mouseover_box_text' );
$l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-appearance', __( 'Tooltip appearance', 'footnotes' ), 'mouseover_box_appearance' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'mouse-over-box-appearance', __( 'Tooltip appearance', 'footnotes' ), 'mouseover_box_appearance' );
if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE ) ) ) { if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE ) ) ) {
$l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'custom-css', __( 'Your existing Custom CSS code', 'footnotes' ), 'custom_css' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'customize', 'custom-css', __( 'Your existing Custom CSS code', 'footnotes' ), 'custom_css' );
} }
$l_arr_meta_boxes[] = $this->add_meta_box( 'expert', 'lookup', __( 'WordPress hooks with priority level', 'footnotes' ), 'lookup_hooks' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'expert', 'lookup', __( 'WordPress hooks with priority level', 'footnotes' ), 'lookup_hooks' );
if ( Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE ) ) ) { if ( Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE ) ) ) {
$l_arr_meta_boxes[] = $this->add_meta_box( 'customcss', 'custom-css-migration', __( 'Your existing Custom CSS code', 'footnotes' ), 'custom_css_migration' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'customcss', 'custom-css-migration', __( 'Your existing Custom CSS code', 'footnotes' ), 'custom_css_migration' );
} }
$l_arr_meta_boxes[] = $this->add_meta_box( 'customcss', 'custom-css-new', __( 'Custom CSS', 'footnotes' ), 'custom_css_new' ); $l_arr_meta_boxes[] = $this->add_meta_box( 'customcss', 'custom-css-new', __( 'Custom CSS', 'footnotes' ), 'custom_css_new' );
@ -153,17 +156,17 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
public function amp_compat() { public function amp_compat() {
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'settings-amp' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'settings-amp' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
// Translators: '%s' is the link text 'AMP-WP' linked to the plugin's front page on WordPress.org. // Translators: '%s' is the link text 'AMP-WP' linked to the plugin's front page on WordPress.org.
'description-1-amp' => sprintf( __( 'The official %s plugin is required when this option is enabled.', 'footnotes' ), '<a href="https://wordpress.org/plugins/amp/" target="_blank" style="font-style: normal;">AMP-WP</a>' ), 'description-1-amp' => sprintf( __( 'The official %s plugin is required when this option is enabled.', 'footnotes' ), '<a href="https://wordpress.org/plugins/amp/" target="_blank" style="font-style: normal;">AMP-WP</a>' ),
'label-amp' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE, __( 'Enable AMP compatibility mode:', 'footnotes' ) ), 'label-amp' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE, __( 'Enable AMP compatibility mode:', 'footnotes' ) ),
'amp' => $this->add_checkbox( Footnotes_Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE ), 'amp' => $this->add_checkbox( Includes\Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE ),
'notice-amp' => __( 'This option enables hard links with configurable scroll offset in % viewport height.', 'footnotes' ), 'notice-amp' => __( 'This option enables hard links with configurable scroll offset in % viewport height.', 'footnotes' ),
// Translators: '%s' is the logogram of the 'Footnotes' plugin. // Translators: '%s' is the logogram of the 'Footnotes' plugin.
'description-2-amp' => sprintf( __( '%s is becoming AMP compatible when this box is checked. Styled tooltips are displayed with fade-in/fade-out effect if enabled, and the reference container expands also on clicking a referrer if it\'s collapsed by default.', 'footnotes' ), '<span style="font-style: normal;">' . Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ), 'description-2-amp' => sprintf( __( '%s is becoming AMP compatible when this box is checked. Styled tooltips are displayed with fade-in/fade-out effect if enabled, and the reference container expands also on clicking a referrer if it\'s collapsed by default.', 'footnotes' ), '<span style="font-style: normal;">' . Includes\Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
) )
); );
// Display template with replaced placeholders. // Display template with replaced placeholders.
@ -241,102 +244,102 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'settings-reference-container' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'settings-reference-container' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-name' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME, __( 'Heading:', 'footnotes' ) ), 'label-name' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_NAME, __( 'Heading:', 'footnotes' ) ),
'name' => $this->add_text_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME ), 'name' => $this->add_text_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_NAME ),
'label-element' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, __( 'Heading\'s HTML element:', 'footnotes' ) ), 'label-element' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, __( 'Heading\'s HTML element:', 'footnotes' ) ),
'element' => $this->add_select_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, $l_arr_label_element ), 'element' => $this->add_select_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, $l_arr_label_element ),
'label-border' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, __( 'Border under the heading:', 'footnotes' ) ), 'label-border' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, __( 'Border under the heading:', 'footnotes' ) ),
'border' => $this->add_select_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, $l_arr_enabled ), 'border' => $this->add_select_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, $l_arr_enabled ),
'label-collapse' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE, __( 'Collapse by default:', 'footnotes' ) ), 'label-collapse' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE, __( 'Collapse by default:', 'footnotes' ) ),
'collapse' => $this->add_select_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE, $l_arr_enabled ), 'collapse' => $this->add_select_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE, $l_arr_enabled ),
'label-script' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, __( 'Script mode:', 'footnotes' ) ), 'label-script' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, __( 'Script mode:', 'footnotes' ) ),
'script' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, $l_arr_script_mode ), 'script' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, $l_arr_script_mode ),
'notice-script' => __( 'The plain JavaScript mode will enable hard links with configurable scroll offset.', 'footnotes' ), 'notice-script' => __( 'The plain JavaScript mode will enable hard links with configurable scroll offset.', 'footnotes' ),
'label-position' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __( 'Default position:', 'footnotes' ) ), 'label-position' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION, __( 'Default position:', 'footnotes' ) ),
'position' => $this->add_select_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_positions ), 'position' => $this->add_select_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_positions ),
// Translators: %s: at the end of the post. // Translators: %s: at the end of the post.
'notice-position' => sprintf( __( 'To use the position or section shortcode, please set the position to: %s', 'footnotes' ), '<span style="font-style: normal;">' . __( 'at the end of the post', 'footnotes' ) . '</span>' ), 'notice-position' => sprintf( __( 'To use the position or section shortcode, please set the position to: %s', 'footnotes' ), '<span style="font-style: normal;">' . __( 'at the end of the post', 'footnotes' ) . '</span>' ),
'label-shortcode' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE, __( 'Position shortcode:', 'footnotes' ) ), 'label-shortcode' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE, __( 'Position shortcode:', 'footnotes' ) ),
'shortcode' => $this->add_text_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE ), 'shortcode' => $this->add_text_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE ),
'notice-shortcode' => __( 'If present in the content, any shortcode in this text box will be replaced with the reference container.', 'footnotes' ), 'notice-shortcode' => __( 'If present in the content, any shortcode in this text box will be replaced with the reference container.', 'footnotes' ),
'label-section' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE, __( 'Footnote section shortcode:', 'footnotes' ) ), 'label-section' => $this->add_label( Includes\Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE, __( 'Footnote section shortcode:', 'footnotes' ) ),
'section' => $this->add_text_box( Footnotes_Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE ), 'section' => $this->add_text_box( Includes\Settings::C_STR_FOOTNOTE_SECTION_SHORTCODE ),
'notice-section' => __( 'If present in the content, any shortcode in this text box will delimit a section terminated by a reference container.', 'footnotes' ), 'notice-section' => __( 'If present in the content, any shortcode in this text box will delimit a section terminated by a reference container.', 'footnotes' ),
'label-startpage' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, __( 'Display on start page too:', 'footnotes' ) ), 'label-startpage' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, __( 'Display on start page too:', 'footnotes' ) ),
'startpage' => $this->add_select_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_enabled ), 'startpage' => $this->add_select_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_enabled ),
'label-margin-top' => $this->add_label( Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, __( 'Top margin:', 'footnotes' ) ), 'label-margin-top' => $this->add_label( Includes\Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, __( 'Top margin:', 'footnotes' ) ),
'margin-top' => $this->add_num_box( Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, -500, 500 ), 'margin-top' => $this->add_num_box( Includes\Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, -500, 500 ),
'notice-margin-top' => __( 'pixels; may be negative', 'footnotes' ), 'notice-margin-top' => __( 'pixels; may be negative', 'footnotes' ),
'label-margin-bottom' => $this->add_label( Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, __( 'Bottom margin:', 'footnotes' ) ), 'label-margin-bottom' => $this->add_label( Includes\Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, __( 'Bottom margin:', 'footnotes' ) ),
'margin-bottom' => $this->add_num_box( Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, -500, 500 ), 'margin-bottom' => $this->add_num_box( Includes\Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, -500, 500 ),
'notice-margin-bottom' => __( 'pixels; may be negative', 'footnotes' ), 'notice-margin-bottom' => __( 'pixels; may be negative', 'footnotes' ),
'label-page-layout' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, __( 'Apply basic responsive page layout:', 'footnotes' ) ), 'label-page-layout' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, __( 'Apply basic responsive page layout:', 'footnotes' ) ),
'page-layout' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, $l_arr_page_layout_options ), 'page-layout' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, $l_arr_page_layout_options ),
'notice-page-layout' => __( 'Most themes don\'t need this fix.', 'footnotes' ), 'notice-page-layout' => __( 'Most themes don\'t need this fix.', 'footnotes' ),
'label-url-wrap' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED, __( 'Allow URLs to line-wrap anywhere:', 'footnotes' ) ), 'label-url-wrap' => $this->add_label( Includes\Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED, __( 'Allow URLs to line-wrap anywhere:', 'footnotes' ) ),
'url-wrap' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED, $l_arr_enabled ), 'url-wrap' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED, $l_arr_enabled ),
'notice-url-wrap' => __( 'Unicode-conformant browsers don\'t need this fix.', 'footnotes' ), 'notice-url-wrap' => __( 'Unicode-conformant browsers don\'t need this fix.', 'footnotes' ),
'label-symbol' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __( 'Display a backlink symbol:', 'footnotes' ) ), 'label-symbol' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __( 'Display a backlink symbol:', 'footnotes' ) ),
'symbol-enable' => $this->add_select_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_enabled ), 'symbol-enable' => $this->add_select_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_enabled ),
'notice-symbol' => __( 'Please choose or input the symbol at the top of the next dashboard tab.', 'footnotes' ), 'notice-symbol' => __( 'Please choose or input the symbol at the top of the next dashboard tab.', 'footnotes' ),
'label-switch' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __( 'Symbol appended, not prepended:', 'footnotes' ) ), 'label-switch' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __( 'Symbol appended, not prepended:', 'footnotes' ) ),
'switch' => $this->add_select_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $l_arr_enabled ), 'switch' => $this->add_select_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $l_arr_enabled ),
'label-3column' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __( 'Backlink symbol in an extra column:', 'footnotes' ) ), 'label-3column' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __( 'Backlink symbol in an extra column:', 'footnotes' ) ),
'3column' => $this->add_select_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $l_arr_enabled ), '3column' => $this->add_select_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $l_arr_enabled ),
'notice-3column' => __( 'This legacy layout is available if identical footnotes are not combined.', 'footnotes' ), 'notice-3column' => __( 'This legacy layout is available if identical footnotes are not combined.', 'footnotes' ),
'label-row-borders' => $this->add_label( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, __( 'Borders around the table rows:', 'footnotes' ) ), 'label-row-borders' => $this->add_label( Includes\Settings::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, __( 'Borders around the table rows:', 'footnotes' ) ),
'row-borders' => $this->add_select_box( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, $l_arr_enabled ), 'row-borders' => $this->add_select_box( Includes\Settings::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, $l_arr_enabled ),
'label-separator' => $this->add_label( Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED, __( 'Add a separator when enumerating backlinks:', 'footnotes' ) ), 'label-separator' => $this->add_label( Includes\Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED, __( 'Add a separator when enumerating backlinks:', 'footnotes' ) ),
'separator-enable' => $this->add_select_box( Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED, $l_arr_enabled ), 'separator-enable' => $this->add_select_box( Includes\Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED, $l_arr_enabled ),
'separator-options' => $this->add_select_box( Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION, $l_arr_separators ), 'separator-options' => $this->add_select_box( Includes\Settings::C_STR_BACKLINKS_SEPARATOR_OPTION, $l_arr_separators ),
'separator-custom' => $this->add_text_box( Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM ), 'separator-custom' => $this->add_text_box( Includes\Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM ),
'notice-separator' => __( 'Your input overrides the selection.', 'footnotes' ), 'notice-separator' => __( 'Your input overrides the selection.', 'footnotes' ),
'label-terminator' => $this->add_label( Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED, __( 'Add a terminal punctuation to backlinks:', 'footnotes' ) ), 'label-terminator' => $this->add_label( Includes\Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED, __( 'Add a terminal punctuation to backlinks:', 'footnotes' ) ),
'terminator-enable' => $this->add_select_box( Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED, $l_arr_enabled ), 'terminator-enable' => $this->add_select_box( Includes\Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED, $l_arr_enabled ),
'terminator-options' => $this->add_select_box( Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION, $l_arr_terminators ), 'terminator-options' => $this->add_select_box( Includes\Settings::C_STR_BACKLINKS_TERMINATOR_OPTION, $l_arr_terminators ),
'terminator-custom' => $this->add_text_box( Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM ), 'terminator-custom' => $this->add_text_box( Includes\Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM ),
'notice-terminator' => __( 'Your input overrides the selection.', 'footnotes' ), 'notice-terminator' => __( 'Your input overrides the selection.', 'footnotes' ),
'label-width' => $this->add_label( Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED, __( 'Set backlinks column width:', 'footnotes' ) ), 'label-width' => $this->add_label( Includes\Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED, __( 'Set backlinks column width:', 'footnotes' ) ),
'width-enable' => $this->add_select_box( Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED, $l_arr_enabled ), 'width-enable' => $this->add_select_box( Includes\Settings::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED, $l_arr_enabled ),
'width-scalar' => $this->add_num_box( Footnotes_Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR, 0, 500, true ), 'width-scalar' => $this->add_num_box( Includes\Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR, 0, 500, true ),
'width-unit' => $this->add_select_box( Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT, $l_arr_width_units ), 'width-unit' => $this->add_select_box( Includes\Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT, $l_arr_width_units ),
'notice-width' => __( 'Absolute width in pixels doesn\'t need to be accurate to the tenth, but relative width in rem or em may.', 'footnotes' ), 'notice-width' => __( 'Absolute width in pixels doesn\'t need to be accurate to the tenth, but relative width in rem or em may.', 'footnotes' ),
'label-max-width' => $this->add_label( Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, __( 'Set backlinks column maximum width:', 'footnotes' ) ), 'label-max-width' => $this->add_label( Includes\Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, __( 'Set backlinks column maximum width:', 'footnotes' ) ),
'max-width-enable' => $this->add_select_box( Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, $l_arr_enabled ), 'max-width-enable' => $this->add_select_box( Includes\Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, $l_arr_enabled ),
'max-width-scalar' => $this->add_num_box( Footnotes_Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, 0, 500, true ), 'max-width-scalar' => $this->add_num_box( Includes\Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, 0, 500, true ),
'max-width-unit' => $this->add_select_box( Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT, $l_arr_width_units ), 'max-width-unit' => $this->add_select_box( Includes\Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT, $l_arr_width_units ),
'notice-max-width' => __( 'Absolute width in pixels doesn\'t need to be accurate to the tenth, but relative width in rem or em may.', 'footnotes' ), 'notice-max-width' => __( 'Absolute width in pixels doesn\'t need to be accurate to the tenth, but relative width in rem or em may.', 'footnotes' ),
'label-line-break' => $this->add_label( Footnotes_Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED, __( 'Stack backlinks when enumerating:', 'footnotes' ) ), 'label-line-break' => $this->add_label( Includes\Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED, __( 'Stack backlinks when enumerating:', 'footnotes' ) ),
'line-break' => $this->add_select_box( Footnotes_Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED, $l_arr_enabled ), 'line-break' => $this->add_select_box( Includes\Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED, $l_arr_enabled ),
'notice-line-break' => __( 'This option adds a line break before each added backlink when identical footnotes are combined.', 'footnotes' ), 'notice-line-break' => __( 'This option adds a line break before each added backlink when identical footnotes are combined.', 'footnotes' ),
'label-link' => $this->add_label( Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ), 'label-link' => $this->add_label( Includes\Settings::C_STR_LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ),
'link' => $this->add_select_box( Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED, $l_arr_enabled ), 'link' => $this->add_select_box( Includes\Settings::C_STR_LINK_ELEMENT_ENABLED, $l_arr_enabled ),
'notice-link' => __( 'The link element is needed to apply the theme\'s link color.', 'footnotes' ), 'notice-link' => __( 'The link element is needed to apply the theme\'s link color.', 'footnotes' ),
'description-link' => __( 'If the link element is not desired for styling, a simple span is used instead when the above is set to No.', 'footnotes' ), 'description-link' => __( 'If the link element is not desired for styling, a simple span is used instead when the above is set to No.', 'footnotes' ),
) )
@ -388,31 +391,31 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'settings-start-end' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'settings-start-end' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'description-escapement' => __( 'When delimiters with pointy brackets are used, the diverging escapement schemas will be unified before footnotes are processed.', 'footnotes' ), 'description-escapement' => __( 'When delimiters with pointy brackets are used, the diverging escapement schemas will be unified before footnotes are processed.', 'footnotes' ),
'label-short-code-start' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ), 'label-short-code-start' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ),
'short-code-start' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_shortcode_start ), 'short-code-start' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_shortcode_start ),
'short-code-start-user' => $this->add_text_box( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ), 'short-code-start-user' => $this->add_text_box( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ),
'label-short-code-end' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, __( 'Footnote end tag short code:', 'footnotes' ) ), 'label-short-code-end' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END, __( 'Footnote end tag short code:', 'footnotes' ) ),
'short-code-end' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, $l_arr_shortcode_end ), 'short-code-end' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END, $l_arr_shortcode_end ),
'short-code-end-user' => $this->add_text_box( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ), 'short-code-end-user' => $this->add_text_box( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ),
// For script showing/hiding user defined text boxes. // For script showing/hiding user defined text boxes.
'short-code-start-id' => Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, 'short-code-start-id' => Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START,
'short-code-end-id' => Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, 'short-code-end-id' => Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END,
'short-code-start-user-id' => Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, 'short-code-start-user-id' => Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED,
'short-code-end-user-id' => Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED, 'short-code-end-user-id' => Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED,
'description-parentheses' => __( 'WARNING: Although widespread industry standard, the double parentheses are problematic because they may occur in scripts embedded in the content and be mistaken as a short code.', 'footnotes' ), 'description-parentheses' => __( 'WARNING: Although widespread industry standard, the double parentheses are problematic because they may occur in scripts embedded in the content and be mistaken as a short code.', 'footnotes' ),
// Option to enable syntax validation, label mirrored in task.php. // Option to enable syntax validation, label mirrored in task.php.
'label-syntax' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __( 'Check for balanced shortcodes:', 'footnotes' ) ), 'label-syntax' => $this->add_label( Includes\Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __( 'Check for balanced shortcodes:', 'footnotes' ) ),
'syntax' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $l_arr_enable ), 'syntax' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $l_arr_enable ),
'notice-syntax' => __( 'In the presence of a lone start tag shortcode, a warning displays below the post title.', 'footnotes' ), 'notice-syntax' => __( 'In the presence of a lone start tag shortcode, a warning displays below the post title.', 'footnotes' ),
'description-syntax' => __( 'If the start tag short code is \'((\' or \'(((\', it will not be reported as unbalanced if the following string contains braces hinting that it is a script.', 'footnotes' ), 'description-syntax' => __( 'If the start tag short code is \'((\' or \'(((\', it will not be reported as unbalanced if the following string contains braces hinting that it is a script.', 'footnotes' ),
@ -448,16 +451,16 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'settings-numbering' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'settings-numbering' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-counter-style' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __( 'Numbering style:', 'footnotes' ) ), 'label-counter-style' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __( 'Numbering style:', 'footnotes' ) ),
'counter-style' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_counter_style ), 'counter-style' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_counter_style ),
// Algorithmically combine identicals. // Algorithmically combine identicals.
'label-identical' => $this->add_label( Footnotes_Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES, __( 'Combine identical footnotes:', 'footnotes' ) ), 'label-identical' => $this->add_label( Includes\Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES, __( 'Combine identical footnotes:', 'footnotes' ) ),
'identical' => $this->add_select_box( Footnotes_Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_enable ), 'identical' => $this->add_select_box( Includes\Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_enable ),
'notice-identical' => __( 'This option may require copy-pasting footnotes in multiple instances.', 'footnotes' ), 'notice-identical' => __( 'This option may require copy-pasting footnotes in multiple instances.', 'footnotes' ),
// Support for Ibid. notation added thanks to @meglio in <https://wordpress.org/support/topic/add-support-for-ibid-notation/>. // Support for Ibid. notation added thanks to @meglio in <https://wordpress.org/support/topic/add-support-for-ibid-notation/>.
'description-identical' => __( 'Even when footnotes are combined, footnote numbers keep incrementing. This avoids suboptimal referrer and backlink disambiguation using a secondary numbering system. The Ibid. notation and the op. cit. abbreviation followed by the current page number avoid repeating the footnote content. For changing sources, shortened citations may be used. Repeating full citations is also an opportunity to add details.', 'footnotes' ), 'description-identical' => __( 'Even when footnotes are combined, footnote numbers keep incrementing. This avoids suboptimal referrer and backlink disambiguation using a secondary numbering system. The Ibid. notation and the op. cit. abbreviation followed by the current page number avoid repeating the footnote content. For changing sources, shortened citations may be used. Repeating full citations is also an opportunity to add details.', 'footnotes' ),
@ -483,38 +486,38 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'settings-scrolling' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'settings-scrolling' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-scroll-css' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, __( 'CSS-based smooth scrolling:', 'footnotes' ) ), 'label-scroll-css' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, __( 'CSS-based smooth scrolling:', 'footnotes' ) ),
'scroll-css' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, $l_arr_enable ), 'scroll-css' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, $l_arr_enable ),
'notice-scroll-css' => __( 'May slightly disturb jQuery scrolling and is therefore disabled by default. Works in recent browsers.', 'footnotes' ), 'notice-scroll-css' => __( 'May slightly disturb jQuery scrolling and is therefore disabled by default. Works in recent browsers.', 'footnotes' ),
'label-scroll-offset' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, __( 'Scroll offset:', 'footnotes' ) ), 'label-scroll-offset' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, __( 'Scroll offset:', 'footnotes' ) ),
'scroll-offset' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, 0, 100 ), 'scroll-offset' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, 0, 100 ),
'notice-scroll-offset' => __( 'per cent viewport height from the upper edge', 'footnotes' ), 'notice-scroll-offset' => __( 'per cent viewport height from the upper edge', 'footnotes' ),
'label-scroll-duration' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, __( 'Scroll duration:', 'footnotes' ) ), 'label-scroll-duration' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_SCROLL_DURATION, __( 'Scroll duration:', 'footnotes' ) ),
'scroll-duration' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, 0, 20000 ), 'scroll-duration' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_SCROLL_DURATION, 0, 20000 ),
'notice-scroll-duration' => __( 'milliseconds. If asymmetric scroll durations are enabled, this is the scroll-up duration.', 'footnotes' ), 'notice-scroll-duration' => __( 'milliseconds. If asymmetric scroll durations are enabled, this is the scroll-up duration.', 'footnotes' ),
// Enable scroll duration asymmetricity. // Enable scroll duration asymmetricity.
'label-scroll-asymmetricity' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, __( 'Enable asymmetric scroll durations:', 'footnotes' ) ), 'label-scroll-asymmetricity' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, __( 'Enable asymmetric scroll durations:', 'footnotes' ) ),
'scroll-asymmetricity' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, $l_arr_enable ), 'scroll-asymmetricity' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, $l_arr_enable ),
'notice-scroll-asymmetricity' => __( 'With this option enabled, scrolling up may take longer than down, or conversely.', 'footnotes' ), 'notice-scroll-asymmetricity' => __( 'With this option enabled, scrolling up may take longer than down, or conversely.', 'footnotes' ),
'label-scroll-down-duration' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, __( 'Scroll-down duration:', 'footnotes' ) ), 'label-scroll-down-duration' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, __( 'Scroll-down duration:', 'footnotes' ) ),
'scroll-down-duration' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, 0, 20000 ), 'scroll-down-duration' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, 0, 20000 ),
'notice-scroll-down-duration' => __( 'milliseconds', 'footnotes' ), 'notice-scroll-down-duration' => __( 'milliseconds', 'footnotes' ),
'label-scroll-down-delay' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, __( 'Scroll-down delay:', 'footnotes' ) ), 'label-scroll-down-delay' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, __( 'Scroll-down delay:', 'footnotes' ) ),
'scroll-down-delay' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, 0, 20000 ), 'scroll-down-delay' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, 0, 20000 ),
'notice-scroll-down-delay' => __( 'milliseconds. Useful to see the effect on input elements when referrers without hard links are clicked in form labels.', 'footnotes' ), 'notice-scroll-down-delay' => __( 'milliseconds. Useful to see the effect on input elements when referrers without hard links are clicked in form labels.', 'footnotes' ),
'label-scroll-up-delay' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, __( 'Scroll-up delay:', 'footnotes' ) ), 'label-scroll-up-delay' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, __( 'Scroll-up delay:', 'footnotes' ) ),
'scroll-up-delay' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, 0, 20000 ), 'scroll-up-delay' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, 0, 20000 ),
'notice-scroll-up-delay' => __( 'milliseconds. Less useful than the scroll-down delay.', 'footnotes' ), 'notice-scroll-up-delay' => __( 'milliseconds. Less useful than the scroll-down delay.', 'footnotes' ),
) )
@ -539,34 +542,34 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'settings-hard-links' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'settings-hard-links' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-hard-links' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_HARD_LINKS_ENABLE, __( 'Enable hard links:', 'footnotes' ) ), 'label-hard-links' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_HARD_LINKS_ENABLE, __( 'Enable hard links:', 'footnotes' ) ),
'hard-links' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_HARD_LINKS_ENABLE, $l_arr_enable ), 'hard-links' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_HARD_LINKS_ENABLE, $l_arr_enable ),
'notice-hard-links' => __( 'Hard links disable jQuery delays but have the same scroll offset, and allow to share footnotes (accessed if the list is not collapsed by default).', 'footnotes' ), 'notice-hard-links' => __( 'Hard links disable jQuery delays but have the same scroll offset, and allow to share footnotes (accessed if the list is not collapsed by default).', 'footnotes' ),
'label-footnote' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnotes:', 'footnotes' ) ), 'label-footnote' => $this->add_label( Includes\Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnotes:', 'footnotes' ) ),
'footnote' => $this->add_text_box( Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG ), 'footnote' => $this->add_text_box( Includes\Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG ),
'notice-footnote' => __( 'This will show up in the address bar after clicking on a hard-linked footnote referrer.', 'footnotes' ), 'notice-footnote' => __( 'This will show up in the address bar after clicking on a hard-linked footnote referrer.', 'footnotes' ),
'label-referrer' => $this->add_label( Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnote referrers:', 'footnotes' ) ), 'label-referrer' => $this->add_label( Includes\Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG, __( 'Fragment identifier slug for footnote referrers:', 'footnotes' ) ),
'referrer' => $this->add_text_box( Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG ), 'referrer' => $this->add_text_box( Includes\Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG ),
'notice-referrer' => __( 'This will show up in the address bar after clicking on a hard-linked backlink.', 'footnotes' ), 'notice-referrer' => __( 'This will show up in the address bar after clicking on a hard-linked backlink.', 'footnotes' ),
'label-separator' => $this->add_label( Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR, __( 'ID separator:', 'footnotes' ) ), 'label-separator' => $this->add_label( Includes\Settings::C_STR_HARD_LINK_IDS_SEPARATOR, __( 'ID separator:', 'footnotes' ) ),
'separator' => $this->add_text_box( Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR ), 'separator' => $this->add_text_box( Includes\Settings::C_STR_HARD_LINK_IDS_SEPARATOR ),
'notice-separator' => __( 'May be empty or any string, for example _, - or +, to distinguish post number, container number and footnote number.', 'footnotes' ), 'notice-separator' => __( 'May be empty or any string, for example _, - or +, to distinguish post number, container number and footnote number.', 'footnotes' ),
// Enable backlink tooltips. // Enable backlink tooltips.
'label-backlink-tooltips' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __( 'Enable backlink tooltips:', 'footnotes' ) ), 'label-backlink-tooltips' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __( 'Enable backlink tooltips:', 'footnotes' ) ),
'backlink-tooltips' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, $l_arr_enable ), 'backlink-tooltips' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, $l_arr_enable ),
'notice-backlink-tooltips' => __( 'Hard backlinks get ordinary tooltips hinting to use the backbutton instead to keep it usable.', 'footnotes' ), 'notice-backlink-tooltips' => __( 'Hard backlinks get ordinary tooltips hinting to use the backbutton instead to keep it usable.', 'footnotes' ),
'label-backlink-tooltip-text' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __( 'Backlink tooltip text:', 'footnotes' ) ), 'label-backlink-tooltip-text' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __( 'Backlink tooltip text:', 'footnotes' ) ),
'backlink-tooltip-text' => $this->add_text_box( Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT ), 'backlink-tooltip-text' => $this->add_text_box( Includes\Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT ),
'notice-backlink-tooltip-text' => __( 'Default text is the keyboard shortcut; may be a localized descriptive hint.', 'footnotes' ), 'notice-backlink-tooltip-text' => __( 'Default text is the keyboard shortcut; may be a localized descriptive hint.', 'footnotes' ),
) )
@ -586,35 +589,35 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
// Options for the acknowledgment display in the footer. // Options for the acknowledgment display in the footer.
$l_arr_love = array( $l_arr_love = array(
// Logo only. // Logo only.
'text-3' => sprintf( '%s', Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ), 'text-3' => sprintf( '%s', Includes\Config::C_STR_PLUGIN_PUBLIC_NAME ),
// Logo followed by heart symbol. // Logo followed by heart symbol.
'text-4' => sprintf( '%s %s', Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, Footnotes_Config::C_STR_LOVE_SYMBOL ), 'text-4' => sprintf( '%s %s', Includes\Config::C_STR_PLUGIN_PUBLIC_NAME, Includes\Config::C_STR_LOVE_SYMBOL ),
// Logo preceded by heart symbol. // Logo preceded by heart symbol.
'text-5' => sprintf( '%s %s', Footnotes_Config::C_STR_LOVE_SYMBOL, Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ), 'text-5' => sprintf( '%s %s', Includes\Config::C_STR_LOVE_SYMBOL, Includes\Config::C_STR_PLUGIN_PUBLIC_NAME ),
// Translators: 2: heart symbol 1: footnotes logogram. // Translators: 2: heart symbol 1: footnotes logogram.
'text-1' => sprintf( __( 'I %2$s %1$s', 'footnotes' ), Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, Footnotes_Config::C_STR_LOVE_SYMBOL ), 'text-1' => sprintf( __( 'I %2$s %1$s', 'footnotes' ), Includes\Config::C_STR_PLUGIN_PUBLIC_NAME, Includes\Config::C_STR_LOVE_SYMBOL ),
// Translators: %s: Footnotes plugin logo. // Translators: %s: Footnotes plugin logo.
'text-6' => sprintf( __( 'This website uses %s.', 'footnotes' ), Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ), 'text-6' => sprintf( __( 'This website uses %s.', 'footnotes' ), Includes\Config::C_STR_PLUGIN_PUBLIC_NAME ),
// Translators: %s: Footnotes plugin logo. // Translators: %s: Footnotes plugin logo.
'text-7' => sprintf( __( 'This website uses the %s plugin.', 'footnotes' ), Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ), 'text-7' => sprintf( __( 'This website uses the %s plugin.', 'footnotes' ), Includes\Config::C_STR_PLUGIN_PUBLIC_NAME ),
// Translators: %s: Footnotes plugin logo. // Translators: %s: Footnotes plugin logo.
'text-2' => sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ), 'text-2' => sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), Includes\Config::C_STR_PLUGIN_PUBLIC_NAME ),
'random' => __( 'randomly determined display of either mention', 'footnotes' ), 'random' => __( 'randomly determined display of either mention', 'footnotes' ),
// Translators: 1: Plugin logo.2: heart symbol. // Translators: 1: Plugin logo.2: heart symbol.
'no' => sprintf( __( 'no display of any "%1$s %2$s" mention in the footer', 'footnotes' ), Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, Footnotes_Config::C_STR_LOVE_SYMBOL ), 'no' => sprintf( __( 'no display of any "%1$s %2$s" mention in the footer', 'footnotes' ), Includes\Config::C_STR_PLUGIN_PUBLIC_NAME, Includes\Config::C_STR_LOVE_SYMBOL ),
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'settings-love' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'settings-love' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
// Translators: %s: Footnotes plugin logo. // Translators: %s: Footnotes plugin logo.
'label-love' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf( __( 'Tell the world you\'re using %s:', 'footnotes' ), Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ) ), 'label-love' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_LOVE, sprintf( __( 'Tell the world you\'re using %s:', 'footnotes' ), Includes\Config::C_STR_PLUGIN_PUBLIC_NAME ) ),
'love' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_LOVE, $l_arr_love ), 'love' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_LOVE, $l_arr_love ),
// Translators: %s: Footnotes plugin logo. // Translators: %s: Footnotes plugin logo.
'label-no-love' => $this->add_text( sprintf( __( 'Shortcode to inhibit the display of the %s mention on specific pages:', 'footnotes' ), Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME ) ), 'label-no-love' => $this->add_text( sprintf( __( 'Shortcode to inhibit the display of the %s mention on specific pages:', 'footnotes' ), Includes\Config::C_STR_PLUGIN_PUBLIC_NAME ) ),
'no-love' => $this->add_text( Footnotes_Config::C_STR_NO_LOVE_SLUG ), 'no-love' => $this->add_text( Includes\Config::C_STR_NO_LOVE_SLUG ),
) )
); );
// Display template with replaced placeholders. // Display template with replaced placeholders.
@ -637,16 +640,16 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'settings-excerpts' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'settings-excerpts' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-excerpts' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT, __( 'Process footnotes in excerpts:', 'footnotes' ) ), 'label-excerpts' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_IN_EXCERPT, __( 'Process footnotes in excerpts:', 'footnotes' ) ),
'excerpts' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT, $l_arr_excerpt_mode ), 'excerpts' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_IN_EXCERPT, $l_arr_excerpt_mode ),
'notice-excerpts' => __( 'If the_excerpt is enabled.', 'footnotes' ), 'notice-excerpts' => __( 'If the_excerpt is enabled.', 'footnotes' ),
// Translators: %s: link text 'Advanced Excerpt' linked to the plugin\'s WordPress.org front page. // Translators: %s: link text 'Advanced Excerpt' linked to the plugin\'s WordPress.org front page.
// Translators: %s: Footnotes plugin logo. // Translators: %s: Footnotes plugin logo.
'description-excerpts' => sprintf( __( 'To not display footnotes in excerpts, the %s plugin generates excerpts on the basis of the posts to be able to remove the footnotes. Else, footnotes may be processed in manual excerpts OR processed based on the posts. — For this setting to be effective, the hook the_excerpt must be enabled under Scope and priority.', 'footnotes' ), '<span style="font-style: normal;">' . Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ), 'description-excerpts' => sprintf( __( 'To not display footnotes in excerpts, the %s plugin generates excerpts on the basis of the posts to be able to remove the footnotes. Else, footnotes may be processed in manual excerpts OR processed based on the posts. — For this setting to be effective, the hook the_excerpt must be enabled under Scope and priority.', 'footnotes' ), '<span style="font-style: normal;">' . Includes\Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
) )
); );
// Display template with replaced placeholders. // Display template with replaced placeholders.
@ -673,24 +676,24 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
'all' => __( 'All superscript elements', 'footnotes' ), 'all' => __( 'All superscript elements', 'footnotes' ),
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'customize-superscript' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'customize-superscript' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-superscript' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __( 'Display footnote referrers in superscript:', 'footnotes' ) ), 'label-superscript' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __( 'Display footnote referrers in superscript:', 'footnotes' ) ),
'superscript' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $l_arr_enabled ), 'superscript' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $l_arr_enabled ),
'label-normalize' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, __( 'Normalize vertical alignment and font size:', 'footnotes' ) ), 'label-normalize' => $this->add_label( Includes\Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, __( 'Normalize vertical alignment and font size:', 'footnotes' ) ),
'normalize' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, $l_arr_normalize_superscript ), 'normalize' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, $l_arr_normalize_superscript ),
'notice-normalize' => __( 'Most themes don\'t need this fix.', 'footnotes' ), 'notice-normalize' => __( 'Most themes don\'t need this fix.', 'footnotes' ),
'label-before' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __( 'At the start of the footnote referrers:', 'footnotes' ) ), 'label-before' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __( 'At the start of the footnote referrers:', 'footnotes' ) ),
'before' => $this->add_text_box( Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE ), 'before' => $this->add_text_box( Includes\Settings::C_STR_FOOTNOTES_STYLING_BEFORE ),
'label-after' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER, __( 'At the end of the footnote referrers:', 'footnotes' ) ), 'label-after' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_STYLING_AFTER, __( 'At the end of the footnote referrers:', 'footnotes' ) ),
'after' => $this->add_text_box( Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER ), 'after' => $this->add_text_box( Includes\Settings::C_STR_FOOTNOTES_STYLING_AFTER ),
'label-link' => $this->add_label( Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ), 'label-link' => $this->add_label( Includes\Settings::C_STR_LINK_ELEMENT_ENABLED, __( 'Use the link element for referrers and backlinks:', 'footnotes' ) ),
'notice-link' => __( 'Please find this setting at the end of the reference container settings. The link element is needed to apply the theme\'s link color.', 'footnotes' ), 'notice-link' => __( 'Please find this setting at the end of the reference container settings. The link element is needed to apply the theme\'s link color.', 'footnotes' ),
) )
); );
@ -713,13 +716,13 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
'disconnect' => __( 'B. Labels with footnotes are disconnected from input element (discouraged)', 'footnotes' ), 'disconnect' => __( 'B. Labels with footnotes are disconnected from input element (discouraged)', 'footnotes' ),
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'configure-label-solution' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'configure-label-solution' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'description-1-selection' => __( 'Clicking a footnote referrer in an input element label toggles the input except when hard links are enabled. In jQuery mode, the recommended solution is to move footnotes and append them after the label (option A).', 'footnotes' ), 'description-1-selection' => __( 'Clicking a footnote referrer in an input element label toggles the input except when hard links are enabled. In jQuery mode, the recommended solution is to move footnotes and append them after the label (option A).', 'footnotes' ),
'label-selection' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION, __( 'Solve input label issue:', 'footnotes' ) ), 'label-selection' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION, __( 'Solve input label issue:', 'footnotes' ) ),
'selection' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION, $l_arr_issue_solutions ), 'selection' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_LABEL_ISSUE_SOLUTION, $l_arr_issue_solutions ),
'description-2-selection' => __( 'Option B is discouraged because disconnecting a label from its input element may compromise accessibility. This option is a last resort in case footnotes must absolutely stay inside the label. (Using jQuery \'event.stopPropagation\' failed.)', 'footnotes' ), 'description-2-selection' => __( 'Option B is discouraged because disconnecting a label from its input element may compromise accessibility. This option is a last resort in case footnotes must absolutely stay inside the label. (Using jQuery \'event.stopPropagation\' failed.)', 'footnotes' ),
) )
); );
@ -742,20 +745,20 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-display' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'mouse-over-box-display' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-enable' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __( 'Display tooltips:', 'footnotes' ) ), 'label-enable' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __( 'Display tooltips:', 'footnotes' ) ),
'enable' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_enabled ), 'enable' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_enabled ),
'notice-enable' => __( 'Formatted text boxes allowing hyperlinks, displayed on mouse-over or tap and hold.', 'footnotes' ), 'notice-enable' => __( 'Formatted text boxes allowing hyperlinks, displayed on mouse-over or tap and hold.', 'footnotes' ),
'label-alternative' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __( 'Display alternative tooltips:', 'footnotes' ) ), 'label-alternative' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __( 'Display alternative tooltips:', 'footnotes' ) ),
'alternative' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_enabled ), 'alternative' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_enabled ),
'notice-alternative' => __( 'Intended to work around a configuration-related tooltip outage.', 'footnotes' ), 'notice-alternative' => __( 'Intended to work around a configuration-related tooltip outage.', 'footnotes' ),
// Translators: %s: Footnotes plugin logo. // Translators: %s: Footnotes plugin logo.
'description-alternative' => sprintf( __( 'These alternative tooltips work around a website related jQuery UI outage. They are low-script but use the AMP incompatible onmouseover and onmouseout arguments, along with CSS transitions for fade-in/out. The very small script is inserted after Footnotes\' internal stylesheet. When this option is enabled, %s does not load jQuery&nbsp;UI nor jQuery&nbsp;Tools.', 'footnotes' ), '<span style="font-style: normal;">' . Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ), 'description-alternative' => sprintf( __( 'These alternative tooltips work around a website related jQuery UI outage. They are low-script but use the AMP incompatible onmouseover and onmouseout arguments, along with CSS transitions for fade-in/out. The very small script is inserted after Footnotes\' internal stylesheet. When this option is enabled, %s does not load jQuery&nbsp;UI nor jQuery&nbsp;Tools.', 'footnotes' ), '<span style="font-style: normal;">' . Includes\Config::C_STR_PLUGIN_PUBLIC_NAME . '</span>' ),
) )
); );
@ -792,24 +795,24 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-position' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'mouse-over-box-position' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-position' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __( 'Position:', 'footnotes' ) ), 'label-position' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __( 'Position:', 'footnotes' ) ),
'position' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_position ), 'position' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_position ),
'position-alternative' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION, $l_arr_alternative_position ), 'position-alternative' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION, $l_arr_alternative_position ),
'notice-position' => __( 'The second column of settings boxes is for the alternative tooltips.', 'footnotes' ), 'notice-position' => __( 'The second column of settings boxes is for the alternative tooltips.', 'footnotes' ),
'label-offset-x' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __( 'Horizontal offset:', 'footnotes' ) ), 'label-offset-x' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __( 'Horizontal offset:', 'footnotes' ) ),
'offset-x' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ), 'offset-x' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ),
'offset-x-alternative' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ), 'offset-x-alternative' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X, -500, 500 ),
'notice-offset-x' => __( 'pixels; negative value for a leftwards offset; alternative tooltips: direction depends on position', 'footnotes' ), 'notice-offset-x' => __( 'pixels; negative value for a leftwards offset; alternative tooltips: direction depends on position', 'footnotes' ),
'label-offset-y' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __( 'Vertical offset:', 'footnotes' ) ), 'label-offset-y' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __( 'Vertical offset:', 'footnotes' ) ),
'offset-y' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ), 'offset-y' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ),
'offset-y-alternative' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ), 'offset-y-alternative' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y, -500, 500 ),
'notice-offset-y' => __( 'pixels; negative value for an upwards offset; alternative tooltips: direction depends on position', 'footnotes' ), 'notice-offset-y' => __( 'pixels; negative value for an upwards offset; alternative tooltips: direction depends on position', 'footnotes' ),
) )
@ -828,14 +831,14 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
public function mouseover_box_dimensions() { public function mouseover_box_dimensions() {
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-dimensions' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'mouse-over-box-dimensions' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-max-width' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __( 'Maximum width:', 'footnotes' ) ), 'label-max-width' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __( 'Maximum width:', 'footnotes' ) ),
'max-width' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280 ), 'max-width' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280 ),
'width' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH, 0, 1280 ), 'width' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH, 0, 1280 ),
'notice-max-width' => __( 'pixels; set to 0 for jQuery tooltips without max width; alternative tooltips are given the value in the second box as fixed width.', 'footnotes' ), 'notice-max-width' => __( 'pixels; set to 0 for jQuery tooltips without max width; alternative tooltips are given the value in the second box as fixed width.', 'footnotes' ),
) )
@ -854,25 +857,25 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
public function mouseover_box_timing() { public function mouseover_box_timing() {
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-timing' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'mouse-over-box-timing' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-fade-in-delay' => $this->add_label( Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, __( 'Fade-in delay:', 'footnotes' ) ), 'label-fade-in-delay' => $this->add_label( Includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, __( 'Fade-in delay:', 'footnotes' ) ),
'fade-in-delay' => $this->add_num_box( Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, 0, 20000 ), 'fade-in-delay' => $this->add_num_box( Includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, 0, 20000 ),
'notice-fade-in-delay' => __( 'milliseconds', 'footnotes' ), 'notice-fade-in-delay' => __( 'milliseconds', 'footnotes' ),
'label-fade-in-duration' => $this->add_label( Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, __( 'Fade-in duration:', 'footnotes' ) ), 'label-fade-in-duration' => $this->add_label( Includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, __( 'Fade-in duration:', 'footnotes' ) ),
'fade-in-duration' => $this->add_num_box( Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, 0, 20000 ), 'fade-in-duration' => $this->add_num_box( Includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, 0, 20000 ),
'notice-fade-in-duration' => __( 'milliseconds', 'footnotes' ), 'notice-fade-in-duration' => __( 'milliseconds', 'footnotes' ),
'label-fade-out-delay' => $this->add_label( Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, __( 'Fade-out delay:', 'footnotes' ) ), 'label-fade-out-delay' => $this->add_label( Includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, __( 'Fade-out delay:', 'footnotes' ) ),
'fade-out-delay' => $this->add_num_box( Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, 0, 20000 ), 'fade-out-delay' => $this->add_num_box( Includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, 0, 20000 ),
'notice-fade-out-delay' => __( 'milliseconds', 'footnotes' ), 'notice-fade-out-delay' => __( 'milliseconds', 'footnotes' ),
'label-fade-out-duration' => $this->add_label( Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, __( 'Fade-out duration:', 'footnotes' ) ), 'label-fade-out-duration' => $this->add_label( Includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, __( 'Fade-out duration:', 'footnotes' ) ),
'fade-out-duration' => $this->add_num_box( Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, 0, 20000 ), 'fade-out-duration' => $this->add_num_box( Includes\Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, 0, 20000 ),
'notice-fade-out-duration' => __( 'milliseconds', 'footnotes' ), 'notice-fade-out-duration' => __( 'milliseconds', 'footnotes' ),
) )
@ -896,21 +899,21 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-truncation' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'mouse-over-box-truncation' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-truncation' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __( 'Truncate the note in the tooltip:', 'footnotes' ) ), 'label-truncation' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __( 'Truncate the note in the tooltip:', 'footnotes' ) ),
'truncation' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_enabled ), 'truncation' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_enabled ),
'label-max-length' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __( 'Maximum number of characters in the tooltip:', 'footnotes' ) ), 'label-max-length' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __( 'Maximum number of characters in the tooltip:', 'footnotes' ) ),
'max-length' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, 3, 10000 ), 'max-length' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, 3, 10000 ),
// The feature trims back until the last full word. // The feature trims back until the last full word.
'notice-max-length' => __( 'No weird cuts.', 'footnotes' ), 'notice-max-length' => __( 'No weird cuts.', 'footnotes' ),
'label-readon' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __( '\'Read on\' button label:', 'footnotes' ) ), 'label-readon' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __( '\'Read on\' button label:', 'footnotes' ) ),
'readon' => $this->add_text_box( Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL ), 'readon' => $this->add_text_box( Includes\Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL ),
) )
); );
@ -933,23 +936,23 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-text' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'mouse-over-box-text' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'description-delimiter' => __( 'Tooltips can display another content than the footnote entry in the reference container. The trigger is a shortcode in the footnote text separating the tooltip text from the note. That is consistent with what WordPress does for excerpts.', 'footnotes' ), 'description-delimiter' => __( 'Tooltips can display another content than the footnote entry in the reference container. The trigger is a shortcode in the footnote text separating the tooltip text from the note. That is consistent with what WordPress does for excerpts.', 'footnotes' ),
'label-delimiter' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER, __( 'Delimiter for dedicated tooltip text:', 'footnotes' ) ), 'label-delimiter' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER, __( 'Delimiter for dedicated tooltip text:', 'footnotes' ) ),
'delimiter' => $this->add_text_box( Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER ), 'delimiter' => $this->add_text_box( Includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER ),
'notice-delimiter' => __( 'If the delimiter shortcode is present, the tooltip text will be the part before it.', 'footnotes' ), 'notice-delimiter' => __( 'If the delimiter shortcode is present, the tooltip text will be the part before it.', 'footnotes' ),
'label-mirror' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, __( 'Mirror the tooltip in the reference container:', 'footnotes' ) ), 'label-mirror' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, __( 'Mirror the tooltip in the reference container:', 'footnotes' ) ),
'mirror' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, $l_arr_enabled ), 'mirror' => $this->add_select_box( Includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, $l_arr_enabled ),
'notice-mirror' => __( 'Tooltips may be harder to use on mobiles. This option allows to read it in the reference container.', 'footnotes' ), 'notice-mirror' => __( 'Tooltips may be harder to use on mobiles. This option allows to read it in the reference container.', 'footnotes' ),
'label-separator' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR, __( 'Separator between tooltip text and footnote text:', 'footnotes' ) ), 'label-separator' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR, __( 'Separator between tooltip text and footnote text:', 'footnotes' ) ),
'separator' => $this->add_text_box( Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ), 'separator' => $this->add_text_box( Includes\Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ),
'notice-separator' => __( 'May be a simple space, or a line break &lt;br /&gt;, or any string in your language.', 'footnotes' ), 'notice-separator' => __( 'May be a simple space, or a line break &lt;br /&gt;, or any string in your language.', 'footnotes' ),
'description-mirror' => __( 'Tooltips, even jQuery-driven, may be hard to consult on mobiles. This option allows to read the tooltip content in the reference container too.', 'footnotes' ), 'description-mirror' => __( 'Tooltips, even jQuery-driven, may be hard to consult on mobiles. This option allows to read the tooltip content in the reference container too.', 'footnotes' ),
@ -985,42 +988,42 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'mouse-over-box-appearance' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'mouse-over-box-appearance' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-font-size' => $this->add_label( Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, __( 'Set font size:', 'footnotes' ) ), 'label-font-size' => $this->add_label( Includes\Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, __( 'Set font size:', 'footnotes' ) ),
'font-size-enable' => $this->add_select_box( Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $l_arr_enabled ), 'font-size-enable' => $this->add_select_box( Includes\Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $l_arr_enabled ),
'font-size-scalar' => $this->add_num_box( Footnotes_Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR, 0, 50, true ), 'font-size-scalar' => $this->add_num_box( Includes\Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR, 0, 50, true ),
'font-size-unit' => $this->add_select_box( Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT, $l_arr_font_size_units ), 'font-size-unit' => $this->add_select_box( Includes\Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT, $l_arr_font_size_units ),
'notice-font-size' => __( 'By default, the font size is set to equal the surrounding text.', 'footnotes' ), 'notice-font-size' => __( 'By default, the font size is set to equal the surrounding text.', 'footnotes' ),
'label-color' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __( 'Text color:', 'footnotes' ) ), 'label-color' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __( 'Text color:', 'footnotes' ) ),
'color' => $this->add_color_selection( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR ), 'color' => $this->add_color_selection( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR ),
// Translators: %s: Clear or leave empty. // Translators: %s: Clear or leave empty.
'notice-color' => sprintf( __( 'To use the current theme\'s default text color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ), 'notice-color' => sprintf( __( 'To use the current theme\'s default text color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ),
'label-background' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __( 'Background color:', 'footnotes' ) ), 'label-background' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __( 'Background color:', 'footnotes' ) ),
'background' => $this->add_color_selection( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ), 'background' => $this->add_color_selection( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ),
// Translators: %s: Clear or leave empty. // Translators: %s: Clear or leave empty.
'notice-background' => sprintf( __( 'To use the current theme\'s default background color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ), 'notice-background' => sprintf( __( 'To use the current theme\'s default background color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ),
'label-border-width' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __( 'Border width:', 'footnotes' ) ), 'label-border-width' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __( 'Border width:', 'footnotes' ) ),
'border-width' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true ), 'border-width' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true ),
'notice-border-width' => __( 'pixels; 0 for borderless', 'footnotes' ), 'notice-border-width' => __( 'pixels; 0 for borderless', 'footnotes' ),
'label-border-color' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __( 'Border color:', 'footnotes' ) ), 'label-border-color' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __( 'Border color:', 'footnotes' ) ),
'border-color' => $this->add_color_selection( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ), 'border-color' => $this->add_color_selection( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ),
// Translators: %s: Clear or leave empty. // Translators: %s: Clear or leave empty.
'notice-border-color' => sprintf( __( 'To use the current theme\'s default border color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ), 'notice-border-color' => sprintf( __( 'To use the current theme\'s default border color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ),
'label-border-radius' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __( 'Rounded corner radius:', 'footnotes' ) ), 'label-border-radius' => $this->add_label( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __( 'Rounded corner radius:', 'footnotes' ) ),
'border-radius' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 500 ), 'border-radius' => $this->add_num_box( Includes\Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 500 ),
'notice-border-radius' => __( 'pixels; 0 for sharp corners', 'footnotes' ), 'notice-border-radius' => __( 'pixels; 0 for sharp corners', 'footnotes' ),
'label-box-shadow-color' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __( 'Box shadow color:', 'footnotes' ) ), 'label-box-shadow-color' => $this->add_label( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __( 'Box shadow color:', 'footnotes' ) ),
'box-shadow-color' => $this->add_color_selection( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ), 'box-shadow-color' => $this->add_color_selection( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ),
// Translators: %s: Clear or leave empty. // Translators: %s: Clear or leave empty.
'notice-box-shadow-color' => sprintf( __( 'To use the current theme\'s default box shadow color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ), 'notice-box-shadow-color' => sprintf( __( 'To use the current theme\'s default box shadow color: %s', 'footnotes' ), __( 'Clear or leave empty.', 'footnotes' ) ),
@ -1039,13 +1042,13 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
*/ */
public function hyperlink_arrow() { public function hyperlink_arrow() {
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'customize-hyperlink-arrow' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'customize-hyperlink-arrow' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-symbol' => $this->add_label( Footnotes_Settings::C_STR_HYPERLINK_ARROW, __( 'Select or input the backlink symbol:', 'footnotes' ) ), 'label-symbol' => $this->add_label( Includes\Settings::C_STR_HYPERLINK_ARROW, __( 'Select or input the backlink symbol:', 'footnotes' ) ),
'symbol-options' => $this->add_select_box( Footnotes_Settings::C_STR_HYPERLINK_ARROW, Footnotes_Convert::get_arrow() ), 'symbol-options' => $this->add_select_box( Includes\Settings::C_STR_HYPERLINK_ARROW, Includes\Convert::get_arrow() ),
'symbol-custom' => $this->add_text_box( Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED ), 'symbol-custom' => $this->add_text_box( Includes\Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED ),
'notice-symbol' => __( 'Your input overrides the selection.', 'footnotes' ), 'notice-symbol' => __( 'Your input overrides the selection.', 'footnotes' ),
'description-symbol' => __( 'This symbol is used in the reference container. But this setting pre-existed under this tab and cannot be moved to another one.', 'footnotes' ), 'description-symbol' => __( 'This symbol is used in the reference container. But this setting pre-existed under this tab and cannot be moved to another one.', 'footnotes' ),
) )
@ -1063,12 +1066,12 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
*/ */
public function custom_css() { public function custom_css() {
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'customize-css' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'customize-css' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-css' => $this->add_label( Footnotes_Settings::C_STR_CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ), 'label-css' => $this->add_label( Includes\Settings::C_STR_CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ),
'css' => $this->add_textarea( Footnotes_Settings::C_STR_CUSTOM_CSS ), 'css' => $this->add_textarea( Includes\Settings::C_STR_CUSTOM_CSS ),
'description-css' => __( 'Custom CSS migrates to a dedicated tab. This text area is intended to keep your data safe, and the code remains valid while visible. Please copy-paste the content into the new text area under the new tab.', 'footnotes' ), 'description-css' => __( 'Custom CSS migrates to a dedicated tab. This text area is intended to keep your data safe, and the code remains valid while visible. Please copy-paste the content into the new text area under the new tab.', 'footnotes' ),
// phpcs:disable Squiz.PHP.CommentedOutCode.Found // phpcs:disable Squiz.PHP.CommentedOutCode.Found
@ -1110,16 +1113,16 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'customize-css-migration' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'customize-css-migration' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'label-css' => $this->add_label( Footnotes_Settings::C_STR_CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ), 'label-css' => $this->add_label( Includes\Settings::C_STR_CUSTOM_CSS, __( 'Your existing Custom CSS code:', 'footnotes' ) ),
'css' => $this->add_textarea( Footnotes_Settings::C_STR_CUSTOM_CSS ), 'css' => $this->add_textarea( Includes\Settings::C_STR_CUSTOM_CSS ),
'description-css' => __( 'Custom CSS migrates to a dedicated tab. This text area is intended to keep your data safe, and the code remains valid while visible. Please copy-paste the content into the new text area below. Set Show legacy to No. Save twice.', 'footnotes' ), 'description-css' => __( 'Custom CSS migrates to a dedicated tab. This text area is intended to keep your data safe, and the code remains valid while visible. Please copy-paste the content into the new text area below. Set Show legacy to No. Save twice.', 'footnotes' ),
'label-show-legacy' => $this->add_label( Footnotes_Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE, 'Show legacy Custom CSS settings containers:' ), 'label-show-legacy' => $this->add_label( Includes\Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE, 'Show legacy Custom CSS settings containers:' ),
'show-legacy' => $this->add_select_box( Footnotes_Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE, $l_arr_enabled ), 'show-legacy' => $this->add_select_box( Includes\Settings::C_STR_CUSTOM_CSS_LEGACY_ENABLE, $l_arr_enabled ),
'notice-show-legacy' => __( 'Please set to No when you are done migrating, for the legacy Custom CSS containers to disappear.', 'footnotes' ), 'notice-show-legacy' => __( 'Please set to No when you are done migrating, for the legacy Custom CSS containers to disappear.', 'footnotes' ),
// Translators: %s: Referres and tooltips. // Translators: %s: Referres and tooltips.
'description-show-legacy' => sprintf( __( 'The legacy Custom CSS under the %s tab and its mirror here are emptied, and the select box saved as No, when the settings tab is saved while the settings container is not displayed.', 'footnotes' ), __( 'Referrers and tooltips', 'footnotes' ) ), 'description-show-legacy' => sprintf( __( 'The legacy Custom CSS under the %s tab and its mirror here are emptied, and the select box saved as No, when the settings tab is saved while the settings container is not displayed.', 'footnotes' ), __( 'Referrers and tooltips', 'footnotes' ) ),
@ -1139,11 +1142,11 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
*/ */
public function custom_css_new() { public function custom_css_new() {
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'customize-css-new' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'customize-css-new' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
'css' => $this->add_textarea( Footnotes_Settings::C_STR_CUSTOM_CSS_NEW ), 'css' => $this->add_textarea( Includes\Settings::C_STR_CUSTOM_CSS_NEW ),
'headline' => $this->add_text( __( 'Recommended CSS classes:', 'footnotes' ) ), 'headline' => $this->add_text( __( 'Recommended CSS classes:', 'footnotes' ) ),
@ -1169,7 +1172,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
*/ */
public function lookup_hooks() { public function lookup_hooks() {
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'expert-lookup' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'expert-lookup' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
@ -1186,29 +1189,29 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
'head-numbox' => __( 'Priority level', 'footnotes' ), 'head-numbox' => __( 'Priority level', 'footnotes' ),
'head-url' => __( 'WordPress documentation', 'footnotes' ), 'head-url' => __( 'WordPress documentation', 'footnotes' ),
'label-the-title' => $this->add_label( Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_TITLE, 'the_title' ), 'label-the-title' => $this->add_label( Includes\Settings::C_STR_EXPERT_LOOKUP_THE_TITLE, 'the_title' ),
'the-title' => $this->add_checkbox( Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_TITLE ), 'the-title' => $this->add_checkbox( Includes\Settings::C_STR_EXPERT_LOOKUP_THE_TITLE ),
'priority-the-title' => $this->add_num_box( Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX ), 'priority-the-title' => $this->add_num_box( Includes\Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX ),
'url-the-title' => 'https://developer.wordpress.org/reference/hooks/the_title/', 'url-the-title' => 'https://developer.wordpress.org/reference/hooks/the_title/',
'label-the-content' => $this->add_label( Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT, 'the_content' ), 'label-the-content' => $this->add_label( Includes\Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT, 'the_content' ),
'the-content' => $this->add_checkbox( Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT ), 'the-content' => $this->add_checkbox( Includes\Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT ),
'priority-the-content' => $this->add_num_box( Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), 'priority-the-content' => $this->add_num_box( Includes\Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL, -1, PHP_INT_MAX ),
'url-the-content' => 'https://developer.wordpress.org/reference/hooks/the_content/', 'url-the-content' => 'https://developer.wordpress.org/reference/hooks/the_content/',
'label-the-excerpt' => $this->add_label( Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT, 'the_excerpt' ), 'label-the-excerpt' => $this->add_label( Includes\Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT, 'the_excerpt' ),
'the-excerpt' => $this->add_checkbox( Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT ), 'the-excerpt' => $this->add_checkbox( Includes\Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT ),
'priority-the-excerpt' => $this->add_num_box( Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), 'priority-the-excerpt' => $this->add_num_box( Includes\Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL, -1, PHP_INT_MAX ),
'url-the-excerpt' => 'https://developer.wordpress.org/reference/functions/the_excerpt/', 'url-the-excerpt' => 'https://developer.wordpress.org/reference/functions/the_excerpt/',
'label-widget-title' => $this->add_label( Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE, 'widget_title' ), 'label-widget-title' => $this->add_label( Includes\Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE, 'widget_title' ),
'widget-title' => $this->add_checkbox( Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE ), 'widget-title' => $this->add_checkbox( Includes\Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE ),
'priority-widget-title' => $this->add_num_box( Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX ), 'priority-widget-title' => $this->add_num_box( Includes\Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX ),
'url-widget-title' => 'https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title', 'url-widget-title' => 'https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title',
'label-widget-text' => $this->add_label( Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT, 'widget_text' ), 'label-widget-text' => $this->add_label( Includes\Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT, 'widget_text' ),
'widget-text' => $this->add_checkbox( Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT ), 'widget-text' => $this->add_checkbox( Includes\Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT ),
'priority-widget-text' => $this->add_num_box( Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL, -1, PHP_INT_MAX ), 'priority-widget-text' => $this->add_num_box( Includes\Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL, -1, PHP_INT_MAX ),
'url-widget-text' => 'https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text', 'url-widget-text' => 'https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text',
) )
); );
@ -1226,13 +1229,13 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
public function Help() { public function Help() {
global $footnotes; global $footnotes;
// Load footnotes starting and end tag. // Load footnotes starting and end tag.
$l_arr_footnote_starting_tag = $this->load_setting( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START ); $l_arr_footnote_starting_tag = $this->load_setting( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START );
$l_arr_footnote_ending_tag = $this->load_setting( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END ); $l_arr_footnote_ending_tag = $this->load_setting( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END );
if ( 'userdefined' === $l_arr_footnote_starting_tag['value'] || 'userdefined' === $l_arr_footnote_ending_tag['value'] ) { if ( 'userdefined' === $l_arr_footnote_starting_tag['value'] || 'userdefined' === $l_arr_footnote_ending_tag['value'] ) {
// Load user defined starting and end tag. // Load user defined starting and end tag.
$l_arr_footnote_starting_tag = $this->load_setting( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); $l_arr_footnote_starting_tag = $this->load_setting( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED );
$l_arr_footnote_ending_tag = $this->load_setting( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); $l_arr_footnote_ending_tag = $this->load_setting( Includes\Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED );
} }
$l_str_example = 'Hello' . $l_arr_footnote_starting_tag['value'] . $l_str_example = 'Hello' . $l_arr_footnote_starting_tag['value'] .
'Sed ut perspiciatis, unde omnis iste natus error ' . 'Sed ut perspiciatis, unde omnis iste natus error ' .
@ -1250,7 +1253,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
$l_arr_footnote_ending_tag['value'] . ' World!'; $l_arr_footnote_ending_tag['value'] . ' World!';
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'how-to-help' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'how-to-help' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(
@ -1267,7 +1270,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
); );
/* /*
* Call {@see Footnotes_Parser::footnotes_output_head()} function to get * Call {@see Includes\Parser::footnotes_output_head()} function to get
* the styling of the mouse-over box. * the styling of the mouse-over box.
* *
* The name of the callback function ought to be distinct from * The name of the callback function ought to be distinct from
@ -1289,7 +1292,7 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine {
*/ */
public function donate() { public function donate() {
// Load template file. // Load template file.
$l_obj_template = new Footnotes_Template( Footnotes_Template::C_STR_DASHBOARD, 'how-to-donate' ); $l_obj_template = new Includes\Template( Includes\Template::C_STR_DASHBOARD, 'how-to-donate' );
// Replace all placeholders. // Replace all placeholders.
$l_obj_template->replace( $l_obj_template->replace(
array( array(

View file

@ -7,10 +7,8 @@
* registers the activation and deactivation functions, and defines a function * registers the activation and deactivation functions, and defines a function
* that starts the plugin. * that starts the plugin.
* *
* @package footnotes * @package footnotes
* @license GPL-3.0-only * @since 1.0.0
* @copyright 2021 Mark Cheret (email: mark@cheret.de)
* @since 1.0.0
* *
* @wordpress-plugin * @wordpress-plugin
* Plugin Name: footnotes * Plugin Name: footnotes
@ -27,6 +25,9 @@
* License URI: https://www.gnu.org/licenses/gpl-3.0.html * License URI: https://www.gnu.org/licenses/gpl-3.0.html
*/ */
namespace footnotes;
// If this file is called directly, abort. // If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) { if ( ! defined( 'WPINC' ) ) {
die; die;
@ -37,9 +38,10 @@ if ( ! defined( 'WPINC' ) ) {
* *
* @link https://github.com/markcheret/footnotes/wiki/Versioning Versioning Guide * @link https://github.com/markcheret/footnotes/wiki/Versioning Versioning Guide
* *
* @since 2.1.4 * @since 2.1.4
* @todo Draw from envfile rather than hard-coding. * @todo Draw from envfile rather than hard-coding.
* @var string PLUGIN_VERSION The version of this instance of the plugin. *
* @global string PLUGIN_VERSION The version of this instance of the plugin.
*/ */
define( 'PLUGIN_VERSION', '2.8.0d' ); define( 'PLUGIN_VERSION', '2.8.0d' );
@ -49,41 +51,46 @@ define( 'PLUGIN_VERSION', '2.8.0d' );
* This primarily affects whether minified or unminified CSS/JS files are * This primarily affects whether minified or unminified CSS/JS files are
* requested. * requested.
* *
* @since 2.5.5 * @since 2.5.5
* @todo Draw from envfile rather than hard-coding. * @todo Draw from envfile rather than hard-coding.
* @todo Replace with string for >2 environment options. * @todo Replace with string for >2 environment options.
* @var bool PRODUCTION_ENV Whether the plugin is running in production mode or not. Default `false`. *
* @global bool PRODUCTION_ENV Whether the plugin is running in production mode or not.
*/ */
define( 'PRODUCTION_ENV', false ); define( 'PRODUCTION_ENV', false );
/** /**
* Handles the activation of the plugin. * Handles the activation of the plugin.
* *
* @since 2.8.0 * @since 2.8.0
* @see Footnotes_Activator::activate() * @see includes\Activator::activate()
*
* @return void
*/ */
function activate_footnotes() { function activate_footnotes() {
/** /**
* Provides plugin activation functionality. * Provides plugin activation functionality.
*/ */
require_once plugin_dir_path( __FILE__ ) . 'includes/class-footnotes-activator.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/class-activator.php';
Footnotes_Activator::activate(); includes\Activator::activate();
} }
/** /**
* Handles the deactivation of the plugin. * Handles the deactivation of the plugin.
* *
* @since 2.8.0 * @since 2.8.0
* @see Footnotes_Deactivator::deactivate() * @see includes\Deactivator::deactivate()
*
* @return void
*/ */
function deactivate_footnotes() { function deactivate_footnotes() {
/** /**
* Provides plugin deactivation functionality. * Provides plugin deactivation functionality.
*/ */
require_once plugin_dir_path( __FILE__ ) . 'includes/class-footnotes-deactivator.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/class-deactivator.php';
Footnotes_Deactivator::deactivate(); includes\Deactivator::deactivate();
} }
register_activation_hook( __FILE__, 'activate_footnotes' ); register_activation_hook( __FILE__, 'activate_footnotes' );
@ -93,7 +100,7 @@ register_deactivation_hook( __FILE__, 'deactivate_footnotes' );
* The core plugin class that defines internationalization, admin-specific and * The core plugin class that defines internationalization, admin-specific and
* public-facing site hooks and functionality. * public-facing site hooks and functionality.
*/ */
require plugin_dir_path( __FILE__ ) . 'includes/class-footnotes.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/class-core.php';
/** /**
* Begins execution of the plugin. * Begins execution of the plugin.
@ -101,11 +108,18 @@ require plugin_dir_path( __FILE__ ) . 'includes/class-footnotes.php';
* Since everything within the plugin is registered via hooks, then kicking off * Since everything within the plugin is registered via hooks, then kicking off
* the plugin from this point in the file does not affect the page life cycle. * the plugin from this point in the file does not affect the page life cycle.
* *
* @since 2.8.0 * @since 2.8.0
*
* @return void
*/ */
function run_footnotes() { function run_footnotes() {
/**
* The plugin core.
*
* @global includes\Core $footnotes
*/
global $footnotes; global $footnotes;
$footnotes = new Footnotes(); $footnotes = new includes\Core();
$footnotes->run(); $footnotes->run();
} }
run_footnotes(); run_footnotes();

View file

@ -0,0 +1,53 @@
<?php
/**
* footnotes\includes: Activator class
*
* `footnotes\includes` consists of functionality that is shared across both
* the admin- and the public-facing sides of the plugin.
*
* The primary entry point is {@see Footnotes}, which uses {@see Loader}
* to initialise {@see i18n} for internationalization, {@see Admin\Admin} for
* admin-specific functionality and {@see General\General} for public-facing
* functionality.
*
* It also includes various utility classes:
*
* - {@see Activator}: defines plugin activation behaviour, called in
* {@see activate_footnotes()};
* - {@see Deactivator}: defines plugin deactivation behaviour, called in
* {@see deactivate_footnotes()};
* - {@see Config}: defines plugin constants;
* - {@see Convert}: provides data conversion methods;
* - {@see Settings}: defines configurable plugin settings; and
* - {@see Template}: handles template rendering.
*
* @package footnotes
* @since 2.8.0
*/
namespace footnotes\includes;
/**
* Class providing action(s) on plugin activation.
*
* This class defines all code necessary to run during the plugin's activation.
*
* @package footnotes
* @since 2.8.0
*/
class Activator {
/**
* Runs when the plugin is deactivated.
*
* Currently NOP.
*
* @since 2.8.0
*
* @return void
*/
public static function activate() {
// Nothing yet.
}
}

View file

@ -1,38 +1,57 @@
<?php <?php
/** /**
* File providing the `Footnotes_Config` class. * footnotes\includes: Config class
* *
* @package footnotes * `footnotes\includes` consists of functionality that is shared across both
* @subpackage includes * the admin- and the public-facing sides of the plugin.
* *
* @since 1.5.0 * The primary entry point is {@see Footnotes}, which uses {@see Loader}
* @since 2.8.0 Rename file from `config.php` to `class-footnotes-config.php`, * to initialise {@see i18n} for internationalization, {@see Admin\Admin} for
* rename `class/` sub-directory to `includes/`. * admin-specific functionality and {@see General\General} for public-facing
* @todo Remove. * functionality.
*
* It also includes various utility classes:
*
* - {@see Activator}: defines plugin activation behaviour, called in
* {@see activate_footnotes()};
* - {@see Deactivator}: defines plugin deactivation behaviour, called in
* {@see deactivate_footnotes()};
* - {@see Config}: defines plugin constants;
* - {@see Convert}: provides data conversion methods;
* - {@see Settings}: defines configurable plugin settings; and
* - {@see Template}: handles template rendering.
*
* @package footnotes
* @since 1.5.0
* @since 2.8.0 Renamed file from `init.php` to `class-config.php`.
* Renamed parent `class/` directory to `includes/`.
* @todo Remove.
* @deprecated * @deprecated
*/ */
namespace footnotes\includes;
/** /**
* Class defining plugin constants. * Class defining plugin constants.
* *
* This class contains no methods of properties. * This class contains no methods of properties.
* *
* @package footnotes * @package footnotes
* @subpackage includes * @since 1.5.0
* * @since 2.8.0 Renamed class from `Footnotes_Config` to `Config`.
* @since 1.5.0 * Moved under `footnotes\includes` namespace.
* @todo Remove. * @todo Remove.
* @deprecated * @deprecated
*/ */
class Footnotes_Config { class Config {
/** /**
* Public plugin name. * Public plugin name.
* *
* @var string * @since 1.5.0
* * @todo Remove.
* @since 1.5.0
* @todo Remove.
* @deprecated * @deprecated
*
* @var string
*/ */
const C_STR_PLUGIN_PUBLIC_NAME = '<span class="footnotes_logo footnotes_logo_part1">foot</span><span class="footnotes_logo footnotes_logo_part2">notes</span>'; const C_STR_PLUGIN_PUBLIC_NAME = '<span class="footnotes_logo footnotes_logo_part1">foot</span><span class="footnotes_logo footnotes_logo_part2">notes</span>';
@ -45,44 +64,44 @@ class Footnotes_Config {
* The only working solution found so far is using `position:fixed` in one heading * The only working solution found so far is using `position:fixed` in one heading
* that isn't translated, and dropping the logo in another, translatable heading. * that isn't translated, and dropping the logo in another, translatable heading.
* *
* @var string * @since 2.0.4
* * @todo Remove.
* @since 2.0.4
* @todo Remove.
* @deprecated * @deprecated
*
* @var string
*/ */
const C_STR_PLUGIN_HEADING_NAME = '<span class="footnotes_logo_heading footnotes_logo_part1_heading">foot</span><span class="footnotes_logo_heading footnotes_logo_part2_heading">notes</span>'; const C_STR_PLUGIN_HEADING_NAME = '<span class="footnotes_logo_heading footnotes_logo_part1_heading">foot</span><span class="footnotes_logo_heading footnotes_logo_part2_heading">notes</span>';
/** /**
* HTML element for the love symbol. * HTML element for the love symbol.
* *
* @var string * @since 1.5.0
* * @todo Remove.
* @since 1.5.0
* @todo Remove.
* @deprecated * @deprecated
*
* @var string
*/ */
const C_STR_LOVE_SYMBOL = '<span style="color:#ff6d3b; font-weight:bold;">&hearts;</span>'; const C_STR_LOVE_SYMBOL = '<span style="color:#ff6d3b; font-weight:bold;">&hearts;</span>';
/** /**
* HTML element for the love symbol used in dashboard heading * HTML element for the love symbol used in dashboard heading
* *
* @var string * @since 2.0.4
* * @todo Remove.
* @since 2.0.4
* @todo Remove.
* @deprecated * @deprecated
*
* @var string
*/ */
const C_STR_LOVE_SYMBOL_HEADING = '<span class="footnotes_heart_heading">&hearts;</span>'; const C_STR_LOVE_SYMBOL_HEADING = '<span class="footnotes_heart_heading">&hearts;</span>';
/** /**
* Shortcode to NOT display the LOVE ME slug on certain pages. * Shortcode to NOT display the LOVE ME slug on certain pages.
* *
* @var string * @since 1.5.0
* * @todo Remove.
* @since 1.5.0
* @todo Remove.
* @deprecated * @deprecated
*
* @var string
*/ */
const C_STR_NO_LOVE_SLUG = '[[no footnotes: love]]'; const C_STR_NO_LOVE_SLUG = '[[no footnotes: love]]';
} }

View file

@ -1,24 +1,21 @@
<?php <?php
/** /**
* File providing core `Footnotes_Convert` class. * File providing core `Convert` class.
* *
* @package footnotes * @package footnotes
* @subpackage includes * @since 1.5.0
* * @since 2.8.0 Rename file from `convert.php` to `class-footnotes-convert.php`,
* @since 1.5.0
* @since 2.8.0 Rename file from `convert.php` to `class-footnotes-convert.php`,
* rename `class/` sub-directory to `includes/`. * rename `class/` sub-directory to `includes/`.
*/ */
namespace footnotes\includes;
/** /**
* Class providing variable type and value conversion functions. * Class providing variable type and value conversion functions.
* *
* @package footnotes
* @subpackage includes
*
* @since 1.5.0 * @since 1.5.0
*/ */
class Footnotes_Convert { class Convert {
/** /**
* Converts an integer into the user-defined counter style for the footnotes. * Converts an integer into the user-defined counter style for the footnotes.

View file

@ -1,33 +1,56 @@
<?php // phpcs:disable PEAR.Commenting.FileComment.Missing <?php // phpcs:disable PEAR.Commenting.FileComment.Missing
/** /**
* File providing core `Footnotes` class. * footnotes\includes: Core class
* *
* A class definition that includes attributes and functions used across both the * `footnotes\includes` consists of functionality that is shared across both
* public-facing side of the site and the admin area. * the admin- and the public-facing sides of the plugin.
* *
* @package footnotes\includes * The primary entry point is {@see Footnotes}, which uses {@see Loader}
* to initialise {@see i18n} for internationalization, {@see Admin\Admin} for
* admin-specific functionality and {@see General\General} for public-facing
* functionality.
*
* It also includes various utility classes:
*
* - {@see Activator}: defines plugin activation behaviour, called in
* {@see activate_footnotes()};
* - {@see Deactivator}: defines plugin deactivation behaviour, called in
* {@see deactivate_footnotes()};
* - {@see Config}: defines plugin constants;
* - {@see Convert}: provides data conversion methods;
* - {@see Settings}: defines configurable plugin settings; and
* - {@see Template}: handles template rendering.
*
* @package footnotes
* @since 1.5.0 * @since 1.5.0
* @since 2.8.0 Rename file from `init.php` to `class-footnotes.php`, rename * @since 2.8.0 Renamed file from `init.php` to `class-core.php`.
* `class/` sub-directory to `includes/`. * Renamed parent `class/` directory to `includes/`.
*/ */
namespace footnotes\includes;
use footnotes\general as General;
use footnotes\admin as Admin;
/** /**
* Class providing core plugin functionality. * Class providing core plugin functionality.
* *
* This is used to define internationalization, admin-specific hooks, and * This is used to define internationalization, admin-specific hooks, and
* public-facing site hooks. * public-facing site hooks.
* @package footnotes\includes * @package footnotes
* @since 1.5.0 * @since 1.5.0
* @since 2.8.0 Renamed class from `Footnotes` to `Core`.
* Moved under `footnotes\includes` namespace.
*/ */
class Footnotes { class Core {
/** /**
* The loader that's responsible for maintaining and registering all hooks that power * The loader that's responsible for maintaining and registering all hooks
* the plugin. * that power the plugin.
* *
* @since 2.8.0 * @since 2.8.0
* *
* @var Footnotes_Loader $loader Maintains and registers all hooks for the plugin. * @var Loader $loader Maintains and registers all hooks for the plugin.
*/ */
protected $loader; protected $loader;
@ -51,14 +74,14 @@ class Footnotes {
protected $version; protected $version;
/** /**
* Build the core of the plugin. * Builds the core of the plugin.
* *
* Set the plugin name and the plugin version that can be used throughout the * Set the plugin name and the plugin version that can be used throughout the
* plugin. Load the dependencies, define the locale, and set the hooks for * plugin. Load the dependencies, define the locale, and set the hooks for
* the admin area and the public-facing side of the site. * the admin area and the public-facing side of the site.
* *
* @since 1.0.0 * @since 1.0.0
* @see PLUGIN_VERSION The plugin version constant. * @global string PLUGIN_VERSION
* *
* @return void * @return void
*/ */
@ -81,14 +104,14 @@ class Footnotes {
* *
* Includes the following files that make up the plugin: * Includes the following files that make up the plugin:
* *
* - {@see Footnotes_Loader}: orchestrates the hooks of the plugin; * - {@see Loader}: orchestrates the hooks of the plugin;
* - {@see Footnotes_i18n}: defines internationalization functionality; * - {@see i18n}: defines internationalization functionality;
* - {@see Footnotes_Config}: defines plugin details; * - {@see Config}: defines plugin details;
* - {@see Footnotes_Convert}: provides conversion methods; * - {@see Convert}: provides conversion methods;
* - {@see Footnotes_Settings}: defines customisable plugin settings; * - {@see Settings}: defines customisable plugin settings;
* - {@see Footnotes_Template}: handles template rendering; * - {@see Template}: handles template rendering;
* - {@see Footnotes_Admin}: defines all hooks for the admin area; and * - {@see Admin\Admin}: defines all hooks for the admin area; and
* - {@see Footnotes_Public}: defines all hooks for the public side of the site. * - {@see General\Public}: defines all hooks for the public side of the site.
* *
* Creates an instance of the loader which will be used to register the hooks * Creates an instance of the loader which will be used to register the hooks
* with WordPress. * with WordPress.
@ -103,51 +126,51 @@ class Footnotes {
* The class responsible for orchestrating the actions and filters of the * The class responsible for orchestrating the actions and filters of the
* core plugin. * core plugin.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-loader.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-loader.php';
/** /**
* The class responsible for defining internationalization functionality * The class responsible for defining internationalization functionality
* of the plugin. * of the plugin.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-i18n.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-i18n.php';
/** /**
* The various utility classes. * The various utility classes.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-config.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-config.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-convert.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-convert.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-settings.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-settings.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-template.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-template.php';
/** /**
* The class responsible for defining all actions that occur in the admin area. * The class responsible for defining all actions that occur in the admin area.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-footnotes-admin.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-admin.php';
/** /**
* The class responsible for defining all actions that occur in the public-facing * The class responsible for defining all actions that occur in the public-facing
* side of the site. * side of the site.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-footnotes-public.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-general.php';
$this->loader = new Footnotes_Loader(); $this->loader = new Loader();
} }
/** /**
* Define the locale for this plugin for internationalization. * Define the locale for this plugin for internationalization.
* *
* Uses {@see Footnotes_i18n} in order to set the domain and to * Uses {@see i18n} in order to set the domain and to
* register the hook with WordPress. * register the hook with WordPress.
* *
* @since 2.8.0 * @since 2.8.0
* @uses Footnotes_i18n Handles initialization functions. * @uses i18n Handles initialization functions.
* *
* @return void * @return void
*/ */
private function set_locale() { private function set_locale() {
$plugin_i18n = new Footnotes_i18n(); $plugin_i18n = new i18n();
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
@ -158,19 +181,19 @@ class Footnotes {
* plugin. * plugin.
* *
* @since 1.5.0 * @since 1.5.0
* @since 2.8.0 Moved hook registrations from various classes into `Footnotes_Admin`. * @since 2.8.0 Moved hook registrations from various classes into `Admin\Admin`.
* @uses Footnotes_Admin Defines admin functionality. * @see Admin\Admin Defines admin functionality.
* *
* @return void * @return void
*/ */
private function define_admin_hooks() { private function define_admin_hooks() {
$plugin_admin = new Footnotes_Admin( $this->get_plugin_name(), $this->get_version() ); $plugin_admin = new Admin\Admin( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
$this->loader->add_filter( 'plugin_action_links_footnotes/footnotes.php', $plugin_admin, 'footnotes_action_links' ); $this->loader->add_filter( 'plugin_action_links_footnotes/footnotes.php', $plugin_admin, 'action_links' );
$this->loader->add_filter( 'mce_buttons', $plugin_admin->wysiwyg, 'new_visual_editor_button' ); $this->loader->add_filter( 'mce_buttons', $plugin_admin->wysiwyg, 'new_visual_editor_button' );
$this->loader->add_action( 'admin_print_footer_scripts', $plugin_admin->wysiwyg, 'new_plain_text_editor_button' ); $this->loader->add_action( 'admin_print_footer_scripts', $plugin_admin->wysiwyg, 'new_plain_text_editor_button' );
@ -190,13 +213,13 @@ class Footnotes {
* the plugin. * the plugin.
* *
* @since 2.8.0 * @since 2.8.0
* @uses Footnotes_Admin Defines public-facing functionality. * @see General\General Defines public-facing functionality.
* *
* @return void * @return void
*/ */
private function define_public_hooks() { private function define_public_hooks() {
$plugin_public = new Footnotes_Public( $this->get_plugin_name(), $this->get_version() ); $plugin_public = new General\General( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
@ -230,7 +253,7 @@ class Footnotes {
* *
* @since 2.8.0 * @since 2.8.0
*/ */
public function get_loader(): Footnotes_Loader { public function get_loader(): Loader {
return $this->loader; return $this->loader;
} }

View file

@ -1,31 +1,29 @@
<?php <?php
/** /**
* File providing `Footnotes_Deactivator` class. * File providing `Deactivator` class.
* *
* @package footnotes * @package footnotes
* @subpackage includes * @since 2.8.0
*
* @since 2.8.0
*/ */
namespace footnotes\includes;
/** /**
* Class providing action(s) on plugin deactivation. * Class providing action(s) on plugin deactivation.
* *
* This class defines all code necessary to run during the plugin's deactivation. * This class defines all code necessary to run during the plugin's deactivation.
* *
* @package footnotes * @package footnotes
* @subpackage includes * @since 2.8.0
*
* @since 2.8.0
*/ */
class Footnotes_Deactivator { class Deactivator {
/** /**
* Runs when the plugin is deactivated. * Runs when the plugin is deactivated.
* *
* Currently NOP. * Currently NOP.
* *
* @since 2.8.0 * @since 2.8.0
*/ */
public static function deactivate() { public static function deactivate() {
// Nothing yet. // Nothing yet.

View file

@ -1,34 +0,0 @@
<?php
/**
* File providing `Footnotes_Activator` class.
*
* @package footnotes
* @subpackage includes
*
* @since 2.8.0
*/
/**
* Class providing action(s) on plugin activation.
*
* This class defines all code necessary to run during the plugin's activation.
*
* @package footnotes
* @subpackage includes
*
* @since 2.8.0
*/
class Footnotes_Activator {
/**
* Runs when the plugin is deactivated.
*
* Currently NOP.
*
* @since 2.8.0
*/
public static function activate() {
// Nothing yet.
}
}

View file

@ -1,16 +1,16 @@
<?php // phpcs:disable PEAR.NamingConventions.ValidClassName.Invalid <?php // phpcs:disable PEAR.NamingConventions.ValidClassName.Invalid
/** /**
* File providing core `Footnotes_i18n` class. * File providing core `i18n` class.
* *
* @package footnotes * @package footnotes
* @subpackage includes * @since 1.5.0
* * @since 2.8.0 Rename file from `language.php` to `class-footnotes-i18n.php`,
* @since 1.5.0
* @since 2.8.0 Rename file from `language.php` to `class-footnotes-i18n.php`,
* rename `class/` sub-directory to `includes/`. * rename `class/` sub-directory to `includes/`.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-config.php'; namespace footnotes\includes;
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-config.php';
/** /**
* Class providing internationalization functionality. * Class providing internationalization functionality.
@ -18,15 +18,13 @@ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-
* Loads and defines the internationalization files for this plugin so that it * Loads and defines the internationalization files for this plugin so that it
* is ready for translation. * is ready for translation.
* *
* @link https://translate.wordpress.org/projects/wp-plugins/footnotes/ GlotPress listing * @link https://translate.wordpress.org/projects/wp-plugins/footnotes/ GlotPress listing
* *
* @package footnotes * @package footnotes
* @subpackage includes * @since 1.5.0
* * @since 2.8.0 Rename class from `Language` to `i18n`.
* @since 1.5.0
* @since 2.8.0 Rename class from `Footnotes_Language` to `Footnotes_i18n`.
*/ */
class Footnotes_i18n { class i18n {
/** /**
* Load the plugin text domain for translation. * Load the plugin text domain for translation.

View file

@ -1,13 +1,14 @@
<?php <?php
/** /**
* File providing the `Footnotes_Loader` class. * File providing the `Loader` class.
* *
* @package footnotes * @package footnotes
* @subpackage includes
* *
* @since 2.8.0 * @since 2.8.0
*/ */
namespace footnotes\includes;
/** /**
* Class defining action/filter registration for the plugin. * Class defining action/filter registration for the plugin.
* *
@ -16,11 +17,10 @@
* list of actions and filters. * list of actions and filters.
* *
* @package footnotes * @package footnotes
* @subpackage includes
* *
* @since 2.8.0 * @since 2.8.0
*/ */
class Footnotes_Loader { class Loader {
/** /**
* The array of actions registered with WordPress. * The array of actions registered with WordPress.
* *

View file

@ -1,27 +1,31 @@
<?php // phpcs:disable Squiz.Commenting.FileComment.Missing <?php // phpcs:disable Squiz.Commenting.FileComment.Missing
/** /**
* File providing the `Footnotes_Setting` class. * File providing the `Setting` class.
* *
* @package footnotes * @package footnotes
* @subpackage includes * @since 1.5.0
* * @since 2.8.0 Renamed file from `settings.php` to `class-settings.php`.
* @since 1.5.0 * Renamed parent `class/` directory to `includes/`.
* @since 2.8.0 Rename file from `settings.php` to `class-footnotes-settings.php`,
* rename `class/` sub-directory to `includes/`.
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-convert.php'; namespace footnotes\includes;
/**
* Provides data conversion methods.
*
* @todo Move to {@see Loader}.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-convert.php';
/** /**
* Class defining configurable plugin settings. * Class defining configurable plugin settings.
* *
* @package footnotes * @package footnotes
* @subpackage includes * @since 1.5.0
* * @since 2.8.0 Renamed class from `Footnotes_Settings` to `Settings`.
* @since 1.5.0 * Moved under `footnotes\includes` namespace.
*/ */
class Footnotes_Settings { class Settings {
/** /**
* Settings container key for the label of the reference container. * Settings container key for the label of the reference container.
* *
@ -1104,7 +1108,7 @@ class Footnotes_Settings {
/** /**
* Stores a singleton reference of this class. * Stores a singleton reference of this class.
* *
* @var Footnotes_Settings * @var Settings
* *
* @since 1.5.0 * @since 1.5.0
*/ */
@ -1129,12 +1133,11 @@ class Footnotes_Settings {
/** /**
* Contains all default values for each Settings Container. * Contains all default values for each Settings Container.
* *
* @var (string|int)[]
* @see C_STR_*
*
* @since 1.5.0 * @since 1.5.0
* @todo Review. Why are the constants just initialised with these values? * @todo Review. Why are the constants just initialised with these values?
* At the very least, we should stop using yes to mean `true` etc. * At the very least, we should stop using yes to mean `true` etc.
*
* @var (string|int)[]
*/ */
private $a_arr_default = array( private $a_arr_default = array(
@ -1339,7 +1342,7 @@ class Footnotes_Settings {
/** /**
* Returns a singleton of this class. * Returns a singleton of this class.
* *
* @return Footnotes_Settings * @return Settings
* *
* @since 1.5.0 * @since 1.5.0
* @todo Remove? * @todo Remove?

View file

@ -1,6 +1,6 @@
<?php <?php
/** /**
* File providing the `Footnotes_Template` class. * File providing the `Template` class.
* *
* @package footnotes * @package footnotes
* @subpackage includes * @subpackage includes
@ -11,6 +11,8 @@
* rename `class/` sub-directory to `includes/`. * rename `class/` sub-directory to `includes/`.
*/ */
namespace footnotes\includes;
/** /**
* Class defining template rendering. * Class defining template rendering.
* *
@ -23,7 +25,7 @@
* @since 1.5.0 * @since 1.5.0
* @todo Refactor templating. * @todo Refactor templating.
*/ */
class Footnotes_Template { class Template {
/** /**
* Directory name for dashboard partials. * Directory name for dashboard partials.
@ -185,14 +187,14 @@ class Footnotes_Template {
* The directory can be changed. * The directory can be changed.
* *
* @usage to change location of templates to 'template_parts/footnotes/': * @usage to change location of templates to 'template_parts/footnotes/':
* add_filter( 'footnotes_template_directory', function( $directory ) { * add_filter( 'template_directory', function( $directory ) {
* return 'template_parts/footnotes/'; * return 'template_parts/footnotes/';
* } ); * } );
* *
* @todo Review. * @todo Review.
*/ */
$template_directory = apply_filters( '', 'footnotes/' ); $template_directory = apply_filters( '', 'footnotes/' );
$custom_directory = apply_filters( 'footnotes_custom_template_directory', 'footnotes-custom/' ); $custom_directory = apply_filters( 'custom_template_directory', 'footnotes-custom/' );
$template_name = $p_str_file_type . '/' . $p_str_file_name . '.' . $p_str_extension; $template_name = $p_str_file_type . '/' . $p_str_file_name . '.' . $p_str_extension;
/** /**

View file

@ -2,20 +2,23 @@
/** /**
* The public-facing functionality of the plugin. * The public-facing functionality of the plugin.
* *
* @package footnotes\public * @package footnotes
* @since 2.8.0 * @since 2.8.0
*/ */
namespace footnotes\general;
use footnotes\includes as Includes;
/** /**
* Class provide all admin-specific functionality of the plugin. * Class provide all public-facing functionality of the plugin.
* *
* Defines the plugin name, version, and enqueues all public-facing stylesheets * Defines the plugin name, version, and enqueues all public-facing stylesheets
* and JavaScript. * and JavaScript.
* *
* @package footnotes\public * @package footnotes
* @since 2.8.0 * @since 2.8.0
*/ */
class Footnotes_Public { class General {
/** /**
* The ID of this plugin. * The ID of this plugin.
@ -42,7 +45,7 @@ class Footnotes_Public {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @var Footnotes_Widget_Reference_Container $reference_container_widget The reference container widget * @var Widget\Reference_Container $reference_container_widget The reference container widget
*/ */
private $reference_container_widget; private $reference_container_widget;
@ -50,9 +53,9 @@ class Footnotes_Public {
* The footnote parser. * The footnote parser.
* *
* @since 1.5.0 * @since 1.5.0
* @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}. * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* *
* @var Footnotes_Parser $task The Plugin task. * @var Parser $task The Plugin task.
*/ */
public $a_obj_task = null; public $a_obj_task = null;
@ -60,7 +63,7 @@ class Footnotes_Public {
* Flag for using tooltips. * Flag for using tooltips.
* *
* @since 2.4.0 * @since 2.4.0
* @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}. * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* *
* @var bool $tooltips_enabled Whether tooltips are enabled or not. * @var bool $tooltips_enabled Whether tooltips are enabled or not.
*/ */
@ -70,7 +73,7 @@ class Footnotes_Public {
* Allows to determine whether alternative tooltips are enabled. * Allows to determine whether alternative tooltips are enabled.
* *
* @since 2.1.1 * @since 2.1.1
* @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}. * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* *
* @var bool * @var bool
*/ */
@ -80,7 +83,7 @@ class Footnotes_Public {
* Allows to determine whether AMP compatibility mode is enabled. * Allows to determine whether AMP compatibility mode is enabled.
* *
* @since 2.6.0 * @since 2.6.0
* @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}. * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* *
* @var bool * @var bool
*/ */
@ -90,7 +93,7 @@ class Footnotes_Public {
* Allows to determine the script mode among jQuery or plain JS. * Allows to determine the script mode among jQuery or plain JS.
* *
* @since 2.5.6 * @since 2.5.6
* @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}. * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
* *
* @var string js to use plain JavaScript, jquery to use jQuery. * @var string js to use plain JavaScript, jquery to use jQuery.
*/ */
@ -111,10 +114,10 @@ class Footnotes_Public {
$this->load_dependencies(); $this->load_dependencies();
// Set conditions re-used for stylesheet enqueuing and in class/task.php. // Set conditions re-used for stylesheet enqueuing and in class/task.php.
self::$a_bool_amp_enabled = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) ); self::$a_bool_amp_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_AMP_COMPATIBILITY_ENABLE ) );
self::$a_bool_tooltips_enabled = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) ); self::$a_bool_tooltips_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) );
self::$a_bool_alternative_tooltips_enabled = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) ); self::$a_bool_alternative_tooltips_enabled = Includes\Convert::to_bool( Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) );
self::$a_str_script_mode = Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE ); self::$a_str_script_mode = Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE );
} }
/** /**
@ -123,23 +126,23 @@ class Footnotes_Public {
* Include the following files that provide the public-facing functionality * Include the following files that provide the public-facing functionality
* of this plugin: * of this plugin:
* *
* - {@see Footnotes_Parser}: parses Posts and Pages for footnote shortcodes; and * - {@see Parser}: parses Posts and Pages for footnote shortcodes; and
* - {@see Footnotes_Widget_Reference_Container}: defines the Reference Container widget. * - {@see Widget\Reference_Container}: defines the Reference Container widget.
* *
* @since 2.8.0 * @since 2.8.0
*/ */
private function load_dependencies() { private function load_dependencies() {
// TODO: neaten up and document once placements and names are settled. // TODO: neaten up and document once placements and names are settled.
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-config.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-config.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-settings.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-settings.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-footnotes-convert.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-convert.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-footnotes-parser.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-parser.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/widget/class-footnotes-widget-reference-container.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/widget/class-reference-container.php';
$this->reference_container_widget = new Footnotes_Widget_Reference_Container( $this->plugin_name ); $this->reference_container_widget = new Widget\Reference_Container( $this->plugin_name );
$this->a_obj_task = new Footnotes_Parser(); $this->a_obj_task = new Parser();
} }
/** /**
@ -150,7 +153,7 @@ class Footnotes_Public {
* *
* @since 1.5.0 * @since 1.5.0
* @since 2.5.5 Change stylesheet schema. * @since 2.5.5 Change stylesheet schema.
* @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}. * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
*/ */
public function enqueue_styles() { public function enqueue_styles() {
if ( PRODUCTION_ENV ) { if ( PRODUCTION_ENV ) {
@ -176,7 +179,7 @@ class Footnotes_Public {
} }
// Set basic responsive page layout mode for use in stylesheet name. // Set basic responsive page layout mode for use in stylesheet name.
$l_str_page_layout_option = Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT ); $l_str_page_layout_option = Includes\Settings::instance()->get( Includes\Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT );
switch ( $l_str_page_layout_option ) { switch ( $l_str_page_layout_option ) {
case 'reference-container': case 'reference-container':
$l_str_layout_mode = '1'; $l_str_layout_mode = '1';
@ -215,7 +218,7 @@ class Footnotes_Public {
* @since 2.0.0 Add jQueryUI dependency. * @since 2.0.0 Add jQueryUI dependency.
* @since 2.1.2 Add jQuery Tools dependency. * @since 2.1.2 Add jQuery Tools dependency.
* @since 2.5.6 Add jQuery dependency. * @since 2.5.6 Add jQuery dependency.
* @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}. * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
*/ */
public function enqueue_scripts() { public function enqueue_scripts() {
/* /*
@ -264,7 +267,7 @@ class Footnotes_Public {
* Register the widget(s) for the public-facing side of the site. * Register the widget(s) for the public-facing side of the site.
* *
* @since 1.5.0 * @since 1.5.0
* @since 2.8.0 Moved from {@see Footnotes} to {@see Footnotes_Public}. * @since 2.8.0 Moved from {@see Footnotes} to {@see Includes\Public}.
*/ */
public function register_widgets() { public function register_widgets() {
register_widget( $this->reference_container_widget ); register_widget( $this->reference_container_widget );

View file

@ -1,15 +1,18 @@
<?php <?php
/** /**
* Widgets: Footnotes_Widget_Base class * Widgets: Base class
* *
* The Widget subpackage is composed of the {@see Footnotes_Widget_Base} * The Widget subpackage is composed of the {@see Base}
* abstract class, which is extended by the {@see Footnotes_Widget_Reference_Container} * abstract class, which is extended by the {@see Reference_Container}
* sub-class. * sub-class.
* *
* @package footnotes\public\widget * @package footnotes
* @since 1.5.0 * @since 1.5.0
*/ */
namespace footnotes\general\Widget;
use footnotes\includes as Includes;
/** /**
* Base class to be extended by all widget sub-classes. * Base class to be extended by all widget sub-classes.
* *
@ -18,11 +21,11 @@
* *
* @abstract * @abstract
* *
* @package footnotes\public\widget * @package footnotes
* @since 1.5.0 * @since 1.5.0
* @todo Review implemenation of Widgets API. * @todo Review implemenation of Widgets API.
*/ */
abstract class Footnotes_Widget_Base extends WP_Widget { abstract class Base extends \WP_Widget {
/** /**
* Returns an unique ID as string used for the Widget Base ID. * Returns an unique ID as string used for the Widget Base ID.

View file

@ -1,33 +1,36 @@
<?php // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped <?php // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
/** /**
* Widgets: Footnotes_Widget_Reference_Container class * Widgets: Reference_Container class
* *
* The Widget subpackage is composed of the {@see Footnotes_Widget_Base} * The Widget subpackage is composed of the {@see Base}
* abstract class, which is extended by the {@see Footnotes_Widget_Reference_Container} * abstract class, which is extended by the {@see Reference_Container}
* sub-class. * sub-class.
* *
* @package footnotes\public\widget * @package footnotes
* @since 1.5.0 * @since 1.5.0
*/ */
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'widget/class-footnotes-widget-base.php'; namespace footnotes\general\Widget;
use footnotes\includes as Includes;
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'widget/class-base.php';
/** /**
* Registers a Widget to put the Reference Container to the widget area. * Registers a Widget to put the Reference Container to the widget area.
* *
* @package footnotes\public\widget * @package footnotes
* @since 1.5.0 * @since 1.5.0
* @see Footnotes_Widget_Base * @todo Review implemenation of Widgets API.
* @todo Review implemenation of Widgets API. * @see Base
*/ */
class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base { class Reference_Container extends Base {
/** /**
* The ID of this plugin. * The ID of this plugin.
* *
* @access private * @access private
* @since 2.8.0 * @since 2.8.0
* @see Footnotes::$plugin_name * @see Includes\Footnotes::$plugin_name
* @var string $plugin_name The ID of this plugin. * @var string $plugin_name The ID of this plugin.
*/ */
private $plugin_name; private $plugin_name;
@ -47,7 +50,7 @@ class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base {
/** /**
* Returns an unique ID as string used for the Widget Base ID. * Returns an unique ID as string used for the Widget Base ID.
* *
* @see Footnotes_Widget_Base::get_id() * @see Base::get_id()
* @since 1.5.0 * @since 1.5.0
* *
* @return string * @return string
@ -59,7 +62,7 @@ class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base {
/** /**
* Returns the Public name of the Widget to be displayed in the Configuration page. * Returns the Public name of the Widget to be displayed in the Configuration page.
* *
* @see Footnotes_Widget_Base::get_name() * @see Base::get_name()
* @since 1.5.0 * @since 1.5.0
* *
* @return string * @return string
@ -71,7 +74,7 @@ class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base {
/** /**
* Returns the Description of the child widget. * Returns the Description of the child widget.
* *
* @see Footnotes_Widget_Base::get_description() * @see Base::get_description()
* @since 1.5.0 * @since 1.5.0
* *
* @return string * @return string
@ -104,7 +107,7 @@ class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base {
public function widget( $args, $instance ) { public function widget( $args, $instance ) {
global $footnotes; global $footnotes;
// Reference container positioning is set to "widget area". // Reference container positioning is set to "widget area".
if ( 'widget' === Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) { if ( 'widget' === Includes\Settings::instance()->get( Includes\Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) {
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo $footnotes->a_obj_task->reference_container(); echo $footnotes->a_obj_task->reference_container();
// phpcs:enable // phpcs:enable

View file

@ -12,9 +12,8 @@
* - Repeat with other user roles. Best directly by using the links/query string parameters. * - Repeat with other user roles. Best directly by using the links/query string parameters.
* - Repeat things for multisite. Once for a single site in the network, once sitewide. * - Repeat things for multisite. Once for a single site in the network, once sitewide.
* *
* @since 2.8.0 * @package footnotes
* * @since 2.8.0
* @package footnotes
*/ */
// If uninstall not called from WordPress, then exit. // If uninstall not called from WordPress, then exit.