Prepare for release version 1.5.6
- **IMPORTANT**: We have changed the html tag for the superscript. Please check and update your custom CSS. - Add: .pot file to enable Translations for everybody - Add: Settings to customize the mouse-over box (color, background color, border, max. width) - Update: Translation file names - Update: Translation EN and DE - Update: Styling of the superscript (need to check custom CSS code for the superscript) - Update: Description of CSS classes for the 'customize CSS' text area - Bugfix: Removed 'a' tag around the superscript for Footnotes inside the content to avoid page reloads (empty href attribute) - Bugfix: Avoid Settings fallback to its default value after submit an empty value for a setting - Bugfix: Enable multiple WP_Post objects for the_post hook git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@1005623 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
a466a886bd
commit
b183563518
19 changed files with 622 additions and 188 deletions
|
@ -193,6 +193,10 @@ abstract class MCI_Footnotes_LayoutEngine {
|
|||
wp_enqueue_script('jquery');
|
||||
// enable meta boxes layout and close functionality
|
||||
wp_enqueue_script('postbox');
|
||||
// add WordPress color picker layout
|
||||
wp_enqueue_style('wp-color-picker');
|
||||
// add WordPress color picker function
|
||||
wp_enqueue_script('wp-color-picker');
|
||||
// register stylesheet
|
||||
wp_register_style('mci-footnotes-admin-styles', plugins_url('../../css/settings.css', __FILE__));
|
||||
// add stylesheet to the output
|
||||
|
@ -258,6 +262,7 @@ abstract class MCI_Footnotes_LayoutEngine {
|
|||
// output special javascript for the expand/collapse function of the meta boxes
|
||||
echo '<script type="text/javascript">';
|
||||
echo "jQuery(document).ready(function ($) {";
|
||||
echo 'jQuery(".mfmmf-color-picker").wpColorPicker();';
|
||||
echo "jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');";
|
||||
echo "postboxes.add_postbox_toggles('" . $this->a_str_SubPageHook . "');";
|
||||
echo "});";
|
||||
|
@ -272,12 +277,24 @@ abstract class MCI_Footnotes_LayoutEngine {
|
|||
* @return bool
|
||||
*/
|
||||
private function saveSettings() {
|
||||
$l_arr_newSettings = array();
|
||||
// get current section
|
||||
reset($this->a_arr_Sections);
|
||||
$l_str_ActiveSectionID = isset($_GET['t']) ? $_GET['t'] : key($this->a_arr_Sections);
|
||||
$l_arr_ActiveSection = $this->a_arr_Sections[$l_str_ActiveSectionID];
|
||||
|
||||
// iterate through each value that has to be in the specific contaienr
|
||||
foreach(MCI_Footnotes_Settings::instance()->getDefaults($l_arr_ActiveSection["container"]) as $l_str_Key => $l_mixed_Value) {
|
||||
// setting is available in the POST array, use it
|
||||
if (array_key_exists($l_str_Key, $_POST)) {
|
||||
$l_arr_newSettings[$l_str_Key] = $_POST[$l_str_Key];
|
||||
} else {
|
||||
// setting is not defined in the POST array, define it to avoid the Default value
|
||||
$l_arr_newSettings[$l_str_Key] = "";
|
||||
}
|
||||
}
|
||||
// update settings
|
||||
return MCI_Footnotes_Settings::instance()->saveOptions($l_arr_ActiveSection["container"], $_POST);
|
||||
return MCI_Footnotes_Settings::instance()->saveOptions($l_arr_ActiveSection["container"], $l_arr_newSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -437,4 +454,36 @@ abstract class MCI_Footnotes_LayoutEngine {
|
|||
$l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the html tag for an input [type = text] with color selection class.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.6
|
||||
* @param string $p_str_SettingName Name of the Settings key to pre load the input field.
|
||||
* @return string
|
||||
*/
|
||||
protected function addColorSelection($p_str_SettingName) {
|
||||
// collect data for given settings field
|
||||
$l_arr_Data = $this->LoadSetting($p_str_SettingName);
|
||||
return sprintf('<input type="text" name="%s" id="%s" class="mfmmf-color-picker" value="%s"/>',
|
||||
$l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the html tag for an input [type = num].
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_SettingName Name of the Settings key to pre load the input field.
|
||||
* @param int $p_in_Min Minimum value.
|
||||
* @param int $p_int_Max Maximum value.
|
||||
* @return string
|
||||
*/
|
||||
protected function addNumBox($p_str_SettingName, $p_in_Min, $p_int_Max) {
|
||||
// collect data for given settings field
|
||||
$l_arr_Data = $this->LoadSetting($p_str_SettingName);
|
||||
return sprintf('<input type="number" name="%s" id="%s" value="%d" min="%d" max="%d"/>',
|
||||
$l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"], $p_in_Min, $p_int_Max);
|
||||
}
|
||||
|
||||
} // end of class
|
|
@ -297,11 +297,37 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
array(
|
||||
"label-enable" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __("Enable the mouse-over box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_Enabled),
|
||||
|
||||
"label-activate-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __("Display only an excerpt", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"activate-excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_Enabled),
|
||||
|
||||
"label-excerpt-length" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __("Maximum characters for the excerpt", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"excerpt-length" => $this->addTextBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH)
|
||||
)
|
||||
"excerpt-length" => $this->addTextBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH),
|
||||
|
||||
"label-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __("Color", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR),
|
||||
"notice-color" => __("Empty color will use the default color defined by your current theme.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-background" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __("Background color", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"background" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND),
|
||||
"notice-background" => __("Empty color will use the default background-color defined by your current theme.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-border-width" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __("Border width (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"border-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4),
|
||||
"notice-border-width" => __("Set the width to 0px to hide the border.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-border-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __("Border color", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"border-color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR),
|
||||
"notice-border-color" => __("Empty color will use the default border-color defined by your current theme.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-border-radius" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __("Border radius (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"border-radius" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 20),
|
||||
"notice-border-radius" => __("Set the radius to 0px to avoid a radius.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-max-width" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __("Max. width (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"max-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280),
|
||||
"notice-max-width" => __("Set the max-width to 0px to disable this setting.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
|
@ -349,19 +375,19 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
"headline" => $this->addText(__("Available CSS classes to customize the footnotes and the reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
|
||||
"label-class-1" => ".footnote_plugin_tooltip_text",
|
||||
"class-1" => $this->addText(__("inline footnotes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"class-1" => $this->addText(__("superscript, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
|
||||
"label-class-2" => ".footnote_tooltip",
|
||||
"class-2" => $this->addText(__("inline footnotes, mouse over highlight box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"class-2" => $this->addText(__("mouse-over box, tooltip for each superscript", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
|
||||
"label-class-3" => ".footnote_plugin_index",
|
||||
"class-3" => $this->addText(__("reference container footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"class-3" => $this->addText(__("1st column of the Reference Container, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
|
||||
"label-class-4" => ".footnote_plugin_link",
|
||||
"class-4" => $this->addText(__("reference container footnotes linked arrow", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"class-4" => $this->addText(__("2nd column of the Reference Container, Arrow / Hyperlink", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
|
||||
"label-class-5" => ".footnote_plugin_text",
|
||||
"class-5" => $this->addText(__("reference container footnotes text", MCI_Footnotes_Config::C_STR_PLUGIN_NAME))
|
||||
"class-5" => $this->addText(__("3rd column of the Reference Container, Footnote text", MCI_Footnotes_Config::C_STR_PLUGIN_NAME))
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
|
@ -375,7 +401,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
* @since 1.5.5
|
||||
*/
|
||||
public function lookupHooks() {
|
||||
// load template file
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "expert-lookup");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
|
|
Reference in a new issue