Prepare for release version 1.5.2

- Add: Setting to enable/disable the mouse-over box
- Add: Current WordPress Theme to the Diagnostics sub page
- Add: ManFisher note in the "other Plugins" sub page
- Update: Removed unnecessary hidden inputs from the Settings page
- Update: Merged public CSS files to reduce the output and improve the performance
- Update: Translations (EN and DE)
- Bugfix: Removed the 'trim' function to allow whitespaces at the beginning and end of each setting
- Bugfix: Convert the footnotes short code to HTML special chars when adding them into the page/post editor (visual and text)
- Bugfix: Detailed error messages if other Plugins can't be loaded. Also added empty strings as default values to avoid 'undefined'

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@1000036 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
Aricura 2014-10-01 20:57:16 +00:00
parent a0d945d44c
commit 58b3dd27f6
26 changed files with 345 additions and 241 deletions

View file

@ -141,10 +141,14 @@ class MCI_Footnotes_Layout_Init {
* @since 1.5.0
*/
public function displayOtherPlugins() {
printf("<br/>");
printf("<h3>%s</h3>", __('Take a look on other Plugins we have developed.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
printf("<br/><br/>");
// load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "manfisher");
echo $l_obj_Template->getContent();
printf('<em><a href="http://manfisher.net/" target="_blank">visit ManFisher Medien ManuFaktur</a></em>');
printf("<br/><br/>");
printf("<h3>%s</h3>", __('Take a look on other Plugins we have developed.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
/*
// collect plugin list as JSON
$l_arr_Response = wp_remote_get("http://herndler.org/wordpress/plugins/get.json");
@ -204,22 +208,30 @@ class MCI_Footnotes_Layout_Init {
$l_arr_Response = wp_remote_get($l_str_Url);
// check if response is valid
if (is_wp_error($l_arr_Response)) {
echo json_encode(array("error" => "Can't get Plugin information."));
echo json_encode(array("error" => "Error receiving Plugin Information from WordPress."));
exit;
}
if (!array_key_exists("body", $l_arr_Response)) {
echo json_encode(array("error" => "Error reading WordPress API response message."));
exit;
}
// get the body of the response
$l_str_Response = $l_arr_Response["body"];
// get plugin object
$l_arr_Plugin = json_decode($l_str_Response, true);
if (empty($l_arr_Plugin)) {
echo json_encode(array("error" => "Error reading Plugin meta information."));
exit;
}
// return Plugin information as JSON encoded string
echo json_encode(
array(
"error" => "",
"PluginImage" => "",
"PluginDescription" => html_entity_decode($l_arr_Plugin["short_description"]),
"PluginUrl" => $l_arr_Plugin["homepage"],
"PluginVersion" => $l_arr_Plugin["version"]
"PluginDescription" => array_key_exists("short_description", $l_arr_Plugin) ? html_entity_decode($l_arr_Plugin["short_description"]) : "Error reading Plugin information",
"PluginUrl" => array_key_exists("homepage", $l_arr_Plugin) ? $l_arr_Plugin["homepage"] : "",
"PluginVersion" => array_key_exists("version", $l_arr_Plugin) ? $l_arr_Plugin["version"] : "---"
)
);
exit;

View file

@ -216,6 +216,8 @@ abstract class MCI_Footnotes_LayoutEngine {
$l_bool_SettingsUpdated = false;
if (array_key_exists("save-settings", $_POST)) {
if ($_POST["save-settings"] == "save") {
unset($_POST["save-settings"]);
unset($_POST["submit"]);
$l_bool_SettingsUpdated = $this->saveSettings();
}
}
@ -239,7 +241,7 @@ abstract class MCI_Footnotes_LayoutEngine {
// form to submit the active section
echo '<!--suppress HtmlUnknownTarget --><form method="post" action="">';
settings_fields($l_arr_ActiveSection["container"]);
//settings_fields($l_arr_ActiveSection["container"]);
echo '<input type="hidden" name="save-settings" value="save" />';
// outputs the settings field of the active section
do_settings_sections($l_arr_ActiveSection["id"]);
@ -270,19 +272,12 @@ abstract class MCI_Footnotes_LayoutEngine {
* @return bool
*/
private function saveSettings() {
// get only Footnotes settings
$l_arr_Settings = array();
foreach($_POST as $l_str_SettingsName => $l_str_Value) {
if (substr($l_str_SettingsName, 0, 8) == "footnote") {
$l_arr_Settings[$l_str_SettingsName] = $l_str_Value;
}
}
// 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];
// update settings
return MCI_Footnotes_Settings::instance()->saveOptions($l_arr_ActiveSection["container"], $l_arr_Settings);
return MCI_Footnotes_Settings::instance()->saveOptions($l_arr_ActiveSection["container"], $_POST);
}
/**

View file

@ -90,6 +90,10 @@ class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_LayoutEngine {
}
$l_str_PhpExtensions .= $l_str_Extension . ' ' . phpversion($l_str_Extension);
}
/** @var WP_Theme $l_obj_CurrentTheme */
$l_obj_CurrentTheme = wp_get_theme();
$l_str_WordPressPlugins = "";
// iterate through each installed WordPress Plugin
foreach (get_plugins() as $l_arr_Plugin) {
@ -121,6 +125,9 @@ class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_LayoutEngine {
"label-wordpress" => __("WordPress version", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"wordpress" => $wp_version,
"label-theme" => __("Active Theme", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"theme" => $l_obj_CurrentTheme->get("Name") . " " . $l_obj_CurrentTheme->get("Version") . ", " . $l_obj_CurrentTheme->get("Author"). " [" . $l_obj_CurrentTheme->get("AuthorURI") . "]",
"plugins" => $l_str_WordPressPlugins
)
);

View file

@ -78,6 +78,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
$this->addMetaBox("settings", "other", __("Other", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Other"),
$this->addMetaBox("customize", "superscript", __("Superscript layout", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Superscript"),
$this->addMetaBox("customize", "mouse-over-box", __("Mouse-over box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBox"),
$this->addMetaBox("customize", "hyperlink-arrow", __("Hyperlink symbol in the Reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "HyperlinkArrow"),
$this->addMetaBox("customize", "custom-css", __("Add custom CSS to the public page", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSS"),
@ -270,6 +271,31 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
echo $l_obj_Template->getContent();
}
/**
* Displays all settings for the footnotes mouse-over box.
*
* @author Stefan Herndler
* @since 1.5.2
*/
public function MouseOverBox() {
// options for the Footnotes to be replaced in excerpt
$l_arr_Enabled = array(
"yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
);
// load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-mouse-over-box");
// replace all placeholders
$l_obj_Template->replace(
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),
)
);
// display template with replaced placeholders
echo $l_obj_Template->getContent();
}
/**
* Displays all settings for the hyperlink arrow.
*