2009){ $year_check = 1;} if($month < 12 && $month != 0){ $month_check = 1; } if($day < 31 && $day != 0){ $day_check = 1; } if($year_check == 1 && $month_check == 1 && $day_check == 1){ return 1; } } } function announcer_compare_dates(){ $options = get_option('announcer_data'); $announcer_status = $options['announcer_status']; $announcer_end_date = strtotime($options['announcer_end_date']); $announcer_todays_date = strtotime(date('Y-n-d')); if (($announcer_end_date > $announcer_todays_date) || $announcer_end_date == 0){ return 1; }else{ return 0; } } ## Main function function announcer(){ static $announcer_is_added; if($announcer_is_added != 'yes' && $announcer_is_added == NULL){ $options = get_option('announcer_data'); $announcer_status = $options['announcer_status']; $announcer_previous_content = stripslashes($options['announcer_previous_content']); $announcer_content = stripslashes($options['announcer_content']); $announcer_end_date = $options['announcer_end_date']; $announcer_id_name = $options['announcer_id_name']; $announcer_show_close_button = $options['announcer_show_close_button']; $announcer_class_type = $options['announcer_class_type']; $announcer_custom_class_name = $options['announcer_custom_class_name']; $announcer_inbuilt_class_select = $options['announcer_inbuilt_class_select']; $announcer_revision = $options['announcer_revision']; ## For close button if ($announcer_show_close_button == 'Yes'){ $announcer_close_button = "\n" . 'x' . "\n"; }else{ $announcer_close_button = ''; } ## For class type if ($announcer_class_type == '1'){ $announcer_class_name = $announcer_custom_class_name; }else{ $announcer_class_name = $announcer_inbuilt_class_select; } ## Announcement Revision check if($_COOKIE['announcerRevision'] != $announcer_revision){ setcookie("announcerRevision", $announcer_revision, time() + 1866240000, '/'); setcookie("toggle-" . $announcer_id_name , "show", time() + 1866240000 , '/'); } ## Main output if ($announcer_status == "1" && announcer_compare_dates()){ echo "\n\n"; echo '
'.$announcer_close_button.$announcer_content.'
'; echo "\n\n"; $announcer_is_added = 'yes'; } } } function announcer_add(){ $options = get_option('announcer_data'); $announcer_placement = $options['announcer_placement']; if($announcer_placement == 'bp'){ add_action('loop_start', 'announcer'); }elseif($announcer_placement == 'ap'){ add_action('loop_end', 'announcer'); } } function announcer_js() { $options = get_option('announcer_data'); $announcer_id_name = $options['announcer_id_name']; $announcer_class_type = $options['announcer_class_type']; $announcer_js_content = '' . ''; echo $announcer_js_content; if ($announcer_class_type != '1'){ echo ''; } } function announcer_button($what){ $options = get_option('announcer_data'); $announcer_status = $options['announcer_status']; $announcer_end_date = $options['announcer_end_date']; if ( $announcer_status == '1' && announcer_compare_dates() ){ if($what == 'class'){ echo 'announceStatusButtonGreen'; }else{ echo 'Announcement is On'; } }else{ if($what == 'text'){ echo 'Announcement is Off'; }else{ echo 'announceStatusButtonOrange'; } } } function announcer_addpage() { add_submenu_page('options-general.php', 'Announcer', 'Announcer', 10, __FILE__, 'announcer_admin_page'); } #### End basic functions #### ## Actions add_action('admin_menu', 'announcer_addpage'); add_action('init', 'announcer_add'); add_action('wp_footer', 'announcer_js'); #### Announcer Admin page #### function announcer_admin_page(){ ### Shortcoder basic infos $announcer_version = '1.3' ; $announcer_author = 'Aakash Chakravarthy' ; $announcer_donate_link = 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=donations@aakashweb.com&item_name=Donation for Announcer&amount=&currency_code=USD'; ## Announcer admin page $announcer_updated = false; $options = get_option('announcer_data'); ## Check version if($options['announcer_info']['announcer_version'] == $announcer_version ){ $announcer_show_admin = 1; } ## Announcer date entry check if(!$_POST["announcer_submit"] && announcer_compare_dates() == 0){ echo '

The end date ' . $options['announcer_end_date'] . ' has expired. Announcement is turned off

'; } ## Announce main admin form if ( $_POST["announcer_submit"] && $_POST["announcer_form_main"] == '1') { ## Default msg $announcer_msg = 'Updated successfully !'; ## If no data is entered if($_POST['announcer_end_date'] == NULL){ $_POST['announcer_end_date'] = 0; } if($_POST['announcer_id_name'] == NULL){ echo '

Please enter a ID for the announcement box

'; } ## Getting the posted datas $options['announcer_previous_content'] = $options['announcer_content']; $options['announcer_status'] = $_POST['announcer_status']; $options['announcer_end_date'] = $_POST['announcer_end_date']; $options['announcer_id_name'] = $_POST['announcer_id_name']; $options['announcer_show_close_button'] = $_POST['announcer_show_close_button']; $options['announcer_class_type'] = $_POST['announcer_class_type']; $options['announcer_custom_class_name'] = $_POST['announcer_custom_class_name']; $options['announcer_inbuilt_class_select'] = $_POST['announcer_inbuilt_class_select']; $options['announcer_placement'] = $_POST['announcer_placement']; if($options['announcer_previous_content'] != $_POST['announcer_content']){ $options['announcer_content'] = $_POST['announcer_content']; $options['announcer_revision'] = $options['announcer_revision'] + 1 ; }else{ $announcer_msg = "Announcement content is not changed. Other options are updated !"; } ## Updating the DB update_option("announcer_data", $options); $announcer_updated = "true"; ## Updated message if($announcer_updated == 'true'){ echo '

' . $announcer_msg . '

'; if (str_shuffle('123') == '123' || str_shuffle('123') == '321'){ echo '

Like this plugin, then just donate and support the future of this plugin !

'; } }else{ echo '

Unable to update !

'; } ## Check whether date is valid if(announcer_compare_dates() == 0 || announcer_check_user_date() == 0){ echo '

The end date ' . $options['announcer_end_date'] . ' has expired or invalid. Please check the date. Format is YYYY-MM-DD

'; $announcer_end_date_class = 'style="border: 1px solid #FF0000;"'; } } ## Announcer intro form if ($_POST["announcer_submit_intro"] && $_POST["announcer_form_intro"] == '1' ) { $options['announcer_info']['announcer_version'] = $announcer_version; update_option("announcer_data", $options); if($options['announcer_info']['announcer_is_new'] == 0){ $announcer_show_admin = 1; }else{ echo '

Seems like a version error and cannot continue to admin page please try again or contact the plugin author.

'; } } ## Retrieve and assign the new data to variables $announcer_status = $options['announcer_status']; $announcer_content = stripslashes($options['announcer_content']); $announcer_end_date = $options['announcer_end_date']; $announcer_id_name = $options['announcer_id_name']; $announcer_show_close_button = $options['announcer_show_close_button']; $announcer_class_type = $options['announcer_class_type']; $announcer_custom_class_name = $options['announcer_custom_class_name']; $announcer_inbuilt_class_select = $options['announcer_inbuilt_class_select']; $announcer_placement = $options['announcer_placement']; ?>

 Announcer v


Your Announcement
 
/>
Format is YYYY-MM-DD | 0 for no limit

Announcement box Class

/>

Announcement box placement






This will not be shown in future | All links open in new tab

  v

Welcome to Announcer wordpress plugin.
Before using this plugin just look at the usage, documentation, features of this plugin.
  1. Features
  2. Usage
  3. Documentation
  4. FAQs
  5. Author homepage
  6. Make a donation
  7. Subscribe to updates

Complete Usage in short :

  1. Enter an announcement.
  2. Enter a valid date, div tag ID and other options. "On" the announcement.
  3. Choose the place for the announcement placement.
  4. If you want to place it in anywhere in a theme file, copy the code <?php if(function_exists('announcer')) { announcer();} ?>in your theme file
Subscribe:
Donate