Version 1.6.4
git-svn-id: https://plugins.svn.wordpress.org/footnotes/tags/1.6.4@1445721 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
d01c3d9d5b
commit
efd245e0fb
15 changed files with 3382 additions and 0 deletions
262
class/dashboard/init.php
Normal file
262
class/dashboard/init.php
Normal file
|
@ -0,0 +1,262 @@
|
|||
<?php
|
||||
/**
|
||||
* Includes the Plugin settings menu.
|
||||
*
|
||||
* @filesource
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0 12.09.14 10:26
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Handles the Settings interface of the Plugin.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class MCI_Footnotes_Layout_Init {
|
||||
|
||||
/**
|
||||
* Slug for the Plugin main menu.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @var string
|
||||
*/
|
||||
const C_STR_MAIN_MENU_SLUG = "mfmmf";
|
||||
|
||||
/**
|
||||
* Plugin main menu name.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @var string
|
||||
*/
|
||||
const C_STR_MAIN_MENU_TITLE = "ManFisher";
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @var array
|
||||
*/
|
||||
private $a_arr_SubPageClasses = array();
|
||||
|
||||
/**
|
||||
* Class Constructor. Initializes all WordPress hooks for the Plugin Settings.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function __construct() {
|
||||
// iterate through each class define in the current script
|
||||
foreach(get_declared_classes() as $l_str_ClassName) {
|
||||
// accept only child classes of the layout engine
|
||||
if(is_subclass_of($l_str_ClassName, 'MCI_Footnotes_LayoutEngine')) {
|
||||
/** @var MCI_Footnotes_LayoutEngine $l_obj_Class */
|
||||
$l_obj_Class = new $l_str_ClassName();
|
||||
// append new instance of the layout engine sub class
|
||||
$this->a_arr_SubPageClasses[$l_obj_Class->getPriority()] = $l_obj_Class;
|
||||
}
|
||||
}
|
||||
ksort($this->a_arr_SubPageClasses);
|
||||
|
||||
// register hooks/actions
|
||||
add_action('admin_init', array($this, 'initializeSettings'));
|
||||
add_action('admin_menu', array($this, 'registerMainMenu'));
|
||||
// register AJAX callbacks for Plugin information
|
||||
add_action("wp_ajax_nopriv_footnotes_getPluginInfo", array($this, "getPluginMetaInformation"));
|
||||
add_action("wp_ajax_footnotes_getPluginInfo", array($this, "getPluginMetaInformation"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes all sub pages and registers the settings.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function initializeSettings() {
|
||||
MCI_Footnotes_Settings::instance()->RegisterSettings();
|
||||
// iterate though each sub class of the layout engine and register their sections
|
||||
/** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */
|
||||
foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) {
|
||||
$l_obj_LayoutEngineSubClass->registerSections();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the new main menu for the WordPress dashboard.
|
||||
* Registers all sub menu pages for the new main menu.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 2.0.2
|
||||
* @see http://codex.wordpress.org/Function_Reference/add_menu_page
|
||||
*/
|
||||
public function registerMainMenu() {
|
||||
global $menu;
|
||||
// iterate through each main menu
|
||||
foreach($menu as $l_arr_MainMenu) {
|
||||
// iterate through each main menu attribute
|
||||
foreach($l_arr_MainMenu as $l_str_Attribute) {
|
||||
// main menu already added, append sub pages and stop
|
||||
if ($l_str_Attribute == self::C_STR_MAIN_MENU_SLUG) {
|
||||
$this->registerSubPages();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add a new main menu page to the WordPress dashboard
|
||||
add_menu_page(
|
||||
self::C_STR_MAIN_MENU_TITLE, // page title
|
||||
self::C_STR_MAIN_MENU_TITLE, // menu title
|
||||
'manage_options', // capability
|
||||
self::C_STR_MAIN_MENU_SLUG, // menu slug
|
||||
array($this, "displayOtherPlugins"), // function
|
||||
plugins_url('footnotes/img/main-menu.png'), // icon url
|
||||
null // position
|
||||
);
|
||||
$this->registerSubPages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers all SubPages for this Plugin.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
private function registerSubPages() {
|
||||
// first registered sub menu page MUST NOT contain a unique slug suffix
|
||||
// iterate though each sub class of the layout engine and register their sub page
|
||||
/** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */
|
||||
foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) {
|
||||
$l_obj_LayoutEngineSubClass->registerSubPage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays other Plugins from the developers.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function displayOtherPlugins() {
|
||||
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>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/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));
|
||||
return;
|
||||
}
|
||||
// get the body of the response
|
||||
$l_str_Response = $l_arr_Response["body"];
|
||||
// convert the body to a json string
|
||||
$l_arr_Plugins = json_decode($l_str_Response, true);
|
||||
|
||||
$l_str_Server = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://" . $_SERVER["SERVER_NAME"];
|
||||
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "other-plugins");
|
||||
|
||||
printf('<div id="the-list">');
|
||||
// iterate through each Plugin
|
||||
foreach($l_arr_Plugins as $l_arr_PluginInfo) {
|
||||
$l_str_InstallButton = '<a class="install-now button" href="'.$l_str_Server.'/wp-admin/update.php?action=install-plugin&plugin='.$l_arr_PluginInfo["name"].'&_wpnonce=e7a5c90faf" aria-label="Install '.$l_arr_PluginInfo["title"].' now">'.__("Install now", MCI_Footnotes_Config::C_STR_PLUGIN_NAME).'</a>';
|
||||
$l_str_AlreadyInstalled = '<span class="button button-disabled" title="'.__("This Plugin is already installed and up to date.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME).'">'.__("Installed", MCI_Footnotes_Config::C_STR_PLUGIN_NAME).'</span>';
|
||||
$l_bool_isPluginInstalled = false;
|
||||
// iterate through each installed WordPress Plugin
|
||||
foreach (get_plugins() as $l_arr_Plugin) {
|
||||
if (strtolower($l_arr_PluginInfo["title"]) == strtolower($l_arr_Plugin["Name"])) {
|
||||
$l_bool_isPluginInstalled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// replace Plugin information
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"server" => $l_str_Server,
|
||||
"plugin-name" => $l_arr_PluginInfo["name"],
|
||||
"plugin-title" => $l_arr_PluginInfo["title"],
|
||||
"plugin-icon" => strlen($l_arr_PluginInfo["img"]) > 0 ? "http://plugins.svn.wordpress.org/" . $l_arr_PluginInfo["name"] ."/assets/" . $l_arr_PluginInfo["img"] : "",
|
||||
|
||||
"install-link" => !$l_bool_isPluginInstalled ? $l_str_InstallButton : $l_str_AlreadyInstalled,
|
||||
"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
|
||||
echo $l_obj_Template->getContent();
|
||||
// reload template
|
||||
$l_obj_Template->reload();
|
||||
}
|
||||
printf('</div>');
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX call. returns a JSON string containing meta information about a specific WordPress Plugin.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function getPluginMetaInformation() {
|
||||
// get plugin internal name from POST data
|
||||
$l_str_PluginName = array_key_exists("plugin", $_POST) ? $_POST["plugin"] : null;
|
||||
if (empty($l_str_PluginName)) {
|
||||
echo json_encode(array("error" => "Plugin name invalid."));
|
||||
exit;
|
||||
}
|
||||
$l_str_Url = "https://api.wordpress.org/plugins/info/1.0/".$l_str_PluginName.".json";
|
||||
// call URL and collect data
|
||||
$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" => "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.<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" => "",
|
||||
"PluginDescription" => array_key_exists("short_description", $l_arr_Plugin) ? html_entity_decode($l_arr_Plugin["short_description"]) : "Error reading Plugin information",
|
||||
"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_Stars >= 0.5 ? "star-full" : "star-empty",
|
||||
"PluginRating2" => $l_int_Stars >= 1.5 ? "star-full" : "star-empty",
|
||||
"PluginRating3" => $l_int_Stars >= 2.5 ? "star-full" : "star-empty",
|
||||
"PluginRating4" => $l_int_Stars >= 3.5 ? "star-full" : "star-empty",
|
||||
"PluginRating5" => $l_int_Stars >= 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;
|
||||
}
|
||||
}
|
487
class/dashboard/layout.php
Normal file
487
class/dashboard/layout.php
Normal file
|
@ -0,0 +1,487 @@
|
|||
<?php
|
||||
/**
|
||||
* Includes Layout Engine for the admin dashboard.
|
||||
*
|
||||
* @filesource
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0 12.09.14 10:56
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Layout Engine for the administration dashboard.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
abstract class MCI_Footnotes_LayoutEngine {
|
||||
|
||||
/**
|
||||
* Stores the Hook connection string for the child sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @var null|string
|
||||
*/
|
||||
protected $a_str_SubPageHook = null;
|
||||
|
||||
/**
|
||||
* Stores all Sections for the child sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @var array
|
||||
*/
|
||||
protected $a_arr_Sections = array();
|
||||
|
||||
/**
|
||||
* Returns a Priority index. Lower numbers have a higher Priority.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return int
|
||||
*/
|
||||
abstract public function getPriority();
|
||||
|
||||
/**
|
||||
* Returns the unique slug of the child sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getSubPageSlug();
|
||||
|
||||
/**
|
||||
* Returns the title of the child sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getSubPageTitle();
|
||||
|
||||
/**
|
||||
* Returns an array of all registered sections for a sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return array
|
||||
*/
|
||||
abstract protected function getSections();
|
||||
|
||||
/**
|
||||
* Returns an array of all registered meta boxes.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return array
|
||||
*/
|
||||
abstract protected function getMetaBoxes();
|
||||
|
||||
/**
|
||||
* Returns an array describing a sub page section.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_ID Unique ID suffix.
|
||||
* @param string $p_str_Title Title of the section.
|
||||
* @param int $p_int_SettingsContainerIndex Settings Container Index.
|
||||
* @param bool $p_bool_hasSubmitButton Should a Submit Button be displayed for this section, default: true.
|
||||
* @return array Array describing the section.
|
||||
*/
|
||||
protected function addSection($p_str_ID, $p_str_Title, $p_int_SettingsContainerIndex, $p_bool_hasSubmitButton = true) {
|
||||
return array("id" => MCI_Footnotes_Config::C_STR_PLUGIN_NAME . "-" . $p_str_ID, "title" => $p_str_Title, "submit" => $p_bool_hasSubmitButton, "container" => $p_int_SettingsContainerIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array describing a meta box.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_SectionID Parent Section ID.
|
||||
* @param string $p_str_ID Unique ID suffix.
|
||||
* @param string $p_str_Title Title for the meta box.
|
||||
* @param string $p_str_CallbackFunctionName Class method name for callback.
|
||||
* @return array meta box description to be able to append a meta box to the output.
|
||||
*/
|
||||
protected function addMetaBox($p_str_SectionID, $p_str_ID, $p_str_Title, $p_str_CallbackFunctionName) {
|
||||
return array("parent" => MCI_Footnotes_Config::C_STR_PLUGIN_NAME . "-" . $p_str_SectionID, "id" => $p_str_ID, "title" => $p_str_Title, "callback" => $p_str_CallbackFunctionName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function registerSubPage() {
|
||||
global $submenu;
|
||||
// any sub menu for our main menu exists
|
||||
if (array_key_exists(plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG), $submenu)) {
|
||||
// iterate through all sub menu entries of the ManFisher main menu
|
||||
foreach($submenu[plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG)] as $l_arr_SubMenu) {
|
||||
if ($l_arr_SubMenu[2] == plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug())) {
|
||||
// remove that sub menu and add it again to move it to the bottom
|
||||
remove_submenu_page(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG .$this->getSubPageSlug());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->a_str_SubPageHook = add_submenu_page(
|
||||
MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, // parent slug
|
||||
$this->getSubPageTitle(), // page title
|
||||
$this->getSubPageTitle(), // menu title
|
||||
'manage_options', // capability
|
||||
MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug(), // menu slug
|
||||
array($this, 'displayContent') // function
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers all sections for a sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function registerSections() {
|
||||
// iterate through each section
|
||||
foreach($this->getSections() as $l_arr_Section) {
|
||||
// append tab to the tab-array
|
||||
$this->a_arr_Sections[$l_arr_Section["id"]] = $l_arr_Section;
|
||||
add_settings_section(
|
||||
$l_arr_Section["id"], // unique id
|
||||
"", //$l_arr_Section["title"], // title
|
||||
array($this, 'Description'), // callback function for the description
|
||||
$l_arr_Section["id"] // parent sub page slug
|
||||
);
|
||||
$this->registerMetaBoxes($l_arr_Section["id"]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers all Meta boxes for a sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_ParentID Parent section unique id.
|
||||
*/
|
||||
private function registerMetaBoxes($p_str_ParentID) {
|
||||
// iterate through each meta box
|
||||
foreach($this->getMetaBoxes() as $l_arr_MetaBox) {
|
||||
if ($l_arr_MetaBox["parent"] != $p_str_ParentID) {
|
||||
continue;
|
||||
}
|
||||
add_meta_box(
|
||||
$p_str_ParentID. "-" . $l_arr_MetaBox["id"], // unique id
|
||||
$l_arr_MetaBox["title"], // meta box title
|
||||
array($this, $l_arr_MetaBox["callback"]), // callback function to display (echo) the content
|
||||
$p_str_ParentID, // post type = parent section id
|
||||
'main' // context
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Append javascript and css files for specific sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
private function appendScripts() {
|
||||
// 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
|
||||
wp_enqueue_style('mci-footnotes-admin-styles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of specific sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function displayContent() {
|
||||
// register and enqueue scripts and styling
|
||||
$this->appendScripts();
|
||||
// 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];
|
||||
// store settings
|
||||
$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();
|
||||
}
|
||||
}
|
||||
|
||||
// display all sections and highlight the active section
|
||||
echo '<div class="wrap">';
|
||||
echo '<h2 class="nav-tab-wrapper">';
|
||||
// iterate through all register sections
|
||||
foreach ($this->a_arr_Sections as $l_str_ID => $l_arr_Description) {
|
||||
echo sprintf(
|
||||
'<a class="nav-tab%s" href="?page=%s&t=%s">%s</a>',
|
||||
$l_arr_ActiveSection["id"] == $l_str_ID ? ' nav-tab-active' : '',
|
||||
MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug(), $l_str_ID, $l_arr_Description["title"]
|
||||
);
|
||||
}
|
||||
echo '</h2><br/>';
|
||||
|
||||
if ($l_bool_SettingsUpdated) {
|
||||
echo sprintf('<div id="message" class="updated">%s</div>', __("Settings saved", MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
|
||||
}
|
||||
|
||||
// form to submit the active section
|
||||
echo '<!--suppress HtmlUnknownTarget --><form method="post" action="">';
|
||||
//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"]);
|
||||
do_meta_boxes($l_arr_ActiveSection["id"], 'main', NULL);
|
||||
|
||||
// add submit button to active section if defined
|
||||
if ($l_arr_ActiveSection["submit"]) {
|
||||
submit_button();
|
||||
}
|
||||
// close the form to submit data
|
||||
echo '</form>';
|
||||
// close container for the settings page
|
||||
echo '</div>';
|
||||
// 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 "});";
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Save all Plugin settings.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @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"], $l_arr_newSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the Description of a section. May be overwritten in any section.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function Description() {
|
||||
// default no description will be displayed
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads specific setting and returns an array with the keys [id, name, value].
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_SettingKeyName Settings Array key name.
|
||||
* @return array Contains Settings ID, Settings Name and Settings Value.
|
||||
*/
|
||||
protected function LoadSetting($p_str_SettingKeyName) {
|
||||
// get current section
|
||||
reset($this->a_arr_Sections);
|
||||
$p_arr_Return = array();
|
||||
$p_arr_Return["id"] = sprintf('%s', $p_str_SettingKeyName);
|
||||
$p_arr_Return["name"] = sprintf('%s', $p_str_SettingKeyName);
|
||||
$p_arr_Return["value"] = esc_attr(MCI_Footnotes_Settings::instance()->get($p_str_SettingKeyName));
|
||||
return $p_arr_Return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a line break to start a new line.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return string
|
||||
*/
|
||||
protected function addNewline() {
|
||||
return '<br/>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a line break to have a space between two lines.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return string
|
||||
*/
|
||||
protected function addLineSpace() {
|
||||
return '<br/><br/>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a simple text inside html <span> text.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_Text Message to be surrounded with simple html tag (span).
|
||||
* @return string
|
||||
*/
|
||||
protected function addText($p_str_Text) {
|
||||
return sprintf('<span>%s</span>', $p_str_Text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the html tag for an input/select label.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_SettingName Name of the Settings key to connect the Label with the input/select field.
|
||||
* @param string $p_str_Caption Label caption.
|
||||
* @return string
|
||||
*/
|
||||
protected function addLabel($p_str_SettingName, $p_str_Caption) {
|
||||
if (empty($p_str_Caption)) {
|
||||
return "";
|
||||
}
|
||||
return sprintf('<label for="%s">%s:</label>', $p_str_SettingName, $p_str_Caption);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the html tag for an input [type = text].
|
||||
*
|
||||
* @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_str_MaxLength Maximum length of the input, default 999 characters.
|
||||
* @param bool $p_bool_Readonly Set the input to be read only, default false.
|
||||
* @param bool $p_bool_Hidden Set the input to be hidden, default false.
|
||||
* @return string
|
||||
*/
|
||||
protected function addTextBox($p_str_SettingName, $p_str_MaxLength = 999, $p_bool_Readonly = false, $p_bool_Hidden = false) {
|
||||
$l_str_Style = "";
|
||||
// collect data for given settings field
|
||||
$l_arr_Data = $this->LoadSetting($p_str_SettingName);
|
||||
if ($p_bool_Hidden) {
|
||||
$l_str_Style .= 'display:none;';
|
||||
}
|
||||
return sprintf('<input type="text" name="%s" id="%s" maxlength="%d" style="%s" value="%s" %s/>',
|
||||
$l_arr_Data["name"], $l_arr_Data["id"], $p_str_MaxLength,
|
||||
$l_str_Style, $l_arr_Data["value"], $p_bool_Readonly ? 'readonly="readonly"' : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the html tag for an input [type = checkbox].
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_SettingName Name of the Settings key to pre load the input field.
|
||||
* @return string
|
||||
*/
|
||||
protected function addCheckbox($p_str_SettingName) {
|
||||
// collect data for given settings field
|
||||
$l_arr_Data = $this->LoadSetting($p_str_SettingName);
|
||||
return sprintf('<input type="checkbox" name="%s" id="%s" %s/>',
|
||||
$l_arr_Data["name"], $l_arr_Data["id"],
|
||||
MCI_Footnotes_Convert::toBool($l_arr_Data["value"]) ? 'checked="checked"' : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the html tag for a select box.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_SettingName Name of the Settings key to pre select the current value.
|
||||
* @param array $p_arr_Options Possible options to be selected.
|
||||
* @return string
|
||||
*/
|
||||
protected function addSelectBox($p_str_SettingName, $p_arr_Options) {
|
||||
// collect data for given settings field
|
||||
$l_arr_Data = $this->LoadSetting($p_str_SettingName);
|
||||
$l_str_Options = "";
|
||||
|
||||
/* loop through all array keys */
|
||||
foreach ($p_arr_Options as $l_str_Value => $l_str_Caption) {
|
||||
$l_str_Options .= sprintf('<option value="%s" %s>%s</option>',
|
||||
$l_str_Value,
|
||||
$l_arr_Data["value"] == $l_str_Value ? "selected" : "",
|
||||
$l_str_Caption);
|
||||
}
|
||||
return sprintf('<select name="%s" id="%s">%s</select>',
|
||||
$l_arr_Data["name"], $l_arr_Data["id"], $l_str_Options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the html tag for a text area.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_SettingName Name of the Settings key to pre fill the text area.
|
||||
* @return string
|
||||
*/
|
||||
protected function addTextArea($p_str_SettingName) {
|
||||
// collect data for given settings field
|
||||
$l_arr_Data = $this->LoadSetting($p_str_SettingName);
|
||||
return sprintf('<textarea name="%s" id="%s">%s</textarea>',
|
||||
$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
|
140
class/dashboard/subpage-diagnostics.php
Normal file
140
class/dashboard/subpage-diagnostics.php
Normal file
|
@ -0,0 +1,140 @@
|
|||
<?php
|
||||
/**
|
||||
* Includes the Plugin Class to display Diagnostics.
|
||||
*
|
||||
* @filesource
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0 14.09.14 14:47
|
||||
*/
|
||||
|
||||
/**
|
||||
* Displays Diagnostics of the web server, PHP and WordPress.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_LayoutEngine {
|
||||
|
||||
/**
|
||||
* Returns a Priority index. Lower numbers have a higher Priority.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return int
|
||||
*/
|
||||
public function getPriority() {
|
||||
return 999;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unique slug of the sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return string
|
||||
*/
|
||||
protected function getSubPageSlug() {
|
||||
return "-diagnostics";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return string
|
||||
*/
|
||||
protected function getSubPageTitle() {
|
||||
return __("Diagnostics", MCI_Footnotes_Config::C_STR_PLUGIN_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all registered sections for the sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return array
|
||||
*/
|
||||
protected function getSections() {
|
||||
return array(
|
||||
$this->addSection("diagnostics", __("Diagnostics", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all registered meta boxes for each section of the sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return array
|
||||
*/
|
||||
protected function getMetaBoxes() {
|
||||
return array(
|
||||
$this->addMetaBox("diagnostics", "diagnostics", __("Displays information about the web server, PHP and WordPress", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Diagnostics")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a diagnostics about the web server, php and WordPress.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function Diagnostics() {
|
||||
global $wp_version;
|
||||
$l_str_PhpExtensions = "";
|
||||
// iterate through each PHP extension
|
||||
foreach (get_loaded_extensions() as $l_int_Index => $l_str_Extension) {
|
||||
if ($l_int_Index > 0) {
|
||||
$l_str_PhpExtensions .= ' | ';
|
||||
}
|
||||
$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) {
|
||||
$l_str_WordPressPlugins .= '<tr>';
|
||||
$l_str_WordPressPlugins .= '<td>' . $l_arr_Plugin["Name"] . '</td>';
|
||||
$l_str_WordPressPlugins .= '<td>' . $l_arr_Plugin["Version"] . ' [' . $l_arr_Plugin["PluginURI"] . ']' . '</td>';
|
||||
$l_str_WordPressPlugins .= '</tr>';
|
||||
}
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "diagnostics");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-server" => __("Server name", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"server" => $_SERVER["SERVER_NAME"],
|
||||
|
||||
"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),
|
||||
|
||||
"label-memory-limit" => __("Memory limit", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"memory-limit" => ini_get('memory_limit'),
|
||||
|
||||
"label-php-extensions" => __("PHP extensions", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"php-extensions" => $l_str_PhpExtensions,
|
||||
|
||||
"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
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
}
|
536
class/dashboard/subpage-main.php
Normal file
536
class/dashboard/subpage-main.php
Normal file
|
@ -0,0 +1,536 @@
|
|||
<?php
|
||||
/**
|
||||
* Includes the Plugin Class to display all Settings.
|
||||
*
|
||||
* @filesource
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0 14.09.14 14:47
|
||||
*/
|
||||
|
||||
/**
|
||||
* Displays and handles all Settings of the Plugin.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
||||
|
||||
/**
|
||||
* Returns a Priority index. Lower numbers have a higher Priority.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return int
|
||||
*/
|
||||
public function getPriority() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unique slug of the sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return string
|
||||
*/
|
||||
protected function getSubPageSlug() {
|
||||
return "-" . MCI_Footnotes_Config::C_STR_PLUGIN_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return string
|
||||
*/
|
||||
protected function getSubPageTitle() {
|
||||
return MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all registered sections for the sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return array
|
||||
*/
|
||||
protected function getSections() {
|
||||
$l_arr_Tabs = array();
|
||||
$l_arr_Tabs[] = $this->addSection("settings", __("Settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 0, true);
|
||||
$l_arr_Tabs[] = $this->addSection("customize", __("Customize", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1, true);
|
||||
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE))) {
|
||||
$l_arr_Tabs[] = $this->addSection("expert", __("Expert mode", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 2, true);
|
||||
}
|
||||
$l_arr_Tabs[] = $this->addSection("how-to", __("Preview", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false);
|
||||
return $l_arr_Tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all registered meta boxes for each section of the sub page.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @return array
|
||||
*/
|
||||
protected function getMetaBoxes() {
|
||||
return array(
|
||||
$this->addMetaBox("settings", "reference-container", __("References Container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "ReferenceContainer"),
|
||||
$this->addMetaBox("settings", "styling", sprintf(__("%s styling", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME), "Styling"),
|
||||
$this->addMetaBox("settings", "love", MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . ' ' . MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, "Love"),
|
||||
$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"),
|
||||
|
||||
$this->addMetaBox("expert", "lookup", __("WordPress hooks to look for Footnote short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "lookupHooks"),
|
||||
|
||||
$this->addMetaBox("how-to", "help", __("Brief introduction in how to use the plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Help"),
|
||||
$this->addMetaBox("how-to", "donate", __("Help us to improve our Plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Donate")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all settings for the reference container.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function ReferenceContainer() {
|
||||
// options for the positioning of the reference container
|
||||
$l_arr_Positions = array(
|
||||
"footer" => __("in the footer", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"post_end" => __("at the end of the post", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"widget" => __("in the widget area", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
);
|
||||
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-reference-container");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"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),
|
||||
|
||||
"label-collapse" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, __("Collapse references by default", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"collapse" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE),
|
||||
|
||||
"label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __("Where shall the reference container appear", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_Positions)
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all settings for the footnotes styling.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function Styling() {
|
||||
// define some space for the output
|
||||
$l_str_Space = " ";
|
||||
// options for the combination of identical footnotes
|
||||
$l_arr_CombineIdentical = array(
|
||||
"yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
);
|
||||
// options for the start of the footnotes short code
|
||||
$l_arr_ShortCodeStart = array(
|
||||
"((" => "((",
|
||||
htmlspecialchars("<fn>") => htmlspecialchars("<fn>"),
|
||||
"[ref]" => "[ref]",
|
||||
"userdefined" => __('user defined', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
);
|
||||
// options for the end of the footnotes short code
|
||||
$l_arr_ShortCodeEnd = array(
|
||||
"))" => "))",
|
||||
htmlspecialchars("</fn>") => htmlspecialchars("</fn>"),
|
||||
"[/ref]" => "[/ref]",
|
||||
"userdefined" => __('user defined', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
);
|
||||
// options for the counter style of the footnotes
|
||||
$l_arr_CounterStyle = array(
|
||||
"arabic_plain" => __("Arabic Numbers - Plain", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "1, 2, 3, 4, 5, ...",
|
||||
"arabic_leading" => __("Arabic Numbers - Leading 0", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "01, 02, 03, 04, 05, ...",
|
||||
"latin_low" => __("Latin Character - lower case", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "a, b, c, d, e, ...",
|
||||
"latin_high" => __("Latin Character - upper case", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "A, B, C, D, E, ...",
|
||||
"romanic" => __("Roman Numerals", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "I, II, III, IV, V, ..."
|
||||
);
|
||||
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-styling");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-identical" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, __("Combine identical footnotes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"identical" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_CombineIdentical),
|
||||
|
||||
"label-short-code-start" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __("Footnote tag starts with", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"short-code-start" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_ShortCodeStart),
|
||||
|
||||
"label-short-code-end" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, __("and ends with", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"short-code-end" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, $l_arr_ShortCodeEnd),
|
||||
|
||||
"label-short-code-start-user" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, ""),
|
||||
"short-code-start-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED),
|
||||
|
||||
"label-short-code-end-user" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED, ""),
|
||||
"short-code-end-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED),
|
||||
|
||||
"label-counter-style" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __("Counter style", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"counter-style" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_CounterStyle),
|
||||
|
||||
"short-code-start-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START,
|
||||
"short-code-end-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END,
|
||||
"short-code-start-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED,
|
||||
"short-code-end-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED,
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all settings for 'I love Footnotes'.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function Love() {
|
||||
// options for the positioning of the reference container
|
||||
$l_arr_Love = array(
|
||||
"text-1" => sprintf(__('I %s %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
|
||||
"text-2" => sprintf(__('this site uses the awesome %s Plugin', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
|
||||
"text-3" => sprintf(__('extra smooth %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
|
||||
"random" => __('random text', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"no" => sprintf(__("Don't display a %s %s text in my footer.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL)
|
||||
);
|
||||
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-love");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-love" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf(__("Tell the world you're using %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)),
|
||||
"love" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, $l_arr_Love),
|
||||
|
||||
"label-no-love" => $this->addText(sprintf(__("Don't tell the world you're using %s on specific pages by adding the following short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)),
|
||||
"no-love" => $this->addText(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG)
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all settings that are not grouped in special meta boxes.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function Other() {
|
||||
// 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, "settings-other");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, __("Allow footnotes on Summarized Posts", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, $l_arr_Enabled),
|
||||
"label-expert-mode" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE, __("Enable the Expert mode", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"expert-mode" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE, $l_arr_Enabled)
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all settings for the footnotes Superscript.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function Superscript() {
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-superscript");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-before" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __("Before Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"before" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE),
|
||||
|
||||
"label-after" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER, __("After Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"after" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER)
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
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)
|
||||
);
|
||||
// options for the Mouse-over box position
|
||||
$l_arr_Position = array(
|
||||
"top left" => __("top left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"top center" => __("top center", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"top right" => __("top right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"center right" => __("center right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"bottom right" => __("bottom right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"bottom center" => __("bottom center", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"bottom left" => __("bottom left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"center left" => __("center left", 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),
|
||||
|
||||
"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),
|
||||
|
||||
"label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __("Position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_Position),
|
||||
|
||||
"label-offset-x" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __("Offset X (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"offset-x" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -50, 50),
|
||||
"notice-offset-x" => __("Offset (X axis) in px (may be negative)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-offset-y" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __("Offset Y (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"offset-y" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -50, 50),
|
||||
"notice-offset-y" => __("Offset (Y axis) in px (may be negative)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"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),
|
||||
|
||||
"label-box-shadow-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __("Box shadow color", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"box-shadow-color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR),
|
||||
"notice-box-shadow-color" => __("Empty color will use the default box shadow defined by your current theme.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all settings for the hyperlink arrow.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function HyperlinkArrow() {
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-hyperlink-arrow");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-symbol" => $this->addLabel(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, __("Hyperlink symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"symbol" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, MCI_Footnotes_Convert::getArrow()),
|
||||
|
||||
"label-user-defined" => $this->addLabel(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED, __("or enter a user defined symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"user-defined" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED),
|
||||
"comment" => __("if set it overrides the hyperlink symbol above", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the custom css box.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function CustomCSS() {
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-css");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-css" => $this->addLabel(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS, __("Add custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"css" => $this->addTextArea(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS),
|
||||
|
||||
"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(__("superscript, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
|
||||
"label-class-2" => ".footnote_tooltip",
|
||||
"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(__("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(__("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(__("3rd column of the Reference Container, Footnote text", MCI_Footnotes_Config::C_STR_PLUGIN_NAME))
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays available Hooks to look for Footnote short codes.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function lookupHooks() {
|
||||
// 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(
|
||||
array(
|
||||
"head-hook" => __("WordPress hook function name", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"head-checkbox" => __("Activate", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"head-url" => __("WordPress documentation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
|
||||
"label-the-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE, "the_title"),
|
||||
"the-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE),
|
||||
"url-the-title" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_title",
|
||||
|
||||
"label-the-content" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT, "the_content"),
|
||||
"the-content" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT),
|
||||
"url-the-content" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content",
|
||||
|
||||
"label-the-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT, "the_excerpt"),
|
||||
"the-excerpt" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT),
|
||||
"url-the-excerpt" => "http://codex.wordpress.org/Function_Reference/the_excerpt",
|
||||
|
||||
"label-widget-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE, "widget_title"),
|
||||
"widget-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE),
|
||||
"url-widget-title" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title",
|
||||
|
||||
"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
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a short introduction of the Plugin.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function Help() {
|
||||
global $g_obj_MCI_Footnotes;
|
||||
// load footnotes starting and end tag
|
||||
$l_arr_Footnote_StartingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START);
|
||||
$l_arr_Footnote_EndingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END);
|
||||
|
||||
if ($l_arr_Footnote_StartingTag["value"] == "userdefined" || $l_arr_Footnote_EndingTag["value"] == "userdefined") {
|
||||
// load user defined starting and end tag
|
||||
$l_arr_Footnote_StartingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED);
|
||||
$l_arr_Footnote_EndingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED);
|
||||
}
|
||||
$l_str_Example = "Hello" . $l_arr_Footnote_StartingTag["value"] .
|
||||
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,".
|
||||
" sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.".
|
||||
" Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,".
|
||||
" consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.".
|
||||
" At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
|
||||
. $l_arr_Footnote_EndingTag["value"] . " World!";
|
||||
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "how-to-help");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"label-start" => __("Start your footnote with the following short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"start" => $l_arr_Footnote_StartingTag["value"],
|
||||
|
||||
"label-end" => __("...and end your footnote with this short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"end" => $l_arr_Footnote_EndingTag["value"],
|
||||
|
||||
"example-code" => $l_str_Example,
|
||||
"example-string" => "<br/>" . __("will be displayed as:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
|
||||
"example" => $g_obj_MCI_Footnotes->a_obj_Task->exec($l_str_Example, true),
|
||||
|
||||
"information" => sprintf(__("For further information please check out our %ssupport forum%s on WordPress.org.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '<a href="http://wordpress.org/support/plugin/footnotes" target="_blank" class="footnote_plugin">', '</a>')
|
||||
)
|
||||
);
|
||||
// call wp_head function to get the Styling of the mouse-over box
|
||||
$g_obj_MCI_Footnotes->a_obj_Task->wp_head();
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all Donate button to support the developers.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public function Donate() {
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "how-to-donate");
|
||||
// replace all placeholders
|
||||
$l_obj_Template->replace(
|
||||
array(
|
||||
"caption" => __('Donate now',MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
|
||||
)
|
||||
);
|
||||
// display template with replaced placeholders
|
||||
echo $l_obj_Template->getContent();
|
||||
}
|
||||
}
|
Reference in a new issue