PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / 0.0.1
Code Engine – PHP Snippets, AI Functions & Automation for WordPress v0.0.1
0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 trunk 0.0.1 0.0.2 0.2.8 0.2.9 0.3.0 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 0.3.8 All 32 releases
code-engine / classes / admin.php

admin.php in Code Engine – PHP Snippets, AI Functions & Automation for WordPress 0.0.1, at classes/admin.php

52 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class Meow_CDEGN_Admin {
3
4 public $core;
5
6 /** @var Meow_CDEGN_List_Table */
7 public $list_table;
8
9 protected $menu_slug = 'cdegn_settings';
10
11 public function __construct( $core ) {
12 $this->core = $core;
13
14 if ( is_admin() ) {
15 add_action( 'admin_menu', array( $this, 'app_menu' ) );
16 add_filter( 'plugin_action_links_' . plugin_basename( CDEGN_ENTRY ), array( $this, 'plugin_action_links' ), 10, 2 );
17 }
18 }
19
20 public function app_menu() {
21 // Needs to initialize the list before admin-header.php called.
22 $this->list_table = new Meow_CDEGN_List_Table( $this->core );
23
24 add_submenu_page( 'options-general.php', 'Code Engine', 'Code Engine', 'manage_options',
25 $this->menu_slug, array( $this, 'admin_settings' ) );
26 }
27
28 public function admin_settings() {
29 $this->list_table->prepare_items();
30 include_once 'views/settings.php';
31 }
32
33 public function plugin_action_links( array $actions, string $plugin_file ): array {
34 if ( plugin_basename( CDEGN_ENTRY ) !== $plugin_file ) {
35 return $actions;
36 }
37
38 return array_merge(
39 [
40 sprintf(
41 '<a href="%s">%s</a>',
42 esc_url( add_query_arg( 'page', $this->menu_slug, admin_url( 'options-general.php' ) ) ),
43 esc_html__( 'Settings', 'code-engine' )
44 ),
45 ],
46 $actions,
47 );
48 }
49 }
50
51 ?>
52