css
5 years ago
font
5 years ago
images
5 years ago
js
5 years ago
admin.php
5 years ago
edit.php
5 years ago
form.php
5 years ago
insert.php
5 years ago
manage.php
5 years ago
tools.php
5 years ago
insert.php
129 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 | <a href="https://www.aakashweb.com/wordpress-plugins/ultimate-floating-widgets-pro/" target="_blank" class="ufw"><i>Check out</i> : Ultimate floating widgets<span>A WordPress plugin to create floating widgets.</span></a> |
| 16 | </div> |
| 17 | |
| 18 | <div class="sc_list"> |
| 19 | <?php |
| 20 | |
| 21 | $shortcodes = Shortcoder::get_shortcodes(); |
| 22 | |
| 23 | if( empty( $shortcodes ) ){ |
| 24 | 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>'; |
| 25 | }else{ |
| 26 | |
| 27 | foreach( $shortcodes as $name => $options ){ |
| 28 | $id = $options[ 'id' ]; |
| 29 | $content = $options[ 'content' ]; |
| 30 | $settings = $options[ 'settings' ]; |
| 31 | $params = array(); |
| 32 | |
| 33 | preg_match_all( '/%%(.*?)%%/', $content, $matches ); |
| 34 | |
| 35 | $cp_data = $matches[1]; |
| 36 | |
| 37 | if( !empty( $cp_data ) ){ |
| 38 | |
| 39 | $cp_data = array_map( 'strtolower', $cp_data ); |
| 40 | |
| 41 | foreach( $cp_data as $data ){ |
| 42 | $colon_pos = strpos( $data, ':' ); |
| 43 | if( $colon_pos === false ){ |
| 44 | array_push( $params, trim( $data ) ); |
| 45 | }else{ |
| 46 | $cp_name = substr( $data, 0, $colon_pos ); |
| 47 | array_push( $params, trim( $cp_name ) ); |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | $enclosed_sc = strpos( $content, '$$enclosed_content$$' ) !== false ? 'true' : 'false'; |
| 53 | |
| 54 | echo '<div class="sc_wrap" data-name="' . esc_attr( $name ) . '" data-id="' . esc_attr( $id ) . '" data-enclosed="' . $enclosed_sc . '">'; |
| 55 | echo '<div class="sc_head">'; |
| 56 | echo '<img src="' . SC_ADMIN_URL . '/images/arrow.svg" width="16" />'; |
| 57 | echo '<h3>' . $settings[ '_sc_title' ] . '</h3>'; |
| 58 | echo '<div class="sc_tools">'; |
| 59 | if( current_user_can( 'edit_post', $id ) ){ |
| 60 | echo '<a href="' . admin_url( 'post.php?action=edit&post=' . $id ) . '" class="button" target="_blank">' . __( 'Edit', 'shortcoder' ) . '</a>'; |
| 61 | } |
| 62 | echo '<button class="button sc_copy">' . __( 'Copy', 'shortcoder' ) . '</button>'; |
| 63 | echo '<button class="button sc_insert">' . __( 'Insert', 'shortcoder' ) . '</button>'; |
| 64 | echo '</div>'; |
| 65 | echo '</div>'; |
| 66 | |
| 67 | echo '<div class="sc_options">'; |
| 68 | |
| 69 | if( !empty( $params ) ){ |
| 70 | echo '<h4>' . __( 'Available parameters', 'shortcoder' ) . ': </h4>'; |
| 71 | echo '<div class="sc_params_wrap">'; |
| 72 | $temp = array(); |
| 73 | |
| 74 | foreach( $params as $k => $v ){ |
| 75 | $cleaned = str_replace( '%', '', $v ); |
| 76 | if( !in_array( $cleaned, $temp ) ){ |
| 77 | array_push( $temp, $cleaned ); |
| 78 | echo '<label>' . $cleaned . ': <input type="text" class="sc_param" data-param="' . $cleaned . '"/></label> '; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | echo '</div>'; |
| 83 | |
| 84 | }else{ |
| 85 | echo '<p>' . __( 'No parameters present in this shortcode', 'shortcoder' ) . '</p>'; |
| 86 | } |
| 87 | |
| 88 | echo '<div class="sc_foot">'; |
| 89 | echo '<button class="sc_insert button button-primary">' . __( 'Insert shortcode', 'shortcoder' ) . '</button>'; |
| 90 | if( $enclosed_sc == 'true' ){ |
| 91 | echo '<span>' . __( 'Has enclosed content parameter', 'shortcoder' ) . '</span>'; |
| 92 | } |
| 93 | echo '</div>'; |
| 94 | |
| 95 | echo '</div>'; |
| 96 | echo '</div>'; |
| 97 | } |
| 98 | |
| 99 | echo '<p class="sc_note sc_search_none">' . __( 'No shortcodes match search term !', 'shortcoder' ) . '</p>'; |
| 100 | |
| 101 | } |
| 102 | |
| 103 | ?> |
| 104 | </div> |
| 105 | |
| 106 | <div class="cfe_box"> |
| 107 | <?php |
| 108 | echo '<div class="cfe_text">'; |
| 109 | echo '<img src="' . SC_ADMIN_URL . '/images/coffee.svg" />'; |
| 110 | echo '<div><h2>Buy me a Coffee !</h2><p>If you like this plugin, buy me a coffee !</p></div>'; |
| 111 | echo '</div>'; |
| 112 | echo '<div class="cfe_form">'; |
| 113 | echo '<select class="cfe_amt">'; |
| 114 | for($i = 5; $i <= 15; $i++){ |
| 115 | echo '<option value="' . $i . '" ' . ($i == 6 ? 'selected="selected"' : '') . '>$' . $i . '</option>'; |
| 116 | } |
| 117 | echo '<option value="">Custom</option>'; |
| 118 | echo '</select>'; |
| 119 | echo '<a class="button button-primary cfe_btn" href="https://www.paypal.me/vaakash/6" data-link="https://www.paypal.me/vaakash/" target="_blank">Buy me coffee !</a>'; |
| 120 | echo '</div>'; |
| 121 | ?> |
| 122 | </div> |
| 123 | |
| 124 | <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> |
| 125 | |
| 126 | <?php do_action( 'sc_do_insert_popup_footer' ); ?> |
| 127 | |
| 128 | </body> |
| 129 | </html> |