PluginProbe ʕ •ᴥ•ʔ
Shortcoder — Create Shortcodes for Anything / 6.2
Shortcoder — Create Shortcodes for Anything v6.2
trunk 3.0 3.0.1 3.1 3.2 3.3 3.4 3.4.1 4.0 4.0.1 4.0.2 4.0.3 4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2 4.3 4.4 4.5 4.6 5.0 5.0.1 5.0.2 5.0.3 5.0.4 5.1 5.2 5.2.1 5.3 5.3.1 5.3.2 5.3.3 5.3.4 5.4 5.5 5.6 5.7 5.8 6.0 6.1 6.2 6.3 6.3.1 6.3.2 6.4 6.5 6.5.1 6.5.2 6.5.3
shortcoder / admin / insert.php
shortcoder / admin Last commit date
css 3 years ago font 3 years ago images 3 years ago js 3 years ago admin.php 3 years ago edit.php 3 years ago form.php 3 years ago insert.php 3 years ago manage.php 3 years ago settings.php 3 years ago tools.php 3 years ago
insert.php
164 lines
1 <?php if( ! defined( 'ABSPATH' ) ) exit; ?>
2 <!DOCTYPE html>
3 <html>
4 <head>
5 <title>Insert shortcode</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1" />
7 <link href="<?php echo SC_ADMIN_URL; ?>css/style-insert.css<?php echo '?ver=' . SC_VERSION; ?>" media="all" rel="stylesheet" />
8 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
9 <script src="<?php echo SC_ADMIN_URL; ?>js/script-insert.js<?php echo '?ver=' . SC_VERSION; ?>"></script>
10 </head>
11 <body>
12
13 <div class="sc_menu">
14 <input type="search" class="sc_search" placeholder="Search ..." />
15 <div class="top_btns">
16 <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=shortcoder' ) ); ?>" target="_blank" class="button"><?php _e( 'Create Shortcode', 'shortcoder' ) ?></a>
17 <span class="promo_link">
18 <?php
19 $promo_links = array(
20 array('super-rss-reader/?utm_source=shortcoder&utm_medium=insert&utm_campaign=srr-pro', 'Super RSS Reader', 'super-rss-reader.png'),
21 array('ultimate-floating-widgets/?utm_source=shortcoder&utm_medium=insert&utm_campaign=ufw-pro', 'Ultimate Floating Widgets', 'ultimate-floating-widgets.png'),
22 array('announcer/?utm_source=shortcoder&utm_medium=sidebar&utm_campaign=announcer-pro', 'Announcer', 'announcer.png'),
23 );
24 $promo_link_id = array_rand( $promo_links, 1 );
25 $promo_link = $promo_links[$promo_link_id ];
26 ?>
27 <a class="button" href="https://www.aakashweb.com/wordpress-plugins/<?php echo $promo_link[0]; ?>" target="_blank"><i><?php _e( 'Check out:', 'shortcoder' ) ?> </i> <?php echo $promo_link[1]; ?></a>
28 <span><img src="<?php echo esc_url( SC_ADMIN_URL . '/images/' . $promo_link[2] ); ?>" /></span>
29 </span>
30 </div>
31 </div>
32
33 <div class="sc_list">
34 <?php
35
36 $shortcodes = Shortcoder::get_shortcodes();
37
38 if( empty( $shortcodes ) ){
39 echo '<p class="sc_note">No shortcodes are created, go ahead create one in <a href="' . esc_url( admin_url( 'post-new.php?post_type=' . SC_POST_TYPE ) ) . '" target="_blank">shortcoder admin page</a>.</p>';
40 }else{
41
42 foreach( $shortcodes as $name => $options ){
43 $id = $options[ 'id' ];
44 $content = $options[ 'content' ];
45 $settings = $options[ 'settings' ];
46 $params = array();
47
48 preg_match_all( '/%%(.*?)%%/', $content, $matches );
49
50 $cp_data = $matches[1];
51
52 if( !empty( $cp_data ) ){
53
54 $cp_data = array_map( 'strtolower', $cp_data );
55
56 foreach( $cp_data as $data ){
57 $colon_pos = strpos( $data, ':' );
58 if( $colon_pos === false ){
59 array_push( $params, trim( $data ) );
60 }else{
61 $cp_name = substr( $data, 0, $colon_pos );
62 array_push( $params, trim( $cp_name ) );
63 }
64 }
65 }
66
67 $enclosed_sc = strpos( $content, '$$enclosed_content$$' ) !== false ? 'true' : 'false';
68
69 echo '<div class="sc_wrap" data-name="' . esc_attr( $name ) . '" data-id="' . esc_attr( $id ) . '" data-enclosed="' . esc_attr( $enclosed_sc ) . '">';
70 echo '<div class="sc_head">';
71 echo '<img src="' . esc_url( SC_ADMIN_URL ) . '/images/arrow.svg" width="16" />';
72 echo '<h3>' . esc_html( $settings[ '_sc_title' ] ) . '</h3>';
73 echo '<p>' . esc_html( $settings[ '_sc_description' ] ) . '</p>';
74 echo '<div class="sc_tools">';
75 if( current_user_can( 'edit_post', $id ) ){
76 echo '<a href="' . esc_url( admin_url( 'post.php?action=edit&post=' . $id ) ) . '" class="button" target="_blank">' . esc_html__( 'View/Edit', 'shortcoder' ) . '</a>';
77 }
78 echo '<button class="button sc_copy">' . esc_html__( 'Copy', 'shortcoder' ) . '</button>';
79 echo '<button class="button sc_insert">' . esc_html__( 'Insert', 'shortcoder' ) . '</button>';
80 echo '</div>';
81 echo '</div>';
82
83 echo '<div class="sc_options">';
84
85 if( !empty( $params ) ){
86 echo '<h4>' . esc_html__( 'Available parameters', 'shortcoder' ) . ': </h4>';
87 echo '<div class="sc_params_wrap">';
88 $temp = array();
89
90 foreach( $params as $k => $v ){
91 $cleaned = str_replace( '%', '', $v );
92 if( !in_array( $cleaned, $temp ) ){
93 array_push( $temp, $cleaned );
94 echo '<label>' . esc_html( $cleaned ) . ': <input type="text" class="sc_param" data-param="' . esc_attr( $cleaned ) . '"/></label> ';
95 }
96 }
97
98 echo '</div>';
99
100 }else{
101 echo '<p>' . esc_html__( 'No parameters present in this shortcode', 'shortcoder' ) . '</p>';
102 }
103
104 echo '<div class="sc_foot">';
105 echo '<button class="sc_insert button button-primary">' . esc_html__( 'Insert shortcode', 'shortcoder' ) . '</button>';
106 if( $enclosed_sc == 'true' ){
107 echo '<span>' . esc_html__( 'Has enclosed content parameter', 'shortcoder' ) . '</span>';
108 }
109 echo '</div>';
110
111 echo '</div>';
112 echo '</div>';
113 }
114
115 echo '<p class="sc_note sc_search_none">' . esc_html__( 'No shortcodes match search term !', 'shortcoder' ) . '</p>';
116
117 }
118
119 ?>
120 </div>
121
122 <div class="note">
123 <p><strong>Note:</strong> When shortcodes are inserted in a post, please ensure all the shortcodes are closed. Click for more details.</p>
124 <table>
125 <tr>
126 <td>
127 <pre>
128 Paragraph 1
129 [sc name="my-shortcode-1"]
130
131 Paragraph 2
132 [sc name="my-shortcode-2"]
133
134 Paragraph 3
135 [sc name="my-shortcode-3"][/sc]
136 </pre>
137 <p> Here, everything between <code>my-shortcode-1</code> and <code>my-shortcode-3</code> won't be displayed because <code>my-shortcode-3</code> has a closing shortcode.</p>
138 <p>So all the contents between <code>[sc name="my-shortcode-1"] ... [/sc]</code> are taken inside <code>my-shortcode-1</code>.</p>
139 </td>
140
141 <td>
142 <pre>
143 Paragraph 1
144 [sc name="my-shortcode-1"][/sc]
145
146 Paragraph 2
147 [sc name="my-shortcode-2"][/sc]
148
149 Paragraph 3
150 [sc name="my-shortcode-3"][/sc]
151 </pre>
152 <p>�
153 Close all the Shortcoder's shortcodes in a post with <code>[/sc]</code>. <a href="https://codex.wordpress.org/Shortcode_API#Unclosed_Shortcodes" target="_blank">Learn more</a></p>
154 </td>
155 </tr>
156 </table>
157 </div>
158
159 <div class="footer_thanks">Thanks for using <a href="https://www.aakashweb.com/wordpress-plugins/shortcoder/" target="_blank">Shortcoder</a> &bull; Please <a href="https://wordpress.org/support/plugin/shortcoder/reviews/?rate=5#new-post" target="_blank">rate 5 stars</a> and spread the word.</div>
160
161 <?php do_action( 'sc_do_insert_popup_footer' ); ?>
162
163 </body>
164 </html>