css
4 years ago
font
4 years ago
images
4 years ago
js
4 years ago
admin.php
4 years ago
edit.php
4 years ago
form.php
4 years ago
insert.php
4 years ago
manage.php
4 years ago
settings.php
4 years ago
tools.php
4 years ago
insert.php
163 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 admin_url( 'post-new.php?post_type=shortcoder' ); ?>" target="_blank" class="button">Create shortcode</a> |
| 17 | <span class="promo_link"> |
| 18 | <?php |
| 19 | $promo_links = array( |
| 20 | array('super-rss-reader/?utm_source=wp-socializer&utm_medium=insert&utm_campaign=srr-pro', 'Super RSS Reader', 'super-rss-reader.png'), |
| 21 | array('ultimate-floating-widgets/?utm_source=wp-socializer&utm_medium=insert&utm_campaign=ufw-pro', 'Ultimate Floating Widgets', 'ultimate-floating-widgets.png'), |
| 22 | array('announcer/?utm_source=wp-socializer&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>Check out: </i> <?php echo $promo_link[1]; ?></a> |
| 28 | <span><img src="<?php echo 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="' . 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="' . $enclosed_sc . '">'; |
| 70 | echo '<div class="sc_head">'; |
| 71 | echo '<img src="' . SC_ADMIN_URL . '/images/arrow.svg" width="16" />'; |
| 72 | echo '<h3>' . $settings[ '_sc_title' ] . '</h3>'; |
| 73 | echo '<div class="sc_tools">'; |
| 74 | if( current_user_can( 'edit_post', $id ) ){ |
| 75 | echo '<a href="' . admin_url( 'post.php?action=edit&post=' . $id ) . '" class="button" target="_blank">' . __( 'View', 'shortcoder' ) . '</a>'; |
| 76 | } |
| 77 | echo '<button class="button sc_copy">' . __( 'Copy', 'shortcoder' ) . '</button>'; |
| 78 | echo '<button class="button sc_insert">' . __( 'Insert', 'shortcoder' ) . '</button>'; |
| 79 | echo '</div>'; |
| 80 | echo '</div>'; |
| 81 | |
| 82 | echo '<div class="sc_options">'; |
| 83 | |
| 84 | if( !empty( $params ) ){ |
| 85 | echo '<h4>' . __( 'Available parameters', 'shortcoder' ) . ': </h4>'; |
| 86 | echo '<div class="sc_params_wrap">'; |
| 87 | $temp = array(); |
| 88 | |
| 89 | foreach( $params as $k => $v ){ |
| 90 | $cleaned = str_replace( '%', '', $v ); |
| 91 | if( !in_array( $cleaned, $temp ) ){ |
| 92 | array_push( $temp, $cleaned ); |
| 93 | echo '<label>' . $cleaned . ': <input type="text" class="sc_param" data-param="' . $cleaned . '"/></label> '; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | echo '</div>'; |
| 98 | |
| 99 | }else{ |
| 100 | echo '<p>' . __( 'No parameters present in this shortcode', 'shortcoder' ) . '</p>'; |
| 101 | } |
| 102 | |
| 103 | echo '<div class="sc_foot">'; |
| 104 | echo '<button class="sc_insert button button-primary">' . __( 'Insert shortcode', 'shortcoder' ) . '</button>'; |
| 105 | if( $enclosed_sc == 'true' ){ |
| 106 | echo '<span>' . __( 'Has enclosed content parameter', 'shortcoder' ) . '</span>'; |
| 107 | } |
| 108 | echo '</div>'; |
| 109 | |
| 110 | echo '</div>'; |
| 111 | echo '</div>'; |
| 112 | } |
| 113 | |
| 114 | echo '<p class="sc_note sc_search_none">' . __( 'No shortcodes match search term !', 'shortcoder' ) . '</p>'; |
| 115 | |
| 116 | } |
| 117 | |
| 118 | ?> |
| 119 | </div> |
| 120 | |
| 121 | <div class="note"> |
| 122 | <p><strong>Note:</strong> When shortcodes are inserted in a post, please ensure all the shortcodes are closed. Click for more details.</p> |
| 123 | <table> |
| 124 | <tr> |
| 125 | <td> |
| 126 | <pre> |
| 127 | Paragraph 1 |
| 128 | [sc name="my-shortcode-1"] |
| 129 | |
| 130 | Paragraph 2 |
| 131 | [sc name="my-shortcode-2"] |
| 132 | |
| 133 | Paragraph 3 |
| 134 | [sc name="my-shortcode-3"][/sc] |
| 135 | </pre> |
| 136 | <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> |
| 137 | <p>So all the contents between <code>[sc name="my-shortcode-1"] ... [/sc]</code> are taken inside <code>my-shortcode-1</code>.</p> |
| 138 | </td> |
| 139 | |
| 140 | <td> |
| 141 | <pre> |
| 142 | Paragraph 1 |
| 143 | [sc name="my-shortcode-1"][/sc] |
| 144 | |
| 145 | Paragraph 2 |
| 146 | [sc name="my-shortcode-2"][/sc] |
| 147 | |
| 148 | Paragraph 3 |
| 149 | [sc name="my-shortcode-3"][/sc] |
| 150 | </pre> |
| 151 | <p>� |
| 152 | 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> |
| 153 | </td> |
| 154 | </tr> |
| 155 | </table> |
| 156 | </div> |
| 157 | |
| 158 | <div class="footer_thanks">Thanks for using <a href="https://www.aakashweb.com/wordpress-plugins/shortcoder/" target="_blank">Shortcoder</a> • 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> |
| 159 | |
| 160 | <?php do_action( 'sc_do_insert_popup_footer' ); ?> |
| 161 | |
| 162 | </body> |
| 163 | </html> |