- Add: Setting to enable an excerpt of the Footnotes mouse-over box text (default: disabled)
- Add: Setting to define the maximum length of the excerpt displayed in the mouse-over box (default: 150 characters) - Update: Detail information about other Plugins from ManFisher (rating, downloads, last updated, Author name/url) - Update: Receiving list of other Plugins from the Developer Team from an external server - Update: Translations (EN and DE) - Bugfix: Removed hard coded position of the 'ManFisher' main menu page (avoid errors with other Plugins) - Bugfix: Changed function name (includes.php) to be unique (avoid errors with other Plugins) - Bugfix: Try to replace each appearance of Footnotes in the current Post object loaded from the WordPress database git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@1003242 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
6a4677251a
commit
e054849b1e
17 changed files with 328 additions and 122 deletions
|
@ -114,7 +114,7 @@ class MCI_Footnotes_Layout_Init {
|
|||
self::C_STR_MAIN_MENU_SLUG, // menu slug
|
||||
array($this, "displayOtherPlugins"), // function
|
||||
plugins_url('footnotes/img/main-menu.png'), // icon url
|
||||
81 // position
|
||||
null // position
|
||||
);
|
||||
$this->registerSubPages();
|
||||
}
|
||||
|
@ -149,9 +149,9 @@ class MCI_Footnotes_Layout_Init {
|
|||
printf('<em>visit <a href="http://manfisher.net/" target="_blank">ManFisher Medien ManuFaktur</a> or <a href="http://herndler.org" target="_blank">herndler.org</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");
|
||||
$l_arr_Response = wp_remote_get("http://herndler.org/project/other-wordpress-plugins.php");
|
||||
// check if response is valid
|
||||
if (is_wp_error($l_arr_Response)) {
|
||||
printf(__("Error loading other WordPress Plugins from Manfisher. Sorry!", MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
|
||||
|
@ -161,13 +161,6 @@ class MCI_Footnotes_Layout_Init {
|
|||
$l_str_Response = $l_arr_Response["body"];
|
||||
// convert the body to a json string
|
||||
$l_arr_Plugins = json_decode($l_str_Response, true);
|
||||
*/
|
||||
$l_arr_Plugins = array(
|
||||
array("name" => "identity", "title" => "Identity"),
|
||||
array("name" => "google-keyword-suggest", "title" => "Google Keyword Suggest"),
|
||||
array("name" => "competition", "title" => "competition"),
|
||||
array("name" => "footnotes", "title" => "Footnotes")
|
||||
);
|
||||
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "other-plugins");
|
||||
|
@ -178,8 +171,13 @@ class MCI_Footnotes_Layout_Init {
|
|||
// replace Plugin information
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"name" => $l_arr_PluginInfo["name"],
|
||||
"title" => $l_arr_PluginInfo["title"]
|
||||
"server" => ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://" . $_SERVER["SERVER_NAME"],
|
||||
"plugin-name" => $l_arr_PluginInfo["name"],
|
||||
"plugin-title" => $l_arr_PluginInfo["title"],
|
||||
"plugin-icon" => "http://plugins.svn.wordpress.org/" . $l_arr_PluginInfo["name"] ."/assets/icon-256x256.png",
|
||||
"install-label" => __("Install now", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"more-details-label" => __("More Details", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"last-updated-label" => __("Last Updated", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
)
|
||||
);
|
||||
// display Plugin
|
||||
|
@ -220,18 +218,29 @@ class MCI_Footnotes_Layout_Init {
|
|||
// 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."));
|
||||
echo json_encode(array("error" => "Error reading Plugin meta information.<br/>URL: " . $l_str_Url . "<br/>Response: " . $l_str_Response));
|
||||
exit;
|
||||
}
|
||||
|
||||
$l_int_NumRatings = array_key_exists("num_ratings", $l_arr_Plugin) ? intval($l_arr_Plugin["num_ratings"]) : 0;
|
||||
$l_int_Rating = array_key_exists("rating", $l_arr_Plugin) ? floatval($l_arr_Plugin["rating"]) : 0.0;
|
||||
$l_int_Stars = round(5 * $l_int_Rating / 100.0, 1);
|
||||
|
||||
// return Plugin information as JSON encoded string
|
||||
echo json_encode(
|
||||
array(
|
||||
"error" => "",
|
||||
"PluginImage" => "",
|
||||
"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"] : "---"
|
||||
"PluginAuthor" => array_key_exists("author", $l_arr_Plugin) ? html_entity_decode($l_arr_Plugin["author"]) : "unknown",
|
||||
"PluginRatingText" => $l_int_Stars . " " . __("rating based on", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . " " . $l_int_NumRatings . " " . __("ratings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"PluginRating1" => $l_int_NumRatings >= 0.5 ? "star-full" : "star-empty",
|
||||
"PluginRating2" => $l_int_NumRatings >= 1.5 ? "star-full" : "star-empty",
|
||||
"PluginRating3" => $l_int_NumRatings >= 2.5 ? "star-full" : "star-empty",
|
||||
"PluginRating4" => $l_int_NumRatings >= 3.5 ? "star-full" : "star-empty",
|
||||
"PluginRating5" => $l_int_NumRatings >= 4.5 ? "star-full" : "star-empty",
|
||||
"PluginRating" => $l_int_NumRatings,
|
||||
"PluginLastUpdated" => array_key_exists("last_updated", $l_arr_Plugin) ? $l_arr_Plugin["last_updated"] : "unknown",
|
||||
"PluginDownloads" => array_key_exists("downloaded", $l_arr_Plugin) ? $l_arr_Plugin["downloaded"] : "---"
|
||||
)
|
||||
);
|
||||
exit;
|
||||
|
|
|
@ -113,6 +113,9 @@ class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_LayoutEngine {
|
|||
"label-php" => __("PHP version", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"php" => phpversion(),
|
||||
|
||||
"label-user-agent" => __("User agent", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"user-agent" => $_SERVER["HTTP_USER_AGENT"],
|
||||
|
||||
"label-max-execution-time" => __("Max execution time", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"max-execution-time" => ini_get('max_execution_time') . ' ' . __('seconds', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
|
|
|
@ -290,6 +290,10 @@ 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)
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
|
|
Reference in a new issue