PluginProbe
Pushly / 1.1.2
Pushly v1.1.2
2.4.0 2.3.0 trunk 1.0 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 2.0.0 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1
pushly / classes / pushly-admin.php

pushly-admin.php in Pushly 1.1.2, at classes/pushly-admin.php

70 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined('ABSPATH' ) or die('No direct access');
4
5 class Pushly_Admin
6 {
7 public static function init()
8 {
9 $self = new self();
10
11 add_action('admin_menu', array(__CLASS__, 'add_settings_page'));
12 add_action('admin_init', array(__CLASS__, 'init_settings'));
13
14 return $self;
15 }
16
17 public static function add_settings_page()
18 {
19 add_menu_page(
20 'Pushly',
21 'Pushly',
22 'manage_options',
23 'pushly',
24 array(__CLASS__, 'settings_menu_html')
25 );
26 }
27
28 public static function settings_menu_html()
29 {
30 if (! current_user_can('manage_options')) {
31 return;
32 }
33
34 if (isset($_GET['settings-updated'])) {
35 add_settings_error('pushly_messages', 'pushly_message', __('Settings Saved', 'pushly' ), 'updated' );
36 }
37
38 require_once PUSHLY_PLUGIN_PATH_ROOT . 'views/templates/settings.php';
39 }
40
41 public static function init_settings()
42 {
43 register_setting('pushly', 'pushly_options');
44
45 add_settings_section(
46 'pushly_section_settings',
47 __('Settings', 'pushly'),
48 null,
49 'pushly'
50 );
51
52 add_settings_field(
53 'pushly_domain_key',
54 __('Domain Key', 'pushly'),
55 array(__CLASS__, 'field_domain_key'),
56 'pushly',
57 'pushly_section_settings',
58 array(
59 'label_for' => 'pushly_domain_key',
60 )
61 );
62 }
63
64 public static function field_domain_key($args)
65 {
66 $options = get_option('pushly_options');
67 require_once PUSHLY_PLUGIN_PATH_ROOT . 'views/fields/domain_key.php';
68 }
69 }
70