- Update: Global styling for the public plugin name

- Update: Easier usage of the public plugin name in translations
- Update: New Layout for the settings page to group similar settings to get a better overview
- Update: Display settings submit button only if there is at least 1 editable setting in the current tab
- Add: setting where the reference container appears on public pages (needs some corrections!)
- Bugfix: displays only one reference container in front of the footer on category pages

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@918851 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
Aricura 2014-05-21 18:33:26 +00:00
parent 49c54b6a89
commit d25f770bc5
19 changed files with 1322 additions and 1096 deletions

View file

@ -14,93 +14,93 @@
*/ */
class Class_Footnotes class Class_Footnotes
{ {
/* /*
* object to the plugin's settings * object to the plugin's settings
* @since 1.0 * @since 1.0
*/ */
var $a_obj_Settings; var $a_obj_Settings;
/** /**
* @constructor * @constructor
* @since 1.0 * @since 1.0
*/ */
function __construct() function __construct()
{ {
/* load settings only if current wordpress user is admin */ /* load settings only if current wordpress user is admin */
if ( is_admin() ) { if (is_admin()) {
/* create a new instance of the class settings */ /* create a new instance of the class settings */
$this->a_obj_Settings = new Class_FootnotesSettings(); $this->a_obj_Settings = new Class_FootnotesSettings();
} }
/* execute class function: init, admin_init and admin_menu */ /* execute class function: init, admin_init and admin_menu */
add_action( 'init', array( $this, 'init' ) ); add_action('init', array($this, 'init'));
add_action( 'admin_init', array( $this, 'admin_init' ) ); add_action('admin_init', array($this, 'admin_init'));
add_action( 'admin_menu', array( $this, 'admin_menu' ) ); add_action('admin_menu', array($this, 'admin_menu'));
/* register hook for activating the plugin */ /* register hook for activating the plugin */
register_activation_hook( __FILE__, array( $this, 'activate' ) ); register_activation_hook(__FILE__, array($this, 'activate'));
/* register hook for deactivating the plugin */ /* register hook for deactivating the plugin */
register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); register_deactivation_hook(__FILE__, array($this, 'deactivate'));
/* register hook for uninstalling the plugin */ /* register hook for uninstalling the plugin */
register_uninstall_hook( __FILE__, array( $this, 'uninstall' ) ); register_uninstall_hook(__FILE__, array($this, 'uninstall'));
} }
/** /**
* activates the plugin * activates the plugin
* @since 1.0 * @since 1.0
*/ */
function activate() function activate()
{ {
// unused // unused
} }
/** /**
* deactivates the plugin * deactivates the plugin
* @since 1.0 * @since 1.0
*/ */
function deactivate() function deactivate()
{ {
// unused // unused
} }
/** /**
* uninstalls the plugin * uninstalls the plugin
* updated file path in version 1.0.6 * updated file path in version 1.0.6
* @since 1.0 * @since 1.0
*/ */
function uninstall() function uninstall()
{ {
require_once( dirname(__FILE__) . '/../includes/uninstall.php' ); require_once(dirname(__FILE__) . '/../includes/uninstall.php');
} }
/** /**
* initialize function * initialize function
* called in the class constructor * called in the class constructor
* @since 1.0 * @since 1.0
*/ */
function init() function init()
{ {
// unused // unused
} }
/** /**
* do admin init stuff * do admin init stuff
* called in the class constructor * called in the class constructor
* @since 1.0 * @since 1.0
*/ */
function admin_init() function admin_init()
{ {
// unused // unused
} }
/** /**
* do admin menu stuff * do admin menu stuff
* called in the class constructor * called in the class constructor
* @since 1.0 * @since 1.0
*/ */
function admin_menu() function admin_menu()
{ {
// unused // unused
} }
} /* class Class_Footnotes */ } /* class Class_Footnotes */

View file

@ -4,7 +4,7 @@
* User: Stefan * User: Stefan
* Date: 15.05.14 * Date: 15.05.14
* Time: 16:21 * Time: 16:21
* Version: 1.0.6 * Version: 1.0.7
* Since: 1.0 * Since: 1.0
*/ */
@ -14,481 +14,526 @@
*/ */
class Class_FootnotesSettings class Class_FootnotesSettings
{ {
/* /*
* attribute for default settings value * attribute for default settings value
* updated default value for 'FOOTNOTE_INPUTFIELD_LOVE' to default: 'no' in version 1.0.6 * updated default value for 'FOOTNOTE_INPUTFIELD_LOVE' to default: 'no' in version 1.0.6
* @since 1.0 * @since 1.0
*/ */
public static $a_arr_Default_Settings = array( public static $a_arr_Default_Settings = array(
FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL => 'yes', FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL => 'yes',
FOOTNOTE_INPUTFIELD_REFERENCES_LABEL => 'References', FOOTNOTE_INPUTFIELD_REFERENCES_LABEL => 'References',
FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES => '', FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES => '',
FOOTNOTE_INPUTFIELD_PLACEHOLDER_START => '((', FOOTNOTE_INPUTFIELD_PLACEHOLDER_START => '((',
FOOTNOTE_INPUTFIELD_PLACEHOLDER_END => '))', FOOTNOTE_INPUTFIELD_PLACEHOLDER_END => '))',
FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT => 'yes', FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT => 'yes',
FOOTNOTE_INPUTFIELD_LOVE => 'no', FOOTNOTE_INPUTFIELD_LOVE => 'no',
FOOTNOTE_INPUTFIELD_COUNTER_STYLE => 'arabic_plain' FOOTNOTE_INPUTFIELD_COUNTER_STYLE => 'arabic_plain',
); FOOTNOTE_INPUTFIELD_REFERENCE_CONTAINER_PLACE => 'post_end'
/* );
* resulting pagehook for adding a new sub menu page to the settings /*
* @since 1.0 * resulting pagehook for adding a new sub menu page to the settings
*/ * @since 1.0
var $a_str_Pagehook; */
/* var $a_str_Pagehook;
* collection of settings values for this plugin /*
* @since 1.0 * collection of settings values for this plugin
*/ * @since 1.0
var $a_arr_Options; */
/* var $a_arr_Options;
* collection of tabs for the settings page of this plugin /*
* @since 1.0 * collection of tabs for the settings page of this plugin
*/ * @since 1.0
private $a_arr_SettingsTabs = array(); */
private $a_arr_SettingsTabs = array();
/** /**
* @constructor * @constructor
* @since 1.0 * @since 1.0
*/ */
function __construct() function __construct()
{ {
/* loads and filters the settings for this plugin */ /* loads and filters the settings for this plugin */
$this->a_arr_Options = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER, self::$a_arr_Default_Settings, true ); $this->a_arr_Options = footnotes_filter_options(FOOTNOTE_SETTINGS_CONTAINER, self::$a_arr_Default_Settings, true);
/* execute class includes on action-even: init, admin_init and admin_menu */ /* execute class includes on action-even: init, admin_init and admin_menu */
add_action( 'init', array( $this, 'LoadScriptsAndStylesheets' ) ); add_action('init', array($this, 'LoadScriptsAndStylesheets'));
add_action( 'admin_init', array( $this, 'RegisterSettings' ) ); add_action('admin_init', array($this, 'RegisterSettings'));
add_action( 'admin_init', array( $this, 'RegisterTab_General' ) ); add_action('admin_init', array($this, 'RegisterTab_General'));
add_action( 'admin_init', array( $this, 'RegisterTab_HowTo' ) ); add_action('admin_init', array($this, 'RegisterTab_HowTo'));
add_action( 'admin_menu', array( $this, 'AddSettingsMenuPanel' ) ); add_action('admin_menu', array($this, 'AddSettingsMenuPanel'));
} }
/** /**
* initialize settings page, loads scripts and stylesheets needed for the layout * initialize settings page, loads scripts and stylesheets needed for the layout
* called in class constructor @ init * called in class constructor @ init
* @since 1.0 * @since 1.0
*/ */
function LoadScriptsAndStylesheets() function LoadScriptsAndStylesheets()
{ {
/* add the jQuery plugin (already registered by WP) */ /* add the jQuery plugin (already registered by WP) */
wp_enqueue_script( 'jquery' ); wp_enqueue_script('jquery');
/* register public stylesheet */ /* register public stylesheet */
wp_register_style( 'footnote_public_style', plugins_url( '../css/footnote.css', __FILE__ ) ); wp_register_style('footnote_public_style', plugins_url('../css/footnote.css', __FILE__));
/* add public stylesheet */ /* add public stylesheet */
wp_enqueue_style( 'footnote_public_style' ); wp_enqueue_style('footnote_public_style');
/* register settings stylesheet */ /* register settings stylesheet */
wp_register_style( 'footnote_settings_style', plugins_url( '../css/settings.css', __FILE__ ) ); wp_register_style('footnote_settings_style', plugins_url('../css/settings.css', __FILE__));
/* add settings stylesheet */ /* add settings stylesheet */
wp_enqueue_style( 'footnote_settings_style' ); wp_enqueue_style('footnote_settings_style');
} /* Needed to allow metabox layout and close functionality */
wp_enqueue_script('postbox');
}
/** /**
* register the settings field in the database for the "save" function * register the settings field in the database for the "save" function
* called in class constructor @ admin_init * called in class constructor @ admin_init
* @since 1.0 * @since 1.0
*/ */
function RegisterSettings() function RegisterSettings()
{ {
register_setting( FOOTNOTE_SETTINGS_LABEL_GENERAL, FOOTNOTE_SETTINGS_CONTAINER ); register_setting(FOOTNOTE_SETTINGS_LABEL_GENERAL, FOOTNOTE_SETTINGS_CONTAINER);
} }
/** /**
* sets the plugin's title for the admins settings menu * sets the plugin's title for the admins settings menu
* called in class constructor @ admin_menu * called in class constructor @ admin_menu
* @since 1.0 * @since 1.0
*/ */
function AddSettingsMenuPanel() function AddSettingsMenuPanel()
{ {
/* current user needs the permission to update plugins for further access */ /* current user needs the permission to update plugins for further access */
if ( !current_user_can( 'update_plugins' ) ) { if (!current_user_can('update_plugins')) {
return; return;
} }
/* submenu page title */ /* submenu page title */
$l_str_PageTitle = '<span style="color: #2bb975; ">foot</span><span style="color: #545f5a; ">notes</span>'; $l_str_PageTitle = FOOTNOTES_PLUGIN_PUBLIC_NAME;
/* submenu title */ /* submenu title */
$l_str_MenuTitle = '<span style="color: #2bb975; ">foot</span><span style="color: #545f5a; ">notes</span>'; $l_str_MenuTitle = FOOTNOTES_PLUGIN_PUBLIC_NAME;
/* Add a new submenu to the standard Settings panel */ /* Add a new submenu to the standard Settings panel */
$this->a_str_Pagehook = add_options_page( $l_str_PageTitle, $l_str_MenuTitle, 'administrator', FOOTNOTES_SETTINGS_PAGE_ID, array( $this, 'OutputSettingsPage' ) ); $this->a_str_Pagehook = add_options_page($l_str_PageTitle, $l_str_MenuTitle, 'administrator', FOOTNOTES_SETTINGS_PAGE_ID, array($this, 'OutputSettingsPage'));
} }
/** /**
* Plugin Options page rendering goes here, checks * Plugin Options page rendering goes here, checks
* for active tab and replaces key with the related * for active tab and replaces key with the related
* settings key. Uses the plugin_options_tabs method * settings key. Uses the plugin_options_tabs method
* to render the tabs. * to render the tabs.
* @since 1.0 * @since 1.0
*/ */
function OutputSettingsPage() function OutputSettingsPage()
{ {
/* gets active tag, or if nothing set the "general" tab will be set to active */ /* gets active tag, or if nothing set the "general" tab will be set to active */
$l_str_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : FOOTNOTE_SETTINGS_LABEL_GENERAL; $l_str_tab = isset($_GET['tab']) ? $_GET['tab'] : FOOTNOTE_SETTINGS_LABEL_GENERAL;
/* outputs all tabs */ /* outputs all tabs */
echo '<div class="wrap">'; echo '<div class="wrap">';
$this->OutputSettingsPageTabs(); $this->OutputSettingsPageTabs();
/* outputs a form with the content of the current active tab */ /* outputs a form with the content of the current active tab */
echo '<form method="post" action="options.php">'; echo '<form method="post" action="options.php">';
wp_nonce_field( 'update-options' ); wp_nonce_field('update-options');
settings_fields( $l_str_tab ); settings_fields($l_str_tab);
/* outputs the settings field of the current active tab */ /* outputs the settings field of the current active tab */
do_settings_sections( $l_str_tab ); do_settings_sections($l_str_tab);
/* adds a submit button to the current page */ do_meta_boxes($l_str_tab, 'main');
submit_button(); /* adds a submit button to the current page */
echo '</form>'; /*
echo '</div>'; * add submit button only if there are some settings on the current page
} * @since version 1.0.7
*/
if ($l_str_tab == FOOTNOTE_SETTINGS_LABEL_GENERAL) {
submit_button();
}
echo '</form>';
echo '</div>';
/*
* output settings page specific javascript code
* @since 1.0.7
*/
$this->OutputJavascript();
}
/** /**
* Renders our tabs in the plugin options page, * Renders our tabs in the plugin options page,
* walks through the object's tabs array and prints * walks through the object's tabs array and prints
* them one by one. Provides the heading for the * them one by one. Provides the heading for the
* plugin_options_page method. * plugin_options_page method.
* @since 1.0 * @since 1.0
*/ */
function OutputSettingsPageTabs() function OutputSettingsPageTabs()
{ {
/* gets active tag, or if nothing set the "general" tab will be set to active */ /* gets active tag, or if nothing set the "general" tab will be set to active */
$l_str_CurrentTab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : FOOTNOTE_SETTINGS_LABEL_GENERAL; $l_str_CurrentTab = isset($_GET['tab']) ? $_GET['tab'] : FOOTNOTE_SETTINGS_LABEL_GENERAL;
screen_icon(); screen_icon();
echo '<h2 class="nav-tab-wrapper">'; echo '<h2 class="nav-tab-wrapper">';
foreach ( $this->a_arr_SettingsTabs as $l_str_TabKey => $l_str_TabCaption ) { foreach ($this->a_arr_SettingsTabs as $l_str_TabKey => $l_str_TabCaption) {
$active = $l_str_CurrentTab == $l_str_TabKey ? 'nav-tab-active' : ''; $active = $l_str_CurrentTab == $l_str_TabKey ? 'nav-tab-active' : '';
echo '<a class="nav-tab ' . $active . '" href="?page=' . FOOTNOTES_SETTINGS_PAGE_ID . '&tab=' . $l_str_TabKey . '">' . $l_str_TabCaption . '</a>'; echo '<a class="nav-tab ' . $active . '" href="?page=' . FOOTNOTES_SETTINGS_PAGE_ID . '&tab=' . $l_str_TabKey . '">' . $l_str_TabCaption . '</a>';
} }
echo '</h2>'; echo '</h2>';
} }
/** /**
* loads specific setting and returns an array with the keys [id, name, value] * outputs page specific javascript code
* @since 1.0 * @since 1.0.7
* @param $p_str_FieldID */
* @return array function OutputJavascript()
*/ {
protected function LoadSetting( $p_str_FieldID ) ?>
{ <!-- Needed to allow metabox layout and close functionality. -->
$p_arr_Return = array(); <script type="text/javascript">
$p_arr_Return[ "id" ] = $this->getFieldID( $p_str_FieldID ); jQuery(document).ready(function ($) {
$p_arr_Return[ "name" ] = $this->getFieldName( $p_str_FieldID ); // close postboxes that should be closed
$p_arr_Return[ "value" ] = esc_attr( $this->getFieldValue( $p_str_FieldID ) ); $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
return $p_arr_Return; // postboxes setup
} postboxes.add_postbox_toggles('<?php echo $this->a_str_Pagehook; ?>');
});
</script>
<?php
}
/** /**
* access settings field by name * loads specific setting and returns an array with the keys [id, name, value]
* @since 1.0 * @since 1.0
* @param string $p_str_FieldName * @param $p_str_FieldID
* @return string * @return array
*/ */
protected function getFieldName( $p_str_FieldName ) protected function LoadSetting($p_str_FieldID)
{ {
return sprintf( '%s[%s]', FOOTNOTE_SETTINGS_CONTAINER, $p_str_FieldName ); $p_arr_Return = array();
//return sprintf( '%s', $p_str_FieldName ); $p_arr_Return["id"] = $this->getFieldID($p_str_FieldID);
} $p_arr_Return["name"] = $this->getFieldName($p_str_FieldID);
$p_arr_Return["value"] = esc_attr($this->getFieldValue($p_str_FieldID));
return $p_arr_Return;
}
/** /**
* access settings field by id * access settings field by name
* @since 1.0 * @since 1.0
* @param string $p_str_FieldID * @param string $p_str_FieldName
* @return string * @return string
*/ */
protected function getFieldID( $p_str_FieldID ) protected function getFieldName($p_str_FieldName)
{ {
return sprintf( '%s[%s]', FOOTNOTE_SETTINGS_CONTAINER, $p_str_FieldID ); return sprintf('%s[%s]', FOOTNOTE_SETTINGS_CONTAINER, $p_str_FieldName);
//return sprintf( '%s', $p_str_FieldID ); //return sprintf( '%s', $p_str_FieldName );
} }
/** /**
* get settings field value * access settings field by id
* @since 1.0 * @since 1.0
* @param string $p_str_Key * @param string $p_str_FieldID
* @return string * @return string
*/ */
protected function getFieldValue( $p_str_Key ) protected function getFieldID($p_str_FieldID)
{ {
return $this->a_arr_Options[ $p_str_Key ]; return sprintf('%s[%s]', FOOTNOTE_SETTINGS_CONTAINER, $p_str_FieldID);
} //return sprintf( '%s', $p_str_FieldID );
}
/** /**
* outputs a input type=text * get settings field value
* @param string $p_str_SettingsID [id of the settings field] * @since 1.0
* @param string $p_str_ClassName [css class name] * @param string $p_str_Key
* @param int $p_str_MaxLength [max length for the input value] * @return string
* @param string $p_str_Label [label text] */
* @since 1.0-beta protected function getFieldValue($p_str_Key)
*/ {
function AddTextbox($p_str_SettingsID, $p_str_ClassName="", $p_str_MaxLength=0, $p_str_Label="") return $this->a_arr_Options[$p_str_Key];
{ }
/* collect data for given settings field */
$l_arr_Data = $this->LoadSetting( $p_str_SettingsID );
/* if input shall have a css class, add the style tag for it */ /**
if (!empty($p_str_ClassName)) { * outputs a break to have a new line
$p_str_ClassName = 'class="' . $p_str_ClassName . '"'; * @since 1.0.7
} */
/* optional add a maxlength to the input field */ function AddNewline()
if (!empty($p_str_MaxLength)) { {
$p_str_MaxLength = ' maxlength="'.$p_str_MaxLength.'"'; echo '<br/><br/>';
} }
/* optional add a label in front of the input field */
if (!empty($p_str_Label)) {
echo '<label for="'.$l_arr_Data[ "id" ].'">'.$p_str_Label.'</label>';
}
/* outputs an input field type TEXT */ /**
echo '<input type="text" '.$p_str_ClassName.$p_str_MaxLength.' name="'.$l_arr_Data[ "name" ].'" id="'.$l_arr_Data[ "id" ].'" value="'.$l_arr_Data[ "value" ].'"/>'; * outputs a label for a specific input/select box
} * @param string $p_str_SettingsID
* @param string $p_str_Caption
* @param string $p_str_Styling
* @since 1.0.7
*/
function AddLabel($p_str_SettingsID, $p_str_Caption, $p_str_Styling = "")
{
/* add styling tag if styling is set */
if (!empty($p_str_Styling)) {
$p_str_Styling = ' style="' . $p_str_Styling . '"';
}
echo '<label for="' . $p_str_SettingsID . '"' . $p_str_Styling . '>' . $p_str_Caption . '</label>';
}
/** /**
* outputs a input type=checkbox * outputs a input type=text
* @param string $p_str_SettingsID [id of the settings field] * @param string $p_str_SettingsID [id of the settings field]
* @param string $p_str_ClassName [optional css class name] * @param string $p_str_ClassName [css class name]
* @since 1.0-beta * @param int $p_str_MaxLength [max length for the input value]
*/ * @since 1.0-beta
function AddCheckbox($p_str_SettingsID, $p_str_ClassName="") * removed optional paremter for a label in version 1.0.7
{ */
/* collect data for given settings field */ function AddTextbox($p_str_SettingsID, $p_str_ClassName = "", $p_str_MaxLength = 0)
$l_arr_Data = $this->LoadSetting( $p_str_SettingsID ); {
/* collect data for given settings field */
$l_arr_Data = $this->LoadSetting($p_str_SettingsID);
/* if input shall have a css class, add the style tag for it */ /* if input shall have a css class, add the style tag for it */
if (!empty($p_str_ClassName)) { if (!empty($p_str_ClassName)) {
$p_str_ClassName = 'class="' . $p_str_ClassName . '"'; $p_str_ClassName = 'class="' . $p_str_ClassName . '"';
} }
/* optional add a maxlength to the input field */
if (!empty($p_str_MaxLength)) {
$p_str_MaxLength = ' maxlength="' . $p_str_MaxLength . '"';
}
/* outputs an input field type TEXT */
echo '<input type="text" ' . $p_str_ClassName . $p_str_MaxLength . ' name="' . $l_arr_Data["name"] . '" id="' . $l_arr_Data["id"] . '" value="' . $l_arr_Data["value"] . '"/>';
}
/* lookup if the checkbox shall be pre-checked */ /**
$l_str_Checked = ""; * outputs a input type=checkbox
if (footnotes_ConvertToBool($l_arr_Data["value"])) { * @param string $p_str_SettingsID [id of the settings field]
$l_str_Checked = 'checked="checked"'; * @param string $p_str_ClassName [optional css class name]
} * @since 1.0-beta
*/
function AddCheckbox($p_str_SettingsID, $p_str_ClassName = "")
{
/* collect data for given settings field */
$l_arr_Data = $this->LoadSetting($p_str_SettingsID);
/* outputs an input field type CHECKBOX */ /* if input shall have a css class, add the style tag for it */
echo sprintf('<input type="checkbox" '.$p_str_ClassName.' name="'.$l_arr_Data[ "name" ].'" id="'.$l_arr_Data[ "id" ].'" %s/>', $l_str_Checked); if (!empty($p_str_ClassName)) {
} $p_str_ClassName = 'class="' . $p_str_ClassName . '"';
}
/** /* lookup if the checkbox shall be pre-checked */
* outputs a select box $l_str_Checked = "";
* @param string $p_str_SettingsID [id of the settings field] if (footnotes_ConvertToBool($l_arr_Data["value"])) {
* @param array $p_arr_Options [array with options] $l_str_Checked = 'checked="checked"';
* @param string $p_str_ClassName [optional css class name] }
* @since 1.0-beta
*/
function AddSelectbox($p_str_SettingsID, $p_arr_Options, $p_str_ClassName="")
{
/* collect data for given settings field */
$l_arr_Data = $this->LoadSetting( $p_str_SettingsID );
/* if input shall have a css class, add the style tag for it */ /* outputs an input field type CHECKBOX */
if (!empty($p_str_ClassName)) { echo sprintf('<input type="checkbox" ' . $p_str_ClassName . ' name="' . $l_arr_Data["name"] . '" id="' . $l_arr_Data["id"] . '" %s/>', $l_str_Checked);
$p_str_ClassName = 'class="' . $p_str_ClassName . '"'; }
}
/* select starting tag */ /**
$l_str_Output = '<select ' . $p_str_ClassName . ' name="'.$l_arr_Data[ "name" ].'" id="'.$l_arr_Data[ "id" ].'">'; * outputs a select box
/* loop through all array keys */ * @param string $p_str_SettingsID [id of the settings field]
foreach($p_arr_Options as $l_str_Value => $l_str_Caption) { * @param array $p_arr_Options [array with options]
/* add key as option value */ * @param string $p_str_ClassName [optional css class name]
$l_str_Output .= '<option value="'.$l_str_Value.'"'; * @since 1.0-beta
/* check if option value is set and has to be pre-selected */ */
if ($l_arr_Data["value"] == $l_str_Value) { function AddSelectbox($p_str_SettingsID, $p_arr_Options, $p_str_ClassName = "")
$l_str_Output .= ' selected'; {
} /* collect data for given settings field */
/* write option caption and close option tag */ $l_arr_Data = $this->LoadSetting($p_str_SettingsID);
$l_str_Output .= '>' . $l_str_Caption . '</option>';
}
/* close select */
$l_str_Output .= '</select>';
/* outputs the SELECT field */
echo $l_str_Output;
}
/** /* if input shall have a css class, add the style tag for it */
* initialize general settings tab if (!empty($p_str_ClassName)) {
* called in class constructor @ admin_init $p_str_ClassName = 'class="' . $p_str_ClassName . '"';
* @since 1.0 }
*/
function RegisterTab_General()
{
$l_str_SectionName = "Footnote_Secion_Settings_General";
/* add tab to the tab array */
$this->a_arr_SettingsTabs[ FOOTNOTE_SETTINGS_LABEL_GENERAL ] = __( "General", FOOTNOTES_PLUGIN_NAME );
/* register settings tab */
add_settings_section( $l_str_SectionName, sprintf(__( "%s Settings", FOOTNOTES_PLUGIN_NAME ), '<span style="color: #2bb975; ">foot</span><span style="color: #545f5a; ">notes</span>'), array( $this, 'RegisterTab_General_Description' ), FOOTNOTE_SETTINGS_LABEL_GENERAL );
add_settings_field( 'Register_References_Label', __( "References label:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_References_Label' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_Collapse_References', __( "Collapse references by default:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_Collapse_References' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_Combine_Identical', __( "Combine identical footnotes:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_Combine_Identical' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_Placeholder_Tags', __( "Footnote tag:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_Placeholder_Tags' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_CounterStyle', __( "Counter style:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_CounterStyle' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_SearchExcerpt', __( "Allow footnotes on Summarized Posts:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_SearchExcerpt' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_LoveAndShare', sprintf(__( "Tell the world you're using %sfoot%snotes%s:", FOOTNOTES_PLUGIN_NAME ), '<span style="color: #2bb975; ">', '</span><span style="color: #545f5a; ">', '</span>'), array( $this, 'Register_LoveAndShare' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
}
/** /* select starting tag */
* adds a desciption to the general settings tab $l_str_Output = '<select ' . $p_str_ClassName . ' name="' . $l_arr_Data["name"] . '" id="' . $l_arr_Data["id"] . '">';
* called in RegisterTab_General /* loop through all array keys */
* @since 1.0 foreach ($p_arr_Options as $l_str_Value => $l_str_Caption) {
*/ /* add key as option value */
function RegisterTab_General_Description() $l_str_Output .= '<option value="' . $l_str_Value . '"';
{ /* check if option value is set and has to be pre-selected */
// unused description if ($l_arr_Data["value"] == $l_str_Value) {
} $l_str_Output .= ' selected';
}
/* write option caption and close option tag */
$l_str_Output .= '>' . $l_str_Caption . '</option>';
}
/* close select */
$l_str_Output .= '</select>';
/* outputs the SELECT field */
echo $l_str_Output;
}
/** /**
* outputs the settings field for the "references label" * initialize general settings tab
* @since 1.0 * called in class constructor @ admin_init
*/ * @since 1.0
function Register_References_Label() * changed layout of settings form settings fields to meta boxes in version 1.0.7
{ */
/* add a textbox to the output */ function RegisterTab_General()
$this->AddTextbox(FOOTNOTE_INPUTFIELD_REFERENCES_LABEL, "footnote_plugin_50"); {
} /* add tab to the tab array */
$this->a_arr_SettingsTabs[FOOTNOTE_SETTINGS_LABEL_GENERAL] = __("General", FOOTNOTES_PLUGIN_NAME);
/* register settings tab */
add_settings_section("Footnote_Secion_Settings_General", sprintf(__("%s Settings", FOOTNOTES_PLUGIN_NAME), FOOTNOTES_PLUGIN_PUBLIC_NAME), array($this, 'RegisterTab_General_Description'), FOOTNOTE_SETTINGS_LABEL_GENERAL);
add_meta_box('Register_MetaBox_ReferenceContainer', __("References Container", FOOTNOTES_PLUGIN_NAME), array($this, 'Register_MetaBox_ReferenceContainer'), FOOTNOTE_SETTINGS_LABEL_GENERAL, 'main');
add_meta_box('Register_MetaBox_FootnoteStyling', __("Footnotes styling", FOOTNOTES_PLUGIN_NAME), array($this, 'Register_MetaBox_FootnoteStyling'), FOOTNOTE_SETTINGS_LABEL_GENERAL, 'main');
add_meta_box('Register_MetaBox_Other', __("Other", FOOTNOTES_PLUGIN_NAME), array($this, 'Register_MetaBox_Other'), FOOTNOTE_SETTINGS_LABEL_GENERAL, 'main');
}
/** /**
* outputs the settings field for the "references label" * adds a desciption to the general settings tab
* @since 1.0-beta * called in RegisterTab_General
*/ * @since 1.0
function Register_Collapse_References() */
{ function RegisterTab_General_Description()
/* add a checkbox to the output */ {
$this->AddCheckbox(FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES); // unused description
} }
/** /**
* outputs the settings field for the "combine identical footnotes" * outputs a container for the reference container settings
* @since 1.0 * @since 1.0.7
*/ */
function Register_Combine_Identical() function Register_MetaBox_ReferenceContainer()
{ {
/* get array with option elements */ /* setting for 'reference label' */
$l_arr_Options = array( $this->AddLabel(FOOTNOTE_INPUTFIELD_REFERENCES_LABEL, __("References label:", FOOTNOTES_PLUGIN_NAME));
"yes" => __( "Yes", FOOTNOTES_PLUGIN_NAME ), $this->AddTextbox(FOOTNOTE_INPUTFIELD_REFERENCES_LABEL, "footnote_plugin_50");
"no" => __( "No", FOOTNOTES_PLUGIN_NAME ) $this->AddNewline();
);
/* add a select box to the output */
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL, $l_arr_Options, "footnote_plugin_25");
}
/** /* setting for 'collapse reference container by default' */
* outputs the settings fields for the footnote starting and ending tag $this->AddLabel(FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES, __("Collapse references by default:", FOOTNOTES_PLUGIN_NAME));
* @since 1.0-gamma $this->AddCheckbox(FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES);
*/ $this->AddNewline();
function Register_Placeholder_Tags()
{
/* add a textbox to the output */
$this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START, "", 14, __( "starts with:", FOOTNOTES_PLUGIN_NAME ));
/* small space between the two input fields */
echo '&nbsp;&nbsp;&nbsp;';
/* add a textbox to the output */
$this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END, "", 14, __( "ends with:", FOOTNOTES_PLUGIN_NAME ));
}
/** /*
* outouts the settings field for the counter style * setting for 'placement of the reference container'
* @since 1.0-gamma * @since 1.0.7
*/ */
function Register_CounterStyle() $l_arr_Options = array(
{ "footer" => __("in the footer", FOOTNOTES_PLUGIN_NAME),
$l_str_Space = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; "post_end" => __("at the end of the post", FOOTNOTES_PLUGIN_NAME)
/* get array with option elements */ );
$l_arr_Options = array( $this->AddLabel(FOOTNOTE_INPUTFIELD_REFERENCE_CONTAINER_PLACE, __("Where shall the reference container appear:", FOOTNOTES_PLUGIN_NAME));
"arabic_plain" => __( "Arabic Numbers - Plain", FOOTNOTES_PLUGIN_NAME ) .$l_str_Space. "1, 2, 3, 4, 5, ...", $this->AddSelectbox(FOOTNOTE_INPUTFIELD_REFERENCE_CONTAINER_PLACE, $l_arr_Options, "footnote_plugin_50");
"arabic_leading" => __( "Arabic Numbers - Leading 0", FOOTNOTES_PLUGIN_NAME ) .$l_str_Space. "01, 02, 03, 04, 05, ...", }
"latin_low" => __( "Latin Character - lower case", FOOTNOTES_PLUGIN_NAME ) .$l_str_Space. "a, b, c, d, e, ...",
"latin_high" => __( "Latin Character - upper case", FOOTNOTES_PLUGIN_NAME ) .$l_str_Space. "A, B, C, D, E, ...",
"romanic" => __( "Roman Numerals", FOOTNOTES_PLUGIN_NAME ) .$l_str_Space. "I, II, III, IV, V, ..."
);
/* add a select box to the output */
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_COUNTER_STYLE, $l_arr_Options, "footnote_plugin_50");
}
/** /**
* outputs the settings field for "allow searching in summarized posts" * outputs a container for the styling of footnotes
* @since 1.0-gamma * @since 1.0.7
*/ */
function Register_SearchExcerpt() function Register_MetaBox_FootnoteStyling()
{ {
/* get array with option elements */ /* setting for 'combine identical footnotes' */
$l_arr_Options = array( $l_arr_Options = array(
"yes" => __( "Yes", FOOTNOTES_PLUGIN_NAME ), "yes" => __("Yes", FOOTNOTES_PLUGIN_NAME),
"no" => __( "No", FOOTNOTES_PLUGIN_NAME ) "no" => __("No", FOOTNOTES_PLUGIN_NAME)
); );
/* add a select box to the output */ $this->AddLabel(FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL, __("Combine identical footnotes:", FOOTNOTES_PLUGIN_NAME));
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT, $l_arr_Options, "footnote_plugin_25"); $this->AddSelectbox(FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL, $l_arr_Options, "footnote_plugin_50");
} $this->AddNewline();
/** /* setting for 'footnote tag starts with' */
* outputs the settings field for "love and share this plugin" $this->AddLabel(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START, __("Footnote tag starts with:", FOOTNOTES_PLUGIN_NAME));
* @since 1.0-gamma $this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START, "footnote_plugin_15", 14);
*/
function Register_LoveAndShare()
{
/* get array with option elements */
$l_arr_Options = array(
"yes" => __( "Yes", FOOTNOTES_PLUGIN_NAME ),
"no" => __( "No", FOOTNOTES_PLUGIN_NAME )
);
/* add a select box to the output */
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_LOVE, $l_arr_Options, "footnote_plugin_25");
}
/** /* setting for 'footnote tag ends with' */
* initialize howto settings tab $this->AddLabel(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END, __("and ends with:", FOOTNOTES_PLUGIN_NAME) . '&nbsp;&nbsp;&nbsp;', 'text-align: right;');
* called in class constructor @ admin_init $this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END, "footnote_plugin_15", 14);
* @since 1.0 $this->AddNewline();
*/
function RegisterTab_HowTo()
{
$l_str_SectionName = "Footnote_Secion_Settings_Howto";
/* add tab to the tab array */
$this->a_arr_SettingsTabs[ FOOTNOTE_SETTINGS_LABEL_HOWTO ] = __( "HowTo", FOOTNOTES_PLUGIN_NAME );
/* register settings tab */
add_settings_section( $l_str_SectionName, __( "HowTo", FOOTNOTES_PLUGIN_NAME ), array( $this, 'RegisterTab_HowTo_Description' ), FOOTNOTE_SETTINGS_LABEL_HOWTO );
add_settings_field( 'Register_Howto_Box', "", array( $this, 'Register_Howto_Box' ), FOOTNOTE_SETTINGS_LABEL_HOWTO, $l_str_SectionName );
}
/** /* setting for 'footnotes counter style' */
* adds a descrption to the HowTo settings tab $l_str_Space = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
* called int RegisterTab_HowTo $l_arr_Options = array(
* @since 1.0 "arabic_plain" => __("Arabic Numbers - Plain", FOOTNOTES_PLUGIN_NAME) . $l_str_Space . "1, 2, 3, 4, 5, ...",
*/ "arabic_leading" => __("Arabic Numbers - Leading 0", FOOTNOTES_PLUGIN_NAME) . $l_str_Space . "01, 02, 03, 04, 05, ...",
function RegisterTab_HowTo_Description() "latin_low" => __("Latin Character - lower case", FOOTNOTES_PLUGIN_NAME) . $l_str_Space . "a, b, c, d, e, ...",
{ "latin_high" => __("Latin Character - upper case", FOOTNOTES_PLUGIN_NAME) . $l_str_Space . "A, B, C, D, E, ...",
echo __( "This is a brief introduction in how to use the plugin.", FOOTNOTES_PLUGIN_NAME ); "romanic" => __("Roman Numerals", FOOTNOTES_PLUGIN_NAME) . $l_str_Space . "I, II, III, IV, V, ..."
} );
$this->AddLabel(FOOTNOTE_INPUTFIELD_COUNTER_STYLE, __('Counter style:', FOOTNOTES_PLUGIN_NAME));
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_COUNTER_STYLE, $l_arr_Options, "footnote_plugin_50");
}
/** /**
* outputs the content of the HowTo settings tab * outputs other footnotes settings that doesn't match a special category
* @since 1.0 * @since 1.0.7
*/ */
function Register_Howto_Box() function Register_MetaBox_Other()
{ {
$l_arr_Footnote_StartingTag = $this->LoadSetting(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START); /* setting for 'search footnotes tag in excerpt' */
$l_arr_Footnote_EndingTag = $this->LoadSetting(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END); $l_arr_Options = array(
?> "yes" => __("Yes", FOOTNOTES_PLUGIN_NAME),
<div style="text-align:center;"> "no" => __("No", FOOTNOTES_PLUGIN_NAME)
<div class="footnote_placeholder_box_container"> );
<p> $this->AddLabel(FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT, __('Allow footnotes on Summarized Posts:', FOOTNOTES_PLUGIN_NAME));
<?php echo __( "Start your footnote with the following shortcode:", FOOTNOTES_PLUGIN_NAME ); ?> $this->AddSelectbox(FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT, $l_arr_Options, "footnote_plugin_50");
<span class="footnote_highlight_placeholder"><?php echo $l_arr_Footnote_StartingTag["value"]; ?></span> $this->AddNewline();
</p>
<p> /* setting for 'love and share this plugin in my footer' */
<?php echo __( "...and end your footnote with this shortcode:", FOOTNOTES_PLUGIN_NAME ); ?> $l_arr_Options = array(
<span class="footnote_highlight_placeholder"><?php echo $l_arr_Footnote_EndingTag["value"]; ?></span> "yes" => __("Yes", FOOTNOTES_PLUGIN_NAME),
</p> "no" => __("No", FOOTNOTES_PLUGIN_NAME)
);
$this->AddLabel(FOOTNOTE_INPUTFIELD_LOVE, sprintf(__("Tell the world you're using %s:", FOOTNOTES_PLUGIN_NAME), FOOTNOTES_PLUGIN_PUBLIC_NAME));
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_LOVE, $l_arr_Options, "footnote_plugin_50");
}
<div class="footnote_placeholder_box_example"> /**
<p> * initialize howto settings tab
<span class="footnote_highlight_placeholder"><?php echo $l_arr_Footnote_StartingTag["value"] . __( "example string", FOOTNOTES_PLUGIN_NAME ) . $l_arr_Footnote_EndingTag["value"]; ?></span> * called in class constructor @ admin_init
<?php echo __( "will be displayed as:", FOOTNOTES_PLUGIN_NAME ); ?> * @since 1.0
&nbsp;&nbsp;&nbsp;&nbsp; * changed layout of settings form settings fields to meta boxes in version 1.0.7
<?php echo footnotes_replaceFootnotes( $l_arr_Footnote_StartingTag["value"] . __( "example string", FOOTNOTES_PLUGIN_NAME ) . $l_arr_Footnote_EndingTag["value"], true, true ); ?> */
</p> function RegisterTab_HowTo()
</div> {
/* add tab to the tab array */
$this->a_arr_SettingsTabs[FOOTNOTE_SETTINGS_LABEL_HOWTO] = __("HowTo", FOOTNOTES_PLUGIN_NAME);
/* register settings tab */
add_settings_section("Footnote_Secion_Settings_Howto", "&nbsp;", array($this, 'RegisterTab_HowTo_Description'), FOOTNOTE_SETTINGS_LABEL_HOWTO);
add_meta_box('Register_MetaBox_HowTo', __("Brief introduction in how to use the plugin", FOOTNOTES_PLUGIN_NAME), array($this, 'Register_MetaBox_HowTo'), FOOTNOTE_SETTINGS_LABEL_HOWTO, 'main');
}
<p> /**
<?php echo sprintf( __( "If you have any questions, please don't hesitate to %se-mail%s us.", FOOTNOTES_PLUGIN_NAME ), '<a href="mailto:mci@cheret.co.uk" class="footnote_plugin">', '</a>' ); ?> * adds a descrption to the HowTo settings tab
</p> * called int RegisterTab_HowTo
</div> * @since 1.0
</div> * removed output of description in version 1.0.7
<?php */
} function RegisterTab_HowTo_Description()
{
// unused
}
/**
* outputs the content of the HowTo settings tab
* @since 1.0
*/
function Register_MetaBox_HowTo()
{
$l_arr_Footnote_StartingTag = $this->LoadSetting(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START);
$l_arr_Footnote_EndingTag = $this->LoadSetting(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END);
?>
<div style="text-align:center;">
<div class="footnote_placeholder_box_container">
<p>
<?php echo __("Start your footnote with the following shortcode:", FOOTNOTES_PLUGIN_NAME); ?>
<span
class="footnote_highlight_placeholder"><?php echo $l_arr_Footnote_StartingTag["value"]; ?></span>
</p>
<p>
<?php echo __("...and end your footnote with this shortcode:", FOOTNOTES_PLUGIN_NAME); ?>
<span
class="footnote_highlight_placeholder"><?php echo $l_arr_Footnote_EndingTag["value"]; ?></span>
</p>
<div class="footnote_placeholder_box_example">
<p>
<span
class="footnote_highlight_placeholder"><?php echo $l_arr_Footnote_StartingTag["value"] . __("example string", FOOTNOTES_PLUGIN_NAME) . $l_arr_Footnote_EndingTag["value"]; ?></span>
<?php echo __("will be displayed as:", FOOTNOTES_PLUGIN_NAME); ?>
&nbsp;&nbsp;&nbsp;&nbsp;
<?php echo footnotes_replaceFootnotes($l_arr_Footnote_StartingTag["value"] . __("example string", FOOTNOTES_PLUGIN_NAME) . $l_arr_Footnote_EndingTag["value"], true, true); ?>
</p>
</div>
<p>
<?php echo sprintf(__("If you have any questions, please don't hesitate to %se-mail%s us.", FOOTNOTES_PLUGIN_NAME), '<a href="mailto:mci@cheret.co.uk" class="footnote_plugin">', '</a>'); ?>
</p>
</div>
</div>
<?php
}
} /* Class Class_FootnotesSettings */ } /* Class Class_FootnotesSettings */

View file

@ -3,135 +3,152 @@
* User: Stefan * User: Stefan
* Date: 15.05.14 * Date: 15.05.14
* Time: 16:21 * Time: 16:21
* Version: 1.0.6 * Version: 1.0.7
* Since: 1.0 * Since: 1.0
*/ */
/*
* styling for the 'footnotes' tag
* @since 1.0.7
*/
.footnote_tag_styling, .footnote_tag_styling:hover {
text-decoration: none;
font-weight: normal;
}
.footnote_tag_styling_1 {
color: #2bb975;
}
.footnote_tag_styling_2 {
color: #545f5a;
}
/* container before the footnote appears at the bottom to get a space between footnote and content */ /* container before the footnote appears at the bottom to get a space between footnote and content */
.footnote_container_prepare { .footnote_container_prepare {
display: block !important; display: block !important;
padding-top: 24px !important; padding-top: 24px !important;
} }
.footnote_container_prepare > p { .footnote_container_prepare > p {
font-size: 1.5em !important; font-size: 1.5em !important;
margin-top: 1em !important; margin-top: 1em !important;
margin-bottom: 0.25em !important; margin-bottom: 0.25em !important;
padding: 0 !important; padding: 0 !important;
line-height: 1.3 !important; line-height: 1.3 !important;
font-weight: normal !important; font-weight: normal !important;
overflow: hidden !important; overflow: hidden !important;
border-bottom: 1px solid #aaaaaa !important; border-bottom: 1px solid #aaaaaa !important;
display: block !important; display: block !important;
-webkit-margin-before: 0.83em !important; -webkit-margin-before: 0.83em !important;
-webkit-margin-after: 0.83em !important; -webkit-margin-after: 0.83em !important;
-webkit-margin-start: 0px !important; -webkit-margin-start: 0px !important;
-webkit-margin-end: 0px !important; -webkit-margin-end: 0px !important;
text-align: left !important; text-align: left !important;
} }
.footnote_container_prepare > p > span { .footnote_container_prepare > p > span {
padding-left: 20px !important; padding-left: 20px !important;
text-align: left !important; text-align: left !important;
cursor: pointer; cursor: pointer;
} }
.footnote_hide_box { .footnote_hide_box {
display:none; display: none;
} }
/* container for the footnote in the bottom */ /* container for the footnote in the bottom */
.footnote_plugin_container { .footnote_plugin_container {
display: block !important; display: block !important;
width: 100% !important; width: 100% !important;
padding-bottom: 14px !important; padding-bottom: 14px !important;
} }
/* footnote (bottom) index */ /* footnote (bottom) index */
.footnote_plugin_index { .footnote_plugin_index {
float: left !important; float: left !important;
min-width: 40px !important; min-width: 40px !important;
white-space: nowrap !important; white-space: nowrap !important;
text-align: right !important; text-align: right !important;
} }
/* footnote (bottom) text */ /* footnote (bottom) text */
.footnote_plugin_text { .footnote_plugin_text {
float: left !important; float: left !important;
padding-left: 16px !important; padding-left: 16px !important;
} }
/* footnote (bottom) link to the footnote implementation */ /* footnote (bottom) link to the footnote implementation */
.footnote_plugin_link { .footnote_plugin_link {
outline: none !important; outline: none !important;
text-decoration: none !important; text-decoration: none !important;
cursor: pointer !important; cursor: pointer !important;
} }
.footnote_plugin_link:hover { .footnote_plugin_link:hover {
color: #4777ff !important; color: #4777ff !important;
text-decoration: none !important; text-decoration: none !important;
} }
/* footnote (bottom) styling end tag */ /* footnote (bottom) styling end tag */
.footnote_plugin_end { .footnote_plugin_end {
clear: left !important; clear: left !important;
} }
/* tooltip */ /* tooltip */
.footnote_plugin_tooltip { .footnote_plugin_tooltip {
outline: none !important; outline: none !important;
color: #4777ff !important; color: #4777ff !important;
text-decoration: none !important; text-decoration: none !important;
cursor: pointer !important; cursor: pointer !important;
} }
.footnote_plugin_tooltip strong { .footnote_plugin_tooltip strong {
line-height: 30px !important; line-height: 30px !important;
} }
.footnote_plugin_tooltip:hover { .footnote_plugin_tooltip:hover {
text-decoration: none !important; text-decoration: none !important;
} }
.footnote_plugin_tooltip span { .footnote_plugin_tooltip span {
z-index: 10 !important; z-index: 10 !important;
display: none !important; display: none !important;
padding: 14px 20px !important; padding: 14px 20px !important;
margin-top: -30px !important; margin-top: -30px !important;
/*margin-left: 28px !important;*/ /*margin-left: 28px !important;*/
/*width: 240px;*/ /*width: 240px;*/
line-height: 16px !important; line-height: 16px !important;
cursor: default; cursor: default;
} }
/* /*
* added width and white-space styling in version 1.0.6 * added width and white-space styling in version 1.0.6
*/ */
.footnote_plugin_tooltip:hover span, .footnote_plugin_tooltip span:hover { .footnote_plugin_tooltip:hover span, .footnote_plugin_tooltip span:hover {
display: inline !important; display: inline !important;
position: absolute !important; position: absolute !important;
color: #474747 !important; color: #474747 !important;
border: 1px solid #ddccaa !important; border: 1px solid #ddccaa !important;
background: #fffaf0 !important; background: #fffaf0 !important;
width: auto; width: auto;
white-space: nowrap; white-space: nowrap;
} }
.callout { .callout {
z-index: 20 !important; z-index: 20 !important;
position: absolute !important; position: absolute !important;
top: 30px !important; top: 30px !important;
border: 0 !important; border: 0 !important;
left: -12px !important; left: -12px !important;
} }
/*CSS3 extras*/ /*CSS3 extras*/
.footnote_plugin_tooltip span { .footnote_plugin_tooltip span {
border-radius: 4px !important; border-radius: 4px !important;
-moz-border-radius: 4px !important; -moz-border-radius: 4px !important;
-webkit-border-radius: 4px !important; -webkit-border-radius: 4px !important;
-moz-box-shadow: 5px 5px 8px #cccccc !important; -moz-box-shadow: 5px 5px 8px #cccccc !important;
-webkit-box-shadow: 5px 5px 8px #cccccc !important; -webkit-box-shadow: 5px 5px 8px #cccccc !important;
box-shadow: 5px 5px 8px #cccccc !important; box-shadow: 5px 5px 8px #cccccc !important;
} }

View file

@ -9,63 +9,87 @@
/* overwrite some styling for inputs [type=text] and select-boxes */ /* overwrite some styling for inputs [type=text] and select-boxes */
input[type=text], input[type=checkbox], input[type=password], textarea, select { input[type=text], input[type=checkbox], input[type=password], textarea, select {
/*margin-left: 12px !important;*/ /*margin-left: 12px !important;*/
} }
input[type=text], input[type=password], textarea, select { input[type=text], input[type=password], textarea, select {
padding-left: 8px !important; padding-left: 8px !important;
padding-right: 8px !important; padding-right: 8px !important;
}
label {
width: 20% !important;
display: inline-block;
}
/*
* layout for the meta box container
* @since 1.0.7
*/
.postbox > h3 {
height: 32px !important;
line-height: 32px !important;
}
.postbox > h3 > span {
padding-left: 10px;
} }
/* overwrite link layout on the settings page */ /* overwrite link layout on the settings page */
a.footnote_plugin { a.footnote_plugin {
text-decoration: underline !important; text-decoration: underline !important;
cursor: pointer !important; cursor: pointer !important;
color: #202020 !important; color: #202020 !important;
}
/* setting with 15% width */
.footnote_plugin_15 {
width: 15% !important;
} }
/* setting with 25% width */ /* setting with 25% width */
.footnote_plugin_25 { .footnote_plugin_25 {
width: 25% !important; width: 25% !important;
} }
/* setting with half width */ /* setting with half width */
.footnote_plugin_50 { .footnote_plugin_50 {
width: 50% !important; width: 50% !important;
} }
/* setting with 75% width */ /* setting with 75% width */
.footnote_plugin_75 { .footnote_plugin_75 {
width: 75% !important; width: 75% !important;
} }
/* setting with full width */ /* setting with full width */
.footnote_plugin_100 { .footnote_plugin_100 {
width: 100% !important; width: 100% !important;
} }
/* container for the box holding the placeholder tags at the end */ /* container for the box holding the placeholder tags at the end */
.footnote_placeholder_box_container { .footnote_placeholder_box_container {
text-align: center !important; text-align: center !important;
/*width: auto; /*width: auto;
display: inline-block; display: inline-block;
padding-left: 20px; padding-left: 20px;
padding-right: 20px; padding-right: 20px;
margin-left: -210px;*/ margin-left: -210px;*/
} }
/* highlight the placeholders */ /* highlight the placeholders */
span.footnote_highlight_placeholder { span.footnote_highlight_placeholder {
font-weight: bold !important; font-weight: bold !important;
padding-left: 8px !important; padding-left: 8px !important;
padding-right: 8px !important; padding-right: 8px !important;
} }
.footnote_placeholder_box_example { .footnote_placeholder_box_example {
border: 2px solid #2bb975 !important; border: 2px solid #2bb975 !important;
border-radius: 4px !important; border-radius: 4px !important;
padding-top: 16px !important; padding-top: 16px !important;
padding-bottom: 16px !important; padding-bottom: 16px !important;
width: 50% !important; width: 50% !important;
display: block !important; display: block !important;
margin: 20px auto !important; margin: 20px auto !important;
} }

View file

@ -16,21 +16,21 @@
* @param string $p_str_ConvertStyle [counter style] * @param string $p_str_ConvertStyle [counter style]
* @return string * @return string
*/ */
function footnote_convert_index($p_int_Index, $p_str_ConvertStyle="arabic_plain") function footnote_convert_index($p_int_Index, $p_str_ConvertStyle = "arabic_plain")
{ {
switch($p_str_ConvertStyle) { switch ($p_str_ConvertStyle) {
case "romanic": case "romanic":
return footnote_convert_to_romanic($p_int_Index); return footnote_convert_to_romanic($p_int_Index);
case "latin_high": case "latin_high":
return footnote_convert_to_latin($p_int_Index, true); return footnote_convert_to_latin($p_int_Index, true);
case "latin_low": case "latin_low":
return footnote_convert_to_latin($p_int_Index, false); return footnote_convert_to_latin($p_int_Index, false);
case "arabic_leading": case "arabic_leading":
return footnote_convert_to_arabic_leading($p_int_Index); return footnote_convert_to_arabic_leading($p_int_Index);
case "arabic_plain": case "arabic_plain":
default: default:
return $p_int_Index; return $p_int_Index;
} }
} }
/** /**
@ -43,29 +43,29 @@ function footnote_convert_index($p_int_Index, $p_str_ConvertStyle="arabic_plain"
*/ */
function footnote_convert_to_latin($p_int_Value, $p_bool_UpperCase) function footnote_convert_to_latin($p_int_Value, $p_bool_UpperCase)
{ {
/* decimal value of the starting ascii character */ /* decimal value of the starting ascii character */
$l_int_StartinAscii = 65-1; // = A $l_int_StartinAscii = 65 - 1; // = A
/* if lower-case, change decimal to lower-case "a" */ /* if lower-case, change decimal to lower-case "a" */
if (!$p_bool_UpperCase) { if (!$p_bool_UpperCase) {
$l_int_StartinAscii = 97-1; // = a $l_int_StartinAscii = 97 - 1; // = a
} }
/* output string */ /* output string */
$l_str_Return = ""; $l_str_Return = "";
$l_int_Offset = 0; $l_int_Offset = 0;
/* check if the value is higher then 26 = Z */ /* check if the value is higher then 26 = Z */
while($p_int_Value > 26) { while ($p_int_Value > 26) {
/* increase offset and reduce counter */ /* increase offset and reduce counter */
$l_int_Offset++; $l_int_Offset++;
$p_int_Value -= 26; $p_int_Value -= 26;
} }
/* if offset set (more then Z), then add a new letter in fron */ /* if offset set (more then Z), then add a new letter in fron */
if ($l_int_Offset > 0) { if ($l_int_Offset > 0) {
$l_str_Return = chr($l_int_Offset + $l_int_StartinAscii); $l_str_Return = chr($l_int_Offset + $l_int_StartinAscii);
} }
/* add the origin letter */ /* add the origin letter */
$l_str_Return .= chr($p_int_Value + $l_int_StartinAscii); $l_str_Return .= chr($p_int_Value + $l_int_StartinAscii);
/* return the latin character representing the integer */ /* return the latin character representing the integer */
return $l_str_Return; return $l_str_Return;
} }
/** /**
@ -76,11 +76,11 @@ function footnote_convert_to_latin($p_int_Value, $p_bool_UpperCase)
*/ */
function footnote_convert_to_arabic_leading($p_int_Value) function footnote_convert_to_arabic_leading($p_int_Value)
{ {
/* add a leading 0 if number lower then 10 */ /* add a leading 0 if number lower then 10 */
if ($p_int_Value < 10) { if ($p_int_Value < 10) {
return "0" . $p_int_Value; return "0" . $p_int_Value;
} }
return $p_int_Value; return $p_int_Value;
} }
/** /**
@ -91,20 +91,20 @@ function footnote_convert_to_arabic_leading($p_int_Value)
*/ */
function footnote_convert_to_romanic($p_int_Value) function footnote_convert_to_romanic($p_int_Value)
{ {
/* table containing all necessary romanic letters */ /* table containing all necessary romanic letters */
$l_arr_RomanicLetters = array('M'=>1000, 'CM'=>900, 'D'=>500, 'CD'=>400, 'C'=>100, 'XC'=>90, 'L'=>50, 'XL'=>40, 'X'=>10, 'IX'=>9, 'V'=>5, 'IV'=>4, 'I'=>1); $l_arr_RomanicLetters = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40, 'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1);
/* return value */ /* return value */
$l_str_Return = ''; $l_str_Return = '';
/* loop through integer value until it is reduced to 0 */ /* loop through integer value until it is reduced to 0 */
while($p_int_Value > 0) { while ($p_int_Value > 0) {
foreach($l_arr_RomanicLetters as $l_str_Romanic => $l_int_Arabic) { foreach ($l_arr_RomanicLetters as $l_str_Romanic => $l_int_Arabic) {
if($p_int_Value >= $l_int_Arabic) { if ($p_int_Value >= $l_int_Arabic) {
$p_int_Value -= $l_int_Arabic; $p_int_Value -= $l_int_Arabic;
$l_str_Return .= $l_str_Romanic; $l_str_Return .= $l_str_Romanic;
break; break;
} }
} }
} }
/* return romanic letters as string */ /* return romanic letters as string */
return $l_str_Return; return $l_str_Return;
} }

View file

@ -8,31 +8,42 @@
* Since: 1.0 * Since: 1.0
*/ */
/*
* PLUGIN PUBLIC NAME WITH STYLING
* @since 1.0.7
*/
define("FOOTNOTES_PLUGIN_PUBLIC_NAME", '<span class="footnote_tag_styling footnote_tag_styling_1">foot</span><span class="footnote_tag_styling footnote_tag_styling_2">notes</span>');
/* GENERAL PLUGIN CONSTANTS */ /* GENERAL PLUGIN CONSTANTS */
define( "FOOTNOTES_PLUGIN_NAME", "footnotes" ); /* plugin's internal name */ define("FOOTNOTES_PLUGIN_NAME", "footnotes"); /* plugin's internal name */
define( "FOOTNOTE_SETTINGS_CONTAINER", "footnotes_storage" ); /* database container where all footnote settings are stored */ define("FOOTNOTE_SETTINGS_CONTAINER", "footnotes_storage"); /* database container where all footnote settings are stored */
/* PLUGIN SETTINGS PAGE */ /* PLUGIN SETTINGS PAGE */
define( "FOOTNOTES_SETTINGS_PAGE_ID", "footnotes" ); /* plugin's setting page internal id */ define("FOOTNOTES_SETTINGS_PAGE_ID", "footnotes"); /* plugin's setting page internal id */
/* PLUGIN SETTINGS PAGE TABS */ /* PLUGIN SETTINGS PAGE TABS */
define( "FOOTNOTE_SETTINGS_LABEL_GENERAL", "footnotes_general_settings" ); /* internal label for the plugin's settings tab */ define("FOOTNOTE_SETTINGS_LABEL_GENERAL", "footnotes_general_settings"); /* internal label for the plugin's settings tab */
define( "FOOTNOTE_SETTINGS_LABEL_HOWTO", "footnotes_howto" ); /* internal label for the plugin's settings tab */ define("FOOTNOTE_SETTINGS_LABEL_HOWTO", "footnotes_howto"); /* internal label for the plugin's settings tab */
/* PLUGIN SETTINGS INPUT FIELDS */ /* PLUGIN SETTINGS INPUT FIELDS */
define( "FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL", "footnote_inputfield_combine_identical" ); /* id of input field for the combine identical setting */ define("FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL", "footnote_inputfield_combine_identical"); /* id of input field for the combine identical setting */
define( "FOOTNOTE_INPUTFIELD_REFERENCES_LABEL", "footnote_inputfield_references_label" ); /* id of input field for the references label setting */ define("FOOTNOTE_INPUTFIELD_REFERENCES_LABEL", "footnote_inputfield_references_label"); /* id of input field for the references label setting */
define( "FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES", "footnote_inputfield_collapse_references" ); /* id of input field for the "collapse references" setting */ define("FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES", "footnote_inputfield_collapse_references"); /* id of input field for the "collapse references" setting */
define( "FOOTNOTE_INPUTFIELD_PLACEHOLDER_START", "footnote_inputfield_placeholder_start"); /* id of input field for the "placeholder starting tag" setting */ define("FOOTNOTE_INPUTFIELD_PLACEHOLDER_START", "footnote_inputfield_placeholder_start"); /* id of input field for the "placeholder starting tag" setting */
define( "FOOTNOTE_INPUTFIELD_PLACEHOLDER_END", "footnote_inputfield_placeholder_end"); /* id of input field for the "placeholder ending tag" setting */ define("FOOTNOTE_INPUTFIELD_PLACEHOLDER_END", "footnote_inputfield_placeholder_end"); /* id of input field for the "placeholder ending tag" setting */
define( "FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT", "footnote_inputfield_search_in_excerpt"); /* id of input field for the "allow footnotes in the excerpt" setting */ define("FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT", "footnote_inputfield_search_in_excerpt"); /* id of input field for the "allow footnotes in the excerpt" setting */
define( "FOOTNOTE_INPUTFIELD_LOVE", "footnote_inputfield_love"); /* id of input field for "love and share this plugin" setting */ define("FOOTNOTE_INPUTFIELD_LOVE", "footnote_inputfield_love"); /* id of input field for "love and share this plugin" setting */
define( "FOOTNOTE_INPUTFIELD_COUNTER_STYLE", "footnote_inputfield_counter_style"); /* id of input field for "counter style of footnote index" setting */ define("FOOTNOTE_INPUTFIELD_COUNTER_STYLE", "footnote_inputfield_counter_style"); /* id of input field for "counter style of footnote index" setting */
/*
* id of input field "placement of reference container" setting
* @since 1.0.7
*/
define("FOOTNOTE_INPUTFIELD_REFERENCE_CONTAINER_PLACE", "footnote_inputfield_reference_container_place");
/* PLUGIN REFERENCES CONTAINER ID */ /* PLUGIN REFERENCES CONTAINER ID */
define( "FOOTNOTE_REFERENCES_CONTAINER_ID", "footnote_references_container" ); /* id for the div surrounding the footnotes */ define("FOOTNOTE_REFERENCES_CONTAINER_ID", "footnote_references_container"); /* id for the div surrounding the footnotes */
/* PLUGIN DIRECTORIES */ /* PLUGIN DIRECTORIES */
define( "FOOTNOTES_PLUGIN_DIR_NAME", "footnotes" ); define("FOOTNOTES_PLUGIN_DIR_NAME", "footnotes");
define( "FOOTNOTES_LANGUAGE_DIR", dirname( __FILE__ ) . "/../languages/" ); define("FOOTNOTES_LANGUAGE_DIR", dirname(__FILE__) . "/../languages/");
define( "FOOTNOTES_TEMPLATES_DIR", dirname( __FILE__ ) . "/../templates/" ); define("FOOTNOTES_TEMPLATES_DIR", dirname(__FILE__) . "/../templates/");

View file

@ -16,21 +16,21 @@
*/ */
function footnotes_load_language() function footnotes_load_language()
{ {
/* read current wordpress langauge */ /* read current wordpress langauge */
$l_str_locale = apply_filters( 'plugin_locale', get_locale(), FOOTNOTES_PLUGIN_NAME ); $l_str_locale = apply_filters('plugin_locale', get_locale(), FOOTNOTES_PLUGIN_NAME);
/* get only language code (removed localization code) */ /* get only language code (removed localization code) */
$l_str_languageCode = footnotes_getLanguageCode(); $l_str_languageCode = footnotes_getLanguageCode();
/* language file with localization exists */ /* language file with localization exists */
if ( $l_bool_loaded = load_textdomain( FOOTNOTES_PLUGIN_NAME, FOOTNOTES_LANGUAGE_DIR . FOOTNOTES_PLUGIN_NAME . '-' . $l_str_locale . '.mo' ) ) { if ($l_bool_loaded = load_textdomain(FOOTNOTES_PLUGIN_NAME, FOOTNOTES_LANGUAGE_DIR . FOOTNOTES_PLUGIN_NAME . '-' . $l_str_locale . '.mo')) {
/* language file without localization exists */ /* language file without localization exists */
} else if ( $l_bool_loaded = load_textdomain( FOOTNOTES_PLUGIN_NAME, FOOTNOTES_LANGUAGE_DIR . FOOTNOTES_PLUGIN_NAME . '-' . $l_str_languageCode . '.mo' ) ) { } else if ($l_bool_loaded = load_textdomain(FOOTNOTES_PLUGIN_NAME, FOOTNOTES_LANGUAGE_DIR . FOOTNOTES_PLUGIN_NAME . '-' . $l_str_languageCode . '.mo')) {
/* load default language file, nothing will happen: default language will be used (=english) */ /* load default language file, nothing will happen: default language will be used (=english) */
} else { } else {
load_textdomain( FOOTNOTES_PLUGIN_NAME, FOOTNOTES_LANGUAGE_DIR . FOOTNOTES_PLUGIN_NAME . '-en.mo' ); load_textdomain(FOOTNOTES_PLUGIN_NAME, FOOTNOTES_LANGUAGE_DIR . FOOTNOTES_PLUGIN_NAME . '-en.mo');
} }
} }
/** /**
@ -41,15 +41,15 @@ function footnotes_load_language()
*/ */
function footnotes_getLanguageCode() function footnotes_getLanguageCode()
{ {
/* read current wordpress langauge */ /* read current wordpress langauge */
$l_str_locale = apply_filters( 'plugin_locale', get_locale(), FOOTNOTES_PLUGIN_NAME ); $l_str_locale = apply_filters('plugin_locale', get_locale(), FOOTNOTES_PLUGIN_NAME);
/* check if wordpress language has a localization (e.g. "en_US" or "de_AT") */ /* check if wordpress language has a localization (e.g. "en_US" or "de_AT") */
if ( strpos( $l_str_locale, "_" ) !== false ) { if (strpos($l_str_locale, "_") !== false) {
/* remove localization code */ /* remove localization code */
$l_arr_languageCode = explode( "_", $l_str_locale ); $l_arr_languageCode = explode("_", $l_str_locale);
$l_str_languageCode = $l_arr_languageCode[ 0 ]; $l_str_languageCode = $l_arr_languageCode[0];
return $l_str_languageCode; return $l_str_languageCode;
} }
/* return language code lowercase */ /* return language code lowercase */
return strtolower( $l_str_locale ); return strtolower($l_str_locale);
} }

View file

@ -16,14 +16,14 @@
* @param mixed $file * @param mixed $file
* @return array * @return array
*/ */
function footnotes_plugin_settings_link( $links, $file ) function footnotes_plugin_settings_link($links, $file)
{ {
/* add link to the /forms.contact plugin's settings page */ /* add link to the /forms.contact plugin's settings page */
$settings_link = '<a href="' . admin_url( 'options-general.php?page=' . FOOTNOTES_SETTINGS_PAGE_ID ) . '">' . __( 'Settings', FOOTNOTES_PLUGIN_NAME ) . '</a>'; $settings_link = '<a href="' . admin_url('options-general.php?page=' . FOOTNOTES_SETTINGS_PAGE_ID) . '">' . __('Settings', FOOTNOTES_PLUGIN_NAME) . '</a>';
array_unshift( $links, $settings_link ); array_unshift($links, $settings_link);
/* return new links */ /* return new links */
return $links; return $links;
} }
@ -36,29 +36,29 @@ function footnotes_plugin_settings_link( $links, $file )
* @param bool $p_bool_ConvertHtmlChars * @param bool $p_bool_ConvertHtmlChars
* @return array * @return array
*/ */
function footnotes_filter_options( $p_str_OptionsField, $p_arr_DefaultValues, $p_bool_ConvertHtmlChars=true ) function footnotes_filter_options($p_str_OptionsField, $p_arr_DefaultValues, $p_bool_ConvertHtmlChars = true)
{ {
$l_arr_Options = get_option( $p_str_OptionsField ); $l_arr_Options = get_option($p_str_OptionsField);
/* loop through all keys in the array and filters them */ /* loop through all keys in the array and filters them */
foreach ( $l_arr_Options as $l_str_Key => $l_str_Value ) { foreach ($l_arr_Options as $l_str_Key => $l_str_Value) {
/* removes special chars from the settings value */ /* removes special chars from the settings value */
$l_str_Value = stripcslashes( $l_str_Value ); $l_str_Value = stripcslashes($l_str_Value);
/* if set, convert html special chars */ /* if set, convert html special chars */
if ($p_bool_ConvertHtmlChars) { if ($p_bool_ConvertHtmlChars) {
$l_str_Value = htmlspecialchars( $l_str_Value ); $l_str_Value = htmlspecialchars($l_str_Value);
} }
/* check if settings value is not empty, otherwise load the default value, or empty string if no default is defined */ /* check if settings value is not empty, otherwise load the default value, or empty string if no default is defined */
if (!empty($l_str_Value)) { if (!empty($l_str_Value)) {
$l_arr_Options[ $l_str_Key ] = stripcslashes( $l_str_Value ); $l_arr_Options[$l_str_Key] = stripcslashes($l_str_Value);
/* check if default value is defined */ /* check if default value is defined */
} else if (array_key_exists($l_str_Key, $p_arr_DefaultValues)) { } else if (array_key_exists($l_str_Key, $p_arr_DefaultValues)) {
$l_arr_Options[ $l_str_Key ] = $p_arr_DefaultValues[$l_str_Key]; $l_arr_Options[$l_str_Key] = $p_arr_DefaultValues[$l_str_Key];
} else { } else {
$l_arr_Options[ $l_str_Key ] = ""; $l_arr_Options[$l_str_Key] = "";
} }
} }
/* returns the filtered array */ /* returns the filtered array */
return $l_arr_Options; return $l_arr_Options;
} }
/** /**
@ -67,18 +67,19 @@ function footnotes_filter_options( $p_str_OptionsField, $p_arr_DefaultValues, $p
* @param string $p_str_Value * @param string $p_str_Value
* @return bool * @return bool
*/ */
function footnotes_ConvertToBool($p_str_Value) { function footnotes_ConvertToBool($p_str_Value)
/* convert string to lower-case to make it easier */ {
$p_str_Value = strtolower($p_str_Value); /* convert string to lower-case to make it easier */
/* check if string seems to contain a "true" value */ $p_str_Value = strtolower($p_str_Value);
switch($p_str_Value) { /* check if string seems to contain a "true" value */
case "checked": switch ($p_str_Value) {
case "yes": case "checked":
case "true": case "yes":
case "on": case "true":
case "1": case "on":
return true; case "1":
} return true;
/* nothing found that says "true", so we return false */ }
return false; /* nothing found that says "true", so we return false */
return false;
} }

View file

@ -4,7 +4,7 @@
* User: Stefan * User: Stefan
* Date: 15.05.14 * Date: 15.05.14
* Time: 16:21 * Time: 16:21
* Version: 1.0.6 * Version: 1.0.7
* Since: 1.0 * Since: 1.0
*/ */
@ -20,77 +20,138 @@ $g_arr_Footnotes = array();
*/ */
$g_arr_FootnotesSettings = array(); $g_arr_FootnotesSettings = array();
/*
* flag to know if the replacement already started for the current page
* @since 1.0.7
*/
$g_bool_FootnotesReplacementStarted = false;
/** /**
* register all functions needed for the replacement in the wordpress core * register all functions needed for the replacement in the wordpress core
* @since 1.0-gamma * @since 1.0-gamma
*/ */
function footnotes_RegisterReplacementFunctions() { function footnotes_RegisterReplacementFunctions()
/* access to the global settings collection */ {
global $g_arr_FootnotesSettings; /* access to the global settings collection */
/* load footnote settings */ global $g_arr_FootnotesSettings;
$g_arr_FootnotesSettings = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER, Class_FootnotesSettings::$a_arr_Default_Settings, false ); /* load footnote settings */
/* get setting for accepting footnotes in the excerpt and convert it to boolean */ $g_arr_FootnotesSettings = footnotes_filter_options(FOOTNOTE_SETTINGS_CONTAINER, Class_FootnotesSettings::$a_arr_Default_Settings, false);
$l_bool_SearchExcerpt = footnotes_ConvertToBool($g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT ]);
/* calls the wordpress filter function to replace page content before displayed on public pages */ /* starts listening to the output for replacement */
add_filter( 'the_content', 'footnotes_startReplacing' ); add_action('wp_head', 'footnotes_startReplacing');
/* search in the excerpt only if activated */ /* stops listening to the output and replaces the footnotes */
if ($l_bool_SearchExcerpt) { add_action('get_footer', 'footnotes_StopReplacing');
add_filter( 'the_excerpt', 'footnotes_DummyReplacing' );
}
/* calls the wordpress filter function to replace widget text before displayed on public pages */ /* moves these contents through the replacement function */
add_filter( 'widget_title', 'footnotes_DummyReplacing' ); add_filter('the_content', 'footnotes_Replacer_Content');
add_filter( 'widget_text', 'footnotes_DummyReplacing' ); add_filter('the_excerpt', 'footnotes_Replacer_Excerpt');
add_filter('widget_title', 'footnotes_Replacer_WidgetTitle');
add_filter('widget_text', 'footnotes_Replacer_WidgetText');
/* calls the wordpress action to display the footer */ /* adds the love and share me slug to the footer */
add_action( 'get_footer', 'footnotes_StopReplacing' ); add_filter('wp_footer', 'footnotes_LoveAndShareMe');
/* get setting for love and share this plugin and convert it to boolean */ }
$l_bool_LoveMe = footnotes_ConvertToBool($g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_LOVE ]);
/* check if the admin allows to add a link to the footer */ /**
if ($l_bool_LoveMe) { * replacement action for the_excerpt
/* calls the wordpress action to hook to the footer */ * @param string $p_str_Content
add_filter('wp_footer', 'footnotes_LoveAndShareMe', 0); * @return string
} * @since 1.0.7
*/
function footnotes_Replacer_Content($p_str_Content)
{
/* access to the global settings collection */
global $g_arr_FootnotesSettings;
/* get setting for 'display reference container position' */
$l_str_ReferenceContainerPosition = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT];
/* check if reference container should be displayed at the end of a post */
if ($l_str_ReferenceContainerPosition == "post_end") {
footnotes_StopReplacing();
footnotes_startReplacing();
}
/* returns content */
return $p_str_Content;
}
/**
* replacement action for the_excerpt
* @param string $p_str_Content
* @return string
* @since 1.0.7
*/
function footnotes_Replacer_Excerpt($p_str_Content)
{
/* access to the global settings collection */
global $g_arr_FootnotesSettings;
/* get setting for accepting footnotes in the excerpt and convert it to boolean */
$l_bool_SearchExcerpt = footnotes_ConvertToBool($g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT]);
/* search in the excerpt only if activated */
if ($l_bool_SearchExcerpt) {
footnotes_StopReplacing();
footnotes_startReplacing();
}
/* returns content */
return $p_str_Content;
}
/**
* replacement action for widget_title
* @param string $p_str_Content
* @return string
* @since 1.0.7
*/
function footnotes_Replacer_WidgetTitle($p_str_Content)
{
/* returns content */
return $p_str_Content;
}
/**
* replacement action for widget_text
* @param string $p_str_Content
* @return string
* @since 1.0.7
*/
function footnotes_Replacer_WidgetText($p_str_Content)
{
/* returns content */
return $p_str_Content;
} }
/** /**
* starts listening for footnotes to be replaced * starts listening for footnotes to be replaced
* output will be buffered and not displayed * output will be buffered and not displayed
* @since 1.0 * @since 1.0
* @param string $p_str_Content * added flag to only start 'stopping output' once in version 1.0.7
* @return string
*/ */
function footnotes_startReplacing( $p_str_Content ) function footnotes_startReplacing()
{ {
/* stop the output and move it to a buffer instead, defines a callback function */ /* global access to the replacement flag */
ob_start( "footnotes_replaceFootnotes" ); global $g_bool_FootnotesReplacementStarted;
/* return unchanged content */ /* stop output if flag is not set yet */
return $p_str_Content; if (!$g_bool_FootnotesReplacementStarted) {
} /* stop the output and move it to a buffer instead, defines a callback function */
ob_start("footnotes_replaceFootnotes");
/** /* set flag to only start stopping the output once */
* dummy function to add the content to the buffer instead of output it $g_bool_FootnotesReplacementStarted = true;
* @since 1.0 }
* @param string $p_str_Content
* @return string
*/
function footnotes_DummyReplacing( $p_str_Content )
{
/* return unchanged content */
return $p_str_Content;
} }
/** /**
* stops buffering the output, automatically calls the ob_start() defined callback function * stops buffering the output, automatically calls the ob_start() defined callback function
* replaces all footnotes in the whole buffer and outputs it * replaces all footnotes in the whole buffer and outputs it
* @since 1.0 * @since 1.0
* cleared the flag in version 1.0.7
*/ */
function footnotes_StopReplacing() function footnotes_StopReplacing()
{ {
/* calls the callback function defined in ob_start(); */ /* global access to the replacement flag */
ob_end_flush(); global $g_bool_FootnotesReplacementStarted;
/* un-set the flag as soon as the replacement function stops and the content will be displayed */
$g_bool_FootnotesReplacementStarted = false;
/* calls the callback function defined in ob_start(); */
ob_end_flush();
} }
/** /**
@ -99,16 +160,26 @@ function footnotes_StopReplacing()
*/ */
function footnotes_LoveAndShareMe() function footnotes_LoveAndShareMe()
{ {
/* /* access to the global settings collection */
* updated url to wordpress.org plugin page instead of the github page global $g_arr_FootnotesSettings;
* also updated the font-style and translation the string "footnotes" /*
* in version 1.0.6 * updated url to wordpress.org plugin page instead of the github page
*/ * also updated the font-style and translation the string "footnotes"
echo ' * in version 1.0.6
<div style="text-align:center; color:#acacac;">'. */
sprintf(__("Hey there, I'm using the awesome WordPress Plugin called %s", FOOTNOTES_PLUGIN_NAME), '<a href="http://wordpress.org/plugins/footnotes/" target="_blank" style="text-decoration: none;"><span style="color: #2bb975;">foot</span><span style="color: #545f5a;">notes</span></a>'). /*
'</div>' * changed replacement of public plugin name to use global styling setting
; * @since 1.0.7
*/
/* get setting for love and share this plugin and convert it to boolean */
$l_bool_LoveMe = footnotes_ConvertToBool($g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_LOVE]);
/* check if the admin allows to add a link to the footer */
if ($l_bool_LoveMe) {
echo '
<div style="text-align:center; color:#acacac;">' .
sprintf(__("Hey there, I'm using the awesome WordPress Plugin called %s", FOOTNOTES_PLUGIN_NAME), '<a href="http://wordpress.org/plugins/footnotes/" target="_blank" style="text-decoration: none;">' . FOOTNOTES_PLUGIN_PUBLIC_NAME . '</a>') .
'</div>';
}
} }
/** /**
@ -116,29 +187,29 @@ function footnotes_LoveAndShareMe()
* loading settings if not happened yet since 1.0-gamma * loading settings if not happened yet since 1.0-gamma
* @since 1.0 * @since 1.0
* @param string $p_str_Content * @param string $p_str_Content
* @param bool $p_bool_OutputReferences [default: true] * @param bool $p_bool_OutputReferences [default: true]
* @param bool $p_bool_ReplaceHtmlChars [ default: false] * @param bool $p_bool_ReplaceHtmlChars [ default: false]
* @return string * @return string
*/ */
function footnotes_replaceFootnotes( $p_str_Content, $p_bool_OutputReferences = true, $p_bool_ReplaceHtmlChars = false ) function footnotes_replaceFootnotes($p_str_Content, $p_bool_OutputReferences = true, $p_bool_ReplaceHtmlChars = false)
{ {
/* get access to the global array */ /* get access to the global array */
global $g_arr_Footnotes; global $g_arr_Footnotes;
/* access to the global settings collection */ /* access to the global settings collection */
global $g_arr_FootnotesSettings; global $g_arr_FootnotesSettings;
/* load footnote settings */ /* load footnote settings */
$g_arr_FootnotesSettings = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER, Class_FootnotesSettings::$a_arr_Default_Settings, $p_bool_ReplaceHtmlChars ); $g_arr_FootnotesSettings = footnotes_filter_options(FOOTNOTE_SETTINGS_CONTAINER, Class_FootnotesSettings::$a_arr_Default_Settings, $p_bool_ReplaceHtmlChars);
/* replace all footnotes in the content */ /* replace all footnotes in the content */
$p_str_Content = footnotes_getFromString( $p_str_Content ); $p_str_Content = footnotes_getFromString($p_str_Content);
/* add the reference list if set */ /* add the reference list if set */
if ( $p_bool_OutputReferences ) { if ($p_bool_OutputReferences) {
$p_str_Content = $p_str_Content . footnotes_OutputReferenceContainer(); $p_str_Content = $p_str_Content . footnotes_OutputReferenceContainer();
/* free all found footnotes if reference container will be displayed */ /* free all found footnotes if reference container will be displayed */
$g_arr_Footnotes = array(); $g_arr_Footnotes = array();
} }
/* return the replaced content */ /* return the replaced content */
return $p_str_Content; return $p_str_Content;
} }
/** /**
@ -148,62 +219,62 @@ function footnotes_replaceFootnotes( $p_str_Content, $p_bool_OutputReferences =
* @param string $p_str_Content * @param string $p_str_Content
* @return string * @return string
*/ */
function footnotes_getFromString( $p_str_Content ) function footnotes_getFromString($p_str_Content)
{ {
/* get access to the global array to store footnotes */ /* get access to the global array to store footnotes */
global $g_arr_Footnotes; global $g_arr_Footnotes;
/* access to the global settings collection */ /* access to the global settings collection */
global $g_arr_FootnotesSettings; global $g_arr_FootnotesSettings;
/* contains the index for the next footnote on this page */ /* contains the index for the next footnote on this page */
$l_int_FootnoteIndex = 1; $l_int_FootnoteIndex = 1;
/* contains the starting position for the lookup of a footnote */ /* contains the starting position for the lookup of a footnote */
$l_int_PosStart = 0; $l_int_PosStart = 0;
/* contains the footnote template */ /* contains the footnote template */
$l_str_FootnoteTemplate = file_get_contents( FOOTNOTES_TEMPLATES_DIR . "footnote.html" ); $l_str_FootnoteTemplate = file_get_contents(FOOTNOTES_TEMPLATES_DIR . "footnote.html");
/* get footnote starting tag */ /* get footnote starting tag */
$l_str_StartingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_START]; $l_str_StartingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_START];
/*get footnote ending tag */ /*get footnote ending tag */
$l_str_EndingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_END]; $l_str_EndingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_END];
/*get footnote counter style */ /*get footnote counter style */
$l_str_CounterStyle = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_COUNTER_STYLE]; $l_str_CounterStyle = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_COUNTER_STYLE];
/* check for a footnote placeholder in the current page */ /* check for a footnote placeholder in the current page */
do { do {
/* get first occurence of a footnote starting tag */ /* get first occurence of a footnote starting tag */
$l_int_PosStart = strpos( $p_str_Content, $l_str_StartingTag, $l_int_PosStart ); $l_int_PosStart = strpos($p_str_Content, $l_str_StartingTag, $l_int_PosStart);
/* tag found */ /* tag found */
if ( $l_int_PosStart !== false ) { if ($l_int_PosStart !== false) {
/* get first occurence of a footnote ending tag after the starting tag */ /* get first occurence of a footnote ending tag after the starting tag */
$l_int_PosEnd = strpos( $p_str_Content, $l_str_EndingTag, $l_int_PosStart ); $l_int_PosEnd = strpos($p_str_Content, $l_str_EndingTag, $l_int_PosStart);
/* tag found */ /* tag found */
if ( $l_int_PosEnd !== false ) { if ($l_int_PosEnd !== false) {
/* get length of footnote text */ /* get length of footnote text */
$l_int_Length = $l_int_PosEnd - $l_int_PosStart; $l_int_Length = $l_int_PosEnd - $l_int_PosStart;
/* get text inside footnote */ /* get text inside footnote */
$l_str_FootnoteText = substr( $p_str_Content, $l_int_PosStart + strlen( $l_str_StartingTag ), $l_int_Length - strlen( $l_str_StartingTag ) ); $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag));
/* set replacer for the footnote */ /* set replacer for the footnote */
$l_str_ReplaceText = str_replace( "[[FOOTNOTE INDEX]]", footnote_convert_index($l_int_FootnoteIndex,$l_str_CounterStyle), $l_str_FootnoteTemplate ); $l_str_ReplaceText = str_replace("[[FOOTNOTE INDEX]]", footnote_convert_index($l_int_FootnoteIndex, $l_str_CounterStyle), $l_str_FootnoteTemplate);
$l_str_ReplaceText = str_replace( "[[FOOTNOTE TEXT]]", $l_str_FootnoteText, $l_str_ReplaceText ); $l_str_ReplaceText = str_replace("[[FOOTNOTE TEXT]]", $l_str_FootnoteText, $l_str_ReplaceText);
/* replace footnote in content */ /* replace footnote in content */
$p_str_Content = substr_replace( $p_str_Content, $l_str_ReplaceText, $l_int_PosStart, $l_int_Length + strlen( $l_str_EndingTag ) ); $p_str_Content = substr_replace($p_str_Content, $l_str_ReplaceText, $l_int_PosStart, $l_int_Length + strlen($l_str_EndingTag));
/* set footnote to the output box at the end */ /* set footnote to the output box at the end */
$g_arr_Footnotes[ ] = $l_str_FootnoteText; $g_arr_Footnotes[] = $l_str_FootnoteText;
/* increase footnote index */ /* increase footnote index */
$l_int_FootnoteIndex++; $l_int_FootnoteIndex++;
/* add offset to the new starting position */ /* add offset to the new starting position */
$l_int_PosStart += ( $l_int_PosEnd - $l_int_PosStart ); $l_int_PosStart += ($l_int_PosEnd - $l_int_PosStart);
/* no ending tag found */ /* no ending tag found */
} else { } else {
$l_int_PosStart++; $l_int_PosStart++;
} }
/* no starting tag found */ /* no starting tag found */
} else { } else {
break; break;
} }
} while ( true ); } while (true);
/* return content */ /* return content */
return $p_str_Content; return $p_str_Content;
} }
/** /**
@ -215,82 +286,82 @@ function footnotes_getFromString( $p_str_Content )
*/ */
function footnotes_OutputReferenceContainer() function footnotes_OutputReferenceContainer()
{ {
/* get access to the global array to read footnotes */ /* get access to the global array to read footnotes */
global $g_arr_Footnotes; global $g_arr_Footnotes;
/* access to the global settings collection */ /* access to the global settings collection */
global $g_arr_FootnotesSettings; global $g_arr_FootnotesSettings;
/* no footnotes has been replaced on this page */ /* no footnotes has been replaced on this page */
if ( empty( $g_arr_Footnotes ) ) { if (empty($g_arr_Footnotes)) {
/* return empty string */ /* return empty string */
return ""; return "";
} }
/* get setting for combine identical footnotes and convert it to boolean */ /* get setting for combine identical footnotes and convert it to boolean */
$l_bool_CombineIdentical = footnotes_ConvertToBool($g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL ]); $l_bool_CombineIdentical = footnotes_ConvertToBool($g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL]);
/* get setting for preferences label */ /* get setting for preferences label */
$l_str_ReferencesLabel = $g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_REFERENCES_LABEL ]; $l_str_ReferencesLabel = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_REFERENCES_LABEL];
/* get setting for collapse reference footnotes and convert it to boolean */ /* get setting for collapse reference footnotes and convert it to boolean */
$l_bool_CollapseReference = footnotes_ConvertToBool($g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES ]); $l_bool_CollapseReference = footnotes_ConvertToBool($g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES]);
/*get footnote counter style */ /*get footnote counter style */
$l_str_CounterStyle = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_COUNTER_STYLE]; $l_str_CounterStyle = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_COUNTER_STYLE];
/* output string, prepare it with the reference label as headline */ /* output string, prepare it with the reference label as headline */
$l_str_Output = '<div class="footnote_container_prepare"><p><span onclick="footnote_expand_reference_container(\"\");">' . $l_str_ReferencesLabel . '</span></p></div>'; $l_str_Output = '<div class="footnote_container_prepare"><p><span onclick="footnote_expand_reference_container(\"\");">' . $l_str_ReferencesLabel . '</span></p></div>';
/* add a box around the footnotes */ /* add a box around the footnotes */
$l_str_Output .= '<div id="'.FOOTNOTE_REFERENCES_CONTAINER_ID.'"'; $l_str_Output .= '<div id="' . FOOTNOTE_REFERENCES_CONTAINER_ID . '"';
/* add class to hide the references by default, if the user wants it */ /* add class to hide the references by default, if the user wants it */
if ($l_bool_CollapseReference) { if ($l_bool_CollapseReference) {
$l_str_Output .= ' class="footnote_hide_box"'; $l_str_Output .= ' class="footnote_hide_box"';
} }
$l_str_Output .= '>'; $l_str_Output .= '>';
/* contains the footnote template */ /* contains the footnote template */
$l_str_FootnoteTemplate = file_get_contents( FOOTNOTES_TEMPLATES_DIR . "container.html" ); $l_str_FootnoteTemplate = file_get_contents(FOOTNOTES_TEMPLATES_DIR . "container.html");
/* loop through all footnotes found in the page */ /* loop through all footnotes found in the page */
for ( $l_str_Index = 0; $l_str_Index < count( $g_arr_Footnotes ); $l_str_Index++ ) { for ($l_str_Index = 0; $l_str_Index < count($g_arr_Footnotes); $l_str_Index++) {
/* get footnote text */ /* get footnote text */
$l_str_FootnoteText = $g_arr_Footnotes[ $l_str_Index ]; $l_str_FootnoteText = $g_arr_Footnotes[$l_str_Index];
/* if fottnote is empty, get to the next one */ /* if fottnote is empty, get to the next one */
if ( empty( $l_str_FootnoteText ) ) { if (empty($l_str_FootnoteText)) {
continue; continue;
} }
/* get footnote index */ /* get footnote index */
$l_str_FirstFootnoteIndex = ( $l_str_Index + 1 ); $l_str_FirstFootnoteIndex = ($l_str_Index + 1);
$l_str_FootnoteIndex = footnote_convert_index(( $l_str_Index + 1 ),$l_str_CounterStyle); $l_str_FootnoteIndex = footnote_convert_index(($l_str_Index + 1), $l_str_CounterStyle);
/* check if it isn't the last footnote in the array */ /* check if it isn't the last footnote in the array */
if ( $l_str_FirstFootnoteIndex < count( $g_arr_Footnotes ) && $l_bool_CombineIdentical ) { if ($l_str_FirstFootnoteIndex < count($g_arr_Footnotes) && $l_bool_CombineIdentical) {
/* get all footnotes that I haven't passed yet */ /* get all footnotes that I haven't passed yet */
for ( $l_str_CheckIndex = $l_str_FirstFootnoteIndex; $l_str_CheckIndex < count( $g_arr_Footnotes ); $l_str_CheckIndex++ ) { for ($l_str_CheckIndex = $l_str_FirstFootnoteIndex; $l_str_CheckIndex < count($g_arr_Footnotes); $l_str_CheckIndex++) {
/* check if a further footnote is the same as the actual one */ /* check if a further footnote is the same as the actual one */
if ( $l_str_FootnoteText == $g_arr_Footnotes[ $l_str_CheckIndex ] ) { if ($l_str_FootnoteText == $g_arr_Footnotes[$l_str_CheckIndex]) {
/* set the further footnote as empty so it won't be displayed later */ /* set the further footnote as empty so it won't be displayed later */
$g_arr_Footnotes[ $l_str_CheckIndex ] = ""; $g_arr_Footnotes[$l_str_CheckIndex] = "";
/* add the footnote index to the actual index */ /* add the footnote index to the actual index */
$l_str_FootnoteIndex .= ", " . footnote_convert_index(( $l_str_CheckIndex + 1 ),$l_str_CounterStyle); $l_str_FootnoteIndex .= ", " . footnote_convert_index(($l_str_CheckIndex + 1), $l_str_CounterStyle);
} }
} }
} }
/* add the footnote to the output box */ /* add the footnote to the output box */
/* /*
* added function to convert the counter style in the reference container (bugfix for the link to the footnote) in version 1.0.6 * added function to convert the counter style in the reference container (bugfix for the link to the footnote) in version 1.0.6
*/ */
$l_str_ReplaceText = str_replace( "[[FOOTNOTE INDEX SHORT]]", footnote_convert_index($l_str_FirstFootnoteIndex,$l_str_CounterStyle), $l_str_FootnoteTemplate ); $l_str_ReplaceText = str_replace("[[FOOTNOTE INDEX SHORT]]", footnote_convert_index($l_str_FirstFootnoteIndex, $l_str_CounterStyle), $l_str_FootnoteTemplate);
$l_str_ReplaceText = str_replace( "[[FOOTNOTE INDEX]]", $l_str_FootnoteIndex, $l_str_ReplaceText ); $l_str_ReplaceText = str_replace("[[FOOTNOTE INDEX]]", $l_str_FootnoteIndex, $l_str_ReplaceText);
$l_str_ReplaceText = str_replace( "[[FOOTNOTE TEXT]]", $l_str_FootnoteText, $l_str_ReplaceText ); $l_str_ReplaceText = str_replace("[[FOOTNOTE TEXT]]", $l_str_FootnoteText, $l_str_ReplaceText);
/* add the footnote container to the output */ /* add the footnote container to the output */
$l_str_Output = $l_str_Output . $l_str_ReplaceText; $l_str_Output = $l_str_Output . $l_str_ReplaceText;
} }
/* add closing tag for the div of the references container */ /* add closing tag for the div of the references container */
$l_str_Output = $l_str_Output . '</div>'; $l_str_Output = $l_str_Output . '</div>';
/* add a javascript to expand the reference container when clicking on a footnote or the reference label */ /* add a javascript to expand the reference container when clicking on a footnote or the reference label */
$l_str_Output .= ' $l_str_Output .= '
<script type="text/javascript"> <script type="text/javascript">
function footnote_expand_reference_container(p_str_ID) { function footnote_expand_reference_container(p_str_ID) {
jQuery("#'.FOOTNOTE_REFERENCES_CONTAINER_ID.'").show(); jQuery("#' . FOOTNOTE_REFERENCES_CONTAINER_ID . '").show();
if (p_str_ID.length > 0) { if (p_str_ID.length > 0) {
jQuery(p_str_ID).focus(); jQuery(p_str_ID).focus();
} }
@ -298,6 +369,6 @@ function footnotes_OutputReferenceContainer()
</script> </script>
'; ';
/* return the output string */ /* return the output string */
return $l_str_Output; return $l_str_Output;
} }

View file

@ -15,10 +15,10 @@
*/ */
function footnotes_add_public_stylesheet() function footnotes_add_public_stylesheet()
{ {
/* register public stylesheet */ /* register public stylesheet */
wp_register_style( 'footnotes_public_style', plugins_url( '../css/footnote.css', __FILE__ ) ); wp_register_style('footnotes_public_style', plugins_url('../css/footnote.css', __FILE__));
/* add public stylesheet */ /* add public stylesheet */
wp_enqueue_style( 'footnotes_public_style' ); wp_enqueue_style('footnotes_public_style');
} }
/** /**
@ -27,8 +27,8 @@ function footnotes_add_public_stylesheet()
*/ */
function footnotes_add_settings_stylesheet() function footnotes_add_settings_stylesheet()
{ {
/* register settings stylesheet */ /* register settings stylesheet */
wp_register_style( 'footnotes_settings_style', plugins_url( '../css/settings.css', __FILE__ ) ); wp_register_style('footnotes_settings_style', plugins_url('../css/settings.css', __FILE__));
/* add settings stylesheet */ /* add settings stylesheet */
wp_enqueue_style( 'footnotes_settings_style' ); wp_enqueue_style('footnotes_settings_style');
} }

View file

@ -9,10 +9,10 @@
*/ */
/* check if the wordpress function to uninstall plugins is active */ /* check if the wordpress function to uninstall plugins is active */
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) { if (!defined('WP_UNINSTALL_PLUGIN')) {
header( 'Status: 403 Forbidden' ); header('Status: 403 Forbidden');
header( 'HTTP/1.1 403 Forbidden' ); header('HTTP/1.1 403 Forbidden');
exit(); exit();
} }
/* /*
@ -22,13 +22,13 @@ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
require_once(dirname(__FILE__) . '/defines.php'); require_once(dirname(__FILE__) . '/defines.php');
/* uninstalling the plugin is only allowed for logged in users */ /* uninstalling the plugin is only allowed for logged in users */
if ( !is_user_logged_in() ) { if (!is_user_logged_in()) {
wp_die( __( 'You must be logged in to run this script.', FOOTNOTES_PLUGIN_NAME ) ); wp_die(__('You must be logged in to run this script.', FOOTNOTES_PLUGIN_NAME));
} }
/* current user needs the permission to (un)install plugins */ /* current user needs the permission to (un)install plugins */
if ( !current_user_can( 'install_plugins' ) ) { if (!current_user_can('install_plugins')) {
wp_die( __( 'You do not have permission to run this script.', FOOTNOTES_PLUGIN_NAME ) ); wp_die(__('You do not have permission to run this script.', FOOTNOTES_PLUGIN_NAME));
} }
/* /*

View file

@ -37,47 +37,47 @@
/* include constants */ /* include constants */
require_once( dirname( __FILE__ ) . "/includes/defines.php" ); require_once(dirname(__FILE__) . "/includes/defines.php");
/* include language functions */ /* include language functions */
require_once( dirname( __FILE__ ) . "/includes/language.php" ); require_once(dirname(__FILE__) . "/includes/language.php");
/* include storage functions and global plugin functions */ /* include storage functions and global plugin functions */
require_once( dirname( __FILE__ ) . "/includes/plugin-settings.php" ); require_once(dirname(__FILE__) . "/includes/plugin-settings.php");
/* include script and stylesheet functions */ /* include script and stylesheet functions */
require_once( dirname( __FILE__ ) . "/includes/scripts.php" ); require_once(dirname(__FILE__) . "/includes/scripts.php");
/* include script and stylesheet functions */ /* include script and stylesheet functions */
require_once( dirname( __FILE__ ) . "/includes/convert.php" ); require_once(dirname(__FILE__) . "/includes/convert.php");
/* include script and stylesheet functions */ /* include script and stylesheet functions */
require_once( dirname( __FILE__ ) . "/includes/replacer.php" ); require_once(dirname(__FILE__) . "/includes/replacer.php");
/* require plugin class */ /* require plugin class */
require_once( dirname( __FILE__ ) . "/classes/footnotes.php" ); require_once(dirname(__FILE__) . "/classes/footnotes.php");
/* require plugin settings class */ /* require plugin settings class */
require_once( dirname( __FILE__ ) . "/classes/footnotes_settings.php" ); require_once(dirname(__FILE__) . "/classes/footnotes_settings.php");
/* register functions for the footnote replacement */ /* register functions for the footnote replacement */
footnotes_RegisterReplacementFunctions(); footnotes_RegisterReplacementFunctions();
/* adds javascript and stylesheets to the public page */ /* adds javascript and stylesheets to the public page */
add_action( 'wp_enqueue_scripts', 'footnotes_add_public_stylesheet' ); add_action('wp_enqueue_scripts', 'footnotes_add_public_stylesheet');
/* only admin is allowed to execute the plugin settings */ /* only admin is allowed to execute the plugin settings */
if ( !function_exists( 'is_admin' ) ) { if (!function_exists('is_admin')) {
header( 'Status: 403 Forbidden' ); header('Status: 403 Forbidden');
header( 'HTTP/1.1 403 Forbidden' ); header('HTTP/1.1 403 Forbidden');
exit(); exit();
} }
/* action to locate language and load the wordpress-specific language file */ /* action to locate language and load the wordpress-specific language file */
add_action( 'plugins_loaded', 'footnotes_load_language' ); add_action('plugins_loaded', 'footnotes_load_language');
/* add link to the settings page in plugin main page */ /* add link to the settings page in plugin main page */
$l_str_plugin_file = FOOTNOTES_PLUGIN_DIR_NAME . '/index.php'; $l_str_plugin_file = FOOTNOTES_PLUGIN_DIR_NAME . '/index.php';
add_filter( "plugin_action_links_{$l_str_plugin_file}", 'footnotes_plugin_settings_link', 10, 2 ); add_filter("plugin_action_links_{$l_str_plugin_file}", 'footnotes_plugin_settings_link', 10, 2);
/* initialize an object of the plugin class */ /* initialize an object of the plugin class */
global $g_obj_FootnotesPlugin; global $g_obj_FootnotesPlugin;
/* if object isn't initialized yet, initialize it now */ /* if object isn't initialized yet, initialize it now */
if ( empty( $g_obj_FootnotesPlugin ) ) { if (empty($g_obj_FootnotesPlugin)) {
$g_obj_FootnotesPlugin = new Class_Footnotes(); $g_obj_FootnotesPlugin = new Class_Footnotes();
} }

Binary file not shown.

View file

@ -1,9 +1,9 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: footnotes\n" "Project-Id-Version: footnotes\n"
"POT-Creation-Date: 2014-05-20 17:59+0100\n" "POT-Creation-Date: 2014-05-21 20:28+0100\n"
"PO-Revision-Date: 2014-05-20 21:49+0100\n" "PO-Revision-Date: 2014-05-21 20:30+0100\n"
"Last-Translator: Mark Cheret <mark@cheret.de>\n" "Last-Translator: Stefan Herndler <support@herndler.org>\n"
"Language-Team: SHE <s.herndler@methis.at>\n" "Language-Team: SHE <s.herndler@methis.at>\n"
"Language: de\n" "Language: de\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -18,107 +18,127 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
#: classes/footnotes_settings.php:312 #: classes/footnotes_settings.php:366
msgid "General" msgid "General"
msgstr "Allgemein" msgstr "Allgemein"
#: classes/footnotes_settings.php:314 #: classes/footnotes_settings.php:368
#, php-format #, php-format
msgid "%s Settings" msgid "%s Settings"
msgstr "%s Einstellungen" msgstr "%s Einstellungen"
#: classes/footnotes_settings.php:315 #: classes/footnotes_settings.php:369
msgid "References Container"
msgstr "Einzelnachweise"
#: classes/footnotes_settings.php:370
msgid "Footnotes styling"
msgstr "Layout der Fußnoten"
#: classes/footnotes_settings.php:371
msgid "Other"
msgstr "Andere"
#: classes/footnotes_settings.php:391
msgid "References label:" msgid "References label:"
msgstr "Überschrift \"Einzelnachweis\":" msgstr "Überschrift \"Einzelnachweis\":"
#: classes/footnotes_settings.php:316 #: classes/footnotes_settings.php:396
msgid "Collapse references by default:" msgid "Collapse references by default:"
msgstr "Verstecke Einzelnachweise standardmäßig:" msgstr "Verstecke Einzelnachweise standardmäßig:"
#: classes/footnotes_settings.php:317 #: classes/footnotes_settings.php:405
msgid "Combine identical footnotes:" msgid "in the footer"
msgstr "Kombiniere meine Fußnoten:" msgstr "am Ende der Seite"
#: classes/footnotes_settings.php:318 #: classes/footnotes_settings.php:406
msgid "Footnote tag:" msgid "at the end of the post"
msgstr "Fußzeile einbinden:" msgstr "nach einem Beitrag"
#: classes/footnotes_settings.php:319 #: classes/footnotes_settings.php:408
msgid "Counter style:" msgid "Where shall the reference container appear:"
msgstr "Fußnoten Zähler:" msgstr "Positionierung der Einzelnachweise:"
#: classes/footnotes_settings.php:320 #: classes/footnotes_settings.php:420 classes/footnotes_settings.php:457
msgid "Allow footnotes on Summarized Posts:" #: classes/footnotes_settings.php:466
msgstr "Erlaube Fußnoten in Zusammenfassungen:"
#: classes/footnotes_settings.php:321
#, php-format
msgid "Tell the world you're using %sfoot%snotes%s:"
msgstr "Teile der Welt mit, dass du %sfoot%snotes%s verwendest:"
#: classes/footnotes_settings.php:362 classes/footnotes_settings.php:410
#: classes/footnotes_settings.php:425
msgid "Yes" msgid "Yes"
msgstr "Ja" msgstr "Ja"
#: classes/footnotes_settings.php:363 classes/footnotes_settings.php:411 #: classes/footnotes_settings.php:421 classes/footnotes_settings.php:458
#: classes/footnotes_settings.php:426 #: classes/footnotes_settings.php:467
msgid "No" msgid "No"
msgstr "Nein" msgstr "Nein"
#: classes/footnotes_settings.php:376 #: classes/footnotes_settings.php:423
msgid "starts with:" msgid "Combine identical footnotes:"
msgstr "beginnt mit:" msgstr "Kombiniere meine Fußnoten:"
#: classes/footnotes_settings.php:380 #: classes/footnotes_settings.php:428
msgid "ends with:" msgid "Footnote tag starts with:"
msgstr "endet mit:" msgstr "Fußnoten starten mit:"
#: classes/footnotes_settings.php:392 #: classes/footnotes_settings.php:432
msgid "and ends with:"
msgstr "und endet mit:"
#: classes/footnotes_settings.php:439
msgid "Arabic Numbers - Plain" msgid "Arabic Numbers - Plain"
msgstr "arabische Ziffern" msgstr "arabische Ziffern"
#: classes/footnotes_settings.php:393 #: classes/footnotes_settings.php:440
msgid "Arabic Numbers - Leading 0" msgid "Arabic Numbers - Leading 0"
msgstr "arabisch Ziffern - führende Null" msgstr "arabisch Ziffern - führende Null"
#: classes/footnotes_settings.php:394 #: classes/footnotes_settings.php:441
msgid "Latin Character - lower case" msgid "Latin Character - lower case"
msgstr "alphabetisch - Kleinschreibung" msgstr "alphabetisch - Kleinschreibung"
#: classes/footnotes_settings.php:395 #: classes/footnotes_settings.php:442
msgid "Latin Character - upper case" msgid "Latin Character - upper case"
msgstr "alphabetisch - Großschreibung" msgstr "alphabetisch - Großschreibung"
#: classes/footnotes_settings.php:396 #: classes/footnotes_settings.php:443
msgid "Roman Numerals" msgid "Roman Numerals"
msgstr "Römische Ziffern" msgstr "Römische Ziffern"
#: classes/footnotes_settings.php:441 classes/footnotes_settings.php:443 #: classes/footnotes_settings.php:445
msgid "Counter style:"
msgstr "Fußnoten Zähler:"
#: classes/footnotes_settings.php:460
msgid "Allow footnotes on Summarized Posts:"
msgstr "Erlaube Fußnoten in Zusammenfassungen:"
#: classes/footnotes_settings.php:469
#, php-format
msgid "Tell the world you're using %s:"
msgstr "Teile der Welt mit, dass du %s verwendest:"
#: classes/footnotes_settings.php:482
msgid "HowTo" msgid "HowTo"
msgstr "Hilfe" msgstr "Hilfe"
#: classes/footnotes_settings.php:454 #: classes/footnotes_settings.php:485
msgid "This is a brief introduction in how to use the plugin." msgid "Brief introduction in how to use the plugin"
msgstr "Eine kurze Anleitung für die Verwendung des Plugins." msgstr "Kurze Anleitung für die Verwendung des Plugins."
#: classes/footnotes_settings.php:469 #: classes/footnotes_settings.php:511
msgid "Start your footnote with the following shortcode:" msgid "Start your footnote with the following shortcode:"
msgstr "Starten Sie eine Fußnote mit:" msgstr "Starten Sie eine Fußnote mit:"
#: classes/footnotes_settings.php:474 #: classes/footnotes_settings.php:517
msgid "...and end your footnote with this shortcode:" msgid "...and end your footnote with this shortcode:"
msgstr "...und beenden Sie diese mit:" msgstr "...und beenden Sie diese mit:"
#: classes/footnotes_settings.php:480 classes/footnotes_settings.php:483 #: classes/footnotes_settings.php:525 classes/footnotes_settings.php:528
msgid "example string" msgid "example string"
msgstr "Beispieltext" msgstr "Beispieltext"
#: classes/footnotes_settings.php:481 #: classes/footnotes_settings.php:526
msgid "will be displayed as:" msgid "will be displayed as:"
msgstr "wird dargestellt als:" msgstr "wird dargestellt als:"
#: classes/footnotes_settings.php:488 #: classes/footnotes_settings.php:533
#, php-format #, php-format
msgid "If you have any questions, please don't hesitate to %se-mail%s us." msgid "If you have any questions, please don't hesitate to %se-mail%s us."
msgstr "Bei Fragen können Sie uns gerne eine %se-Mail%s senden." msgstr "Bei Fragen können Sie uns gerne eine %se-Mail%s senden."
@ -127,7 +147,7 @@ msgstr "Bei Fragen können Sie uns gerne eine %se-Mail%s senden."
msgid "Settings" msgid "Settings"
msgstr "Einstellungen" msgstr "Einstellungen"
#: includes/replacer.php:109 #: includes/replacer.php:180
#, php-format #, php-format
msgid "Hey there, I'm using the awesome WordPress Plugin called %s" msgid "Hey there, I'm using the awesome WordPress Plugin called %s"
msgstr "Diese Seite verwendet das %s Plugin" msgstr "Diese Seite verwendet das %s Plugin"
@ -140,6 +160,9 @@ msgstr "Sie müssen angemeldet sein um diese Funktion ausführen zu können."
msgid "You do not have permission to run this script." msgid "You do not have permission to run this script."
msgstr "Sie haben nicht die Berechtigung diese Funktion auszuführen." msgstr "Sie haben nicht die Berechtigung diese Funktion auszuführen."
#~ msgid "starts with:"
#~ msgstr "beginnt mit:"
#~ msgid "Save" #~ msgid "Save"
#~ msgstr "Speichern" #~ msgstr "Speichern"

Binary file not shown.

View file

@ -1,9 +1,9 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: footnotes\n" "Project-Id-Version: footnotes\n"
"POT-Creation-Date: 2014-05-20 21:36+0100\n" "POT-Creation-Date: 2014-05-21 20:28+0100\n"
"PO-Revision-Date: 2014-05-20 21:50+0100\n" "PO-Revision-Date: 2014-05-21 20:28+0100\n"
"Last-Translator: Mark Cheret <mark@cheret.de>\n" "Last-Translator: Stefan Herndler <support@herndler.org>\n"
"Language-Team: SHE <s.herndler@methis.at>\n" "Language-Team: SHE <s.herndler@methis.at>\n"
"Language: en\n" "Language: en\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -18,107 +18,127 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
#: classes/footnotes_settings.php:312 #: classes/footnotes_settings.php:366
msgid "General" msgid "General"
msgstr "General" msgstr "General"
#: classes/footnotes_settings.php:314 #: classes/footnotes_settings.php:368
#, php-format #, php-format
msgid "%s Settings" msgid "%s Settings"
msgstr "%s Settings" msgstr "%s Settings"
#: classes/footnotes_settings.php:315 #: classes/footnotes_settings.php:369
msgid "References Container"
msgstr "References Container"
#: classes/footnotes_settings.php:370
msgid "Footnotes styling"
msgstr "Footnotes styling"
#: classes/footnotes_settings.php:371
msgid "Other"
msgstr "Other"
#: classes/footnotes_settings.php:391
msgid "References label:" msgid "References label:"
msgstr "References label:" msgstr "References label:"
#: classes/footnotes_settings.php:316 #: classes/footnotes_settings.php:396
msgid "Collapse references by default:" msgid "Collapse references by default:"
msgstr "Collapse references by default:" msgstr "Collapse references by default:"
#: classes/footnotes_settings.php:317 #: classes/footnotes_settings.php:405
msgid "Combine identical footnotes:" msgid "in the footer"
msgstr "Combine identical footnotes:" msgstr "in the footer"
#: classes/footnotes_settings.php:318 #: classes/footnotes_settings.php:406
msgid "Footnote tag:" msgid "at the end of the post"
msgstr "Footnote tag:" msgstr "at the end of the post"
#: classes/footnotes_settings.php:319 #: classes/footnotes_settings.php:408
msgid "Counter style:" msgid "Where shall the reference container appear:"
msgstr "Counter style:" msgstr "Where shall the reference container appear:"
#: classes/footnotes_settings.php:320 #: classes/footnotes_settings.php:420 classes/footnotes_settings.php:457
msgid "Allow footnotes on Summarized Posts:" #: classes/footnotes_settings.php:466
msgstr "Allow footnotes on Summarized Posts:"
#: classes/footnotes_settings.php:321
#, php-format
msgid "Tell the world you're using %sfoot%snotes%s:"
msgstr "Tell the world you're using %sfoot%snotes%s:"
#: classes/footnotes_settings.php:362 classes/footnotes_settings.php:410
#: classes/footnotes_settings.php:425
msgid "Yes" msgid "Yes"
msgstr "Yes" msgstr "Yes"
#: classes/footnotes_settings.php:363 classes/footnotes_settings.php:411 #: classes/footnotes_settings.php:421 classes/footnotes_settings.php:458
#: classes/footnotes_settings.php:426 #: classes/footnotes_settings.php:467
msgid "No" msgid "No"
msgstr "No" msgstr "No"
#: classes/footnotes_settings.php:376 #: classes/footnotes_settings.php:423
msgid "starts with:" msgid "Combine identical footnotes:"
msgstr "starts with:" msgstr "Combine identical footnotes:"
#: classes/footnotes_settings.php:380 #: classes/footnotes_settings.php:428
msgid "ends with:" msgid "Footnote tag starts with:"
msgstr "ends with:" msgstr "Footnote tag starts with:"
#: classes/footnotes_settings.php:392 #: classes/footnotes_settings.php:432
msgid "and ends with:"
msgstr "and ends with:"
#: classes/footnotes_settings.php:439
msgid "Arabic Numbers - Plain" msgid "Arabic Numbers - Plain"
msgstr "Arabic Numbers - Plain" msgstr "Arabic Numbers - Plain"
#: classes/footnotes_settings.php:393 #: classes/footnotes_settings.php:440
msgid "Arabic Numbers - Leading 0" msgid "Arabic Numbers - Leading 0"
msgstr "Arabic Numbers - Leading 0" msgstr "Arabic Numbers - Leading 0"
#: classes/footnotes_settings.php:394 #: classes/footnotes_settings.php:441
msgid "Latin Character - lower case" msgid "Latin Character - lower case"
msgstr "Latin Character - lower case" msgstr "Latin Character - lower case"
#: classes/footnotes_settings.php:395 #: classes/footnotes_settings.php:442
msgid "Latin Character - upper case" msgid "Latin Character - upper case"
msgstr "Latin Character - upper case" msgstr "Latin Character - upper case"
#: classes/footnotes_settings.php:396 #: classes/footnotes_settings.php:443
msgid "Roman Numerals" msgid "Roman Numerals"
msgstr "Roman Numerals" msgstr "Roman Numerals"
#: classes/footnotes_settings.php:441 classes/footnotes_settings.php:443 #: classes/footnotes_settings.php:445
msgid "Counter style:"
msgstr "Counter style:"
#: classes/footnotes_settings.php:460
msgid "Allow footnotes on Summarized Posts:"
msgstr "Allow footnotes on Summarized Posts:"
#: classes/footnotes_settings.php:469
#, php-format
msgid "Tell the world you're using %s:"
msgstr "Tell the world you're using %s:"
#: classes/footnotes_settings.php:482
msgid "HowTo" msgid "HowTo"
msgstr "HowTo" msgstr "HowTo"
#: classes/footnotes_settings.php:454 #: classes/footnotes_settings.php:485
msgid "This is a brief introduction in how to use the plugin." msgid "Brief introduction in how to use the plugin"
msgstr "This is a brief introduction in how to use the plugin." msgstr "Brief introduction in how to use the plugin"
#: classes/footnotes_settings.php:469 #: classes/footnotes_settings.php:511
msgid "Start your footnote with the following shortcode:" msgid "Start your footnote with the following shortcode:"
msgstr "Start your footnote with the following shortcode:" msgstr "Start your footnote with the following shortcode:"
#: classes/footnotes_settings.php:474 #: classes/footnotes_settings.php:517
msgid "...and end your footnote with this shortcode:" msgid "...and end your footnote with this shortcode:"
msgstr "...and end your footnote with this shortcode:" msgstr "...and end your footnote with this shortcode:"
#: classes/footnotes_settings.php:480 classes/footnotes_settings.php:483 #: classes/footnotes_settings.php:525 classes/footnotes_settings.php:528
msgid "example string" msgid "example string"
msgstr "example string" msgstr "example string"
#: classes/footnotes_settings.php:481 #: classes/footnotes_settings.php:526
msgid "will be displayed as:" msgid "will be displayed as:"
msgstr "will be displayed as:" msgstr "will be displayed as:"
#: classes/footnotes_settings.php:488 #: classes/footnotes_settings.php:533
#, php-format #, php-format
msgid "If you have any questions, please don't hesitate to %se-mail%s us." msgid "If you have any questions, please don't hesitate to %se-mail%s us."
msgstr "If you have any questions, please don't hesitate to %se-mail%s us." msgstr "If you have any questions, please don't hesitate to %se-mail%s us."
@ -127,7 +147,7 @@ msgstr "If you have any questions, please don't hesitate to %se-mail%s us."
msgid "Settings" msgid "Settings"
msgstr "Settings" msgstr "Settings"
#: includes/replacer.php:109 #: includes/replacer.php:180
#, php-format #, php-format
msgid "Hey there, I'm using the awesome WordPress Plugin called %s" msgid "Hey there, I'm using the awesome WordPress Plugin called %s"
msgstr "Hey there, I'm using the awesome %s Plugin" msgstr "Hey there, I'm using the awesome %s Plugin"
@ -140,6 +160,9 @@ msgstr "You must be logged in to run this script."
msgid "You do not have permission to run this script." msgid "You do not have permission to run this script."
msgstr "You do not have permission to run this script." msgstr "You do not have permission to run this script."
#~ msgid "starts with:"
#~ msgstr "starts with:"
#~ msgid "Save" #~ msgid "Save"
#~ msgstr "Save" #~ msgstr "Save"

View file

@ -38,6 +38,14 @@ No, this Plugin has been written from scratch. Of course some inspirations on ho
== Changelog == == Changelog ==
= next version =
- Update: Global styling for the public plugin name
- Update: Easier usage of the public plugin name in translations
- Update: New Layout for the settings page to group similar settings to get a better overview
- Update: Display settings submit button only if there is at least 1 editable setting in the current tab
- Add: setting where the reference container appears on public pages (needs some corrections!)
- Bugfix: displays only one reference container in front of the footer on category pages
= 1.0.6 = = 1.0.6 =
- Bugfix: Uninstall function to delete all plugin settings - Bugfix: Uninstall function to delete all plugin settings
- Bugfix: Counter style internal name in the reference container to correctly link to the right footnote on the page above - Bugfix: Counter style internal name in the reference container to correctly link to the right footnote on the page above

View file

@ -1,13 +1,15 @@
<div class="footnote_plugin_container"> <div class="footnote_plugin_container">
<div class="footnote_plugin_index"> <div class="footnote_plugin_index">
[[FOOTNOTE INDEX]]. [[FOOTNOTE INDEX]].
</div> </div>
<div class="footnote_plugin_text"> <div class="footnote_plugin_text">
<a class="footnote_plugin_link" href="#footnote_plugin_tooltip_[[FOOTNOTE INDEX SHORT]]" name="footnote_plugin_reference_[[FOOTNOTE INDEX SHORT]]" id="footnote_plugin_reference_[[FOOTNOTE INDEX SHORT]]"> <a class="footnote_plugin_link" href="#footnote_plugin_tooltip_[[FOOTNOTE INDEX SHORT]]"
&#8593; name="footnote_plugin_reference_[[FOOTNOTE INDEX SHORT]]"
</a> id="footnote_plugin_reference_[[FOOTNOTE INDEX SHORT]]">
&nbsp; &#8593;
[[FOOTNOTE TEXT]] </a>
</div> &nbsp;
<div class="footnote_plugin_end"></div> [[FOOTNOTE TEXT]]
</div>
<div class="footnote_plugin_end"></div>
</div> </div>

View file

@ -1,5 +1,6 @@
<sup class="footnote_plugin_tooltip" name="footnote_plugin_tooltip_[[FOOTNOTE INDEX]]" onclick="footnote_expand_reference_container('#footnote_plugin_reference_[[FOOTNOTE INDEX]]');"> <sup class="footnote_plugin_tooltip" name="footnote_plugin_tooltip_[[FOOTNOTE INDEX]]"
[[FOOTNOTE INDEX]]) onclick="footnote_expand_reference_container('#footnote_plugin_reference_[[FOOTNOTE INDEX]]');">
[[FOOTNOTE INDEX]])
<span> <span>
[[FOOTNOTE TEXT]] [[FOOTNOTE TEXT]]
</span> </span>