Changeset 2087009
- Timestamp:
- 05/13/2019 03:34:09 PM (7 years ago)
- Location:
- be-lazy/trunk
- Files:
-
- 5 added
- 3 edited
-
app/Controllers/Backend.php (modified) (1 diff)
-
app/Controllers/Frontend.php (modified) (1 diff)
-
app/Views (added)
-
app/Views/options_page.php (added)
-
assets/css/be-lazy-admin.css (added)
-
assets/img (added)
-
assets/img/be-lazy.svg (added)
-
config/constants.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
be-lazy/trunk/app/Controllers/Backend.php
r2086714 r2087009 7 7 public function __construct() 8 8 { 9 add_action('admin_enqueue_scripts', [$this, 'enqueue_styles']); 10 add_action('admin_menu', [$this, 'add_menu']); 11 add_action('admin_init', [$this, 'register_settings']); 9 12 } 13 14 public function enqueue_styles() 15 { 16 wp_enqueue_style('be-lazy', BE_LAZY_URL_CSS .'be-lazy-admin.css', [], BE_LAZY_VERSION); 17 } 18 19 public function add_menu() 20 { 21 add_menu_page( 22 'Be Lazy', 23 'Be Lazy', 24 'manage_options', 25 BE_LAZY_SLUG, 26 [$this, 'show_options_page'], 27 BE_LAZY_URL_IMG .'/be-lazy.svg', 28 999 29 ); 30 } 31 32 public function show_options_page() 33 { 34 require_once BE_LAZY_DIR_VIEWS .'options_page.php'; 35 } 36 37 public function register_settings() 38 { 39 register_setting(BE_LAZY_SLUG, BE_LAZY_SLUG_DB .'_active', [ 40 // 'default' => '1' 41 ]); 42 } 10 43 } -
be-lazy/trunk/app/Controllers/Frontend.php
r2086752 r2087009 7 7 public function __construct() 8 8 { 9 add_action('wp_enqueue_scripts', [$this, 'enqueue_styles']); 10 add_action('wp_enqueue_scripts', [$this, 'enqueue_scripts']); 11 12 add_filter('the_content', [$this, 'filter_content'], 100); 9 switch(get_option(BE_LAZY_SLUG_DB .'_active')) 10 { 11 case '0': 12 case '1': 13 add_action('wp_enqueue_scripts', [$this, 'enqueue_styles']); 14 add_action('wp_enqueue_scripts', [$this, 'enqueue_scripts']); 15 add_filter('the_content', [$this, 'filter_content'], 100); 16 break; 17 } 13 18 } 14 19 15 20 public function enqueue_styles() 16 21 { 17 wp_enqueue_style('be-lazy', BE_LAZY_URL_CSS .'be-lazy.css', [], '1.0.0');22 wp_enqueue_style('be-lazy', BE_LAZY_URL_CSS .'be-lazy.css', [], BE_LAZY_VERSION); 18 23 } 19 24 20 25 public function enqueue_scripts() 21 26 { 22 wp_enqueue_script('be-lazy', BE_LAZY_URL_JS .'be-lazy.js', [], '1.0.0', true);27 wp_enqueue_script('be-lazy', BE_LAZY_URL_JS .'be-lazy.js', [], BE_LAZY_VERSION, true); 23 28 } 24 29 -
be-lazy/trunk/config/constants.php
r2086730 r2087009 1 1 <?php 2 2 3 /**4 * @var string Base directory5 */6 3 define('BE_LAZY_DIR', dirname(__DIR__) . '/'); 7 4 8 /**9 * @var string Base url10 */11 5 define('BE_LAZY_URL', plugin_dir_url(__DIR__)); 12 6 13 /**14 * @var string Plugin slug15 */16 7 const BE_LAZY_SLUG = 'be-lazy'; 17 8 18 /** 19 * @var string JS directory 20 */ 9 const BE_LAZY_SLUG_DB = 'be_lazy'; 10 11 const BE_LAZY_VERSION = '1.0'; 12 13 const BE_LAZY_DIR_VIEWS = BE_LAZY_DIR .'app/Views/'; 14 21 15 const BE_LAZY_URL_JS = BE_LAZY_URL . 'assets/js/'; 22 16 23 /**24 * @var string CSS directory25 */26 17 const BE_LAZY_URL_CSS = BE_LAZY_URL . 'assets/css/'; 18 19 const BE_LAZY_URL_IMG = BE_LAZY_URL . 'assets/img/';
Note: See TracChangeset
for help on using the changeset viewer.