PluginProbe ʕ •ᴥ•ʔ
Code Manager / 1.0.7
Code Manager v1.0.7
1.0.47 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.3 1.0.30 1.0.31 1.0.32 1.0.33 1.0.34 1.0.35 1.0.36 1.0.37 1.0.38 1.0.39 1.0.4 1.0.40 1.0.41 1.0.42 1.0.43 1.0.44 1.0.45 1.0.46 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
code-manager / Code_Manager / Code_Manager_Tabs.php
code-manager / Code_Manager Last commit date
Code_Manager.php 5 years ago Code_Manager_Export.php 5 years ago Code_Manager_Form.php 5 years ago Code_Manager_Import.php 5 years ago Code_Manager_Import_File.php 5 years ago Code_Manager_List.php 5 years ago Code_Manager_List_View.php 5 years ago Code_Manager_Model.php 5 years ago Code_Manager_Preview.php 5 years ago Code_Manager_Settings.php 5 years ago Code_Manager_Tabs.php 5 years ago Message_Box.php 5 years ago WP_List_Table.php 5 years ago
Code_Manager_Tabs.php
126 lines
1 <?php
2
3 namespace Code_Manager {
4
5 /**
6 * Class Code_Manager_Tabs
7 *
8 * Builds the Code Manager tab mode IDE
9 *
10 * @author Peter Schulz
11 * @since 1.0.0
12 */
13 class Code_Manager_Tabs {
14
15 protected $wpnonce;
16 protected $wpnonce_get_code;
17
18 /**
19 * Code_Manager_Tabs constructor
20 *
21 * Creates a number of wpnonces needed to authorize ajax calls
22 *
23 * @since 1.0.0
24 */
25 public function __construct() {
26 $this->wpnonce = wp_create_nonce( 'code-manager-' . Code_manager::get_current_user_login() );
27 $this->wpnonce_get_code = wp_create_nonce( 'code-manager-get-code' . Code_manager::get_current_user_login() );
28 }
29
30 /**
31 * Shows the tab mode IDE
32 *
33 * JavaScript depending on server variables not available in the browser are added here. Generic JavaScript
34 * code is added as a script file.
35 *
36 * @since 1.0.0
37 */
38 public function show() {
39 ?>
40 <script type="text/javascript">
41 var wpnonce = '<?php echo $this->wpnonce; ?>';
42 var wpnonce_get_code = '<?php echo $this->wpnonce_get_code; ?>';
43 var code_manager_code_groups = [];
44 <?php
45 $code_manager_tab_class = CODE_MANAGER_TAB_CLASS;
46 $code_manager_tab = new $code_manager_tab_class();
47 $code_types = $code_manager_tab->get_code_types();
48 foreach ( $code_types as $code_type_group => $value ) {
49 echo 'code_manager_code_group = [];';
50 foreach ( $value as $code_type => $code_type_label ) {
51 echo "code_manager_code_group['{$code_type}'] = '{$code_type_label}';";
52 }
53 echo "code_manager_code_groups['{$code_type_group}'] = code_manager_code_group;";
54 }
55 ?>
56 </script>
57 <div class="wrap">
58 <table cellspacing="0" cellpadding="0" border="0" width="100%">
59 <tr>
60 <td>
61 <h1 class="wp-heading-inline">
62 <span>
63 <span class="cm_page_title">
64 <?php echo CODE_MANAGER_H1_TITLE; ?>
65 </span>
66 <a href="?page=<?php echo CODE_MANAGER_MENU_SLUG; ?>"
67 title="Switch to list mode">
68 <span class="material-icons cm_menu_title">menu</span></a>
69 <a id="code_manager_new" href="javascript:void(0)">
70 <span class="material-icons cm_menu_title"
71 title="Add new code">add_circle_outline</span></a>
72 <a id="code_manager_open" href="javascript:void(0)">
73 <span class="material-icons cm_menu_title"
74 title="Open existing code">arrow_circle_down</span></a>
75 <a href="<?php echo CODE_MANAGER_HELP_URL; ?>" target="_blank"
76 title="Plugin help - opens in a new tab or window">
77 <span class="material-icons cm_menu_title">help_outline</span></a>
78 </span>
79 </h1>
80 </td>
81 <td style="text-align:right;padding-right:10px;padding-top:4px">
82 <a id="disable_preview"
83 href="javascript:void(0)"
84 class="material-icons cm_menu_title"
85 style="text-decoration:none"
86 title="Turn of preview mode for all code IDs"
87 >visibility_off</a>
88 </td>
89 </tr>
90 </table>
91 <div id="code_manager_open_frame" style="display: none; background-color: transparent;">
92 <form>
93 <select id="code_manager_code_list">
94 <option>Loading data...</option>
95 </select>
96 </form>
97 </div>
98 <div id="code_manager_taskbar_tabmode" class="nav-tab-wrapper"></div>
99 <div id="code_manager_workspace_tabmode"></div>
100 </div>
101 <?php
102 }
103
104 /**
105 * Get code types
106 *
107 * Code types are organized in group to allow grouping in list boxes.
108 *
109 * @since 1.0.0
110 *
111 * @return \string[][]
112 */
113 public function get_code_types() {
114 return [
115 'Shortcodes' => [
116 'php shortcode' => 'PHP Shortcode',
117 'javascript shortcode' => 'JavaScript Shortcode',
118 'css shortcode' => 'CSS Shortcode',
119 'html shortcode' => 'HTML Shortcode'
120 ],
121 ];
122 }
123
124 }
125
126 }