Feature: Tooltip 'Continue reading' button label customizable in Settongs; Stable release 2.1.0

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2414862 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2020-11-08 21:21:24 +00:00
parent 9f732e0b38
commit 2e85b40bc0
10 changed files with 78 additions and 75 deletions

View file

@ -6,7 +6,9 @@
* @author Stefan Herndler
* @since 1.5.0 14.09.14 14:47
*
* Edited for v2.0.4 2020-11-01T0509+0100
* Edited for:
* v2.0.4 2020-11-01T0509+0100
* v2.1.0 2020-11-08T2148+0100
*/
/**
@ -119,6 +121,9 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
// replace all placeholders
$l_obj_Template->replace(
array(
"label-readon" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __("Read on button label", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"readon" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL),
"label-name" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME, __("References label", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"name" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME),
@ -465,10 +470,6 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
"label-widget-text" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT, "widget_text"),
"widget-text" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT),
"url-widget-text" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text",
"label-post-object" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST, "the_post"),
"post-object" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST),
"url-post-object" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_post"
)
);
// display template with replaced placeholders

View file

@ -116,34 +116,35 @@ class MCI_Footnotes {
* jQueryUI re-enables the tooltip infobox disabled when WPv5.5 was released.
*/
public function registerPublic() {
### SCRIPTS
// add the jQuery plugin registered by WordPress
wp_enqueue_script( 'jquery' );
// // Add jQuery Tools:
// wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__));
//
// // Add the jQuery UI libraries registered by WordPress:
// // 'no need to enqueue -core, because dependencies are set'
// // Source: <https://wordpress.stackexchange.com/questions/273986/correct-way-to-enqueue-jquery-ui>
// wp_enqueue_script( 'jquery-ui-widget' );
// wp_enqueue_script( 'jquery-ui-mouse' );
// wp_enqueue_script( 'jquery-ui-accordion' );
// wp_enqueue_script( 'jquery-ui-autocomplete' );
// wp_enqueue_script( 'jquery-ui-slider' );
// Add jQuery Tools:
wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__));
// Add the jQuery UI libraries registered by WordPress:
// 'no need to enqueue -core, because dependencies are set'
// Source: <https://wordpress.stackexchange.com/questions/273986/correct-way-to-enqueue-jquery-ui>
wp_enqueue_script( 'jquery-ui-widget' );
wp_enqueue_script( 'jquery-ui-mouse' );
wp_enqueue_script( 'jquery-ui-accordion' );
wp_enqueue_script( 'jquery-ui-autocomplete' );
wp_enqueue_script( 'jquery-ui-slider' );
// Should that not work, fetch jQuery UI from cdnjs.cloudflare.com:
// Add jQuery UI following @vonpiernik:
// <https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13456762>:
// This was enabled in Footnotes v2.0.0 through v2.0.3.
// Re-added for 2.0.9d1 to look whether it can fix a broken tooltip display. 2020-11-07T1601+0100
wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, true );
wp_enqueue_script( 'jQueryUI' );
//wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, true );
//wp_enqueue_script( 'jQueryUI' );
// Add jQuery Tools and finish adding jQueryUI: 2020-11-08T1638+0100
wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__), ['jQueryUI']);
//wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__), ['jQueryUI']);
### STYLES
@ -153,7 +154,7 @@ class MCI_Footnotes {
'mci-footnotes-css-public',
plugins_url('../css/public.css', __FILE__),
'',
'2.0.9d3'
'2.1.0'
);
}

View file

@ -9,6 +9,7 @@
* Edited for:
* v2.0.4 2020-11-02T2115+0100
* v2.0.7 2020-11-06T1342+0100
* v2.1.0 2020-11-08T2149+0100
*/
@ -22,6 +23,16 @@
*/
class MCI_Footnotes_Settings {
/**
* Settings Container Key for the label of the 'Read on' button in truncated tooltips
*
* @since 2.0.9
* @var string
*
* 2020-11-08T2106+0100
*/
const C_STR_FOOTNOTES_TOOLTIP_READON_LABEL = "footnote_inputfield_readon_label";
/**
* Settings Container Key for the label of the reference container.
*
@ -337,15 +348,6 @@ class MCI_Footnotes_Settings {
*/
const C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT = "footnote_inputfield_expert_lookup_widget_text";
/**
* Settings Container Key the activation of the_post hook.
*
* @author Stefan Herndler
* @since 1.5.5
* @var string
*/
const C_BOOL_EXPERT_LOOKUP_THE_POST = "footnote_inputfield_expert_lookup_the_post";
/**
* Stores a singleton reference of this class.
*
@ -373,6 +375,7 @@ class MCI_Footnotes_Settings {
*/
private $a_arr_Default = array(
"footnotes_storage" => array(
self::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading',
self::C_STR_REFERENCE_CONTAINER_NAME => 'References',
self::C_BOOL_REFERENCE_CONTAINER_COLLAPSE => '',
self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end',
@ -447,7 +450,6 @@ class MCI_Footnotes_Settings {
self::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT => 'yes',
self::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE => 'yes',
self::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT => 'yes',
self::C_BOOL_EXPERT_LOOKUP_THE_POST => ''//NEVER ENABLE THIS HOOK!!!!!
)
);

View file

@ -12,8 +12,9 @@
* @docteurfitness <https://wordpress.org/support/topic/auto-load-post-compatibility-update/>
*
* Edited for v2.0.9: DISABLED the_post HOOK 2020-11-08T1839+0100
* Edited for v2.1.0: Promoted the 'Continue reading' button from localization to customization 2020-11-08T2146+0100
*
* Last modified 2020-11-08T1850+0100
* Last modified 2020-11-08T2146+0100
*/
// If called directly, abort:
@ -257,17 +258,17 @@ class MCI_Footnotes_Task {
* @since 1.5.4
* @param array|WP_Post $p_mixed_Posts
*/
public function the_post(&$p_mixed_Posts) {
// single WP_Post object received
if (!is_array($p_mixed_Posts)) {
$p_mixed_Posts = $this->replacePostObject($p_mixed_Posts);
return;
}
// array of WP_Post objects received
for($l_int_Index = 0; $l_int_Index < count($p_mixed_Posts); $l_int_Index++) {
$p_mixed_Posts[$l_int_Index] = $this->replacePostObject($p_mixed_Posts[$l_int_Index]);
}
}
// public function the_post(&$p_mixed_Posts) {
// // single WP_Post object received
// if (!is_array($p_mixed_Posts)) {
// $p_mixed_Posts = $this->replacePostObject($p_mixed_Posts);
// return;
// }
// // array of WP_Post objects received
// for($l_int_Index = 0; $l_int_Index < count($p_mixed_Posts); $l_int_Index++) {
// $p_mixed_Posts[$l_int_Index] = $this->replacePostObject($p_mixed_Posts[$l_int_Index]);
// }
// }
/**
* Replace all Footnotes in a WP_Post object.
@ -395,7 +396,7 @@ class MCI_Footnotes_Task {
$l_str_ExcerptText = substr($l_str_DummyText, 0, $l_int_MaxLength);
$l_str_ExcerptText = substr($l_str_ExcerptText, 0, strrpos($l_str_ExcerptText, ' '));
// Removed hyperlink navigation on user request, but left <a> element for style.
$l_str_ExcerptText .= '&nbsp;&#x2026; ' . sprintf(__("%scontinue%s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '<a class="continue" onclick="footnote_moveToAnchor_' . $l_int_PostID . '(\'footnote_plugin_reference_' . $l_int_PostID . '_' . $l_str_Index . '\');">', '</a>');
$l_str_ExcerptText .= '&nbsp;&#x2026; ' . '<a class="continue" onclick="footnote_moveToAnchor_' . $l_int_PostID . '(\'footnote_plugin_reference_' . $l_int_PostID . '_' . $l_str_Index . '\');">' . MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL) . '</a>';
}
}