C:\xampp\htdocs\landing\wp-content\plugins\penci-smart-lists\inc\shortcode.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
if ( ! defined'ABSPATH' ) ) {
    exit;
}

if ( ! 
class_exists'Penci_Smart_Lists_Shortcode' ) ):
    class 
Penci_Smart_Lists_Shortcode {
        private static 
$instance null;

        
// Function has already run.
        
public static function get_instance() {
            if ( ! 
self::$instance ) {
                
self::$instance = new self;
            }

            return 
self::$instance;
        }

        public function 
init() {
            
add_action'admin_init', array( $this'init_plugin' ), 20 );
            
add_action'after_setup_theme', array( $this'after_setup_theme_callback' ) );

            
add_shortcode'penci_sml_start', array( $this'sml_start_callback' ) );
            
add_shortcode'penci_sml_end', array( $this'sml_end_callback' ) );
        }

        public function 
init_plugin() {
            if ( 
current_user_can'edit_posts' ) || current_user_can'edit_pages' ) ) {
                
add_action'print_media_templates', array( $this'print_media_templates' ) );
                
add_action'admin_head', array( $this'admin_head' ) );
                
add_action'wp_ajax_penci_sml_mce_button', array( $this'wp_ajax_penci_sml_mce_button' ) );
                
add_filter"mce_external_plugins", array( $this'mce_plugin' ) );
                
add_filter"mce_buttons", array( $this'mce_button' ) );
            }
        }

        public function 
after_setup_theme_callback(){
            
add_editor_style( array( PENCI_SMLIST_URL '/assets/css/editor-style.css' ) );
        }


        public function 
sml_start_callback$atts = array(), $innercontent ''$code '' ) {
            return 
'<u class="penci-sml-start"></u>';
        }
        public function 
sml_end_callback$atts = array(), $innercontent ''$code '' ) {
            return 
'<u class="penci-sml-end"></u>';
        }

        public function 
mce_plugin$plugin_array ) {
            
$plugin_array['penci_sml_mce'] = PENCI_SMLIST_URL.  'assets/js/mce-button-inline.js';

            return 
$plugin_array;
        }

        public function 
mce_button$buttons ) {
            
array_push$buttons'penci_sml_mce_button' );

            return 
$buttons;
        }

        public function 
print_media_templates() {
            if ( ! isset( 
get_current_screen()->id ) || get_current_screen()->base != 'post' ) {
                return;
            }
            
?>
            <script type="text/html" id="tmpl-editor-penci-sml-start">
                <div class="penci-sml-break penci-sml-break-start"><div class="title"><i class="fa fa-arrow-circle-o-down"></i><?php esc_html_e'Smart List Start Break','penci' ); ?></div></div>
            </script>
            <script type="text/html" id="tmpl-editor-penci-sml-end">
                <div class="penci-sml-break penci-sml-break-end"><div class="title"><i class="fa fa-arrow-circle-o-up"></i><?php esc_html_e'Smart List End Break','penci' ); ?></div></div>
            </script>
            <?php
        
}

        public function 
admin_head() {
            
$current_screen get_current_screen();
            if ( ! isset( 
$current_screen->id ) || $current_screen->base !== 'post' ) {
                return;
            }

            
wp_enqueue_script'penci-sml-editor-view'PENCI_SMLIST_URL.  'assets/js/editor-view.js', array( 'shortcode''wp-util''jquery' ), falsetrue );
        }
    }

    
Penci_Smart_Lists_Shortcode::get_instance()->init();

endif;

x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586