shortcoder
Last commit date
images
14 years ago
js
14 years ago
languages
14 years ago
readme.txt
14 years ago
sc-admin-css.css
14 years ago
sc-admin-js.js
14 years ago
sc-editor.php
14 years ago
screenshot-1.png
14 years ago
screenshot-2.png
14 years ago
screenshot-3.png
14 years ago
screenshot-4.png
14 years ago
shortcoder.php
14 years ago
sc-editor.php
239 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Shortcoder include for inserting and editing shortcodes in post and pages |
| 4 | * v1.0 |
| 5 | **/ |
| 6 | |
| 7 | if ( ! isset( $_GET['inline'] ) ) |
| 8 | define( 'IFRAME_REQUEST' , true ); |
| 9 | |
| 10 | // Load WordPress Administration Bootstrap |
| 11 | require_once('../../../wp-admin/admin.php'); |
| 12 | |
| 13 | if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) |
| 14 | wp_die(__('You do not have permission to edit posts.')); |
| 15 | |
| 16 | // Load all created shortodes |
| 17 | $sc_options = get_option('shortcoder_data'); |
| 18 | |
| 19 | if(empty($sc_options)) |
| 20 | die(); |
| 21 | ?> |
| 22 | |
| 23 | <html> |
| 24 | <head> |
| 25 | <title>Shortcodes created</title> |
| 26 | <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> |
| 27 | <style type="text/css"> |
| 28 | body{ |
| 29 | font: 13px Arial, Helvetica, sans-serif; |
| 30 | padding: 10px; |
| 31 | } |
| 32 | h2{ |
| 33 | font-size: 23px; |
| 34 | font-weight: normal; |
| 35 | } |
| 36 | h4{ |
| 37 | margin: 0px 0px 10px; |
| 38 | } |
| 39 | hr{ |
| 40 | border-width: 0px; |
| 41 | margin: 10px -10px; |
| 42 | border-bottom: 1px solid #dfdfdf; |
| 43 | } |
| 44 | .sc_wrap{ |
| 45 | border: 1px solid #dfdfdf; |
| 46 | -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); |
| 47 | -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); |
| 48 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); |
| 49 | -moz-border-radius: 10px; |
| 50 | border-radius: 10px; |
| 51 | } |
| 52 | .sc_shortcode{ |
| 53 | border-bottom: 1px solid #ccc; |
| 54 | padding: 0px; |
| 55 | -moz-border-radius: 10px; |
| 56 | border-radius: 10px; |
| 57 | } |
| 58 | .sc_shortcode_name{ |
| 59 | cursor: pointer; |
| 60 | padding: 10px; |
| 61 | } |
| 62 | .sc_params{ |
| 63 | border: 1px solid #dfdfdf; |
| 64 | background: #F9F9F9; |
| 65 | margin: 2px 10px 10px; |
| 66 | padding: 10px; |
| 67 | display: none; |
| 68 | -moz-border-radius: 5px; |
| 69 | border-radius: 5px; |
| 70 | } |
| 71 | .sc_insert{ |
| 72 | -moz-border-radius:20px; |
| 73 | -webkit-border-radius:20px; |
| 74 | border-radius:20px; |
| 75 | -moz-box-shadow:1px 1px 2px rgba(0, 0, 0, 0.5); |
| 76 | -webkit-box-shadow:1px 1px 2px rgba(0, 0, 0, 0.5); |
| 77 | box-shadow:1px 1px 2px rgba(0, 0, 0, 0.5); |
| 78 | background: -moz-linear-gradient(19% 65% 90deg,#0087B4, #0099CC, #0099CC 51%); |
| 79 | background: -webkit-gradient(linear, 0% 45%, 0% 60%, from(#0099CC), to(#0087B4)); |
| 80 | color:#FFFFFF; |
| 81 | padding:2px 15px; |
| 82 | text-shadow:0 1px 1px rgba(0, 0, 0, 0.5); |
| 83 | border: 1px solid #267ed4; |
| 84 | font-weight: bold; |
| 85 | } |
| 86 | |
| 87 | .sc_insert:hover{ |
| 88 | background: -moz-linear-gradient(19% 65% 90deg,#0082AD, #0099CC, #0099CC 51%); |
| 89 | background: -webkit-gradient(linear, 0% 45%, 0% 60%, from(#0099CC), to(#0082AD)); |
| 90 | color: #f1f1f1; |
| 91 | } |
| 92 | input[type=text], textarea{ |
| 93 | padding: 5px; |
| 94 | border: 1px solid #ccc; |
| 95 | box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1); |
| 96 | -moz-box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1); |
| 97 | -webkit-box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1); |
| 98 | -moz-border-radius: 5px; |
| 99 | border-radius: 5px; |
| 100 | width: 120px; |
| 101 | margin: 0px 25px 10px 0px; |
| 102 | cursor: pointer; |
| 103 | } |
| 104 | .sc_toggle{ |
| 105 | background: url(images/toggle-arrow.png) no-repeat; |
| 106 | float: right; |
| 107 | width: 16px; |
| 108 | height: 16px; |
| 109 | opacity: 0.4; |
| 110 | } |
| 111 | |
| 112 | .sc_share_iframe{ |
| 113 | background: #FFFFFF; |
| 114 | border: 1px solid #dfdfdf; |
| 115 | -webkit-border-radius: 5px; |
| 116 | -moz-border-radius: 5px; |
| 117 | border-radius: 5px; |
| 118 | -moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1); |
| 119 | -webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1); |
| 120 | box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1); |
| 121 | } |
| 122 | .sc_credits{ |
| 123 | background: url(images/aw.png) no-repeat; |
| 124 | padding-left: 23px; |
| 125 | color: #8B8B8B; |
| 126 | margin-left: -5px; |
| 127 | font-size: 13px; |
| 128 | text-decoration: none; |
| 129 | } |
| 130 | </style> |
| 131 | <script type="text/javascript"> |
| 132 | $(document).ready(function(){ |
| 133 | |
| 134 | $('.sc_shortcode_name').append('<span class="sc_toggle"></span>'); |
| 135 | |
| 136 | $('.sc_insert').click(function(){ |
| 137 | var params = ''; |
| 138 | var scname = $(this).attr('data-name'); |
| 139 | var sc = ''; |
| 140 | |
| 141 | $(this).parent().children().find('input[type="text"]').each(function(){ |
| 142 | if($(this).val() != ''){ |
| 143 | attr = $(this).attr('data-param'); |
| 144 | val = $(this).val(); |
| 145 | params += attr + '="' + val + '" '; |
| 146 | } |
| 147 | }); |
| 148 | |
| 149 | if(wsc(scname)){ |
| 150 | name = '"' + scname + '"'; |
| 151 | }else{ |
| 152 | name = scname; |
| 153 | } |
| 154 | sc = '[sc:' + name + ' ' + params + ']'; |
| 155 | parent.send_to_editor(sc); |
| 156 | }); |
| 157 | |
| 158 | $('.sc_share_bar img').mouseenter(function(){ |
| 159 | $this = $(this); |
| 160 | $('.sc_share_iframe').remove(); |
| 161 | $('body').append('<iframe class="sc_share_iframe"></iframe>'); |
| 162 | $('.sc_share_iframe').css({ |
| 163 | position: 'absolute', |
| 164 | top: $this.offset()['top'] - $this.attr('data-height') - 15, |
| 165 | left: $this.offset()['left'] - $this.attr('data-width')/2 , |
| 166 | width: $this.attr('data-width'), |
| 167 | height: $this.attr('data-height'), |
| 168 | }).attr('src', $this.attr('data-url')).hide().fadeIn(); |
| 169 | |
| 170 | }); |
| 171 | |
| 172 | $('.sc_shortcode_name').click(function(e){ |
| 173 | $('.sc_params').slideUp(); |
| 174 | if($(this).next('.sc_params').is(':visible')){ |
| 175 | $(this).next('.sc_params').slideUp(); |
| 176 | }else{ |
| 177 | $(this).next('.sc_params').slideDown(); |
| 178 | } |
| 179 | }) |
| 180 | |
| 181 | }); |
| 182 | |
| 183 | var sc_closeiframe = function(){ |
| 184 | $('.sc_share_iframe').remove(); |
| 185 | } |
| 186 | |
| 187 | function wsc(s){ |
| 188 | if(s == null) |
| 189 | return ''; |
| 190 | return s.indexOf(' ') >= 0; |
| 191 | } |
| 192 | </script> |
| 193 | </head> |
| 194 | <body> |
| 195 | <?php sc_admin_buttons('fbrec'); ?> |
| 196 | <h2><img src="images/shortcoder.png" align="absmiddle" alt="Shortcoder" width="35px"/> List of Shortcodes created</h2> |
| 197 | |
| 198 | <div class="sc_wrap"> |
| 199 | <?php |
| 200 | foreach($sc_options as $key=>$value){ |
| 201 | if($key != '_version_fix'){ |
| 202 | echo '<div class="sc_shortcode"><div class="sc_shortcode_name">' . $key; |
| 203 | echo '</div>'; |
| 204 | preg_match_all('/%[^%\s]+%/', $value['content'], $matches); |
| 205 | echo '<div class="sc_params">'; |
| 206 | if(!empty($matches[0])){ |
| 207 | echo '<h4>Available parameters: </h4>'; |
| 208 | $temp = array(); |
| 209 | foreach($matches[0] as $k=>$v){ |
| 210 | $cleaned = str_replace('%', '', $v); |
| 211 | if(!in_array($cleaned, $temp)){ |
| 212 | array_push($temp, $cleaned); |
| 213 | echo '<label>' . $cleaned . ': <input type="text" data-param="' . $cleaned . '"/></label> '; |
| 214 | } |
| 215 | } |
| 216 | echo'<hr/>'; |
| 217 | }else{ |
| 218 | echo 'No parameters avaialble - '; |
| 219 | } |
| 220 | echo '<input type="button" class="sc_insert cupid-blue" data-name="' . $key . '" value="Insert Shortcode"/>'; |
| 221 | echo '</div>'; |
| 222 | echo '</div>'; |
| 223 | } |
| 224 | } |
| 225 | ?> |
| 226 | </div> |
| 227 | |
| 228 | <p class="sc_share_bar" align="center"> |
| 229 | <img class="sc_donate" src="images/donate.png" data-width="300" data-height="220" data-url="<?php echo SC_URL . 'js/share.php?i=1'; ?>"/> |
| 230 | |
| 231 | <img class="sc_share" src="images/share.png" data-width="350" data-height="85" data-url="<?php echo SC_URL . 'js/share.php?i=2'; ?>"/> |
| 232 | </p> |
| 233 | |
| 234 | <p align="center"><a class="sc_credits" href="http://www.aakashweb.com/" target="_blank">a Aakash Web plugin</a></p> |
| 235 | |
| 236 | |
| 237 | <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=vaakash"></script> |
| 238 | </body> |
| 239 | </html> |