aioFaviconSettings = (array)get_option(AIOFAVICON_SETTINGSNAME);
if(!is_admin()){
require_once AIOFAVICON_PLUGIN_DIR . '/includes/header-blog.php';
add_action( 'wp_head', 'aioFaviconRenderBlogHeader' );
} else if (is_admin()){
require_once AIOFAVICON_PLUGIN_DIR . '/includes/header-admin.php';
add_action( 'admin_head', 'aioFaviconRenderAdminHeader' );
}
// only register scripts and styles for this plugin page since JavaScript overwrites default WordPress behaviour
if (isset($_GET['page']) && $_GET['page'] == 'all-in-one-favicon/all-in-one-favicon.php') {
add_action('admin_print_scripts', array(& $this, 'registerAdminScripts'));
add_action('admin_print_styles', array(& $this, 'registerAdminStyles'));
}
add_action('wp_meta',array(& $this, 'renderMetaLink'));
}
// allInOneFavicon()
/**
* Renders plugin link in Meta widget
*
* @since 1.0
* @access private
* @author Arne Franken
*/
function renderMetaLink() { ?>
registerAdminNotice($return_message);
$this->registerSettingsPage();
}
// registerAdminMenu()
/**
* Registers Admin Notices
*
* @since 1.0
* @access private
* @author Arne Franken
*/
function registerAdminNotice($notice) {
if ($notice != '') {
$message = '';
add_action('admin_notices', create_function('', "echo '$message';"));
}
}
// registerAdminNotice()
/**
* Update jQuery Colorbox settings wrapper
*
* handles checks and redirect
*
* @since 1.0
* @access private
* @author Arne Franken
*/
function aioFaviconUpdateSettings() {
if (!current_user_can('manage_options'))
wp_die(__('Did not update settings, you do not have the necessary rights.', AIOFAVICON_TEXTDOMAIN));
//cross check the given referer for nonce set in settings form
check_admin_referer('aio-favicon-settings-form');
//get settings from plugins admin page
$this->aioFaviconSettings = $_POST[AIOFAVICON_SETTINGSNAME];
//have to add jQueryColorboxVersion here because it is not included in the HTML form
$this->aioFaviconSettings['aioFaviconVersion'] = AIOFAVICON_VERSION;
$this->updateSettingsInDatabase();
$referrer = str_replace(array('&aioFaviconUpdateSettings', '&aioFaviconDeleteSettings'), '', $_POST['_wp_http_referer']);
wp_redirect($referrer . '&aioFaviconUpdateSettings');
}
// aioFaviconUpdateSettings()
/**
* Update jQuery Colorbox settings
*
* handles updating settings in the WordPress database
*
* @since 1.0
* @access private
* @author Arne Franken
*/
function updateSettingsInDatabase() {
update_option(AIOFAVICON_SETTINGSNAME, $this->aioFaviconSettings);
}
//aioFaviconUpdateSettingsInDatabase()
/**
* Delete jQuery Colorbox settings wrapper
*
* handles checks and redirect
*
* @since 1.0
* @access private
* @author Arne Franken
*/
function aioFaviconDeleteSettings() {
if (current_user_can('manage_options') && isset($_POST['delete_settings-true'])) {
//cross check the given referer for nonce set in delete settings form
check_admin_referer('aio-favicon-delete_settings-form');
$this->deleteSettingsFromDatabase();
} else {
wp_die(sprintf(__('Did not delete %1$s settings. Either you dont have the nececssary rights or you didnt check the checkbox.', AIOFAVICON_TEXTDOMAIN), AIOFAVICON_NAME));
}
//clean up referrer
$referrer = str_replace(array('&aioFaviconUpdateSettings', '&aioFaviconDeleteSettings'), '', $_POST['_wp_http_referer']);
wp_redirect($referrer . '&aioFaviconDeleteSettings');
}
// aioFaviconDeleteSettings()
/**
* Delete jQuery Colorbox settings
*
* handles deletion from WordPress database
*
* @since 1.0
* @access private
* @author Arne Franken
*/
function deleteSettingsFromDatabase() {
delete_option(AIOFAVICON_SETTINGSNAME);
}
// aioFaviconDeleteSettingsFromDatabase()
}
?>