diff --git a/class/dashboard/init.php b/class/dashboard/init.php index 90a4c3b..7b6016a 100644 --- a/class/dashboard/init.php +++ b/class/dashboard/init.php @@ -146,7 +146,7 @@ class MCI_Footnotes_Layout_Init { $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "manfisher"); echo $l_obj_Template->getContent(); - printf('visit Mark Cheret or herndler.org'); + printf('visit ManFisher Medien ManuFaktur or herndler.org'); printf("

"); printf("

%s

", __('Take a look on other Plugins we have developed.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); diff --git a/class/init.php b/class/init.php index 7b83541..9187fdd 100644 --- a/class/init.php +++ b/class/init.php @@ -32,23 +32,24 @@ class MCI_Footnotes { * @since 1.5.0 */ public function run() { - // register language + // register language MCI_Footnotes_Language::registerHooks(); // register Button hooks MCI_Footnotes_WYSIWYG::registerHooks(); // register general hooks MCI_Footnotes_Hooks::registerHooks(); - // register all Widgets of the Plugin. - $this->initializeWidgets(); + // initialize the Plugin Dashboard $this->initializeDashboard(); // initialize the Plugin Task $this->initializeTask(); - + // Register all Public Stylesheets and Scripts add_action('init', array($this, 'registerPublic')); // Enqueue all Public Stylesheets and Scripts add_action('wp_enqueue_scripts', array($this, 'registerPublic')); + // Register all Widgets of the Plugin. + add_action('widgets_init', array($this, 'initializeWidgets')); } /** @@ -57,8 +58,8 @@ class MCI_Footnotes { * @author Stefan Herndler * @since 1.5.0 */ - private function initializeWidgets() { - add_action('widgets_init', create_function('', 'return register_widget("MCI_Footnotes_Widget_ReferenceContainer");')); + public function initializeWidgets() { + register_widget("MCI_Footnotes_Widget_ReferenceContainer"); } /** @@ -94,4 +95,4 @@ class MCI_Footnotes { wp_enqueue_script('jquery'); wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__)); } -} \ No newline at end of file +} diff --git a/css/public.css b/css/public.css index effba58..bc8d29f 100755 --- a/css/public.css +++ b/css/public.css @@ -89,4 +89,4 @@ vertical-align: top; width: 99%; text-align: left; -} \ No newline at end of file +} diff --git a/features.txt b/features.txt index 730a609..c5a4b23 100644 --- a/features.txt +++ b/features.txt @@ -17,4 +17,4 @@ the currently used one should be one of those templates and pre-defined styles o == TODO == - Statistics: How many Footnotes in each post/page - Convert from other Footnote Plugins (e.g. ' ((' from Civil Footnotes) - - Anonymous stats to the developers + - Anonymous stats to the developers \ No newline at end of file diff --git a/footnotes.php b/footnotes.php index 341d6e6..6970d11 100755 --- a/footnotes.php +++ b/footnotes.php @@ -1,29 +1,29 @@ + /** + * 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 MCI_Footnotes_wrapText(elementID, openTag, closeTag) { + var textArea = jQuery('#' + elementID); + var len = textArea.val().length; + var start = textArea[0].selectionStart; + var end = textArea[0].selectionEnd; + var selectedText = textArea.val().substring(start, end); + var replacement = openTag + selectedText + closeTag; + textArea.val(textArea.val().substring(0, start) + replacement + textArea.val().substring(end, len)); + } + /** + * adds a new button to the plain text editor + */ + 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 MCI_Footnotes_text_editor_callback() { + jQuery.ajax({ + type: 'POST', + url: '/wp-admin/admin-ajax.php', + data: { + action: 'footnotes_getTags' + }, + success: function(data, textStatus, XMLHttpRequest){ + var l_arr_Tags = JSON.parse(data); + MCI_Footnotes_wrapText("content", l_arr_Tags['start'], l_arr_Tags['end']); + }, + error: function(MLHttpRequest, textStatus, errorThrown){ + } + }); + } + \ No newline at end of file diff --git a/templates/public/tooltip.html b/templates/public/tooltip.html index 38c3d3c..b320652 100644 --- a/templates/public/tooltip.html +++ b/templates/public/tooltip.html @@ -9,4 +9,4 @@ relative: true, offset: [[[offset-y]], [[offset-x]]] }); - \ No newline at end of file +