PluginProbe ʕ •ᴥ•ʔ
Code Manager / 1.0.1
Code Manager v1.0.1
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
129 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 $wpnone_get_code_list;
16 protected $wpnone_get_code;
17 protected $wpnone_update_code;
18 protected $wpnone_activate_code_preview;
19
20 /**
21 * Code_Manager_Tabs constructor
22 *
23 * Creates a number of wpnonces needed to authorize ajax calls
24 *
25 * @since 1.0.0
26 */
27 public function __construct() {
28 $this->wpnonce_get_code_list = wp_create_nonce( "code-manager-get-code-list" );
29 $this->wpnonce_get_code = wp_create_nonce( "code-manager-get-code" );
30 $this->wpnonce_update_code = wp_create_nonce( "code-manager-update-code" );
31 $this->wpnone_activate_code_preview = wp_create_nonce( "code-manager-activate-preview" );
32 }
33
34 /**
35 * Shows the tab mode IDE
36 *
37 * JavaScript depending on server variables not available in the browser are added here. Generic JavaScript
38 * code is added as a script file.
39 *
40 * @since 1.0.0
41 */
42 public function show() {
43 $wpnonce_code_manager_reset_preview = wp_create_nonce( "code-manager-reset-preview" );
44 ?>
45 <script type="text/javascript">
46 var wpnonce_get_code_list = '<?php echo $this->wpnonce_get_code_list; ?>';
47 var wpnonce_get_code = '<?php echo $this->wpnonce_get_code; ?>';
48 var wpnonce_update_code = '<?php echo $this->wpnonce_update_code; ?>';
49 var wpnone_activate_code_preview = '<?php echo $this->wpnone_activate_code_preview; ?>';
50 var wpnonce_code_manager_activate_preview = '<?php echo $wpnonce_code_manager_reset_preview; ?>';
51 var code_manager_code_groups = [];
52 <?php
53 $code_manager_tab_class = CODE_MANAGER_TAB_CLASS;
54 $code_manager_tab = new $code_manager_tab_class();
55 $code_types = $code_manager_tab->get_code_types();
56 foreach ( $code_types as $code_type_group => $value ) {
57 echo 'code_manager_code_group = [];';
58 foreach ( $value as $code_type => $code_type_label ) {
59 echo "code_manager_code_group['{$code_type}'] = '{$code_type_label}';";
60 }
61 echo "code_manager_code_groups['{$code_type_group}'] = code_manager_code_group;";
62 }
63 ?>
64 </script>
65 <div class="wrap">
66 <table cellspacing="0" cellpadding="0" border="0" width="100%">
67 <tr>
68 <td>
69 <h1 class="wp-heading-inline">
70 <span>
71 <a href="?page=<?php echo CODE_MANAGER_MENU_SLUG; ?>"
72 title="Switch to list mode">
73 <span class="material-icons cm_menu_title">list</span></a>
74 <span class="cm_page_title">
75 <?php echo CODE_MANAGER_H1_TITLE; ?>
76 </span>
77 <a id="code_manager_new" href="javascript:void(0)">
78 <span class="material-icons cm_menu_title"
79 title="Add new code">add_circle_outline</span></a>
80 <a id="code_manager_open" href="javascript:void(0)">
81 <span class="material-icons cm_menu_title"
82 title="Open existing code">arrow_circle_down</span></a>
83 <a href="<?php echo CODE_MANAGER_HELP_URL; ?>" target="_blank"
84 title="Plugin help - opens in a new tab or window">
85 <span class="material-icons cm_menu_title">help_outline</span></a>
86 </span>
87 </h1>
88 </td>
89 <td style="text-align: right">
90 <a id="disable_preview" href="javascript:void(0)" class="button" title="Turns of preview mode for all code IDs">Reset preview</a>
91 </td>
92 </tr>
93 </table>
94 <div id="code_manager_open_frame" style="display: none; background-color: transparent;">
95 <form>
96 <select id="code_manager_code_list">
97 <option>Loading data...</option>
98 </select>
99 </form>
100 </div>
101 <div id="code_manager_taskbar_tabmode" class="nav-tab-wrapper"></div>
102 <div id="code_manager_workspace_tabmode"></div>
103 </div>
104 <?php
105 }
106
107 /**
108 * Get code types
109 *
110 * Code types are organized in group to allow grouping in list boxes.
111 *
112 * @since 1.0.0
113 *
114 * @return \string[][]
115 */
116 public function get_code_types() {
117 return [
118 'Shortcodes' => [
119 'php shortcode' => 'PHP Shortcode',
120 'javascript shortcode' => 'JavaScript Shortcode',
121 'css shortcode' => 'CSS Shortcode',
122 'html shortcode' => 'HTML Shortcode'
123 ],
124 ];
125 }
126
127 }
128
129 }