getWPTBPluginOptions();
}
//Returns an array of admin options, but sets default values if none are loaded.
function getWPTBPluginOptions() {
$wptbAdminOptions = array(
'enable_topbar' => 'false',
'text_color' => '#000000',
'bar_color' => '#ffffff',
'bottom_color' => '#f90000',
'link_color' => '#c00000',
'bottom_border_height' => '3',
'include_pages' => '0',
'delay_time' => '5000',
'slide_time' => '200',
'font_size' => '14',
'padding_top' => '8',
'padding_bottom' => '8',
'bar_link' => 'http://wordpress.org/extend/plugins/wp-topbar/',
'bar_text' => 'Get your own TopBar ',
'bar_link_text' => 'from the Wordpress plugin repository',
'text_align' => 'center',
'bar_image' => '',
'enable_image' => 'false',
'custom_css_bar' => 'background:rgb(254,255,255);background:-moz-linear-gradient(top,rgba(254,255,255,1)0%,rgba(221,241,249,1)35%,rgba(160,216,239,1)100%);background:-webkit-gradient(linear,lefttop,leftbottom,color-stop(0%,rgba(254,255,255,1)),color-stop(35%,rgba(221,241,249,1)),color-stop(100%,rgba(160,216,239,1)));background:-webkit-linear-gradient(top,rgba(254,255,255,1)0%,rgba(221,241,249,1)35%,rgba(160,216,239,1)100%);background:-o-linear-gradient(top,rgba(254,255,255,1)0%,rgba(221,241,249,1)35%,rgba(160,216,239,1)100%);background:-ms-linear-gradient(top,rgba(254,255,255,1)0%,rgba(221,241,249,1)35%,rgba(160,216,239,1)100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#feffff",endColorstr="#a0d8ef",GradientType=0);background:linear-gradient(top,rgba(254,255,255,1)0%,rgba(221,241,249,1)35%,rgba(160,216,239,1)100%);',
'custom_css_text' => 'font-family:georgia;padding-right:10px;',
'margin_top' => '0',
'margin_bottom' => '0');
$wptbOptions = get_option($this->adminOptionsName);
if (!empty($wptbOptions)) {
foreach ($wptbOptions as $key => $option)
$wptbAdminOptions[$key] = $option;
}
return $wptbAdminOptions;
}
// common code to display the TopBar
function wptb_displayTopBar($visibility, $wptbOptions) {
?>
margin: px 0px px;
text-align:;
font-size: px;
padding-top:px;
padding-bottom:px;
color:; display:block;
border-bottom-color:;
border-bottom-style: solid;
border-bottom-width: px;
border-bottom-width: px;
">
"href=""target="_blank">
getWPTBPluginOptions();
if ($wptbOptions['enable_topbar'] == "false") { return; }
$thePostID = $wp_query->post->ID;
if ( ! in_array( $thePostID, explode( ',', $wptbOptions['include_pages'] ) ) && ! in_array( 0, explode( ',', $wptbOptions['include_pages'] ) ) )
{ return; }
echo '';
$vis = "visibility:hidden;";
$this->wptb_displayTopBar($vis,$wptbOptions);
echo '
getWPTBPluginOptions();
if (isset($_POST['update_wptbSettings'])) {
if (isset($_POST['wptbenabletopbar'])) {
$wptbOptions['enable_topbar'] = $_POST['wptbenabletopbar'];
}
if (isset($_POST['wptbtextcolor'])) {
$wptbOptions['text_color'] = $_POST['wptbtextcolor'];
}
if (isset($_POST['wptbbarcolor'])) {
$wptbOptions['bar_color'] = $_POST['wptbbarcolor'];
}
if (isset($_POST['wptbbottomcolor'])) {
$wptbOptions['bottom_color'] = $_POST['wptbbottomcolor'];
}
if (isset($_POST['wptblinkcolor'])) {
$wptbOptions['link_color'] = $_POST['wptblinkcolor'];
}
if (isset($_POST['wptbincludepages'])) {
$wptbOptions['include_pages'] = $_POST['wptbincludepages'];
}
if (isset($_POST['wptbbottomborderheight'])) {
if (!is_numeric($_POST['wptbbottomborderheight'])) {
echo 'Bottom border height is not numeric. Resetting to 3px.
';
$wptbOptions['bottom_border_height'] = 3;
}
else
$wptbOptions['bottom_border_height'] = $_POST['wptbbottomborderheight']+0;
}
if (isset($_POST['wptbdelayintime'])) {
if (!is_numeric($_POST['wptbdelayintime'])) {
echo 'Delay time is not numeric. Resetting to zero.
';
$wptbOptions['delay_time'] = 0;
}
else
$wptbOptions['delay_time'] = $_POST['wptbdelayintime']+0;
}
if (isset($_POST['wptbslidetime'])) {
if (!is_numeric($_POST['wptbslidetime'])) {
echo 'Slide time is not numeric. Resetting to zero.
';
$wptbOptions['slide_time'] = 0;
}
else
$wptbOptions['slide_time'] = $_POST['wptbslidetime']+0;
}
if (isset($_POST['wptbfontsize'])) {
if (!is_numeric($_POST['wptbfontsize'])) {
echo 'Top padding is not numeric. Resetting to 8px.
';
$wptbOptions['font_size'] = 8;
}
else
$wptbOptions['font_size'] = $_POST['wptbfontsize']+0;
}
if (isset($_POST['wptbpaddingtop'])) {
if (!is_numeric($_POST['wptbpaddingtop'])) {
echo 'Top padding is not numeric. Resetting to 8px.
';
$wptbOptions['padding_top'] = 8;
}
else
$wptbOptions['padding_top'] = $_POST['wptbpaddingtop']+0;
}
if (isset($_POST['wptbpaddingbottom'])) {
if (!is_numeric($_POST['wptbpaddingbottom'])) {
echo 'Bottom padding is not numeric. Resetting to 8px.
';
$wptbOptions['padding_bottom'] = 8;
}
else
$wptbOptions['padding_bottom'] = $_POST['wptbpaddingbottom']+0;
}
if (isset($_POST['wptbmargintop'])) {
if (!is_numeric($_POST['wptbmargintop'])) {
echo 'Top margin is not numeric. Resetting to 0px.
';
$wptbOptions['margin_top'] = 0;
}
else
$wptbOptions['margin_top'] = $_POST['wptbmargintop']+0;
}
if (isset($_POST['wptbmarginbottom'])) {
if (!is_numeric($_POST['wptbmarginbottom'])) {
echo 'Bottom margin is not numeric. Resetting to 0px.
';
$wptbOptions['margin_bottom'] = 0;
}
else
$wptbOptions['margin_bottom'] = $_POST['wptbmarginbottom']+0;
}
if (isset($_POST['wptblink'])) {
$wptbOptions['bar_link'] = $_POST['wptblink'];
}
if (isset($_POST['wptbbartext'])) {
$wptbOptions['bar_text'] = $_POST['wptbbartext'];
}
if (isset($_POST['wptblinktext'])) {
$wptbOptions['bar_link_text'] = $_POST['wptblinktext'];
}
if (isset($_POST['wptbtextalign'])) {
$wptbOptions['text_align'] = $_POST['wptbtextalign'];
}
if (isset($_POST['wptbbarimage'])) {
$wptbOptions['bar_image'] = $_POST['wptbbarimage'];
}
if (isset($_POST['wptbenableimage'])) {
$wptbOptions['enable_image'] = $_POST['wptbenableimage'];
}
if (isset($_POST['wptbcustomcssbar'])) {
$wptbOptions['custom_css_bar'] = str_replace('"',"'",stripslashes_deep($_POST['wptbcustomcssbar']));
}
if (isset($_POST['wptbcustomcsstext'])) {
$wptbOptions['custom_css_text'] = str_replace('"',"'",stripslashes_deep($_POST['wptbcustomcsstext']));
}
update_option($this->adminOptionsName, $wptbOptions);
?>
adminOptionsName);
$wptbOptions = $this->getWPTBPluginOptions();
?>
%s', admin_url( 'admin.php?page=wp-topbar.php' ), __('Settings') );
array_unshift($links, $wptb_settings_link);
return $links;
}
// donate link on manage plugin page
//function wptb_plugin_donate_link($links, $file) {
// if ($file == plugin_basename(__FILE__)) {
// $donate_link = 'Donate';
// $links[] = $donate_link;
// }
// return $links;
//}
//Actions and Filters, if on plugin admin page
if (isset($wtpb_plugin)) {
//Actions
add_action('admin_menu', 'wptb_options_panel');
add_action('activate_wptb-plugin-series/wptb-plugin-series.php', array(&$wtpb_plugin, 'init'));
add_action('init', 'wptb_enqueue_scripts');
//Filters
add_filter('plugin_action_links_' . plugin_basename(__FILE__) , 'wptb_plugin_action_links');
// add_filter('plugin_row_meta', 'wptb_plugin_donate_link', 10, 2);
}
//Actions and Filters, on all pages
if (isset($wtpb_plugin)) {
add_action('wp_head', array(&$wtpb_plugin, 'wptb_addHeaderCode'), 1);
add_action('wp_footer', 'wptb_reveal_topbar', 15);
}
?>