PluginProbe ʕ •ᴥ•ʔ
Tracking Code Manager / 2.3.0
Tracking Code Manager v2.3.0
trunk 1.11.8 1.11.9 1.12.0 1.12.1 1.12.2 1.12.3 1.4 1.5 2.0.0 2.0.1 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0
tracking-code-manager / includes / admin / button-mce.php
tracking-code-manager / includes / admin Last commit date
about.php 1 year ago button-mce.php 1 year ago faq.php 1 year ago feedback.php 1 year ago metabox.php 1 year ago settings.php 1 year ago whatsnew.php 1 year ago
button-mce.php
64 lines
1 <?php
2 add_action('admin_head', 'irp_add_mce_button');
3 function irp_add_mce_button() {
4 global $typenow;
5
6 if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) {
7 return;
8 }
9
10 if(!in_array($typenow, array('post', 'page'))) {
11 return;
12 }
13 if (get_user_option('rich_editing') == 'true') {
14 add_filter("mce_external_plugins", "irp_add_mce_plugin");
15 add_filter('mce_buttons', 'irp_register_mce_button');
16 }
17 }
18
19 function irp_add_mce_plugin($plugin_array) {
20 $plugin_array['irp_mce_button']=IRP_PLUGIN_ASSETS.'js/button-mce.js';
21 return $plugin_array;
22 }
23 function irp_register_mce_button($buttons) {
24 array_push($buttons, "irp_mce_button");
25 return $buttons;
26 }
27
28 function irp_ui_button_editor() {
29 global $irp;
30
31 wp_enqueue_style( 'irp_free_select2_style', IRP_PLUGIN_ASSETS . 'css/style.css' );
32 wp_enqueue_script( 'irp_free_common', IRP_PLUGIN_ASSETS . 'js/common.js', array('jquery') );
33 $postType = '';
34 if ( isset($_REQUEST['irp_post_type']) ) {
35 $postType = sanitize_text_field($_REQUEST['irp_post_type']);
36 }
37 wp_add_inline_script( 'irp_free_common', 'const search_data = ' . wp_json_encode( array(
38 'post_type' => $postType ) ) );
39
40 $irp->Utils->printScriptCss();
41 $irp->Form->prefix='Editor';
42 $irp->Form->labels=FALSE;
43
44 $args=array('class'=>'wp-admin wp-core-ui admin-bar'
45 , 'style'=>'padding:10px; margin-left:auto; margin-right:auto;');
46 $irp->Form->formStarts('post', '', $args);
47 {
48 ?>
49 <p style="text-align:center;"><?php $irp->Lang->P('EditorSubtitle') ?></p>
50 <?php
51 $irp->Form->select('irpPostId', '', array() );
52 ?>
53 <div style="clear:both;"></div>
54 <p style="text-align:right;">
55 <input type="button" id="btnInsert" class="button button-primary irp-button irp-submit" value="<?php $irp->Lang->P('Insert')?>"/>
56 <input type="button" id="btnClose" class="button irp-button" value="<?php $irp->Lang->P('Cancel')?>"/>
57 </p>
58 <?php
59 }
60 $irp->Form->formEnds();
61 exit;
62 }
63
64