PluginProbe
PixCodes / 2.3.8
PixCodes v2.3.8
2.3.9 trunk 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8
pixcodes / views / shortcodes-modal.php

shortcodes-modal.php in PixCodes 2.3.8, at views/shortcodes-modal.php

80 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( '-1' );
4 }
5
6 // get the root
7 $plug_path = dirname( dirname( __FILE__ ) );
8 include_once( $plug_path . '/shortcodes.php' );
9 global $wpgrade_shortcodes;
10
11 global $post;
12
13 $post_id = filter_input( INPUT_GET, 'post_id', FILTER_VALIDATE_INT );
14 if ( $post_id ) {
15 $post = get_post( $post_id );
16 } elseif ( $post === null ) {
17 $post = get_post( 1 );
18 } ?>
19 <div id="wpgrade_shortcodes">
20 <div class="l_modal_header">
21 <button type="button" class="btn back"><i class="icon-reply"></i><span><?php esc_html_e( 'Back', 'pixcodes' ); ?></span></button>
22 <div class="l_modal_title"><?php esc_html_e( 'Choose shortcode:', 'pixcodes' ); ?></div>
23 <button type="button" class="btn close close-reveal-modal"><i class="icon-remove"></i></button>
24 </div>
25 <div class="l_modal_body three_col">
26 <div class="details_container ">
27 <div class="details_content"></div>
28 </div>
29 <ul class="l_three_col">
30 <?php
31 $shortcoces_array = $wpgrade_shortcodes->get_shortcodes();
32 /**
33 * In case someone has something to say about this list
34 * here is the only place where it can be filtered
35 */
36 $shortcoces_array = apply_filters( 'filter_shortcodes', $shortcoces_array, $post );
37
38 foreach ( $shortcoces_array as $key => $shortcode ) {
39 $class = 'shortcode_' . $shortcode["name"] . '_open';
40 $data_trigger_open = 'shortcode_' . $shortcode["name"] . '_open';
41 $shortcode_js = wp_json_encode( (object) $shortcode );
42 if ( $shortcode["direct"] ) {
43 $class .= ' insert-direct-shortcode';
44 } ?>
45 <li class="shortcode">
46 <a class="details <?php echo esc_attr( $class ); ?>" data-params='<?php echo esc_attr( $shortcode_js ); ?>' data-trigger-open="<?php echo esc_attr( $data_trigger_open ); ?>">
47 <i class="icon <?php echo esc_attr( $shortcode["icon"] ); ?>"></i>
48 <span class="title"><?php echo esc_html( $shortcode["name"] ); ?></span>
49 </a>
50 <?php if ( ! $shortcode['direct'] && ! empty( $shortcode['params'] ) ) { ?>
51 <div class="shortcode_params details_content">
52 <form id="wpgrade_shortcodes_form">
53 <fieldset>
54 <div class="row">
55 <?php
56 foreach ( $shortcode['params'] as $k => $param ) {
57
58 // inject the key in param ... since i was too lazy to do that before
59 $param['param_key'] = $k;
60 echo wp_kses( $wpgrade_shortcodes->render_param( $param ), pixcodes_shortcode_modal_allowed_html() );
61 } ?>
62
63 <button type="submit" class="btn hidden"><?php esc_html_e( 'Submit', 'pixcodes' ); ?></button>
64 </div>
65 </fieldset>
66 </form>
67 <div id="data_params" type="hidden" data-params='<?php echo esc_attr( $shortcode_js ); ?>'></div>
68 </div>
69 <?php } ?>
70 </li>
71 <?php } ?>
72 </ul>
73 </div>
74 <div class="l_modal_footer">
75 <a class="btn btn_secondary close"><?php esc_html_e( 'Cancel', 'pixcodes' ); ?></a>
76 <span><?php esc_html_e( 'or', 'pixcodes' ); ?></span>
77 <a class="btn btn_primary disabled"><?php esc_html_e( 'Insert', 'pixcodes' ); ?></a>
78 </div>
79 </div>
80