Changes for upcoming version 1.3.0

- Bugfix: Changed tooltip class to be unique
- Bugfix: Changed superscript styling to not manipulate the line height
- Bugfix: Changed styling of the footnotes text in the reference container to avoid line breaks
- Updated: Reformatted code
- Added: new settings tab for custom CSS settings

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@957947 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
Aricura 2014-07-31 10:17:38 +00:00
parent 0f3996338b
commit 3802249ec4
26 changed files with 2137 additions and 1651 deletions

View file

@ -8,13 +8,24 @@
* Since: 1.2.0
*/
// add new button to the WYSIWYG - editor
add_filter("mce_buttons", "MCI_Footnotes_wysiwyg_editor_functions");
add_filter("mce_external_plugins", "MCI_Footnotes_wysiwyg_editor_buttons");
// add new button to the plain text editor
add_action("admin_print_footer_scripts", "MCI_Footnotes_text_editor_buttons");
// defines the callback function for the editor buttons
add_action("wp_ajax_nopriv_footnotes_getTags", "MCI_Footnotes_wysiwyg_ajax_callback");
add_action("wp_ajax_footnotes_getTags", "MCI_Footnotes_wysiwyg_ajax_callback");
/**
* adds a new button to the WYSIWYG editor for pages and posts
* @param array $buttons
* @return array
* @since 1.2.0
*/
function footnotes_wysiwyg_editor_functions($buttons) {
function MCI_Footnotes_wysiwyg_editor_functions($buttons) {
array_push($buttons, FOOTNOTES_PLUGIN_NAME);
return $buttons;
}
@ -25,7 +36,7 @@ function footnotes_wysiwyg_editor_functions($buttons) {
* @return array
* @since 1.2.0
*/
function footnotes_wysiwyg_editor_buttons($plugin_array) {
function MCI_Footnotes_wysiwyg_editor_buttons($plugin_array) {
$plugin_array[FOOTNOTES_PLUGIN_NAME] = plugins_url('/../js/wysiwyg-editor.js', __FILE__);
return $plugin_array;
}
@ -34,16 +45,16 @@ function footnotes_wysiwyg_editor_buttons($plugin_array) {
* adds a new button to the plain text editor for pages and posts
* @since 1.2.0
*/
function footnotes_text_editor_buttons() {
function MCI_Footnotes_text_editor_buttons() {
?>
<script type="text/javascript">
/**
* adds a tag in at the beginning and at the end of a selected text in the specific textarea
* adds a tag in at the beginning and at the end of a selected text in the specific text area
* @param string elementID
* @param string openTag
* @param string closeTag
*/
function footnotes_wrapText(elementID, openTag, closeTag) {
function MCI_Footnotes_wrapText(elementID, openTag, closeTag) {
var textArea = jQuery('#' + elementID);
var len = textArea.val().length;
var start = textArea[0].selectionStart;
@ -55,13 +66,13 @@ function footnotes_text_editor_buttons() {
/**
* adds a new button to the plain text editor
*/
QTags.addButton( 'footnotes_quicktag_button', 'footnotes', footnotes_text_editor_callback );
QTags.addButton( 'MCI_Footnotes_QuickTag_button', 'footnotes', MCI_Footnotes_text_editor_callback );
/**
* callback function when the button is clicked
* executes a ajax call to get the start and end tag for the footnotes and
* adds them in before and after the selected text
*/
function footnotes_text_editor_callback() {
function MCI_Footnotes_text_editor_callback() {
jQuery.ajax({
type: 'POST',
url: '/wp-admin/admin-ajax.php',
@ -71,7 +82,7 @@ function footnotes_text_editor_buttons() {
},
success: function(data, textStatus, XMLHttpRequest){
var l_arr_Tags = JSON.parse(data);
footnotes_wrapText("content", l_arr_Tags['start'], l_arr_Tags['end']);
MCI_Footnotes_wrapText("content", l_arr_Tags['start'], l_arr_Tags['end']);
},
error: function(MLHttpRequest, textStatus, errorThrown){
}
@ -86,23 +97,24 @@ function footnotes_text_editor_buttons() {
* to get the start and end tag for the footnotes
* echos the tags as json-string ("start" | "end")
*/
function footnotes_wysiwyg_ajax_callback() {
require_once(dirname(__FILE__) . '/../includes/defines.php');
require_once(dirname(__FILE__) . '/../includes/plugin-settings.php');
function MCI_Footnotes_wysiwyg_ajax_callback() {
require_once(dirname(__FILE__) . "/defines.php");
require_once(dirname(__FILE__) . '/plugin-settings.php');
require_once(dirname(__FILE__) . '/../classes/admin.php');
/* load footnote settings */
$g_arr_FootnotesSettings = footnotes_filter_options(FOOTNOTE_SETTINGS_CONTAINER, Class_FootnotesSettings::$a_arr_Default_Settings, true);
$g_arr_FootnotesSettings = MCI_Footnotes_getOptions(true);
/* get footnote starting tag */
$l_str_StartingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_START];
$l_str_StartingTag = $g_arr_FootnotesSettings[FOOTNOTES_INPUT_PLACEHOLDER_START];
/*get footnote ending tag */
$l_str_EndingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_END];
$l_str_EndingTag = $g_arr_FootnotesSettings[FOOTNOTES_INPUT_PLACEHOLDER_END];
if ($l_str_StartingTag == "userdefined" || $l_str_EndingTag == "userdefined") {
/* get user defined footnote starting tag */
$l_str_StartingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_START_USERDEFINED];
$l_str_StartingTag = $g_arr_FootnotesSettings[FOOTNOTES_INPUT_PLACEHOLDER_START_USERDEFINED];
/*get user defined footnote ending tag */
$l_str_EndingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_END_USERDEFINED];
$l_str_EndingTag = $g_arr_FootnotesSettings[FOOTNOTES_INPUT_PLACEHOLDER_END_USERDEFINED];
}
echo json_encode(array("start" => $l_str_StartingTag, "end" => $l_str_EndingTag));