PluginProbe ʕ •ᴥ•ʔ
WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager / 2.3.6
WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager v2.3.6
2.3.6 trunk 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.5.0 1.6.0 1.6.1 1.6.2 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.13.1 2.0.2 2.0.3 2.0.4 2.0.4.1 2.0.4.2 2.0.4.3 2.0.4.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.2 2.1.3 2.1.3.1 2.1.4 2.1.4.1 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3.1 2.2.4 2.2.4.1 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.2.1 2.3.3 2.3.4 2.3.5
insert-headers-and-footers / includes / auto-insert / class-wpcode-auto-insert-admin.php
insert-headers-and-footers / includes / auto-insert Last commit date
class-wpcode-auto-insert-admin.php 1 year ago class-wpcode-auto-insert-archive.php 1 year ago class-wpcode-auto-insert-everywhere.php 4 months ago class-wpcode-auto-insert-single.php 1 year ago class-wpcode-auto-insert-site-wide.php 1 year ago class-wpcode-auto-insert-type.php 4 months ago
class-wpcode-auto-insert-admin.php
111 lines
1 <?php
2 /**
3 * Class to auto-insert snippets in the Admin area.
4 *
5 * @package wpcode
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 /**
13 * Class WPCode_Auto_Insert_Admin.
14 */
15 class WPCode_Auto_Insert_Admin extends WPCode_Auto_Insert_Type {
16
17 /**
18 * The category of this type.
19 *
20 * @var string
21 */
22 public $category = 'global';
23
24 /**
25 * Load the available options and labels.
26 *
27 * @return void
28 */
29 public function init() {
30 $this->locations = array(
31 'admin_head' => array(),
32 'admin_footer' => array(),
33 );
34 }
35
36 /**
37 * Load the label.
38 *
39 * @return void
40 */
41 public function load_label() {
42 $this->label = __( 'Admin Area', 'insert-headers-and-footers' );
43 }
44
45 /**
46 * Load the available locations.
47 *
48 * @return void
49 */
50 public function load_locations() {
51 $this->locations = array(
52 'admin_head' => array(
53 'label' => esc_html__( 'Admin header', 'insert-headers-and-footers' ),
54 'description' => esc_html__( 'Insert snippet in the wp-admin header area.', 'insert-headers-and-footers' ),
55 ),
56 'admin_footer' => array(
57 'label' => esc_html__( 'Admin footer', 'insert-headers-and-footers' ),
58 'description' => esc_html__( 'Insert snippet in the wp-admin footer.', 'insert-headers-and-footers' ),
59 ),
60 );
61 }
62
63 /**
64 * Checks if we are on an archive page and we should be executing hooks.
65 *
66 * @return bool
67 */
68 public function conditions() {
69 return is_admin();
70 }
71
72 /**
73 * Add hooks specific to single posts.
74 *
75 * @return void
76 */
77 public function hooks() {
78 add_action( 'admin_head', array( $this, 'insert_admin_head' ), 9 );
79 add_action( 'admin_footer', array( $this, 'insert_admin_footer' ), 9 );
80 }
81
82 /**
83 * Output snippet in the admin head.
84 *
85 * @return void
86 */
87 public function insert_admin_head() {
88 $this->output_location( 'admin_head' );
89 }
90
91 /**
92 * Output snippet in the admin footer.
93 *
94 * @return void
95 */
96 public function insert_admin_footer() {
97 $this->output_location( 'admin_footer' );
98 }
99
100 /**
101 * Override the parent method to add the start hook specific to the admin.
102 *
103 * @return void
104 */
105 protected function add_start_hook() {
106 add_action( 'admin_init', array( $this, 'maybe_run_hooks' ) );
107 }
108 }
109
110 new WPCode_Auto_Insert_Admin();
111