- 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:
parent
49c54b6a89
commit
d25f770bc5
19 changed files with 1322 additions and 1096 deletions
|
@ -16,14 +16,14 @@
|
|||
* @param mixed $file
|
||||
* @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 */
|
||||
$settings_link = '<a href="' . admin_url( 'options-general.php?page=' . FOOTNOTES_SETTINGS_PAGE_ID ) . '">' . __( 'Settings', FOOTNOTES_PLUGIN_NAME ) . '</a>';
|
||||
array_unshift( $links, $settings_link );
|
||||
/* 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>';
|
||||
array_unshift($links, $settings_link);
|
||||
|
||||
/* return new links */
|
||||
return $links;
|
||||
/* return new links */
|
||||
return $links;
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,29 +36,29 @@ function footnotes_plugin_settings_link( $links, $file )
|
|||
* @param bool $p_bool_ConvertHtmlChars
|
||||
* @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 );
|
||||
/* loop through all keys in the array and filters them */
|
||||
foreach ( $l_arr_Options as $l_str_Key => $l_str_Value ) {
|
||||
/* removes special chars from the settings value */
|
||||
$l_str_Value = stripcslashes( $l_str_Value );
|
||||
/* if set, convert html special chars */
|
||||
if ($p_bool_ConvertHtmlChars) {
|
||||
$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 */
|
||||
if (!empty($l_str_Value)) {
|
||||
$l_arr_Options[ $l_str_Key ] = stripcslashes( $l_str_Value );
|
||||
/* check if default value is defined */
|
||||
} else if (array_key_exists($l_str_Key, $p_arr_DefaultValues)) {
|
||||
$l_arr_Options[ $l_str_Key ] = $p_arr_DefaultValues[$l_str_Key];
|
||||
} else {
|
||||
$l_arr_Options[ $l_str_Key ] = "";
|
||||
}
|
||||
}
|
||||
/* returns the filtered array */
|
||||
return $l_arr_Options;
|
||||
$l_arr_Options = get_option($p_str_OptionsField);
|
||||
/* loop through all keys in the array and filters them */
|
||||
foreach ($l_arr_Options as $l_str_Key => $l_str_Value) {
|
||||
/* removes special chars from the settings value */
|
||||
$l_str_Value = stripcslashes($l_str_Value);
|
||||
/* if set, convert html special chars */
|
||||
if ($p_bool_ConvertHtmlChars) {
|
||||
$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 */
|
||||
if (!empty($l_str_Value)) {
|
||||
$l_arr_Options[$l_str_Key] = stripcslashes($l_str_Value);
|
||||
/* check if default value is defined */
|
||||
} else if (array_key_exists($l_str_Key, $p_arr_DefaultValues)) {
|
||||
$l_arr_Options[$l_str_Key] = $p_arr_DefaultValues[$l_str_Key];
|
||||
} else {
|
||||
$l_arr_Options[$l_str_Key] = "";
|
||||
}
|
||||
}
|
||||
/* returns the filtered array */
|
||||
return $l_arr_Options;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,18 +67,19 @@ function footnotes_filter_options( $p_str_OptionsField, $p_arr_DefaultValues, $p
|
|||
* @param string $p_str_Value
|
||||
* @return bool
|
||||
*/
|
||||
function footnotes_ConvertToBool($p_str_Value) {
|
||||
/* convert string to lower-case to make it easier */
|
||||
$p_str_Value = strtolower($p_str_Value);
|
||||
/* check if string seems to contain a "true" value */
|
||||
switch($p_str_Value) {
|
||||
case "checked":
|
||||
case "yes":
|
||||
case "true":
|
||||
case "on":
|
||||
case "1":
|
||||
return true;
|
||||
}
|
||||
/* nothing found that says "true", so we return false */
|
||||
return false;
|
||||
function footnotes_ConvertToBool($p_str_Value)
|
||||
{
|
||||
/* convert string to lower-case to make it easier */
|
||||
$p_str_Value = strtolower($p_str_Value);
|
||||
/* check if string seems to contain a "true" value */
|
||||
switch ($p_str_Value) {
|
||||
case "checked":
|
||||
case "yes":
|
||||
case "true":
|
||||
case "on":
|
||||
case "1":
|
||||
return true;
|
||||
}
|
||||
/* nothing found that says "true", so we return false */
|
||||
return false;
|
||||
}
|
Reference in a new issue