css
11 months ago
font
11 months ago
images
11 months ago
js
11 months ago
admin.php
11 months ago
edit.php
11 months ago
form.php
11 months ago
insert.php
11 months ago
manage.php
11 months ago
settings.php
11 months ago
tools.php
11 months ago
insert.php
132 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, array( trim( $data ), false ) ); |
| 60 | }else{ |
| 61 | $cp_name = substr( $data, 0, $colon_pos ); |
| 62 | $cp_default = substr( $data, $colon_pos+1 ); |
| 63 | array_push( $params, array( trim( $cp_name ), $cp_default ) ); |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | $enclosed_sc = strpos( $content, '$$enclosed_content$$' ) !== false ? 'true' : 'false'; |
| 69 | |
| 70 | echo '<div class="sc_wrap" data-name="' . esc_attr( $name ) . '" data-id="' . esc_attr( $id ) . '" data-enclosed="' . esc_attr( $enclosed_sc ) . '">'; |
| 71 | echo '<div class="sc_head">'; |
| 72 | echo '<img src="' . esc_url( SC_ADMIN_URL ) . '/images/arrow.svg" width="16" />'; |
| 73 | echo '<h3>' . esc_html( $settings[ '_sc_title' ] ) . '</h3>'; |
| 74 | echo '<p>' . esc_html( $settings[ '_sc_description' ] ) . '</p>'; |
| 75 | echo '<div class="sc_tools">'; |
| 76 | if( current_user_can( 'edit_post', $id ) ){ |
| 77 | echo '<a href="' . esc_url( admin_url( 'post.php?action=edit&post=' . $id ) ) . '" class="button" target="_blank">' . esc_html__( 'View/Edit', 'shortcoder' ) . '</a>'; |
| 78 | } |
| 79 | echo '<button class="button sc_copy">' . esc_html__( 'Copy', 'shortcoder' ) . '</button>'; |
| 80 | echo '<button class="button sc_insert">' . esc_html__( 'Insert', 'shortcoder' ) . '</button>'; |
| 81 | echo '</div>'; |
| 82 | echo '</div>'; |
| 83 | |
| 84 | echo '<div class="sc_options">'; |
| 85 | |
| 86 | if( !empty( $params ) ){ |
| 87 | echo '<h4>' . esc_html__( 'Available parameters', 'shortcoder' ) . ': </h4>'; |
| 88 | echo '<div class="sc_params_wrap">'; |
| 89 | $temp = array(); |
| 90 | |
| 91 | foreach( $params as $k => $v ){ |
| 92 | $cleaned = str_replace( '%', '', $v[0] ); |
| 93 | if( !in_array( $cleaned, $temp ) ){ |
| 94 | array_push( $temp, $cleaned ); |
| 95 | echo '<label>' . esc_html( $cleaned ) . ': <input type="text" class="sc_param" data-param="' . esc_attr( $cleaned ) . '"/>'; |
| 96 | if( $v[1] ){ |
| 97 | echo '<small>' . esc_html__( 'Default', 'shortcoder' ) . ': <code>' . esc_html( $v[1] ) . '</code></small>'; |
| 98 | } |
| 99 | echo '</label> '; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | echo '</div>'; |
| 104 | |
| 105 | }else{ |
| 106 | echo '<p>' . esc_html__( 'No parameters present in this shortcode', 'shortcoder' ) . '</p>'; |
| 107 | } |
| 108 | |
| 109 | echo '<div class="sc_foot">'; |
| 110 | echo '<button class="sc_insert button button-primary">' . esc_html__( 'Insert shortcode', 'shortcoder' ) . '</button>'; |
| 111 | if( $enclosed_sc == 'true' ){ |
| 112 | echo '<span>' . esc_html__( 'Has enclosed content parameter', 'shortcoder' ) . '</span>'; |
| 113 | } |
| 114 | echo '</div>'; |
| 115 | |
| 116 | echo '</div>'; |
| 117 | echo '</div>'; |
| 118 | } |
| 119 | |
| 120 | echo '<p class="sc_note sc_search_none">' . esc_html__( 'No shortcodes match search term !', 'shortcoder' ) . '</p>'; |
| 121 | |
| 122 | } |
| 123 | |
| 124 | ?> |
| 125 | </div> |
| 126 | |
| 127 | <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> |
| 128 | |
| 129 | <?php do_action( 'sc_do_insert_popup_footer' ); ?> |
| 130 | |
| 131 | </body> |
| 132 | </html> |