2014-05-20 11:23:45 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
Plugin Name: footnotes
|
|
|
|
Plugin URI: http://www.herndler.org
|
|
|
|
Description: simple adding footnotes to your pages
|
|
|
|
Author: Mark Cheret, Stefan Herndler
|
2014-05-20 11:35:10 +00:00
|
|
|
Version: 1.0.1
|
2014-05-20 11:23:45 +00:00
|
|
|
Author URI: http://www.cheret.de
|
|
|
|
Text Domain: footnotes
|
|
|
|
Domain Path: /languages
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
Copyright 2014 Mark Cheret, Stefan Herndler (email : mark@cheret.de | admin@herndler.org)
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License, version 3, as
|
|
|
|
published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2014-05-20 11:33:11 +00:00
|
|
|
* Created by Stefan Herndler.
|
|
|
|
* User: Stefan
|
|
|
|
* Date: 15.05.14
|
|
|
|
* Time: 16:21
|
|
|
|
* Version: 1.0
|
|
|
|
* Since: 1.0
|
2014-05-20 11:23:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2014-05-20 11:33:11 +00:00
|
|
|
/* include constants */
|
|
|
|
require_once( dirname( __FILE__ ) . "/includes/defines.php" );
|
|
|
|
/* include language functions */
|
|
|
|
require_once( dirname( __FILE__ ) . "/includes/language.php" );
|
|
|
|
/* include storage functions and global plugin functions */
|
|
|
|
require_once( dirname( __FILE__ ) . "/includes/plugin-settings.php" );
|
|
|
|
/* include script and stylesheet functions */
|
|
|
|
require_once( dirname( __FILE__ ) . "/includes/scripts.php" );
|
|
|
|
/* include script and stylesheet functions */
|
|
|
|
require_once( dirname( __FILE__ ) . "/includes/replacer.php" );
|
|
|
|
|
|
|
|
/* calls the wordpress filter function to replace page content before displayed on public pages */
|
|
|
|
add_filter( 'the_content', 'footnotes_startReplacing' );
|
|
|
|
add_filter( 'the_excerpt', 'footnotes_DummyReplacing' );
|
2014-05-20 11:23:45 +00:00
|
|
|
|
2014-05-20 11:33:11 +00:00
|
|
|
/* calls the wordpress filter function to replace widget text before displayed on public pages */
|
|
|
|
add_filter( 'widget_title', 'footnotes_DummyReplacing' );
|
|
|
|
add_filter( 'widget_text', 'footnotes_DummyReplacing' );
|
2014-05-20 11:23:45 +00:00
|
|
|
|
2014-05-20 11:33:11 +00:00
|
|
|
/* calls the wordpress action to display the footer */
|
|
|
|
add_action( 'get_footer', 'footnotes_StopReplacing' );
|
2014-05-20 11:23:45 +00:00
|
|
|
|
|
|
|
/* adds javascript and stylesheets to the public page */
|
2014-05-20 11:33:11 +00:00
|
|
|
add_action( 'wp_enqueue_scripts', 'footnotes_add_public_stylesheet' );
|
2014-05-20 11:23:45 +00:00
|
|
|
|
|
|
|
/* only admin is allowed to execute the plugin settings */
|
2014-05-20 11:33:11 +00:00
|
|
|
if ( !function_exists( 'is_admin' ) ) {
|
|
|
|
header( 'Status: 403 Forbidden' );
|
|
|
|
header( 'HTTP/1.1 403 Forbidden' );
|
2014-05-20 11:23:45 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* require plugin class */
|
2014-05-20 11:33:11 +00:00
|
|
|
require_once( dirname( __FILE__ ) . "/classes/footnote.php" );
|
2014-05-20 11:23:45 +00:00
|
|
|
/* require plugin settings class */
|
2014-05-20 11:33:11 +00:00
|
|
|
require_once( dirname( __FILE__ ) . "/classes/footnote_settings.php" );
|
2014-05-20 11:23:45 +00:00
|
|
|
|
|
|
|
/* action to locate language and load the wordpress-specific language file */
|
2014-05-20 11:33:11 +00:00
|
|
|
add_action( 'plugins_loaded', 'footnotes_load_language' );
|
2014-05-20 11:23:45 +00:00
|
|
|
|
|
|
|
/* add link to the settings page in plugin main page */
|
|
|
|
$l_str_plugin_file = FOOTNOTES_PLUGIN_DIR_NAME . '/index.php';
|
2014-05-20 11:33:11 +00:00
|
|
|
add_filter( "plugin_action_links_{$l_str_plugin_file}", 'footnotes_plugin_settings_link', 10, 2 );
|
2014-05-20 11:23:45 +00:00
|
|
|
|
|
|
|
/* initialize an object of the plugin class */
|
|
|
|
global $g_obj_FootnotesPlugin;
|
|
|
|
|
|
|
|
/* if object isn't initialized yet, initialize it now */
|
2014-05-20 11:33:11 +00:00
|
|
|
if ( empty( $g_obj_FootnotesPlugin ) ) {
|
|
|
|
$g_obj_FootnotesPlugin = new Class_Footnotes();
|
2014-05-20 11:23:45 +00:00
|
|
|
}
|