' . __('Settings', FOOTNOTES_PLUGIN_NAME) . ''; /* add link to the footnotes plugin support page on wordpress.org */ $l_str_SupportLink = '' . __('Support', FOOTNOTES_PLUGIN_NAME) . ''; /* add defined links to the plugin main page */ $links[] = $l_str_SupportLink; $links[] = $l_str_SettingsLink; /* return new links */ return $links; } /** * reads a option field, filters the values and returns the filtered option array * fallback to default value since 1.0-gamma * @since 1.0 * @param string $p_str_OptionsField * @param array $p_arr_DefaultValues * @param bool $p_bool_ConvertHtmlChars * @return array */ function footnotes_filter_options($p_str_OptionsField, $p_arr_DefaultValues, $p_bool_ConvertHtmlChars = true) { $l_arr_Options = get_option($p_str_OptionsField); /* if no settings set yet return default values */ if (empty($l_arr_Options)) { return $p_arr_DefaultValues; } /* 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; } /** * converts a string depending on its value to a boolean * @since 1.0-beta * @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; }