PluginProbe
Announcer – Sticky Message Banner & Notification Bar / 6.2
Announcer – Sticky Message Banner & Notification Bar v6.2
trunk 1.5 2.1 2.2 2.3 2.4 3.0 4.0 4.1 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.0.1 6.1 6.2 6.3 6.4
announcer / announcer.php

announcer.php in Announcer – Sticky Message Banner & Notification Bar 6.2, at announcer.php

85 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Announcer
4 Plugin URI: https://www.aakashweb.com/wordpress-plugins/announcer/
5 Description: Add notification bar to your site and display any message like welcome message, promotions, coupons, news banner to the top/bottom of the page.
6 Author: Aakash Chakravarthy
7 Version: 6.2
8 Author URI: https://www.aakashweb.com/
9 Text Domain: announcer
10 Domain Path: /languages
11 */
12
13 define( 'ANCR_VERSION', '6.2' );
14 define( 'ANCR_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
15 define( 'ANCR_URL', plugin_dir_url( __FILE__ ) );
16 define( 'ANCR_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );
17 define( 'ANCR_BASE_NAME', plugin_basename( __FILE__ ) );
18 define( 'ANCR_POST_TYPE', 'announcer' );
19
20 final class Announcer{
21
22 static public $announcements = array();
23
24 public static function init(){
25
26 self::includes();
27
28 add_action( 'plugins_loaded', array( __CLASS__, 'load_text_domain' ) );
29
30 }
31
32 public static function includes(){
33
34 include_once( ANCR_PATH . 'includes/settings.php' );
35 include_once( ANCR_PATH . 'includes/utilities.php' );
36 include_once( ANCR_PATH . 'includes/location-rules/index.php' );
37 include_once( ANCR_PATH . 'includes/display.php' );
38
39 include_once( ANCR_PATH . 'admin/admin.php' );
40 include_once( ANCR_PATH . 'admin/edit.php' );
41 include_once( ANCR_PATH . 'admin/manage.php' );
42 include_once( ANCR_PATH . 'admin/settings-form.php' );
43 include_once( ANCR_PATH . 'admin/fields.php' );
44
45 }
46
47 public static function get_announcements(){
48
49 if( !empty( self::$announcements ) ){
50 return self::$announcements;
51 }
52
53 $announcements = array();
54 $announcement_posts = get_posts(array(
55 'post_type' => ANCR_POST_TYPE,
56 'posts_per_page' => -1,
57 'orderby' => 'menu_order',
58 'order' => 'asc',
59 'post_status' => 'publish'
60 ));
61
62 foreach( $announcement_posts as $index => $post ){
63 $announcements[ $post->ID ] = array(
64 'content' => $post->post_content,
65 'settings' => ANCR_Settings::get( $post->ID )
66 );
67 }
68
69 self::$announcements = $announcements;
70
71 return $announcements;
72
73 }
74
75 public static function load_text_domain(){
76
77 load_plugin_textdomain( 'announcer', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
78
79 }
80
81 }
82
83 Announcer::init();
84
85 ?>