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