Version Description
- New: Plugin rewritten from scratch.
- New: Brand new administration page
- New: Shortcode vissibility settings, show/hide in desktop/mobile devices
- New: Insert WordPress information into shortcode content.
- Fix: Insert shortcode window is not loading.
- Fix: Unable to delete the shortcodes
Download this release
Release Info
Developer | vaakash |
Plugin | Shortcoder |
Version | 4.0 |
Comparing to | |
See all releases |
Code changes from version 3.4.1 to 4.0
- admin/css/style-insert.css +166 -0
- admin/css/style.css +330 -0
- {images → admin/images}/aw.png +0 -0
- admin/images/coffee.svg +99 -0
- {images → admin/images}/index.html +0 -0
- {images → admin/images}/shortcoder-2.png +0 -0
- {images → admin/images}/shortcoder.png +0 -0
- {images → admin/images}/toggle-arrow.png +0 -0
- admin/js/script-insert.js +67 -0
- admin/js/script.js +132 -0
- admin/js/tinymce/editor_plugin.js +33 -0
- {js → admin/js}/tinymce/icon.png +0 -0
- {js → admin/js/tinymce}/index.html +0 -0
- admin/sc-admin.php +489 -0
- admin/sc-insert.php +81 -0
- images/donate.png +0 -0
- images/grey-bg.png +0 -0
- images/paypal.gif +0 -0
- images/share.png +0 -0
- images/trash-can.png +0 -0
- includes/metadata.php +185 -0
- js/share.php +0 -74
- js/tinymce/editor_plugin.js +0 -37
- js/tinymce/index.html +0 -0
- languages/index.html +0 -0
- languages/shortcoder.mo +0 -0
- languages/shortcoder.po +0 -79
- readme.txt +40 -31
- sc-admin-css.css +0 -246
- sc-admin-js.js +0 -125
- sc-insert.php +0 -227
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- shortcoder.php +216 -398
admin/css/style-insert.css
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
body{
|
2 |
+
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
|
3 |
+
color: #444;
|
4 |
+
padding: 10px;
|
5 |
+
background: #f1f1f1;
|
6 |
+
}
|
7 |
+
h2{
|
8 |
+
font-size: 23px;
|
9 |
+
font-weight: normal;
|
10 |
+
}
|
11 |
+
h4{
|
12 |
+
margin: 0 0 20px 0;
|
13 |
+
}
|
14 |
+
hr{
|
15 |
+
border-width: 0px;
|
16 |
+
margin: 15px 0;
|
17 |
+
border-bottom: 1px solid #DFDFDF;
|
18 |
+
}
|
19 |
+
.sc_wrap{
|
20 |
+
border: 1px solid #DFDFDF;
|
21 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
22 |
+
}
|
23 |
+
.sc_head{
|
24 |
+
background: url(../images/shortcoder.png) no-repeat left 2px;
|
25 |
+
padding-left: 40px;
|
26 |
+
background-size: 32px;
|
27 |
+
}
|
28 |
+
.sc_shortcode{
|
29 |
+
border-bottom: 1px solid #CCC;
|
30 |
+
padding: 0px;
|
31 |
+
background: #FFF;
|
32 |
+
}
|
33 |
+
.sc_shortcode:last-child{
|
34 |
+
border:0;
|
35 |
+
}
|
36 |
+
.sc_shortcode_name{
|
37 |
+
cursor: pointer;
|
38 |
+
padding: 10px 10px 10px 35px;
|
39 |
+
position: relative;
|
40 |
+
}
|
41 |
+
.sc_shortcode_name:hover{
|
42 |
+
background: #fffeea;
|
43 |
+
}
|
44 |
+
.sc_params{
|
45 |
+
border: 1px solid #DFDFDF;
|
46 |
+
background: #F9F9F9;
|
47 |
+
margin: 0 -1px -1px;
|
48 |
+
padding: 20px;
|
49 |
+
display: none;
|
50 |
+
box-shadow: inset 0 2px 6px -5px;
|
51 |
+
}
|
52 |
+
.button{
|
53 |
+
display: inline-block;
|
54 |
+
text-decoration: none;
|
55 |
+
font-size: 13px;
|
56 |
+
line-height: 26px;
|
57 |
+
height: 28px;
|
58 |
+
margin: 0;
|
59 |
+
padding: 0 10px 1px;
|
60 |
+
cursor: pointer;
|
61 |
+
border-width: 1px;
|
62 |
+
border-style: solid;
|
63 |
+
-webkit-appearance: none;
|
64 |
+
-webkit-border-radius: 3px;
|
65 |
+
border-radius: 3px;
|
66 |
+
white-space: nowrap;
|
67 |
+
-webkit-box-sizing: border-box;
|
68 |
+
-moz-box-sizing: border-box;
|
69 |
+
box-sizing: border-box;
|
70 |
+
}
|
71 |
+
.button.button-primary{
|
72 |
+
background: #0085ba;
|
73 |
+
border-color: #0073aa #006799 #006799;
|
74 |
+
-webkit-box-shadow: 0 1px 0 #006799;
|
75 |
+
box-shadow: 0 1px 0 #006799;
|
76 |
+
color: #fff;
|
77 |
+
text-decoration: none;
|
78 |
+
text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
|
79 |
+
}
|
80 |
+
|
81 |
+
.sc_insert:hover{
|
82 |
+
opacity: 0.8;
|
83 |
+
}
|
84 |
+
.sc_wrap input[type=text]{
|
85 |
+
padding: 5px;
|
86 |
+
border: 1px solid #CCC;
|
87 |
+
width: 120px;
|
88 |
+
margin: 0px 25px 10px 0px;
|
89 |
+
}
|
90 |
+
.sc_toggle{
|
91 |
+
background: url(../images/toggle-arrow.png) no-repeat;
|
92 |
+
width: 16px;
|
93 |
+
height: 16px;
|
94 |
+
position: absolute;
|
95 |
+
left: 15px;
|
96 |
+
top: 50%;
|
97 |
+
margin-top: -6px;
|
98 |
+
opacity: 0.4;
|
99 |
+
}
|
100 |
+
|
101 |
+
.sc_options{
|
102 |
+
position: absolute;
|
103 |
+
right: 10px;
|
104 |
+
top: 7px;
|
105 |
+
}
|
106 |
+
.sc_options .button{
|
107 |
+
background: #fff;
|
108 |
+
border: 1px solid transparent;
|
109 |
+
color: #888;
|
110 |
+
font-size: 11px;
|
111 |
+
vertical-align: middle;
|
112 |
+
}
|
113 |
+
.sc_options .button:hover{
|
114 |
+
box-shadow: 0 1px 4px -3px #333;
|
115 |
+
color: #333;
|
116 |
+
}
|
117 |
+
.sc_shortcode:hover .sc_options .button{
|
118 |
+
border-color: #607D8B;
|
119 |
+
}
|
120 |
+
|
121 |
+
.disabled_text{
|
122 |
+
font-size: 10px;
|
123 |
+
background: #ffdfdd;
|
124 |
+
border-radius: 10px;
|
125 |
+
padding: 2px 10px;
|
126 |
+
margin: 0 0 0 10px;
|
127 |
+
color: #F44336;
|
128 |
+
}
|
129 |
+
|
130 |
+
.new_btn{
|
131 |
+
float: right;
|
132 |
+
border: 1px solid #cecece;
|
133 |
+
color: #333;
|
134 |
+
opacity: 0.4;
|
135 |
+
}
|
136 |
+
.new_btn:hover{
|
137 |
+
opacity: 1;
|
138 |
+
}
|
139 |
+
|
140 |
+
.coffee_box{
|
141 |
+
padding: 10px;
|
142 |
+
border: 1px solid #4CAF50;
|
143 |
+
padding-left: 20%;
|
144 |
+
background: url(../images/coffee.svg) no-repeat;
|
145 |
+
border-radius: 3px;
|
146 |
+
background-position: 30px center;
|
147 |
+
margin: 30px 0 15px 0;
|
148 |
+
background-size: 84px;
|
149 |
+
}
|
150 |
+
.coffee_box .coffee_amt {
|
151 |
+
width: 120px;
|
152 |
+
padding: 5px;
|
153 |
+
height: auto;
|
154 |
+
font-size: 1.5em;
|
155 |
+
}
|
156 |
+
.coffee_amt_wrap{
|
157 |
+
float: right;
|
158 |
+
margin: 0 30px;
|
159 |
+
}
|
160 |
+
.coffee_box h3{
|
161 |
+
margin: 5px 0;
|
162 |
+
font-weight: normal;
|
163 |
+
}
|
164 |
+
.coffee_box p{
|
165 |
+
font-size: 13px;
|
166 |
+
}
|
admin/css/style.css
ADDED
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wrap{
|
2 |
+
max-width: 900px;
|
3 |
+
margin: 0 auto;
|
4 |
+
}
|
5 |
+
|
6 |
+
h1.sc_title {
|
7 |
+
background: url(../images/shortcoder.png) no-repeat left;
|
8 |
+
background-size: 32px 32px;
|
9 |
+
padding-left: 40px;
|
10 |
+
padding-bottom: 9px;
|
11 |
+
}
|
12 |
+
h1.sc_title .title-count {
|
13 |
+
font-size: 10px;
|
14 |
+
padding: 2px 8px;
|
15 |
+
opacity: 0.7;
|
16 |
+
}
|
17 |
+
.head_wrap {
|
18 |
+
padding: 15px 0;
|
19 |
+
position: relative;
|
20 |
+
}
|
21 |
+
|
22 |
+
#content{
|
23 |
+
background: #fff;
|
24 |
+
padding: 20px;
|
25 |
+
border: 1px solid #dfdfdf;
|
26 |
+
border-radius: 3px;
|
27 |
+
overflow: hidden;
|
28 |
+
box-shadow: 0 0 4px -3px;
|
29 |
+
}
|
30 |
+
|
31 |
+
.page_title {
|
32 |
+
border-bottom: 1px solid #dfdfdf;
|
33 |
+
margin: -20px -20px 20px -20px;
|
34 |
+
padding: 1em;
|
35 |
+
background: linear-gradient(#fdfdfd, #Fafafa);
|
36 |
+
position: relative;
|
37 |
+
}
|
38 |
+
|
39 |
+
.sc_list {
|
40 |
+
margin: -20px 0;
|
41 |
+
position: relative;
|
42 |
+
}
|
43 |
+
.sc_list li {
|
44 |
+
margin: 0;
|
45 |
+
position: relative;
|
46 |
+
}
|
47 |
+
.sc_list li a {
|
48 |
+
text-decoration: none;
|
49 |
+
}
|
50 |
+
.sc_list li .sc_link {
|
51 |
+
display: block;
|
52 |
+
margin: 0 -20px;
|
53 |
+
padding: 20px;
|
54 |
+
border-bottom: 1px solid #dfdfdf;
|
55 |
+
font-size: 18px;
|
56 |
+
}
|
57 |
+
.sc_list li:last-child .sc_link{
|
58 |
+
border-bottom: 0;
|
59 |
+
}
|
60 |
+
.sc_link:hover{
|
61 |
+
background: #fffeea;
|
62 |
+
}
|
63 |
+
.sc_link:hover:after {
|
64 |
+
font-family: dashicons;
|
65 |
+
content: "\f464";
|
66 |
+
font-size: 15px;
|
67 |
+
position: absolute;
|
68 |
+
margin-left: 10px;
|
69 |
+
}
|
70 |
+
.sc_controls {
|
71 |
+
position: absolute;
|
72 |
+
top: 20px;
|
73 |
+
right: 0;
|
74 |
+
}
|
75 |
+
.sc_list .sc_controls a {
|
76 |
+
padding: 10px;
|
77 |
+
border-radius: 50%;
|
78 |
+
margin: 0 0 0 15px;
|
79 |
+
border: 1px solid transparent;
|
80 |
+
}
|
81 |
+
.sc_list .sc_controls a:hover{
|
82 |
+
border: 1px solid #dfdfdf;
|
83 |
+
}
|
84 |
+
|
85 |
+
.sc_list .sc_delete:hover{
|
86 |
+
border-color: red;
|
87 |
+
color: red;
|
88 |
+
}
|
89 |
+
|
90 |
+
.sc_list:empty:before {
|
91 |
+
content: attr( data-empty );
|
92 |
+
position: absolute;
|
93 |
+
left: 0;
|
94 |
+
right: 0;
|
95 |
+
text-align: center;
|
96 |
+
font-style: italic;
|
97 |
+
top: 25px;
|
98 |
+
}
|
99 |
+
.sc_list:empty {
|
100 |
+
height: 70px;
|
101 |
+
}
|
102 |
+
.spin{
|
103 |
+
animation: spin infinite 1s;
|
104 |
+
}
|
105 |
+
.sc_copy_box {
|
106 |
+
position: absolute;
|
107 |
+
top: -2px;
|
108 |
+
font-size: 20px;
|
109 |
+
width: 86%;
|
110 |
+
padding: 16px;
|
111 |
+
left: -22px;
|
112 |
+
display: none;
|
113 |
+
cursor: copy;
|
114 |
+
background: #e6fffe !important;
|
115 |
+
box-shadow: none !important;
|
116 |
+
text-align: center;
|
117 |
+
}
|
118 |
+
.sc_list .disabled_text{
|
119 |
+
font-size: 10px;
|
120 |
+
background: #ffdfdd;
|
121 |
+
border-radius: 10px;
|
122 |
+
padding: 2px 10px;
|
123 |
+
margin: 0 0 0 10px;
|
124 |
+
color: #F44336;
|
125 |
+
}
|
126 |
+
|
127 |
+
.page_title .button{
|
128 |
+
position: absolute;
|
129 |
+
top: 10px;
|
130 |
+
right: 20px;
|
131 |
+
}
|
132 |
+
|
133 |
+
#content .button .dashicons{
|
134 |
+
margin: 0.5em 0 0 0;
|
135 |
+
font-size: 15px;
|
136 |
+
}
|
137 |
+
|
138 |
+
.sc_section{
|
139 |
+
margin: 0 0 20px 0;
|
140 |
+
}
|
141 |
+
.sc_section label{
|
142 |
+
display: block;
|
143 |
+
margin: 0 0 10px 0;
|
144 |
+
}
|
145 |
+
.sc_section label select{
|
146 |
+
font-size: 12px;
|
147 |
+
margin-left: 10px;
|
148 |
+
}
|
149 |
+
|
150 |
+
#sc_name{
|
151 |
+
padding: 10px;
|
152 |
+
}
|
153 |
+
.sc_name_wrap {
|
154 |
+
position: relative;
|
155 |
+
}
|
156 |
+
|
157 |
+
.sc_name_wrap > .copy_shortcode {
|
158 |
+
position: absolute;
|
159 |
+
top: 1px;
|
160 |
+
right: 1px;
|
161 |
+
bottom: 1px;
|
162 |
+
padding: 10px;
|
163 |
+
border-left: 1px solid #d0d0d0;
|
164 |
+
background: rgba(255, 255, 255, 0.5);
|
165 |
+
}
|
166 |
+
|
167 |
+
.page_footer{
|
168 |
+
margin: 30px -20px -20px -20px;
|
169 |
+
background: #f7f7f7;
|
170 |
+
padding: 20px;
|
171 |
+
border-top: 1px solid #dfdfdf;
|
172 |
+
border-radius: 0 0 5px 5px;
|
173 |
+
}
|
174 |
+
.page_footer .sc_delete_ep{
|
175 |
+
float: right;
|
176 |
+
}
|
177 |
+
.page_footer .sc_delete_ep:hover{
|
178 |
+
color: red;
|
179 |
+
}
|
180 |
+
|
181 |
+
.wrap .notice{
|
182 |
+
margin-bottom: 0;
|
183 |
+
}
|
184 |
+
|
185 |
+
.params_wrap{
|
186 |
+
box-shadow: 0 3px 5px rgba(0,0,0,.2);
|
187 |
+
border: 1px solid #dfdfdf;
|
188 |
+
margin: 0;
|
189 |
+
position: absolute;
|
190 |
+
display: none;
|
191 |
+
background: #fff;
|
192 |
+
}
|
193 |
+
.params_wrap li{
|
194 |
+
position: relative;
|
195 |
+
background: #fff;
|
196 |
+
margin: 0;
|
197 |
+
padding: 10px;
|
198 |
+
width: 200px;
|
199 |
+
border-bottom: 1px solid #dfdfdf;
|
200 |
+
cursor: pointer;
|
201 |
+
}
|
202 |
+
.params_wrap li:hover{
|
203 |
+
background: lightyellow;
|
204 |
+
}
|
205 |
+
.params_wrap > li:after{
|
206 |
+
position: absolute;
|
207 |
+
font-family: dashicons;
|
208 |
+
content: "\f139";
|
209 |
+
right: 5px;
|
210 |
+
top: 10px;
|
211 |
+
}
|
212 |
+
.params_wrap li:last-child{
|
213 |
+
border: 0;
|
214 |
+
}
|
215 |
+
.params_wrap li ul{
|
216 |
+
background: #fff;
|
217 |
+
position: absolute;
|
218 |
+
display: none;
|
219 |
+
top: 0;
|
220 |
+
left: 100%;
|
221 |
+
box-shadow: 0 3px 5px rgba(0,0,0,.2);
|
222 |
+
border: 1px solid #dfdfdf;
|
223 |
+
z-index: 9999;
|
224 |
+
}
|
225 |
+
.params_wrap li:hover ul{
|
226 |
+
display: block;
|
227 |
+
}
|
228 |
+
|
229 |
+
.params_wrap .cp_form{
|
230 |
+
cursor: auto;
|
231 |
+
width: 300px;
|
232 |
+
}
|
233 |
+
.cp_form h4{
|
234 |
+
margin: 0 0 15px 0;
|
235 |
+
}
|
236 |
+
.cp_info{
|
237 |
+
margin: 5px 0;
|
238 |
+
}
|
239 |
+
.cp_info.red{
|
240 |
+
color: red;
|
241 |
+
}
|
242 |
+
|
243 |
+
.top_sharebar{
|
244 |
+
position: absolute;
|
245 |
+
right: 0;
|
246 |
+
top: 24px;
|
247 |
+
}
|
248 |
+
.top_sharebar > * {
|
249 |
+
vertical-align: middle;
|
250 |
+
margin-left: 5px;
|
251 |
+
float: right;
|
252 |
+
}
|
253 |
+
.share_text {
|
254 |
+
font-size: 10px;
|
255 |
+
text-align: right;
|
256 |
+
line-height: 1.5;
|
257 |
+
margin-right: 5px;
|
258 |
+
color: #838383;
|
259 |
+
}
|
260 |
+
|
261 |
+
.coffee_box{
|
262 |
+
padding: 15px 15px 25px 15px;
|
263 |
+
border: 1px solid #4CAF50;
|
264 |
+
padding-left: 18%;
|
265 |
+
background: url(../images/coffee.svg) no-repeat;
|
266 |
+
border-radius: 3px;
|
267 |
+
background-position: 30px center;
|
268 |
+
margin: 30px 0 15px 0;
|
269 |
+
background-size: 84px;
|
270 |
+
}
|
271 |
+
.coffee_box .coffee_amt {
|
272 |
+
width: 120px;
|
273 |
+
padding: 5px;
|
274 |
+
height: auto;
|
275 |
+
font-size: 1.5em;
|
276 |
+
}
|
277 |
+
.coffee_amt_wrap{
|
278 |
+
float: right;
|
279 |
+
margin: 0 30px;
|
280 |
+
}
|
281 |
+
.credits_box{
|
282 |
+
font-size: 12px;
|
283 |
+
font-style: italic;
|
284 |
+
color: #757575;
|
285 |
+
}
|
286 |
+
.credits_box img {
|
287 |
+
vertical-align: middle;
|
288 |
+
margin-right: 5px;
|
289 |
+
}
|
290 |
+
|
291 |
+
.rate_link{
|
292 |
+
float: right;
|
293 |
+
}
|
294 |
+
.rate_link a{
|
295 |
+
color: #e7711b;
|
296 |
+
text-decoration: none;
|
297 |
+
font-size: 13px;
|
298 |
+
}
|
299 |
+
.rate_link:hover a{
|
300 |
+
text-decoration: underline;
|
301 |
+
}
|
302 |
+
.rate_link .dashicons {
|
303 |
+
font-size: 12px;
|
304 |
+
margin: 5px 0 0 0;
|
305 |
+
}
|
306 |
+
|
307 |
+
.help_link{
|
308 |
+
margin-left: 10px;
|
309 |
+
text-decoration: none;
|
310 |
+
}
|
311 |
+
.help_link .dashicons{
|
312 |
+
font-size: 32px;
|
313 |
+
width: 32px;
|
314 |
+
height: 32px;
|
315 |
+
color: #607D8B;
|
316 |
+
}
|
317 |
+
|
318 |
+
@keyframes spin {
|
319 |
+
from {transform:rotate(0deg);}
|
320 |
+
to {transform:rotate(360deg);}
|
321 |
+
}
|
322 |
+
|
323 |
+
.clearfix:after{
|
324 |
+
clear: both;
|
325 |
+
content: ".";
|
326 |
+
display: block;
|
327 |
+
height: 0;
|
328 |
+
visibility: hidden;
|
329 |
+
font-size: 0;
|
330 |
+
}
|
{images → admin/images}/aw.png
RENAMED
File without changes
|
admin/images/coffee.svg
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2 |
+
<svg
|
3 |
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
4 |
+
xmlns:cc="http://creativecommons.org/ns#"
|
5 |
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
6 |
+
xmlns:svg="http://www.w3.org/2000/svg"
|
7 |
+
xmlns="http://www.w3.org/2000/svg"
|
8 |
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
9 |
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
10 |
+
height="128"
|
11 |
+
version="1.1"
|
12 |
+
viewBox="0 0 128 128"
|
13 |
+
width="128"
|
14 |
+
id="svg4495"
|
15 |
+
sodipodi:docname="1494109658_food-drink-cup-coffee-tea-drink-outline-stroke.svg"
|
16 |
+
inkscape:version="0.92.0 r15299">
|
17 |
+
<metadata
|
18 |
+
id="metadata4499">
|
19 |
+
<rdf:RDF>
|
20 |
+
<cc:Work
|
21 |
+
rdf:about="">
|
22 |
+
<dc:format>image/svg+xml</dc:format>
|
23 |
+
<dc:type
|
24 |
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
25 |
+
<dc:title></dc:title>
|
26 |
+
</cc:Work>
|
27 |
+
</rdf:RDF>
|
28 |
+
</metadata>
|
29 |
+
<sodipodi:namedview
|
30 |
+
pagecolor="#ffffff"
|
31 |
+
bordercolor="#666666"
|
32 |
+
borderopacity="1"
|
33 |
+
objecttolerance="10"
|
34 |
+
gridtolerance="10"
|
35 |
+
guidetolerance="10"
|
36 |
+
inkscape:pageopacity="0"
|
37 |
+
inkscape:pageshadow="2"
|
38 |
+
inkscape:window-width="1920"
|
39 |
+
inkscape:window-height="1013"
|
40 |
+
id="namedview4497"
|
41 |
+
showgrid="false"
|
42 |
+
inkscape:zoom="2.2265625"
|
43 |
+
inkscape:cx="60.701019"
|
44 |
+
inkscape:cy="100.20618"
|
45 |
+
inkscape:window-x="-9"
|
46 |
+
inkscape:window-y="-9"
|
47 |
+
inkscape:window-maximized="1"
|
48 |
+
inkscape:current-layer="Layer_2" />
|
49 |
+
<desc
|
50 |
+
id="desc4487" />
|
51 |
+
<defs
|
52 |
+
id="defs4489" />
|
53 |
+
<g
|
54 |
+
id="miu"
|
55 |
+
style="fill:none;fill-rule:evenodd;stroke:none;stroke-width:1"
|
56 |
+
transform="matrix(5.5327011,0,0,5.5327011,-1.3569238,10.877533)">
|
57 |
+
<g
|
58 |
+
id="Artboard-1"
|
59 |
+
transform="translate(-503,-515)">
|
60 |
+
<g
|
61 |
+
id="slice"
|
62 |
+
transform="translate(215,119)" />
|
63 |
+
<path
|
64 |
+
d="m 521.02703,523.35506 c 0.009,-0.39125 0.004,-0.77169 -0.0131,-1.1361 C 521.00824,522.09555 521,521.50003 521,521.5 v 0 c 0,-1.28644 -2.85422,-2 -6.5,-2 -3.64578,0 -6.5,0.71356 -6.5,2 0,10e-6 -0.008,0.59555 -0.014,0.71896 -0.0659,1.41455 0.0458,3.07056 0.4816,4.66302 0.86614,3.1649 2.79873,5.11802 6.03238,5.11802 2.27915,0 3.91196,-0.97026 4.98059,-2.65121 2.90061,-0.0524 6.22639,-2.61697 5.22565,-4.88902 -0.40287,-0.91465 -1.1392,-1.36254 -2.05478,-1.39971 -0.50445,-0.0205 -1.02662,0.0826 -1.542,0.26513 -0.0281,0.01 -0.0556,0.0199 -0.0824,0.0299 z m -0.0645,1.11607 c -0.0739,0.79385 -0.21104,1.61037 -0.4301,2.41085 -0.138,0.50424 -0.30306,0.97772 -0.49615,1.41744 2.14097,-0.32376 4.32372,-2.145 3.75485,-3.43656 -0.24026,-0.54547 -0.62779,-0.7812 -1.18019,-0.80363 -0.35902,-0.0146 -0.76224,0.065 -1.16757,0.20859 -0.21942,0.0777 -0.38848,0.1545 -0.48084,0.20331 z m -0.9347,-1.83112 c 0.0265,1.23414 -0.094,2.64091 -0.45994,3.97801 C 518.80907,529.39062 517.21661,531 514.5,531 c -2.71661,0 -4.30907,-1.60938 -5.06784,-4.38198 -0.36593,-1.3371 -0.48646,-2.74387 -0.45994,-3.97801 1.13669,0.56058 3.16617,0.85999 5.52778,0.85999 2.36161,0 4.39109,-0.29941 5.52778,-0.85999 v 0 z M 509,521.5 c 0,-0.37041 2.51836,-1 5.5,-1 2.98164,0 5.5,0.62959 5.5,1 0,0.37041 -2.51836,1 -5.5,1 -2.98164,0 -5.5,-0.62959 -5.5,-1 z m -4.5,11.5 c 0,0 -0.5,0 -0.5,0.5 0,0.5 0.5,0.5 0.5,0.5 h 21 c 0,0 0.5,0 0.5,-0.5 0,-0.5 -0.5,-0.5 -0.5,-0.5 z"
|
65 |
+
id="food-drink-cup-coffee-tea-drink-outline-stroke"
|
66 |
+
inkscape:connector-curvature="0"
|
67 |
+
style="fill:#000000" />
|
68 |
+
</g>
|
69 |
+
</g>
|
70 |
+
<g
|
71 |
+
id="g4561"
|
72 |
+
transform="translate(180.23158,1.9807019)">
|
73 |
+
<g
|
74 |
+
id="Layer_2"
|
75 |
+
transform="translate(10.329825,-94.315789)">
|
76 |
+
<g
|
77 |
+
id="g4534"
|
78 |
+
transform="matrix(2.4713604,0,0,2.4713604,-210.98683,57.600819)">
|
79 |
+
<path
|
80 |
+
id="path4532"
|
81 |
+
d="m 33.114,51.204 v -1.315 c -0.927,-0.041 -1.827,-0.29 -2.353,-0.595 l 0.415,-1.619 c 0.582,0.318 1.398,0.608 2.297,0.608 0.789,0 1.329,-0.304 1.329,-0.857 0,-0.525 -0.443,-0.857 -1.467,-1.204 -1.481,-0.498 -2.491,-1.19 -2.491,-2.532 0,-1.219 0.858,-2.174 2.339,-2.464 V 39.91 h 1.356 v 1.219 c 0.927,0.041 1.55,0.235 2.007,0.457 l -0.401,1.563 c -0.36,-0.152 -0.997,-0.471 -1.993,-0.471 -0.899,0 -1.19,0.388 -1.19,0.774 0,0.457 0.484,0.748 1.661,1.191 1.647,0.58 2.311,1.342 2.311,2.588 0,1.231 -0.872,2.283 -2.463,2.561 v 1.411 h -1.357 z"
|
82 |
+
inkscape:connector-curvature="0"
|
83 |
+
style="fill:#92278f" />
|
84 |
+
</g>
|
85 |
+
<path
|
86 |
+
id="path4528-3"
|
87 |
+
d="m -133.27695,122.08016 c 4.05154,0 8.24277,-3.06272 8.24277,-8.18852 0,-2.81586 -1.89351,-4.22515 -3.41673,-5.35909 -1.48389,-1.10275 -2.32214,-1.7945 -2.32214,-3.18209 0,-1.45269 0.95218,-2.16073 2.50389,-3.19294 1.44184,-0.96032 3.23498,-2.15259 3.23498,-4.492359 0,-0.750083 -0.60765,-1.356389 -1.35638,-1.356389 -0.74873,0 -1.35639,0.606306 -1.35639,1.356389 0,0.802982 -0.61716,1.296708 -2.02508,2.232616 -1.56664,1.044423 -3.7138,2.471343 -3.7138,5.452683 0,2.81586 1.89351,4.22515 3.41674,5.35909 1.48389,1.10275 2.32214,1.79451 2.32214,3.18209 0,3.55645 -2.84841,5.47574 -5.53,5.47574 -0.74872,0 -1.35638,0.60631 -1.35638,1.35639 0,0.75009 0.60766,1.35639 1.35638,1.35639 z"
|
88 |
+
inkscape:connector-curvature="0"
|
89 |
+
style="fill:#ffcf06;fill-opacity:1;stroke-width:1.35638893" />
|
90 |
+
<path
|
91 |
+
id="path4530-4"
|
92 |
+
d="m -125.24305,122.08016 c 4.05153,0 8.24277,-3.06272 8.24277,-8.18852 0,-2.81586 -1.89352,-4.22515 -3.41675,-5.35909 -1.48389,-1.10275 -2.32214,-1.7945 -2.32214,-3.18209 0,-1.45269 0.95219,-2.16073 2.5039,-3.19294 1.44184,-0.96032 3.23499,-2.15259 3.23499,-4.492359 0,-0.750083 -0.60766,-1.356389 -1.35638,-1.356389 -0.74873,0 -1.3564,0.606306 -1.3564,1.356389 0,0.802982 -0.61716,1.296708 -2.02509,2.232616 -1.56662,1.044423 -3.71379,2.471343 -3.71379,5.452683 0,2.81586 1.89352,4.22515 3.41674,5.35909 1.48254,1.1041 2.32214,1.79451 2.32214,3.18209 0,3.55645 -2.84977,5.47574 -5.52999,5.47574 -0.74873,0 -1.3564,0.60631 -1.3564,1.35639 0,0.75009 0.60767,1.35639 1.3564,1.35639 z"
|
93 |
+
inkscape:connector-curvature="0"
|
94 |
+
style="fill:#ffcf06;fill-opacity:1;stroke-width:1.35638893" />
|
95 |
+
</g>
|
96 |
+
<g
|
97 |
+
id="Layer_3" />
|
98 |
+
</g>
|
99 |
+
</svg>
|
{images → admin/images}/index.html
RENAMED
File without changes
|
{images → admin/images}/shortcoder-2.png
RENAMED
File without changes
|
{images → admin/images}/shortcoder.png
RENAMED
File without changes
|
{images → admin/images}/toggle-arrow.png
RENAMED
File without changes
|
admin/js/script-insert.js
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
|
3 |
+
$(document).ready(function(){
|
4 |
+
|
5 |
+
var send_editor = function( content = '' ){
|
6 |
+
if( typeof parent.send_to_editor === 'function' ){
|
7 |
+
parent.send_to_editor( content );
|
8 |
+
}else{
|
9 |
+
alert( 'Editor does not exist. Cannot insert content !' );
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
var close_window = function(){
|
14 |
+
if( typeof parent.tb_remove === 'function' ){
|
15 |
+
parent.tb_remove();
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
$('.sc_shortcode_name').append('<span class="sc_toggle"></span>');
|
20 |
+
|
21 |
+
$( document ).on( 'click', '.sc_insert', function(){
|
22 |
+
|
23 |
+
var params = '';
|
24 |
+
var scname = $(this).closest( '.sc_shortcode' ).attr( 'data-name' );
|
25 |
+
var sc = '';
|
26 |
+
|
27 |
+
$(this).parent().children().find('input[type="text"]').each(function(){
|
28 |
+
if($(this).val() != ''){
|
29 |
+
attr = $(this).attr('data-param');
|
30 |
+
val = $(this).val().replace( /\"/g, '' );
|
31 |
+
params += attr + '="' + val + '" ';
|
32 |
+
}
|
33 |
+
});
|
34 |
+
|
35 |
+
sc = '[sc name="' + scname + '" ' + params + ']';
|
36 |
+
send_editor( sc );
|
37 |
+
close_window();
|
38 |
+
|
39 |
+
});
|
40 |
+
|
41 |
+
$( document ).on( 'click', '.sc_quick_insert', function(){
|
42 |
+
|
43 |
+
var scname = $(this).closest( '.sc_shortcode' ).attr( 'data-name' );
|
44 |
+
var sc = '[sc name="' + scname + '"]';
|
45 |
+
|
46 |
+
send_editor( sc );
|
47 |
+
close_window();
|
48 |
+
|
49 |
+
});
|
50 |
+
|
51 |
+
$( document ).on( 'click', '.sc_shortcode_name', function(e){
|
52 |
+
$('.sc_params').slideUp();
|
53 |
+
if($(this).next('.sc_params').is(':visible')){
|
54 |
+
$(this).next('.sc_params').slideUp();
|
55 |
+
}else{
|
56 |
+
$(this).next('.sc_params').slideDown();
|
57 |
+
}
|
58 |
+
});
|
59 |
+
|
60 |
+
$( document ).on( 'change', '.coffee_amt', function(){
|
61 |
+
var btn = $( '.buy_coffee_btn' );
|
62 |
+
btn.attr( 'href', btn.data( 'link' ) + $(this).val() );
|
63 |
+
});
|
64 |
+
|
65 |
+
});
|
66 |
+
|
67 |
+
})( jQuery );
|
admin/js/script.js
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
$(document).ready(function(){
|
3 |
+
|
4 |
+
var delete_ctext = 'Are you sure want to delete this shortcode ?';
|
5 |
+
|
6 |
+
$( document ).on( 'click', '.sc_delete', function(e){
|
7 |
+
|
8 |
+
e.preventDefault();
|
9 |
+
|
10 |
+
var del_btn = $(this);
|
11 |
+
var href = del_btn.attr( 'href' );
|
12 |
+
var confirm_user = confirm( delete_ctext );
|
13 |
+
|
14 |
+
if( confirm_user ){
|
15 |
+
|
16 |
+
var ajax = $.get( href );
|
17 |
+
del_btn.addClass( 'spin' );
|
18 |
+
|
19 |
+
ajax.done(function( data ){
|
20 |
+
if( data.search( 'DELETED' ) != -1 ){
|
21 |
+
del_btn.closest( 'li' ).fadeOut( 'slow', function(){
|
22 |
+
$(this).remove();
|
23 |
+
});
|
24 |
+
}else{
|
25 |
+
alert( 'Delete failed ! - ' + data );
|
26 |
+
}
|
27 |
+
});
|
28 |
+
|
29 |
+
ajax.fail(function(){
|
30 |
+
alert( 'Auth failed !' );
|
31 |
+
});
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
});
|
36 |
+
|
37 |
+
$( document ).on( 'click', '.sc_delete_ep', function(e){
|
38 |
+
|
39 |
+
e.preventDefault();
|
40 |
+
|
41 |
+
var $delete_btn = $(this);
|
42 |
+
var href = $delete_btn.attr( 'href' );
|
43 |
+
var confirm_user = confirm( delete_ctext );
|
44 |
+
|
45 |
+
if( confirm_user ){
|
46 |
+
|
47 |
+
var ajax = $.get( href );
|
48 |
+
$delete_btn.addClass( 'spin' );
|
49 |
+
|
50 |
+
ajax.done(function( data ){
|
51 |
+
if( data.search( 'DELETED' ) != -1 ){
|
52 |
+
var back_href = $( '.sc_back_btn' ).attr( 'href' );
|
53 |
+
window.location = back_href + '&msg=3';
|
54 |
+
}else{
|
55 |
+
alert( 'Delete failed ! - ' + data );
|
56 |
+
}
|
57 |
+
});
|
58 |
+
|
59 |
+
ajax.fail(function(){
|
60 |
+
alert( 'Auth failed !' );
|
61 |
+
});
|
62 |
+
|
63 |
+
$delete_btn.removeClass( 'spin' );
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
});
|
68 |
+
|
69 |
+
$( document ).on( 'click', '.sc_copy', function(e){
|
70 |
+
|
71 |
+
e.preventDefault();
|
72 |
+
|
73 |
+
var btn = $(this);
|
74 |
+
var box = btn.closest( 'li' ).find( '.sc_copy_box' );
|
75 |
+
|
76 |
+
$( '.sc_copy_box' ).not( box ).hide();
|
77 |
+
|
78 |
+
box.fadeToggle();
|
79 |
+
box.select();
|
80 |
+
|
81 |
+
});
|
82 |
+
|
83 |
+
$(window).load(function(){
|
84 |
+
$( '.wp-media-buttons' ).append(function(){
|
85 |
+
return '<button class="button button-primary sc_insert_params"><span class="dashicons dashicons-plus"></span> Insert shortcode paramerters <span class="dashicons dashicons-arrow-down"></span></button>';
|
86 |
+
});
|
87 |
+
$( '.params_wrap' ).appendTo( 'body' );
|
88 |
+
});
|
89 |
+
|
90 |
+
$( document ).on( 'click', '.sc_insert_params', function(e){
|
91 |
+
|
92 |
+
e.preventDefault();
|
93 |
+
|
94 |
+
var offset = $(this).offset();
|
95 |
+
var mtop = offset.top + $(this).outerHeight();
|
96 |
+
|
97 |
+
$( '.params_wrap' ).css({
|
98 |
+
top: mtop,
|
99 |
+
left: offset.left
|
100 |
+
}).toggle();
|
101 |
+
});
|
102 |
+
|
103 |
+
$( document ).on( 'click', '.cp_btn', function(){
|
104 |
+
|
105 |
+
var $cp_box = $( '.cp_box' );
|
106 |
+
var $cp_info = $( '.cp_info' );
|
107 |
+
var param_val = $cp_box.val().trim();
|
108 |
+
|
109 |
+
if( param_val != '' && $cp_box[0].checkValidity() ){
|
110 |
+
send_to_editor( '%%' + param_val + '%%' );
|
111 |
+
$cp_info.removeClass( 'red' );
|
112 |
+
$( '.params_wrap' ).hide();
|
113 |
+
}else{
|
114 |
+
$cp_info.addClass( 'red' );
|
115 |
+
}
|
116 |
+
|
117 |
+
});
|
118 |
+
|
119 |
+
$( document ).on( 'click', '.wp_params li', function(){
|
120 |
+
|
121 |
+
send_to_editor( '$$' + $(this).data( 'id' ) + '$$' );
|
122 |
+
$( '.params_wrap' ).hide();
|
123 |
+
|
124 |
+
});
|
125 |
+
|
126 |
+
$( document ).on( 'change', '.coffee_amt', function(){
|
127 |
+
var btn = $( '.buy_coffee_btn' );
|
128 |
+
btn.attr( 'href', btn.data( 'link' ) + $(this).val() );
|
129 |
+
});
|
130 |
+
|
131 |
+
});
|
132 |
+
})( jQuery );
|
admin/js/tinymce/editor_plugin.js
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Shortcoder TinyMCE plugin for inserting Shortcodes
|
3 |
+
*/
|
4 |
+
|
5 |
+
(function() {
|
6 |
+
|
7 |
+
tinymce.create( 'tinymce.plugins.SCButton',{
|
8 |
+
|
9 |
+
init : function( ed, url ){
|
10 |
+
ed.addButton( 'shortcoder', {
|
11 |
+
title : 'Insert shortcodes created using Shortcoder',
|
12 |
+
image : url + '/icon.png',
|
13 |
+
onclick : function() {
|
14 |
+
if( typeof sc_show_insert !== 'undefined' ) sc_show_insert();
|
15 |
+
}
|
16 |
+
});
|
17 |
+
},
|
18 |
+
|
19 |
+
getInfo : function() {
|
20 |
+
return {
|
21 |
+
longname : 'Shortcoder',
|
22 |
+
author : 'Aakash Chakravarthy',
|
23 |
+
authorurl : 'https://www.aakashweb.com/',
|
24 |
+
infourl : 'https://www.aakashweb.com/',
|
25 |
+
version : '1.3'
|
26 |
+
};
|
27 |
+
}
|
28 |
+
|
29 |
+
});
|
30 |
+
|
31 |
+
tinymce.PluginManager.add( 'shortcoder', tinymce.plugins.SCButton );
|
32 |
+
|
33 |
+
})();
|
{js → admin/js}/tinymce/icon.png
RENAMED
File without changes
|
{js → admin/js/tinymce}/index.html
RENAMED
File without changes
|
admin/sc-admin.php
ADDED
@@ -0,0 +1,489 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shortcoder_Admin{
|
4 |
+
|
5 |
+
private static $pagehook = 'settings_page_shortcoder';
|
6 |
+
|
7 |
+
public static function init(){
|
8 |
+
|
9 |
+
// Add menu
|
10 |
+
add_action( 'admin_menu', array( __class__, 'add_menu' ) );
|
11 |
+
|
12 |
+
// Enqueue the scripts and styles
|
13 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) );
|
14 |
+
|
15 |
+
// Register the action for admin ajax features
|
16 |
+
add_action( 'wp_ajax_sc_admin_ajax', array( __CLASS__, 'admin_ajax' ) );
|
17 |
+
|
18 |
+
// Register action links
|
19 |
+
add_filter( 'plugin_action_links_' . SC_BASE_NAME, array( __CLASS__, 'action_links' ) );
|
20 |
+
|
21 |
+
// Add Quick Tag button to the editor
|
22 |
+
add_action( 'admin_footer', array( __class__, 'add_qt_button' ) );
|
23 |
+
|
24 |
+
// Add TinyMCE button
|
25 |
+
add_filter( 'mce_buttons', array( __class__, 'register_mce_button' ) );
|
26 |
+
add_filter( 'mce_external_plugins', array( __class__, 'register_mce_js' ) );
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
public static function add_menu(){
|
31 |
+
|
32 |
+
add_options_page( 'Shortcoder', 'Shortcoder', 'manage_options', 'shortcoder', array( __class__, 'admin_page' ) );
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
public static function enqueue_scripts( $hook ){
|
37 |
+
|
38 |
+
if( $hook == self::$pagehook ){
|
39 |
+
|
40 |
+
wp_enqueue_style( 'sc-admin-css', SC_ADMIN_URL . '/css/style.css', array(), SC_VERSION );
|
41 |
+
|
42 |
+
wp_enqueue_script( 'jquery' );
|
43 |
+
wp_enqueue_script( 'sc-admin-js', SC_ADMIN_URL . '/js/script.js', array( 'jquery' ), SC_VERSION );
|
44 |
+
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
public static function admin_page(){
|
49 |
+
|
50 |
+
echo '<div class="wrap">';
|
51 |
+
echo '<div class="head_wrap">';
|
52 |
+
echo '<h1 class="sc_title">Shortcoder <span class="title-count">' . SC_VERSION . '</span></h1>';
|
53 |
+
self::top_sharebar();
|
54 |
+
self::print_notice();
|
55 |
+
echo '</div>';
|
56 |
+
|
57 |
+
echo '<div id="content">';
|
58 |
+
|
59 |
+
$g = self::clean_get();
|
60 |
+
|
61 |
+
if( !isset( $g[ 'action' ] ) ){
|
62 |
+
$g[ 'action' ] = 'list';
|
63 |
+
}
|
64 |
+
|
65 |
+
if( $g[ 'action' ] == 'list' ){
|
66 |
+
self::list_shortcodes();
|
67 |
+
}
|
68 |
+
|
69 |
+
if( $g[ 'action' ] == 'edit' ){
|
70 |
+
self::edit_shortcode();
|
71 |
+
}
|
72 |
+
|
73 |
+
if( $g[ 'action' ] == 'new' ){
|
74 |
+
self::new_shortcode();
|
75 |
+
}
|
76 |
+
|
77 |
+
echo '</div>';
|
78 |
+
|
79 |
+
self::page_bottom();
|
80 |
+
|
81 |
+
echo '</div>';
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
public static function list_shortcodes(){
|
86 |
+
|
87 |
+
$shortcodes = Shortcoder::list_all();
|
88 |
+
|
89 |
+
echo '<h3 class="page_title">' . __( 'List of shortcodes created', 'shortcoder' );
|
90 |
+
echo '<a href="' . self::get_link(array( 'action' => 'new' )) . '" class="button button-primary sc_new_btn"><span class="dashicons dashicons-plus"></span> ' . __( 'Create a new shortcode', 'shortcoder' ) . '</a>';
|
91 |
+
echo '</h3>';
|
92 |
+
|
93 |
+
echo '<ul class="sc_list" data-empty="' . __( 'No shortcodes are created. Go ahead create one !', 'shortcoder' ) . '">';
|
94 |
+
foreach( $shortcodes as $name => $data ){
|
95 |
+
|
96 |
+
$data = wp_parse_args( $data, Shortcoder::defaults() );
|
97 |
+
|
98 |
+
$link = self::get_link(array(
|
99 |
+
'action' => 'edit',
|
100 |
+
'name' => $name
|
101 |
+
));
|
102 |
+
|
103 |
+
$delete_link = self::get_link(array(
|
104 |
+
'action' => 'sc_admin_ajax',
|
105 |
+
'do' => 'delete',
|
106 |
+
'name' => $name,
|
107 |
+
'_wpnonce' => wp_create_nonce( 'sc_delete_nonce' )
|
108 |
+
), 'admin-ajax.php' );
|
109 |
+
|
110 |
+
$disabled_text = ( $data[ 'disabled' ] == '1' ) ? '<small class="disabled_text">' . __( 'Temporarily disabled', 'shortcoder' ) . '</small>' : '';
|
111 |
+
|
112 |
+
echo '<li>';
|
113 |
+
echo '<a href="' . $link . '" class="sc_link" title="' . __( 'Edit shortcode', 'shortcoder' ) . '">' . $name . $disabled_text . '</a>';
|
114 |
+
echo '<span class="sc_controls">';
|
115 |
+
echo '<a href="#" class="sc_copy" title="' . __( 'Copy shortcode', 'shortcoder' ) . '"><span class="dashicons dashicons-editor-code"></span></a>';
|
116 |
+
echo '<a href="' . $delete_link . '" class="sc_delete" title="' . __( 'Delete', 'shortcoder' ) . '"><span class="dashicons dashicons-trash"></span></a>';
|
117 |
+
echo '</span>';
|
118 |
+
|
119 |
+
echo '<input type="text" value="' . self::get_shortcode( $name ) . '" class="sc_copy_box" readonly="readonly" title="' . __( 'Copy shortcode', 'shortcoder' ) . '" />';
|
120 |
+
|
121 |
+
echo '</li>';
|
122 |
+
|
123 |
+
}
|
124 |
+
echo '</ul>';
|
125 |
+
|
126 |
+
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
public static function new_shortcode(){
|
131 |
+
self::edit_shortcode( 'new' );
|
132 |
+
}
|
133 |
+
|
134 |
+
public static function edit_shortcode( $action = 'edit' ){
|
135 |
+
|
136 |
+
self::save_shortcode();
|
137 |
+
|
138 |
+
$shortcodes = Shortcoder::list_all();
|
139 |
+
$g = self::clean_get();
|
140 |
+
|
141 |
+
$page_title = __( 'New shortcode', 'shortcoder' );
|
142 |
+
$action_btn = __( 'Create shortcode', 'shortcoder' );
|
143 |
+
$sc_name = '';
|
144 |
+
$values = array();
|
145 |
+
|
146 |
+
if( $action == 'edit' ){
|
147 |
+
|
148 |
+
$page_title = __( 'Edit shortcode', 'shortcoder' );
|
149 |
+
$action_btn = __( 'Save settings', 'shortcoder' );
|
150 |
+
|
151 |
+
if( !( isset( $g[ 'name' ] ) && array_key_exists( $g[ 'name' ], $shortcodes ) ) ){
|
152 |
+
echo '<p align="center">' . __( 'Invalid shortcode or Shortcode does not exist !' ) . '</p>';
|
153 |
+
return false;
|
154 |
+
}
|
155 |
+
|
156 |
+
$sc_name = $g[ 'name' ];
|
157 |
+
$values = $shortcodes[ $sc_name ];
|
158 |
+
|
159 |
+
}
|
160 |
+
|
161 |
+
$values = wp_parse_args( $values, Shortcoder::defaults() );
|
162 |
+
|
163 |
+
echo '<h3 class="page_title">' . $page_title;
|
164 |
+
echo '<a href="' . self::get_link() . '" class="button sc_back_btn"><span class="dashicons dashicons-arrow-left-alt2"></span> ' . __( 'Back', 'shortcoder' ) . '</a>';
|
165 |
+
echo '</h3>';
|
166 |
+
|
167 |
+
echo '<form method="post">';
|
168 |
+
|
169 |
+
echo '<div class="sc_section">';
|
170 |
+
echo '<label for="sc_name">' . __( 'Name', 'shortcoder' ) . '</label>';
|
171 |
+
echo '<div class="sc_name_wrap"><input type="text" id="sc_name" name="sc_name" value="' . esc_attr( $sc_name ) . '" class="widefat" required="required" ' . ( ( $action == 'edit' ) ? 'readonly="readonly"' : 'placeholder="' . __( 'Enter a name for the shortcode, case sensitive', 'shortcoder' ) . '"' ) . ' pattern="[a-zA-z0-9 \-]+" title="' . __( 'Allowed characters A to Z, a to z, 0 to 9, hyphens, underscores and space', 'shortcoder' ) . '" />';
|
172 |
+
echo ( $action == 'edit' ) ? '<div class="copy_shortcode">Your shortcode is - <strong contenteditable>' . self::get_shortcode( $sc_name ) . '</strong></div>' : '';
|
173 |
+
echo '</div></div>';
|
174 |
+
|
175 |
+
echo '<div class="sc_section">';
|
176 |
+
echo '<label for="sc_content">' . __( 'Shortcode content', 'shortcoder' ) . '</label>';
|
177 |
+
wp_editor( $values[ 'content' ], 'sc_content', array( 'wpautop'=> false, 'textarea_rows'=> 12 ) );
|
178 |
+
echo '</div>';
|
179 |
+
|
180 |
+
echo '<h4>' . __( 'Settings', 'shortcoder' ) . '</h4>';
|
181 |
+
echo '<div class="sc_section">';
|
182 |
+
echo '<label><input type="checkbox" name="sc_disable" value="1" ' . checked( $values[ 'disabled' ], '1', false ) . '/> ' . __( 'Temporarily disable this shortcode', 'shortcoder' ) . '</label>';
|
183 |
+
echo '<label><input type="checkbox" name="sc_hide_admin" value="1" ' . checked( $values[ 'hide_admin' ], '1', false ) . '/> ' . __( 'Disable this Shortcode for administrators' ) . '</label>';
|
184 |
+
echo '</div>';
|
185 |
+
|
186 |
+
$device_options = array(
|
187 |
+
'all' => __( 'On both desktop and mobile devices', 'shortcoder' ),
|
188 |
+
'mobile_only' => __( 'On mobile devices alone', 'shortcoder' ),
|
189 |
+
'desktop_only' => __( 'On desktops alone', 'shortcoder' )
|
190 |
+
);
|
191 |
+
|
192 |
+
echo '<h4>' . __( 'Visibility', 'shortcoder' ) . '</h4>';
|
193 |
+
echo '<div class="sc_section">';
|
194 |
+
echo '<label>' . __( 'Show this shortcode', 'shortcoder' );
|
195 |
+
echo '<select name="sc_devices">';
|
196 |
+
foreach( $device_options as $id => $name ){
|
197 |
+
echo '<option value="' . $id . '" ' . selected( $values[ 'devices' ], $id ) . '>' . $name . '</option>';
|
198 |
+
}
|
199 |
+
echo '</select></label>';
|
200 |
+
echo '</div>';
|
201 |
+
|
202 |
+
wp_nonce_field( 'sc_edit_nonce' );
|
203 |
+
|
204 |
+
echo '<footer class="page_footer">';
|
205 |
+
echo '<button class="button button-primary">' . $action_btn . '</button>';
|
206 |
+
|
207 |
+
if( $action == 'edit' ){
|
208 |
+
$delete_link = self::get_link(array(
|
209 |
+
'action' => 'sc_admin_ajax',
|
210 |
+
'do' => 'delete',
|
211 |
+
'name' => $sc_name,
|
212 |
+
'_wpnonce' => wp_create_nonce( 'sc_delete_nonce' )
|
213 |
+
), 'admin-ajax.php' );
|
214 |
+
echo '<a href="' . $delete_link . '" class="button sc_delete_ep" title="' . __( 'Delete', 'shortcoder' ) . '"><span class="dashicons dashicons-trash"></span></a>';
|
215 |
+
}
|
216 |
+
|
217 |
+
echo '</footer>';
|
218 |
+
|
219 |
+
echo '</form>';
|
220 |
+
|
221 |
+
$sc_wp_params = Shortcoder::wp_params_list();
|
222 |
+
|
223 |
+
echo '<ul class="params_wrap">';
|
224 |
+
echo '<li>' . __( 'WordPress information', 'shortcoder' ) . '<ul class="wp_params">';
|
225 |
+
foreach( $sc_wp_params as $id => $name ){
|
226 |
+
echo '<li data-id="' . $id . '">' . $name . '</li>';
|
227 |
+
}
|
228 |
+
echo '</ul></li>';
|
229 |
+
echo '<li>' . __( 'Custom parameter', 'shortcoder' ) . '<ul>';
|
230 |
+
echo '<li class="cp_form"><h4>' . __( 'Enter custom parameter name', 'shortcoder' ) . '</h4>';
|
231 |
+
echo '<input type="text" class="cp_box" pattern="[a-zA-Z0-9]+"/> <button class="button cp_btn">' . __( 'Insert parameter', 'shortcoder' ) . '</button><p class="cp_info"><small>' . __( 'Only alphabets and numbers allowed. Custom parameters are case insensitive', 'shortcoder' ) . '</small></p></li>';
|
232 |
+
echo '</ul></li>';
|
233 |
+
echo '</ul>';
|
234 |
+
}
|
235 |
+
|
236 |
+
public static function save_shortcode(){
|
237 |
+
|
238 |
+
if( $_POST && check_admin_referer( 'sc_edit_nonce' ) ){
|
239 |
+
|
240 |
+
$p = wp_parse_args( self::clean_post(), array(
|
241 |
+
'sc_name' => '',
|
242 |
+
'sc_content' => '',
|
243 |
+
'sc_disable' => 0,
|
244 |
+
'sc_hide_admin' => 0,
|
245 |
+
'sc_devices' => 'all',
|
246 |
+
));
|
247 |
+
|
248 |
+
if( empty( trim( $p[ 'sc_name' ] ) ) ){
|
249 |
+
self::print_notice( 0 );
|
250 |
+
return false;
|
251 |
+
}
|
252 |
+
|
253 |
+
$shortcodes = Shortcoder::list_all();
|
254 |
+
$name = self::clean_name( $p[ 'sc_name' ] );
|
255 |
+
$values = array(
|
256 |
+
'content' => $p[ 'sc_content' ],
|
257 |
+
'disabled' => $p[ 'sc_disable' ],
|
258 |
+
'hide_admin' => $p[ 'sc_hide_admin' ],
|
259 |
+
'devices' => $p[ 'sc_devices' ]
|
260 |
+
);
|
261 |
+
|
262 |
+
if( array_key_exists( $name, $shortcodes ) ){
|
263 |
+
self::print_notice( 2 );
|
264 |
+
}else{
|
265 |
+
self::print_notice( 1 );
|
266 |
+
}
|
267 |
+
|
268 |
+
$shortcodes[ $name ] = $values;
|
269 |
+
|
270 |
+
update_option( 'shortcoder_data', $shortcodes );
|
271 |
+
|
272 |
+
/*
|
273 |
+
wp_safe_redirect( self::get_link( array(
|
274 |
+
'action' => 'edit',
|
275 |
+
'name' => urlencode( $name ),
|
276 |
+
'msg' => ( $todo == 'new' ) ? 1 : 2
|
277 |
+
)));*/
|
278 |
+
}
|
279 |
+
|
280 |
+
}
|
281 |
+
|
282 |
+
public static function delete_shortcode( $name ){
|
283 |
+
|
284 |
+
$shortcodes = Shortcoder::list_all();
|
285 |
+
|
286 |
+
if( array_key_exists( $name, $shortcodes ) ){
|
287 |
+
unset( $shortcodes[ $name ] );
|
288 |
+
update_option( 'shortcoder_data', $shortcodes );
|
289 |
+
return true;
|
290 |
+
}else{
|
291 |
+
return false;
|
292 |
+
}
|
293 |
+
|
294 |
+
}
|
295 |
+
|
296 |
+
public static function get_link( $params = array(), $page = 'options-general.php' ){
|
297 |
+
|
298 |
+
$params[ 'page' ] = 'shortcoder';
|
299 |
+
return add_query_arg( $params, admin_url( $page ) );
|
300 |
+
|
301 |
+
}
|
302 |
+
|
303 |
+
public static function get_shortcode( $name = '' ){
|
304 |
+
return esc_attr( '[sc name="' . $name . '"]' );
|
305 |
+
}
|
306 |
+
|
307 |
+
public static function admin_ajax(){
|
308 |
+
|
309 |
+
$g = self::clean_get();
|
310 |
+
|
311 |
+
if( $g[ 'do' ] == 'delete' && isset( $g[ 'name' ] ) && check_admin_referer( 'sc_delete_nonce' ) ){
|
312 |
+
if( self::delete_shortcode( $g[ 'name' ] ) ){
|
313 |
+
echo 'DELETED';
|
314 |
+
}else{
|
315 |
+
echo 'FAILED';
|
316 |
+
}
|
317 |
+
}
|
318 |
+
|
319 |
+
if( $g[ 'do' ] == 'insert_shortcode' ){
|
320 |
+
include_once( 'sc-insert.php' );
|
321 |
+
}
|
322 |
+
|
323 |
+
die(0);
|
324 |
+
}
|
325 |
+
|
326 |
+
public static function add_qt_button(){
|
327 |
+
|
328 |
+
$screen = get_current_screen();
|
329 |
+
if( self::$pagehook == $screen->id )
|
330 |
+
return;
|
331 |
+
|
332 |
+
echo '
|
333 |
+
<script>
|
334 |
+
window.onload = function(){
|
335 |
+
if( typeof QTags === "function" ){
|
336 |
+
QTags.addButton( "QT_sc_insert", "Shortcoder", sc_show_insert );
|
337 |
+
}
|
338 |
+
}
|
339 |
+
function sc_show_insert(){
|
340 |
+
tb_show( "Insert a Shortcode", "' . admin_url( 'admin-ajax.php?action=sc_admin_ajax&do=insert_shortcode&TB_iframe=true' ) . '" );
|
341 |
+
}
|
342 |
+
</script>';
|
343 |
+
}
|
344 |
+
|
345 |
+
public static function register_mce_button( $buttons ){
|
346 |
+
|
347 |
+
$screen = get_current_screen();
|
348 |
+
if( self::$pagehook == $screen->id )
|
349 |
+
return $buttons;
|
350 |
+
|
351 |
+
array_push( $buttons, 'separator', 'shortcoder' );
|
352 |
+
return $buttons;
|
353 |
+
}
|
354 |
+
|
355 |
+
public static function register_mce_js( $plugins ){
|
356 |
+
|
357 |
+
$screen = get_current_screen();
|
358 |
+
if( self::$pagehook == $screen->id )
|
359 |
+
return $plugins;
|
360 |
+
|
361 |
+
$plugins[ 'shortcoder' ] = SC_ADMIN_URL . '/js/tinymce/editor_plugin.js';
|
362 |
+
return $plugins;
|
363 |
+
}
|
364 |
+
|
365 |
+
public static function page_bottom(){
|
366 |
+
|
367 |
+
echo '<div class="coffee_box">
|
368 |
+
<div class="coffee_amt_wrap">
|
369 |
+
<p><select class="coffee_amt">
|
370 |
+
<option value="2">$2</option>
|
371 |
+
<option value="3">$3</option>
|
372 |
+
<option value="4">$4</option>
|
373 |
+
<option value="5" selected="selected">$5</option>
|
374 |
+
<option value="6">$6</option>
|
375 |
+
<option value="7">$7</option>
|
376 |
+
<option value="8">$8</option>
|
377 |
+
<option value="9">$9</option>
|
378 |
+
<option value="10">$10</option>
|
379 |
+
<option value="11">$11</option>
|
380 |
+
<option value="12">$12</option>
|
381 |
+
<option value="">Custom</option>
|
382 |
+
</select></p>
|
383 |
+
<a class="button button-primary buy_coffee_btn" href="https://www.paypal.me/vaakash/5" data-link="https://www.paypal.me/vaakash/" target="_blank">Buy me a coffee !</a>
|
384 |
+
</div>
|
385 |
+
<h2>Buy me a coffee !</h2>
|
386 |
+
<p>Thank you for using Shortcoder. If you found the plugin useful buy me a coffee ! Your donation will motivate and make me happy for all the efforts. You can donate via PayPal.</p>';
|
387 |
+
echo '</div>';
|
388 |
+
|
389 |
+
echo '<p class="credits_box"><img src="' . SC_ADMIN_URL . '/images/aw.png" /> Created by <a href="https://goo.gl/aHKnsM" target="_blank">Aakash Chakravarthy</a> - Follow me on <a href="https://twitter.com/vaakash", target="_blank">Twitter</a>, <a href="https://fb.com/aakashweb" target="_blank">Facebook</a>, <a href="https://www.linkedin.com/in/vaakash/" target="_blank">LinkedIn</a>. Check out <a href="https://goo.gl/OAxx4l" target="_blank">my other works</a>. <span class="rate_link">Rate <a href="https://goo.gl/ltvnIE" target="_blank"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a> if you like Shortcoder</span></p>';
|
390 |
+
|
391 |
+
}
|
392 |
+
|
393 |
+
public static function top_sharebar(){
|
394 |
+
echo '
|
395 |
+
<div class="top_sharebar">
|
396 |
+
|
397 |
+
<a href="https://goo.gl/r8Qr7Y" class="help_link" target="_blank"><span class="dashicons dashicons-editor-help"></span></a>
|
398 |
+
|
399 |
+
<div class="a2a_kit a2a_kit_size_32 a2a_default_style">
|
400 |
+
<a class="a2a_button_twitter"></a>
|
401 |
+
<a class="a2a_button_facebook"></a>
|
402 |
+
<a class="a2a_button_google_plus"></a>
|
403 |
+
<a class="a2a_dd" href="https://www.addtoany.com/share"></a>
|
404 |
+
</div>
|
405 |
+
|
406 |
+
<div class="admin_sb share_text">Share & talk about<br/> Shortcoder</div>
|
407 |
+
|
408 |
+
</div>';
|
409 |
+
|
410 |
+
echo '
|
411 |
+
<script>
|
412 |
+
var a2a_config = a2a_config || {};
|
413 |
+
a2a_config.linkname = "Shortcoder - A WordPress plugin to create custom Shortcodes for HTML, Javascript snippets !";
|
414 |
+
a2a_config.linkurl = "https://www.aakashweb.com/wordpress-plugins/shortcoder/";
|
415 |
+
a2a_config.templates = {
|
416 |
+
twitter: "Check out ${title} ${link} - @vaakash"
|
417 |
+
};
|
418 |
+
</script>
|
419 |
+
<script async src="https://static.addtoany.com/menu/page.js"></script>
|
420 |
+
';
|
421 |
+
}
|
422 |
+
|
423 |
+
public static function action_links( $links ){
|
424 |
+
array_unshift( $links, '<a href="https://goo.gl/qMF3iE" target="_blank">Donate</a>' );
|
425 |
+
array_unshift( $links, '<a href="'. esc_url( admin_url( 'options-general.php?page=shortcoder' ) ) .'">⚙️ Settings</a>' );
|
426 |
+
return $links;
|
427 |
+
}
|
428 |
+
|
429 |
+
public static function print_notice( $id = '' ){
|
430 |
+
|
431 |
+
$g = self::clean_get();
|
432 |
+
$type = 'success';
|
433 |
+
$msg = '';
|
434 |
+
|
435 |
+
if( $id == '' ){
|
436 |
+
if( !isset( $g[ 'msg' ] ) ){
|
437 |
+
return false;
|
438 |
+
}
|
439 |
+
$id = $g[ 'msg' ];
|
440 |
+
}
|
441 |
+
|
442 |
+
if( $id == 0 ){
|
443 |
+
$msg = __( 'Shortcode name is empty. Cannot save settings !', 'shortcoder' );
|
444 |
+
$type = 'error';
|
445 |
+
}
|
446 |
+
|
447 |
+
if( $id == 1 ){
|
448 |
+
$msg = __( 'Shortcode created successfully', 'shortcoder' );
|
449 |
+
}
|
450 |
+
|
451 |
+
if( $id == 2 ){
|
452 |
+
$msg = __( 'Shortcode updated successfully', 'shortcoder' );
|
453 |
+
}
|
454 |
+
|
455 |
+
if( $id == 3 ){
|
456 |
+
$msg = __( 'Shortcode deleted successfully', 'shortcoder' );
|
457 |
+
}
|
458 |
+
|
459 |
+
if( $msg != '' ){
|
460 |
+
echo '<div class="notice notice-' . $type . ' is-dismissible"><p>' . $msg . '</p></div>';
|
461 |
+
}
|
462 |
+
}
|
463 |
+
|
464 |
+
public static function clean_name( $name = '' ){
|
465 |
+
|
466 |
+
return trim( preg_replace('/[^0-9a-zA-Z\- _]/', '', $name ) );
|
467 |
+
|
468 |
+
}
|
469 |
+
|
470 |
+
public static function clean_get(){
|
471 |
+
|
472 |
+
foreach( $_GET as $k=>$v ){
|
473 |
+
$_GET[$k] = sanitize_text_field( $v );
|
474 |
+
}
|
475 |
+
|
476 |
+
return $_GET;
|
477 |
+
}
|
478 |
+
|
479 |
+
public static function clean_post(){
|
480 |
+
|
481 |
+
return stripslashes_deep( $_POST );
|
482 |
+
|
483 |
+
}
|
484 |
+
|
485 |
+
}
|
486 |
+
|
487 |
+
Shortcoder_Admin::init();
|
488 |
+
|
489 |
+
?>
|
admin/sc-insert.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<title>Insert shortcode</title>
|
4 |
+
<link href="<?php echo SC_ADMIN_URL; ?>css/style-insert.css" media="all" rel="stylesheet" />
|
5 |
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
6 |
+
<script src="<?php echo SC_ADMIN_URL; ?>js/script-insert.js"></script>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
|
10 |
+
<h2 class="sc_head">Insert shortcode to editor <a href="<?php echo admin_url( 'options-general.php?page=shortcoder&action=new' ); ?>" target="_blank" class="button new_btn">Create new shortcode</a></h2>
|
11 |
+
|
12 |
+
<div class="sc_wrap">
|
13 |
+
<?php
|
14 |
+
|
15 |
+
$shortcodes = Shortcoder::list_all();
|
16 |
+
|
17 |
+
if( empty( $shortcodes ) ){
|
18 |
+
echo '<p align="center">No shortcodes are created, go ahead create one in <a href="' . admin_url( 'options-general.php?page=shortcoder' ) . '" target="_blank">shortcoder admin page</a>.</p>';
|
19 |
+
}else{
|
20 |
+
|
21 |
+
foreach( $shortcodes as $key=>$value ){
|
22 |
+
if($key != '_version_fix'){
|
23 |
+
|
24 |
+
$name = esc_attr( $key );
|
25 |
+
$value = wp_parse_args( $value, Shortcoder::defaults() );
|
26 |
+
$disabled_text = ( $value[ 'disabled' ] == '1' ) ? '<small class="disabled_text">Temporarily disabled</small>' : '';
|
27 |
+
$options = '<span class="sc_options"><button class="button sc_quick_insert">Quick insert</button> <a href="' . esc_attr( admin_url( 'options-general.php?page=shortcoder&action=edit&name=' . $name ) ) . '" target="_blank" class="button">Edit</a></span>';
|
28 |
+
|
29 |
+
echo '<div class="sc_shortcode" data-name="' . $name . '">';
|
30 |
+
echo '<div class="sc_shortcode_name">' . $name . $disabled_text . $options . '</div>';
|
31 |
+
preg_match_all('/%%[^%\s]+%%/', $value['content'], $matches );
|
32 |
+
|
33 |
+
echo '<div class="sc_params">';
|
34 |
+
if(!empty($matches[0])){
|
35 |
+
echo '<h4>Available parameters: </h4>';
|
36 |
+
$temp = array();
|
37 |
+
foreach($matches[0] as $k=>$v){
|
38 |
+
$cleaned = str_replace('%', '', $v);
|
39 |
+
if(!in_array($cleaned, $temp)){
|
40 |
+
array_push($temp, $cleaned);
|
41 |
+
echo '<label>' . $cleaned . ': <input type="text" data-param="' . $cleaned . '"/></label> ';
|
42 |
+
}
|
43 |
+
}
|
44 |
+
echo'<hr/>';
|
45 |
+
}else{
|
46 |
+
echo 'No parameters available - ';
|
47 |
+
}
|
48 |
+
echo '<input type="button" class="sc_insert button button-primary" value="Insert Shortcode"/>';
|
49 |
+
echo '</div>';
|
50 |
+
echo '</div>';
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
}
|
55 |
+
?>
|
56 |
+
</div>
|
57 |
+
|
58 |
+
<footer class="coffee_box">
|
59 |
+
<div class="coffee_amt_wrap">
|
60 |
+
<p><select class="coffee_amt">
|
61 |
+
<option value="2">$2</option>
|
62 |
+
<option value="3">$3</option>
|
63 |
+
<option value="4">$4</option>
|
64 |
+
<option value="5" selected="selected">$5</option>
|
65 |
+
<option value="6">$6</option>
|
66 |
+
<option value="7">$7</option>
|
67 |
+
<option value="8">$8</option>
|
68 |
+
<option value="9">$9</option>
|
69 |
+
<option value="10">$10</option>
|
70 |
+
<option value="11">$11</option>
|
71 |
+
<option value="12">$12</option>
|
72 |
+
<option value="">Custom</option>
|
73 |
+
</select></p>
|
74 |
+
<a class="button button-primary buy_coffee_btn" href="https://www.paypal.me/vaakash/5" data-link="https://www.paypal.me/vaakash/" target="_blank">Buy me a coffee !</a>
|
75 |
+
</div>
|
76 |
+
<h3>Buy me a coffee !</h3>
|
77 |
+
<p>Thank you for using Shortcoder. If you found the plugin useful buy me a coffee ! Your donation will motivate and make me happy for all the efforts. You can donate via PayPal.</p>
|
78 |
+
</footer>
|
79 |
+
|
80 |
+
</body>
|
81 |
+
</html>
|
images/donate.png
DELETED
Binary file
|
images/grey-bg.png
DELETED
Binary file
|
images/paypal.gif
DELETED
Binary file
|
images/share.png
DELETED
Binary file
|
images/trash-can.png
DELETED
Binary file
|
includes/metadata.php
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Gives the page details for the services
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
class Shortcoder_Metadata{
|
8 |
+
|
9 |
+
public static function init(){
|
10 |
+
|
11 |
+
}
|
12 |
+
|
13 |
+
public static function metadata(){
|
14 |
+
|
15 |
+
global $post;
|
16 |
+
|
17 |
+
$d = array();
|
18 |
+
$defaults = array(
|
19 |
+
'title' => '',
|
20 |
+
'url' => '',
|
21 |
+
'short_url' => '',
|
22 |
+
|
23 |
+
'post_id' => '',
|
24 |
+
'post_excerpt' => '',
|
25 |
+
'post_comments_count' => '',
|
26 |
+
'post_image' => '',
|
27 |
+
'post_author' => '',
|
28 |
+
'post_date' => '',
|
29 |
+
);
|
30 |
+
|
31 |
+
if( in_the_loop()) {
|
32 |
+
|
33 |
+
$d = self::meta_by_id( get_the_ID() );
|
34 |
+
|
35 |
+
}else{
|
36 |
+
|
37 |
+
if( is_home() && get_option( 'show_on_front' ) == 'page' ){
|
38 |
+
|
39 |
+
$d = self::meta_by_id( get_option( 'page_for_posts' ) );
|
40 |
+
|
41 |
+
}elseif( is_front_page() || ( is_home() && ( get_option( 'show_on_front' ) == 'posts' || !get_option( 'page_for_posts' ) ) ) ){
|
42 |
+
|
43 |
+
$d = array(
|
44 |
+
'title' => get_bloginfo( 'name' ),
|
45 |
+
'url' => get_bloginfo( 'url' ),
|
46 |
+
'post_excerpt' => get_bloginfo( 'description' ),
|
47 |
+
'short_url' => get_bloginfo( 'url' ),
|
48 |
+
);
|
49 |
+
|
50 |
+
}elseif( is_singular() ){
|
51 |
+
|
52 |
+
$d = self::meta_by_id( $post->ID );
|
53 |
+
|
54 |
+
}elseif( is_tax() || is_tag() || is_category() ){
|
55 |
+
|
56 |
+
$term = get_queried_object();
|
57 |
+
$d = array(
|
58 |
+
'title' => wp_title( '', false ),
|
59 |
+
'url' => get_term_link( $term, $term->taxonomy ),
|
60 |
+
'post_excerpt' => $term->description
|
61 |
+
);
|
62 |
+
|
63 |
+
}elseif( function_exists( 'get_post_type_archive_link' ) && is_post_type_archive() ){
|
64 |
+
|
65 |
+
$post_type = get_query_var( 'post_type' );
|
66 |
+
$post_type_obj = get_post_type_object( $post_type );
|
67 |
+
|
68 |
+
$d = array(
|
69 |
+
'title' => wp_title( '', false ),
|
70 |
+
'url' => get_post_type_archive_link( $post_type ),
|
71 |
+
'post_excerpt' => $post_type_obj->description
|
72 |
+
);
|
73 |
+
|
74 |
+
}elseif( is_date() ){
|
75 |
+
|
76 |
+
if( is_day() ){
|
77 |
+
|
78 |
+
$d = array(
|
79 |
+
'title' => wp_title( '', false ),
|
80 |
+
'url' => get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) )
|
81 |
+
);
|
82 |
+
|
83 |
+
}elseif( is_month() ){
|
84 |
+
|
85 |
+
$d = array(
|
86 |
+
'title' => wp_title( '', false ),
|
87 |
+
'url' => get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) )
|
88 |
+
);
|
89 |
+
|
90 |
+
}elseif( is_year ){
|
91 |
+
|
92 |
+
$d = array(
|
93 |
+
'title' => wp_title( '', false ),
|
94 |
+
'url' => get_year_link( get_query_var( 'year' ) )
|
95 |
+
);
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
}elseif( is_author() ){
|
100 |
+
|
101 |
+
$d = array(
|
102 |
+
'title' => wp_title( '', false ),
|
103 |
+
'url' => get_author_posts_url( get_query_var( 'author' ), get_query_var( 'author_name' ) )
|
104 |
+
);
|
105 |
+
|
106 |
+
}elseif( is_search() ){
|
107 |
+
|
108 |
+
$d = array(
|
109 |
+
'title' => wp_title( '', false ),
|
110 |
+
'url' => get_search_link()
|
111 |
+
);
|
112 |
+
|
113 |
+
}elseif( is_404() ){
|
114 |
+
|
115 |
+
$d = array(
|
116 |
+
'title' => wp_title( '', false ),
|
117 |
+
'url' => home_url( esc_url( $_SERVER['REQUEST_URI'] ) )
|
118 |
+
);
|
119 |
+
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
$meta = wp_parse_args( $d, $defaults );
|
124 |
+
$meta = array_map( 'trim', $meta );
|
125 |
+
$meta = apply_filters( 'sc_mod_metadata', $meta );
|
126 |
+
|
127 |
+
return $meta;
|
128 |
+
|
129 |
+
}
|
130 |
+
|
131 |
+
public static function meta_by_id( $id ){
|
132 |
+
|
133 |
+
global $post;
|
134 |
+
|
135 |
+
$d = array();
|
136 |
+
|
137 |
+
if( $id ){
|
138 |
+
$d = array(
|
139 |
+
'title' => get_the_title( $id ),
|
140 |
+
'url' => get_permalink( $id ),
|
141 |
+
'short_url' => wp_get_shortlink( $id ),
|
142 |
+
|
143 |
+
'post_id' => $id,
|
144 |
+
'post_excerpt' => self::excerpt( $post->post_excerpt, 100 ), // using $post->post_excerpt instead of get_the_excerpt as the_content filter loses shortcode formatting
|
145 |
+
'post_comments_count' => get_comments_number( $id ),
|
146 |
+
'post_image' => self::post_image( $id ),
|
147 |
+
'post_author' => get_the_author(),
|
148 |
+
'post_date' => get_the_date()
|
149 |
+
);
|
150 |
+
}
|
151 |
+
|
152 |
+
if( $d[ 'short_url' ] == '' ){
|
153 |
+
$d[ 'short_url' ] = $d[ 'url' ];
|
154 |
+
}
|
155 |
+
|
156 |
+
return $d;
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
public static function excerpt( $excerpt, $length = 250 ){
|
161 |
+
|
162 |
+
global $post;
|
163 |
+
|
164 |
+
$excerpt = ( empty( $excerpt ) ) ? strip_tags( strip_shortcodes( $post->post_content ) ) : $excerpt;
|
165 |
+
return substr( $excerpt, 0, $length );
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
public static function post_image( $post_id ){
|
170 |
+
|
171 |
+
$thumbnail = get_the_post_thumbnail_url( $post_id );
|
172 |
+
|
173 |
+
if( $thumbnail === false ){
|
174 |
+
return '';
|
175 |
+
}else{
|
176 |
+
return $thumbnail;
|
177 |
+
}
|
178 |
+
|
179 |
+
}
|
180 |
+
|
181 |
+
}
|
182 |
+
|
183 |
+
Shortcoder_Metadata::init();
|
184 |
+
|
185 |
+
?>
|
js/share.php
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<html>
|
2 |
-
<head>
|
3 |
-
<style type="text/css">
|
4 |
-
<!--
|
5 |
-
body {
|
6 |
-
font: 13px Arial, Helvetica, sans-serif;
|
7 |
-
padding: 10px;
|
8 |
-
overflow: hidden;
|
9 |
-
}
|
10 |
-
.txtBox{
|
11 |
-
font-size: 20px;
|
12 |
-
padding: 5px;
|
13 |
-
width: 25%;
|
14 |
-
}
|
15 |
-
p {
|
16 |
-
font-size: 12px;
|
17 |
-
}
|
18 |
-
#close{
|
19 |
-
background: #dfdfdf;
|
20 |
-
height: 21px;
|
21 |
-
width: 15px;
|
22 |
-
top: -5px;
|
23 |
-
right: -5px;
|
24 |
-
position: absolute;
|
25 |
-
padding: 8px 5px 1px 10px;
|
26 |
-
-webkit-border-radius: 35px;
|
27 |
-
-moz-border-radius: 35px;
|
28 |
-
border-radius: 35px;
|
29 |
-
cursor: pointer;
|
30 |
-
}
|
31 |
-
-->
|
32 |
-
</style>
|
33 |
-
|
34 |
-
</head>
|
35 |
-
<body>
|
36 |
-
<?php $id = intval($_GET['i']); ?>
|
37 |
-
|
38 |
-
<div id="close" onClick="parent.sc_closeiframe();">x</div>
|
39 |
-
|
40 |
-
<?php if ($id == 1): ?>
|
41 |
-
<div id="donate">
|
42 |
-
<h3>Donate and support this plugin !</h3>
|
43 |
-
<p>If you like this plugin, then just make a small donation for this plugin.</p>
|
44 |
-
<p style="font-size:10px">This plugin is free with premium features, so your donation will encourage me to work on the plugin to add more features.</p>
|
45 |
-
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
46 |
-
<input name="cmd" value="_donations" type="hidden">
|
47 |
-
<input name="business" value="donations@aakashweb.com" type="hidden">$
|
48 |
-
<input type="number" name="amount" class="txtBox" value="20">
|
49 |
-
<input align="right" src="../images/paypal.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" type="image" border="0">
|
50 |
-
<input name="item_name" value="Donation for Shortcoder plugin" type="hidden">
|
51 |
-
<input name="no_shipping" value="0" type="hidden">
|
52 |
-
<input name="no_note" value="1" type="hidden">
|
53 |
-
<input name="currency_code" value="USD" type="hidden">
|
54 |
-
<input name="tax" value="0" type="hidden">
|
55 |
-
<input name="lc" value="US" type="hidden">
|
56 |
-
<input name="bn" value="PP-DonationsBF" type="hidden">
|
57 |
-
</form>
|
58 |
-
</div>
|
59 |
-
<?php endif; ?>
|
60 |
-
|
61 |
-
<?php if ($id == 2): ?>
|
62 |
-
<div id="share">
|
63 |
-
<h3>Share this plugin !!</h3>
|
64 |
-
<div class="addthis_toolbox addthis_default_style">
|
65 |
-
<a class="addthis_button_facebook_like" fb:like:layout="button_count" fb:like:href="http://facebook.com/aakashweb"></a>
|
66 |
-
<a class="addthis_button_google_plusone" g:plusone:size="medium" g:plusone:href="http://www.aakashweb.com"></a>
|
67 |
-
<a class="addthis_button_tweet" tw:count="horizontal" tw:url="http://www.aakashweb.com/wordpress-plugins/shortcoder/" tw:text="Shortcoder - Awesome plugin for creating custom Shortcodes in Wordpress !"></a>
|
68 |
-
</div>
|
69 |
-
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=vaakash"></script>
|
70 |
-
</div>
|
71 |
-
<?php endif; ?>
|
72 |
-
|
73 |
-
</body>
|
74 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/tinymce/editor_plugin.js
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Shortcoder TinyMCE plugin for inserting Shortcodes
|
3 |
-
* http://www.aakashweb.com
|
4 |
-
* v1.2
|
5 |
-
* Added since WP Socializer v2.0
|
6 |
-
*/
|
7 |
-
|
8 |
-
// For adding button in the visual editing toolbox
|
9 |
-
(function() {
|
10 |
-
|
11 |
-
tinymce.create('tinymce.plugins.SCButton', {
|
12 |
-
|
13 |
-
init : function(ed, url) {
|
14 |
-
ed.addButton('scbutton', {
|
15 |
-
title : 'Insert shortcodes created using Shortcoder',
|
16 |
-
image : url + '/icon.png',
|
17 |
-
onclick : function() {
|
18 |
-
if( typeof sc_show_insert !== 'undefined' ) sc_show_insert();
|
19 |
-
}
|
20 |
-
});
|
21 |
-
},
|
22 |
-
|
23 |
-
getInfo : function() {
|
24 |
-
return {
|
25 |
-
longname : 'Shortcoder',
|
26 |
-
author : 'Aakash Chakravarthy',
|
27 |
-
authorurl : 'http://www.aakashweb.com/',
|
28 |
-
infourl : 'http://www.aakashweb.com/',
|
29 |
-
version : '1.2'
|
30 |
-
};
|
31 |
-
}
|
32 |
-
|
33 |
-
});
|
34 |
-
|
35 |
-
tinymce.PluginManager.add('scbutton', tinymce.plugins.SCButton);
|
36 |
-
|
37 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/tinymce/index.html
DELETED
File without changes
|
languages/index.html
DELETED
File without changes
|
languages/shortcoder.mo
DELETED
Binary file
|
languages/shortcoder.po
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Shortcoder\n"
|
4 |
-
"POT-Creation-Date: 2014-05-11 03:38+0530\n"
|
5 |
-
"PO-Revision-Date: 2014-05-11 03:39+0530\n"
|
6 |
-
"Last-Translator: Aakash Chakravarthy <aakash.19493@gmail.com>\n"
|
7 |
-
"Language-Team: Aakash Chakravarthy <aakash.19493@gmail.com>\n"
|
8 |
-
"MIME-Version: 1.0\n"
|
9 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
-
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"X-Generator: Poedit 1.5.7\n"
|
12 |
-
"X-Poedit-KeywordsList: __;_e\n"
|
13 |
-
"X-Poedit-Basepath: .\n"
|
14 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
15 |
-
"X-Poedit-SearchPath-0: ..\n"
|
16 |
-
|
17 |
-
#: ../sc-insert.php:15
|
18 |
-
msgid "You do not have permission to edit posts."
|
19 |
-
msgstr ""
|
20 |
-
|
21 |
-
#: ../shortcoder.php:173
|
22 |
-
msgid "Create a Shortcode"
|
23 |
-
msgstr ""
|
24 |
-
|
25 |
-
#: ../shortcoder.php:174
|
26 |
-
msgid "Create Shortcode"
|
27 |
-
msgstr ""
|
28 |
-
|
29 |
-
#: ../shortcoder.php:197 ../temp/shortcoder.php:191
|
30 |
-
msgid "Shortcode updated successfully !"
|
31 |
-
msgstr ""
|
32 |
-
|
33 |
-
#: ../shortcoder.php:199 ../temp/shortcoder.php:193
|
34 |
-
msgid "Unable to create shortcode !"
|
35 |
-
msgstr ""
|
36 |
-
|
37 |
-
#: ../shortcoder.php:213
|
38 |
-
msgid "Edit this Shortcode - "
|
39 |
-
msgstr ""
|
40 |
-
|
41 |
-
#: ../shortcoder.php:214
|
42 |
-
msgid "Update Shortcode"
|
43 |
-
msgstr ""
|
44 |
-
|
45 |
-
#: ../shortcoder.php:220 ../temp/shortcoder.php:214
|
46 |
-
msgid "Shortcode deleted successfully !"
|
47 |
-
msgstr ""
|
48 |
-
|
49 |
-
#: ../shortcoder.php:240
|
50 |
-
msgid "Back"
|
51 |
-
msgstr ""
|
52 |
-
|
53 |
-
#: ../shortcoder.php:245
|
54 |
-
msgid "Title:"
|
55 |
-
msgstr ""
|
56 |
-
|
57 |
-
#: ../shortcoder.php:251
|
58 |
-
msgid "Content:"
|
59 |
-
msgstr ""
|
60 |
-
|
61 |
-
#: ../shortcoder.php:262
|
62 |
-
msgid "Temporarily disable this shortcode"
|
63 |
-
msgstr ""
|
64 |
-
|
65 |
-
#: ../shortcoder.php:263
|
66 |
-
msgid "Disable this Shortcode to admins"
|
67 |
-
msgstr ""
|
68 |
-
|
69 |
-
#: ../shortcoder.php:275
|
70 |
-
msgid "Created Shortcodes"
|
71 |
-
msgstr ""
|
72 |
-
|
73 |
-
#: ../shortcoder.php:275
|
74 |
-
msgid "Click to edit"
|
75 |
-
msgstr ""
|
76 |
-
|
77 |
-
#: ../shortcoder.php:355 ../temp/shortcoder.php:313
|
78 |
-
msgid "Make Donations"
|
79 |
-
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,32 +1,38 @@
|
|
1 |
=== Shortcoder ===
|
2 |
Contributors: vaakash
|
3 |
-
Author URI:
|
4 |
-
Plugin URI:
|
5 |
-
Tags: shortcode,
|
6 |
-
Donate link:
|
7 |
License: GPLv2 or later
|
8 |
Requires at least: 3.3
|
9 |
-
Tested up to: 4.
|
10 |
-
Stable tag:
|
11 |
|
12 |
-
Create custom "Shortcodes"
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
Shortcoder is a plugin which allows to create a custom shortcode and store HTML, Javascript and other snippets in it. So if that shortcode is used in any post or pages, then the code stored in the shortcode get exceuted in that place.
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
= Features =
|
19 |
|
20 |
-
* Create **"custom shortcodes"** easily and use them within WordPress
|
21 |
-
* Use any name for the created shortcode (ex: `[sc name="youtube"]`)
|
22 |
* Use any kind of **HTML** as Shortcode content.
|
23 |
-
*
|
|
|
24 |
* Visual editor for adding shortcode contents.
|
25 |
-
* Global tinyMCE button available in the editing toolbar for inserting created shortcodes.
|
26 |
* Globally disable the shortcode when not needed.
|
27 |
* Can disable the shortcode, showing it to admins.
|
28 |
|
29 |
-
[youtube="
|
30 |
|
31 |
= An example usage =
|
32 |
|
@@ -39,18 +45,12 @@ Shortcoder is a plugin which allows to create a custom shortcode and store HTML,
|
|
39 |
* You can also add parameters (like `%%id%%`) inside the snippets, and vary it like `[sc name="youtube" id="GrlRADfvjII"]`
|
40 |
* This plugin will be hugely useful to all !!!
|
41 |
|
42 |
-
DONATE: If you like this plugin, you can show your [support by donating some amount](http://bit.ly/scDonate).
|
43 |
-
|
44 |
-
= Fix for WordPress 4.4 issue =
|
45 |
-
|
46 |
-
Starting Shortcoder 3.4.1 the syntax for shortcoder is [sc name="your shortcode"]. This is in effect to the shortcode API related changes made in WordPress core which made old the syntax unrecognizable. Version 3.4.1 automatically recognizes the old syntax only in posts where the shortcode is inserted directly and not in widgets or in drag and drop themes modules. Those areas need to be manually replaced from old `[sc:my_shortcode]` to the new `[sc name="my_shortcode"]` syntax. Please use the below resources for any queries.
|
47 |
-
|
48 |
= Resources =
|
49 |
|
50 |
-
* [Documentation](
|
51 |
-
* [FAQs](
|
52 |
-
* [Support](
|
53 |
-
* [Report Bugs](
|
54 |
|
55 |
== Installation ==
|
56 |
|
@@ -62,11 +62,11 @@ Starting Shortcoder 3.4.1 the syntax for shortcoder is [sc name="your shortcode"
|
|
62 |
1. Then use the shortcode `[sc name="name of the shortcode"]` in your post. ex: If "youtube" is the shortcode name, then just use `[sc name="youtube"]` in your posts
|
63 |
1. That's all !
|
64 |
|
65 |
-
You can also insert some parameters within the post. Check this page to [learn more](
|
66 |
|
67 |
== Frequently Asked Questions ==
|
68 |
|
69 |
-
Please visit the [Plugin homepage](
|
70 |
|
71 |
= I've created a shortcode, how to use it ? =
|
72 |
|
@@ -77,19 +77,28 @@ For example, consider you made a shortcode "advertisement". Then you should use
|
|
77 |
Just check the "Temporarily disable this shortcode" in the shortcode admin page to disable it.
|
78 |
Note: When you disable a shortcode, the shortcode will not be executed in the page.
|
79 |
|
80 |
-
[More FAQs](
|
81 |
|
82 |
== Screenshots ==
|
83 |
|
84 |
-
1. Shortcoder admin page
|
85 |
-
2.
|
86 |
-
3.
|
87 |
-
4.
|
|
|
88 |
|
89 |
-
[More Screenshots](
|
90 |
|
91 |
== Changelog ==
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
= 3.4.1 =
|
94 |
* Fixed Shortcoder not working in WordPress 4.4
|
95 |
* Changed the shortcoder syntax from `[sc:the_name]` to `[sc name="the_name"]` permanently in effect of WordPress 4.4 changes.
|
@@ -141,4 +150,4 @@ Note: When you disable a shortcode, the shortcode will not be executed in the pa
|
|
141 |
|
142 |
== Upgrade Notice ==
|
143 |
|
144 |
-
|
1 |
=== Shortcoder ===
|
2 |
Contributors: vaakash
|
3 |
+
Author URI: https://www.aakashweb.com/
|
4 |
+
Plugin URI: https://www.aakashweb.com/wordpress-plugins/shortcoder/
|
5 |
+
Tags: shortcode, html, javascript, shortcodes, short code, posts, pages, widgets, insert, adsense, ads, snippets,
|
6 |
+
Donate link: https://goo.gl/qMF3iE
|
7 |
License: GPLv2 or later
|
8 |
Requires at least: 3.3
|
9 |
+
Tested up to: 4.8
|
10 |
+
Stable tag: 4.0
|
11 |
|
12 |
+
Create custom "Shortcodes" easily for HTML, Javascript snippets and use the shortcodes within posts, pages & widgets.
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
Shortcoder is a plugin which allows to create a custom shortcode and store HTML, Javascript and other snippets in it. So if that shortcode is used in any post or pages, then the code stored in the shortcode get exceuted in that place.
|
17 |
|
18 |
+
= Create custom shortcodes easily =
|
19 |
+
1. Give a name for the shortcode
|
20 |
+
1. Paste the HTML/Javascript as content
|
21 |
+
1. Save !
|
22 |
+
1. Now insert the shortcode `[sc name="my_shortcode"]` in your post.
|
23 |
+
1. **Voila !** You got the HTML/Javascript in your post.
|
24 |
+
|
25 |
= Features =
|
26 |
|
27 |
+
* Create **"custom shortcodes"** easily and use them within WordPress
|
|
|
28 |
* Use any kind of **HTML** as Shortcode content.
|
29 |
+
* Insert: Custom parameters in shortcode
|
30 |
+
* Insert: WordPress parameters in shortcode
|
31 |
* Visual editor for adding shortcode contents.
|
|
|
32 |
* Globally disable the shortcode when not needed.
|
33 |
* Can disable the shortcode, showing it to admins.
|
34 |
|
35 |
+
[youtube="https://www.youtube.com/watch?v=GrlRADfvjII"]
|
36 |
|
37 |
= An example usage =
|
38 |
|
45 |
* You can also add parameters (like `%%id%%`) inside the snippets, and vary it like `[sc name="youtube" id="GrlRADfvjII"]`
|
46 |
* This plugin will be hugely useful to all !!!
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
= Resources =
|
49 |
|
50 |
+
* [Documentation](https://www.aakashweb.com/wordpress-plugins/shortcoder/)
|
51 |
+
* [FAQs](https://www.aakashweb.com/faqs/wordpress-plugins/shortcoder/)
|
52 |
+
* [Support](https://www.aakashweb.com/forum/)
|
53 |
+
* [Report Bugs](https://www.aakashweb.com/forum/)
|
54 |
|
55 |
== Installation ==
|
56 |
|
62 |
1. Then use the shortcode `[sc name="name of the shortcode"]` in your post. ex: If "youtube" is the shortcode name, then just use `[sc name="youtube"]` in your posts
|
63 |
1. That's all !
|
64 |
|
65 |
+
You can also insert some parameters within the post. Check this page to [learn more](https://www.aakashweb.com/wordpress-plugins/shortcoder/).
|
66 |
|
67 |
== Frequently Asked Questions ==
|
68 |
|
69 |
+
Please visit the [Plugin homepage](https://www.aakashweb.com/wordpress-plugins/shortcoder/) for lots of FAQ's. Selected are given here.
|
70 |
|
71 |
= I've created a shortcode, how to use it ? =
|
72 |
|
77 |
Just check the "Temporarily disable this shortcode" in the shortcode admin page to disable it.
|
78 |
Note: When you disable a shortcode, the shortcode will not be executed in the page.
|
79 |
|
80 |
+
[More FAQs](https://www.aakashweb.com/docs/shortcoder-doc/)
|
81 |
|
82 |
== Screenshots ==
|
83 |
|
84 |
+
1. Shortcoder admin page.
|
85 |
+
2. Editing a shortcode.
|
86 |
+
3. Popup to select and insert shortcode into posts.
|
87 |
+
4. A shortcode inserted into a post.
|
88 |
+
5. The shortcode executed in the post.
|
89 |
|
90 |
+
[More Screenshots](https://www.aakashweb.com/wordpress-plugins/shortcoder/)
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 4.0 =
|
95 |
+
* New: Plugin rewritten from scratch.
|
96 |
+
* New: Brand new administration page
|
97 |
+
* New: Shortcode vissibility settings, show/hide in desktop/mobile devices
|
98 |
+
* New: Insert WordPress information into shortcode content.
|
99 |
+
* Fix: Insert shortcode window is not loading.
|
100 |
+
* Fix: Unable to delete the shortcodes
|
101 |
+
|
102 |
= 3.4.1 =
|
103 |
* Fixed Shortcoder not working in WordPress 4.4
|
104 |
* Changed the shortcoder syntax from `[sc:the_name]` to `[sc name="the_name"]` permanently in effect of WordPress 4.4 changes.
|
150 |
|
151 |
== Upgrade Notice ==
|
152 |
|
153 |
+
4.4 is a major upgrade. Entire code is rewritten from scratch.
|
sc-admin-css.css
DELETED
@@ -1,246 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Admin Page CSS for Shortcoder plugin
|
3 |
-
* Author : Aakash Chakravarthy
|
4 |
-
* Version : 3.3
|
5 |
-
*/
|
6 |
-
.wrap{
|
7 |
-
margin: 15px auto 15px;
|
8 |
-
width: 700px;
|
9 |
-
padding: 0px;
|
10 |
-
}
|
11 |
-
.wrap #content{
|
12 |
-
background: #FFFFFF;
|
13 |
-
padding: 15px;
|
14 |
-
border: 1px solid #dfdfdf;
|
15 |
-
margin: 10px 0px 0px;
|
16 |
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
17 |
-
}
|
18 |
-
.wrap h3{
|
19 |
-
margin: 0px -15px 15px;
|
20 |
-
padding: 0px 15px 10px;
|
21 |
-
border-bottom: 1px solid #dfdfdf;
|
22 |
-
background: linear-gradient(to bottom, #FFF, #F3F3F3);
|
23 |
-
}
|
24 |
-
.wrap h3 small{
|
25 |
-
color: #666666;
|
26 |
-
font-size: 11px;
|
27 |
-
margin: 0px 0px 0px 5px;
|
28 |
-
}
|
29 |
-
#sc_form{
|
30 |
-
margin: 0px -15px 10px;
|
31 |
-
padding: 0px 15px 20px;
|
32 |
-
border-bottom: 1px solid #dfdfdf;
|
33 |
-
}
|
34 |
-
#sc_content{
|
35 |
-
width: 100%;
|
36 |
-
font: 11.5px/2em "Courier New", Courier, monospace;
|
37 |
-
resize: vertical;
|
38 |
-
}
|
39 |
-
.sc_section{
|
40 |
-
margin: 0 0 20px 0;
|
41 |
-
}
|
42 |
-
.sc_section:last-of-type{
|
43 |
-
margin: 0;
|
44 |
-
}
|
45 |
-
.sc_name_wrap{
|
46 |
-
position: relative;
|
47 |
-
display: block;
|
48 |
-
}
|
49 |
-
.sc_name_wrap input{
|
50 |
-
padding: 10px;
|
51 |
-
font-size: 14px;
|
52 |
-
font-weight: bold;
|
53 |
-
margin:0;
|
54 |
-
}
|
55 |
-
#sc_code{
|
56 |
-
font-size: 12px;
|
57 |
-
color: #666;
|
58 |
-
display: none;
|
59 |
-
background: #FCFCFC;
|
60 |
-
padding: 3px 10px;
|
61 |
-
position: absolute;
|
62 |
-
right: 1px;
|
63 |
-
bottom: 1px;
|
64 |
-
top:1px;
|
65 |
-
border-left: 1px solid #ccc;
|
66 |
-
line-height: 2.5;
|
67 |
-
}
|
68 |
-
.sc_fld_title{
|
69 |
-
margin: 0 0 10px 0;
|
70 |
-
display: block;
|
71 |
-
}
|
72 |
-
.sc_settings label{
|
73 |
-
margin: 0 0 10px 0;
|
74 |
-
display: block;
|
75 |
-
}
|
76 |
-
.sc_settings label:last-child{
|
77 |
-
margin: 0;
|
78 |
-
}
|
79 |
-
#sc_list{
|
80 |
-
margin: 25px 0 17px 0;
|
81 |
-
}
|
82 |
-
#sc_list li{
|
83 |
-
background: linear-gradient(to bottom, #FFF, #F3F3F3);
|
84 |
-
float: left;
|
85 |
-
cursor: pointer;
|
86 |
-
color: #454545;
|
87 |
-
margin: 0 8px;
|
88 |
-
padding: 5px 15px;
|
89 |
-
border: 1px solid #DFDFDF;
|
90 |
-
font-size: 15px;
|
91 |
-
}
|
92 |
-
#sc_list li:hover{
|
93 |
-
border-color: #0099CC;
|
94 |
-
}
|
95 |
-
#sc_list li:active{
|
96 |
-
background: #f2f2f2;
|
97 |
-
}
|
98 |
-
#sc_submit{
|
99 |
-
font-size: 15px;
|
100 |
-
font-weight: bold;
|
101 |
-
padding: 10px 15px;
|
102 |
-
height: auto!important;
|
103 |
-
}
|
104 |
-
.sc_btdisabled{
|
105 |
-
opacity: 0.5;
|
106 |
-
}
|
107 |
-
|
108 |
-
#sc_delete{
|
109 |
-
background: #F7F7F7 url(images/trash-can.png) no-repeat;
|
110 |
-
height: 48px;
|
111 |
-
width: 48px;
|
112 |
-
border: 1px solid #F00;
|
113 |
-
position: fixed;
|
114 |
-
right: 50px;
|
115 |
-
bottom: 50px;
|
116 |
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
117 |
-
border-radius: 10px;
|
118 |
-
}
|
119 |
-
.sc_trashHover{
|
120 |
-
opacity: 1 !important;
|
121 |
-
box-shadow: 0px 0px 5px 1px #ff0000 !important;
|
122 |
-
}
|
123 |
-
.sc_back{
|
124 |
-
margin: -6px 0px 0px !important;
|
125 |
-
float: right;
|
126 |
-
}
|
127 |
-
.sc_back:hover{
|
128 |
-
color: #666666;
|
129 |
-
}
|
130 |
-
|
131 |
-
.sc_editor_active{
|
132 |
-
border-color: #666666!important;
|
133 |
-
}
|
134 |
-
|
135 |
-
.sc_share_wrap{
|
136 |
-
margin-left: -65px;
|
137 |
-
position: absolute;
|
138 |
-
top: 20%;
|
139 |
-
}
|
140 |
-
.sc_share_wrap li{
|
141 |
-
padding: 7px;
|
142 |
-
background: white url(images/grey-bg.png) repeat-x bottom;
|
143 |
-
border: 1px solid #dfdfdf;
|
144 |
-
margin: 0px 0px 7px;
|
145 |
-
opacity: 0.6;
|
146 |
-
-webkit-border-radius: 5px;
|
147 |
-
-moz-border-radius: 5px;
|
148 |
-
border-radius: 5px;
|
149 |
-
cursor: pointer;
|
150 |
-
}
|
151 |
-
.sc_share_wrap a{
|
152 |
-
background-repeat: no-repeat;
|
153 |
-
height: 32px;
|
154 |
-
width: 32px;
|
155 |
-
display: block;
|
156 |
-
}
|
157 |
-
.sc_donate a{ background-image: url(images/donate.png); }
|
158 |
-
.sc_share a{ background-image: url(images/share.png); }
|
159 |
-
.sc_share_iframe{
|
160 |
-
background: #FFFFFF;
|
161 |
-
border: 1px solid #dfdfdf;
|
162 |
-
-webkit-border-radius: 5px;
|
163 |
-
-moz-border-radius: 5px;
|
164 |
-
border-radius: 5px;
|
165 |
-
-moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
|
166 |
-
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
|
167 |
-
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
|
168 |
-
}
|
169 |
-
|
170 |
-
.sc_hidden_text{
|
171 |
-
display: none;
|
172 |
-
}
|
173 |
-
.sc_credits{
|
174 |
-
background: url(images/aw.png) no-repeat;
|
175 |
-
padding-left: 23px;
|
176 |
-
color: #8B8B8B;
|
177 |
-
margin-left: -5px;
|
178 |
-
font-size: 13px;
|
179 |
-
text-decoration: none;
|
180 |
-
}
|
181 |
-
.sc_edit_note{
|
182 |
-
margin: 10px 0 20px 0;
|
183 |
-
font-size: 10px;
|
184 |
-
}
|
185 |
-
|
186 |
-
/** Modal **/
|
187 |
-
.sc_modal {
|
188 |
-
position: fixed;
|
189 |
-
z-index: 99999;
|
190 |
-
top: 20%;
|
191 |
-
left: 30%;
|
192 |
-
right: 30%;
|
193 |
-
bottom: 20%;
|
194 |
-
background: #FFF;
|
195 |
-
box-shadow: 0 8px 21px -8px #000;
|
196 |
-
border-radius: 5px;
|
197 |
-
padding: 20px;
|
198 |
-
outline: 1000px solid rgba(255, 255, 255, 0.86);
|
199 |
-
border: 3px solid #D8D8D8;
|
200 |
-
overflow: auto;
|
201 |
-
display: none;
|
202 |
-
}
|
203 |
-
.sc_modal_close {
|
204 |
-
color: #777;
|
205 |
-
font: 14px/100% arial, sans-serif;
|
206 |
-
position: absolute;
|
207 |
-
right: 5px;
|
208 |
-
text-decoration: none;
|
209 |
-
text-shadow: 0 1px 0 #fff;
|
210 |
-
padding: 10px;
|
211 |
-
cursor: pointer;
|
212 |
-
font-weight: bold;
|
213 |
-
top: 0;
|
214 |
-
}
|
215 |
-
.sc_modal_close:after {
|
216 |
-
content: 'X';
|
217 |
-
}
|
218 |
-
|
219 |
-
.smallText{
|
220 |
-
font-size: 11px;
|
221 |
-
color: #333333;
|
222 |
-
font-weight: none;
|
223 |
-
}
|
224 |
-
.grey{
|
225 |
-
color: #999;
|
226 |
-
}
|
227 |
-
|
228 |
-
* html .clearfix{
|
229 |
-
height: 1%;
|
230 |
-
overflow: visible;
|
231 |
-
}
|
232 |
-
|
233 |
-
/* float clearing for IE7 */
|
234 |
-
*+html .clearfix{
|
235 |
-
min-height: 1%;
|
236 |
-
}
|
237 |
-
|
238 |
-
/* float clearing for everyone else */
|
239 |
-
.clearfix:after{
|
240 |
-
clear: both;
|
241 |
-
content: ".";
|
242 |
-
display: block;
|
243 |
-
height: 0;
|
244 |
-
visibility: hidden;
|
245 |
-
font-size: 0;
|
246 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sc-admin-js.js
DELETED
@@ -1,125 +0,0 @@
|
|
1 |
-
$j = jQuery.noConflict();
|
2 |
-
|
3 |
-
$j(document).ready(function(){
|
4 |
-
var sccontent;
|
5 |
-
|
6 |
-
$j('#sc_list li').click(function(){
|
7 |
-
$j('#sc_name_edit').val($j(this).text());
|
8 |
-
$j('#sc_edit_form').submit();
|
9 |
-
});
|
10 |
-
|
11 |
-
$j('#sc_list li').draggable({
|
12 |
-
start: function(){ $j('#sc_delete').addClass('sc_trashHover'); },
|
13 |
-
stop: function(){ $j('#sc_delete').removeClass('sc_trashHover'); }
|
14 |
-
});
|
15 |
-
$j('#sc_delete').droppable({
|
16 |
-
drop: function(e, ui){
|
17 |
-
$j('#sc_list li').unbind('click');
|
18 |
-
$j('#sc_name_edit').val(ui.draggable.text());
|
19 |
-
$j('#sc_form_action').val('delete');
|
20 |
-
$j('#sc_edit_form').submit();
|
21 |
-
}
|
22 |
-
});
|
23 |
-
|
24 |
-
$j('#sc_name').bind('keyup focus change',function(){
|
25 |
-
sc_triggerElements($j(this).val());
|
26 |
-
});
|
27 |
-
|
28 |
-
$j('.sc_back').click(function(){
|
29 |
-
location.reload();
|
30 |
-
});
|
31 |
-
|
32 |
-
sc_triggerElements($j('#sc_name').val());
|
33 |
-
|
34 |
-
|
35 |
-
// Video
|
36 |
-
$j('.sc_open_video').click(function(e){
|
37 |
-
e.preventDefault();
|
38 |
-
newwindow2=window.open('','name','height=340,width=585');
|
39 |
-
var tmp = newwindow2.document;
|
40 |
-
tmp.write('<iframe width="560" height="315" src="http://www.youtube.com/embed/GrlRADfvjII" frameborder="0" allowfullscreen></iframe>');
|
41 |
-
tmp.close();
|
42 |
-
});
|
43 |
-
|
44 |
-
// Share bar
|
45 |
-
$j('.sc_share_wrap li').mouseenter(function(){
|
46 |
-
$this = $j(this);
|
47 |
-
$j('.sc_share_iframe').remove();
|
48 |
-
$j('body').append('<iframe class="sc_share_iframe"></iframe>');
|
49 |
-
$j('.sc_share_iframe').css({
|
50 |
-
position: 'absolute',
|
51 |
-
top: $this.offset()['top'],
|
52 |
-
left: $this.offset()['left'] + 55,
|
53 |
-
width: $this.attr('data-width'),
|
54 |
-
height: $this.attr('data-height'),
|
55 |
-
}).attr('src', $this.attr('data-url')).hide().fadeIn();
|
56 |
-
});
|
57 |
-
|
58 |
-
$j('.sc_share_iframe').live('mouseout', function(){
|
59 |
-
$j(this).remove();
|
60 |
-
});
|
61 |
-
|
62 |
-
$j( '.sc_modal_close' ).click(function(){
|
63 |
-
sc_modal( 'close' );
|
64 |
-
});
|
65 |
-
|
66 |
-
sc_modal( 'show' );
|
67 |
-
});
|
68 |
-
|
69 |
-
var sc_closeiframe = function(){
|
70 |
-
$j('.sc_share_iframe').remove();
|
71 |
-
}
|
72 |
-
|
73 |
-
function sc_triggerElements(val){
|
74 |
-
if(val != ''){
|
75 |
-
|
76 |
-
// Not used
|
77 |
-
if(sc_wsc(val)){
|
78 |
-
code = '"' + val + '"';
|
79 |
-
}else{
|
80 |
-
code = val;
|
81 |
-
}
|
82 |
-
//
|
83 |
-
|
84 |
-
$j('#sc_code').show();
|
85 |
-
$j('#sc_code').html('Your shortcode is <b contenteditable="true" disabled="disabled">[sc name="' + val + '"]</b>');
|
86 |
-
$j('#sc_submit').removeClass('sc_btdisabled').removeAttr('disabled');
|
87 |
-
}else{
|
88 |
-
$j('#sc_code').hide();
|
89 |
-
$j('#sc_submit').addClass('sc_btdisabled').attr('disabled', 'disabled');
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
function sc_modal( action ){
|
94 |
-
|
95 |
-
if( typeof( localStorage ) !== "undefined" ){
|
96 |
-
if( action == 'show' ){
|
97 |
-
|
98 |
-
if ( localStorage[ 'sc_modal_' + sc_version ] == null ){
|
99 |
-
|
100 |
-
$j.ajax({
|
101 |
-
type: 'GET',
|
102 |
-
dataType: 'html',
|
103 |
-
crossDomain: true,
|
104 |
-
url: 'https://raw.githubusercontent.com/vaakash/aakash-web/master/misc/release_notes/shortcoder_v341.html',
|
105 |
-
success: function ( data ) {
|
106 |
-
$j('.sc_modal > div').html( data );
|
107 |
-
$j('.sc_modal').fadeIn();
|
108 |
-
}
|
109 |
-
});
|
110 |
-
|
111 |
-
}
|
112 |
-
|
113 |
-
} else if( action == 'close' ){
|
114 |
-
|
115 |
-
localStorage[ 'sc_modal_' + sc_version ] = 'closed';
|
116 |
-
$j('.sc_modal').hide();
|
117 |
-
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
}
|
122 |
-
|
123 |
-
function sc_wsc(s) {
|
124 |
-
return s.indexOf(' ') >= 0;
|
125 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sc-insert.php
DELETED
@@ -1,227 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Shortcoder include for inserting and editing shortcodes in post and pages
|
4 |
-
* v1.3
|
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 |
-
// Not used
|
133 |
-
if(wsc(scname)){
|
134 |
-
name = '"' + scname + '"';
|
135 |
-
}else{
|
136 |
-
name = scname;
|
137 |
-
}
|
138 |
-
//
|
139 |
-
|
140 |
-
sc = '[sc name="' + scname + '" ' + params + ']';
|
141 |
-
|
142 |
-
if( typeof parent.send_to_editor !== undefined ){
|
143 |
-
parent.send_to_editor(sc);
|
144 |
-
}
|
145 |
-
|
146 |
-
});
|
147 |
-
|
148 |
-
$('.sc_share_bar img').mouseenter(function(){
|
149 |
-
$this = $(this);
|
150 |
-
$('.sc_share_iframe').remove();
|
151 |
-
$('body').append('<iframe class="sc_share_iframe"></iframe>');
|
152 |
-
$('.sc_share_iframe').css({
|
153 |
-
position: 'absolute',
|
154 |
-
top: $this.offset()['top'] - $this.attr('data-height') - 15,
|
155 |
-
left: $this.offset()['left'] - $this.attr('data-width')/2 ,
|
156 |
-
width: $this.attr('data-width'),
|
157 |
-
height: $this.attr('data-height'),
|
158 |
-
}).attr('src', $this.attr('data-url')).hide().fadeIn();
|
159 |
-
|
160 |
-
});
|
161 |
-
|
162 |
-
$('.sc_shortcode_name').click(function(e){
|
163 |
-
$('.sc_params').slideUp();
|
164 |
-
if($(this).next('.sc_params').is(':visible')){
|
165 |
-
$(this).next('.sc_params').slideUp();
|
166 |
-
}else{
|
167 |
-
$(this).next('.sc_params').slideDown();
|
168 |
-
}
|
169 |
-
})
|
170 |
-
|
171 |
-
});
|
172 |
-
|
173 |
-
var sc_closeiframe = function(){
|
174 |
-
$('.sc_share_iframe').remove();
|
175 |
-
}
|
176 |
-
|
177 |
-
function wsc(s){
|
178 |
-
if(s == null)
|
179 |
-
return '';
|
180 |
-
return s.indexOf(' ') >= 0;
|
181 |
-
}
|
182 |
-
</script>
|
183 |
-
</head>
|
184 |
-
<body>
|
185 |
-
<?php sc_admin_buttons('fbrec'); ?>
|
186 |
-
<h2><img src="images/shortcoder.png" align="absmiddle" alt="Shortcoder" width="35px"/> Insert shortcode to editor</h2>
|
187 |
-
|
188 |
-
<div class="sc_wrap">
|
189 |
-
<?php
|
190 |
-
foreach($sc_options as $key=>$value){
|
191 |
-
if($key != '_version_fix'){
|
192 |
-
echo '<div class="sc_shortcode"><div class="sc_shortcode_name">' . $key;
|
193 |
-
echo '</div>';
|
194 |
-
preg_match_all('/%%[^%\s]+%%/', $value['content'], $matches);
|
195 |
-
echo '<div class="sc_params">';
|
196 |
-
if(!empty($matches[0])){
|
197 |
-
echo '<h4>Available parameters: </h4>';
|
198 |
-
$temp = array();
|
199 |
-
foreach($matches[0] as $k=>$v){
|
200 |
-
$cleaned = str_replace('%', '', $v);
|
201 |
-
if(!in_array($cleaned, $temp)){
|
202 |
-
array_push($temp, $cleaned);
|
203 |
-
echo '<label>' . $cleaned . ': <input type="text" data-param="' . $cleaned . '"/></label> ';
|
204 |
-
}
|
205 |
-
}
|
206 |
-
echo'<hr/>';
|
207 |
-
}else{
|
208 |
-
echo 'No parameters avaialble - ';
|
209 |
-
}
|
210 |
-
echo '<input type="button" class="sc_insert cupid-blue" data-name="' . $key . '" value="Insert Shortcode"/>';
|
211 |
-
echo '</div>';
|
212 |
-
echo '</div>';
|
213 |
-
}
|
214 |
-
}
|
215 |
-
?>
|
216 |
-
</div>
|
217 |
-
|
218 |
-
<p class="sc_share_bar" align="center">
|
219 |
-
<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'; ?>"/>
|
220 |
-
|
221 |
-
<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'; ?>"/>
|
222 |
-
</p>
|
223 |
-
|
224 |
-
<p align="center"><a class="sc_credits" href="http://www.aakashweb.com/" target="_blank">a Aakash Web plugin</a></p>
|
225 |
-
|
226 |
-
</body>
|
227 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
screenshot-1.png
DELETED
Binary file
|
screenshot-2.png
DELETED
Binary file
|
screenshot-3.png
DELETED
Binary file
|
screenshot-4.png
DELETED
Binary file
|
shortcoder.php
CHANGED
@@ -1,407 +1,225 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Shortcoder
|
4 |
-
Plugin URI:
|
5 |
Description: Shortcoder is a plugin which allows to create a custom shortcode and store HTML, Javascript and other snippets in it. So if that shortcode is used in any post or pages, then the code stored in the shortcode get exceuted in that place. You can create a shortcode for Youtube videos, adsense ads, buttons and more.
|
6 |
Author: Aakash Chakravarthy
|
7 |
-
Version:
|
8 |
-
Author URI:
|
9 |
*/
|
10 |
|
11 |
-
define('SC_VERSION', '
|
12 |
-
define('
|
13 |
-
define('SC_URL',
|
14 |
-
define('
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
function
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
}
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
}
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
}
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
$edit = 1;
|
225 |
-
}else{
|
226 |
-
unset($sc_options[$sc_name_edit]);
|
227 |
-
unset($sc_name_edit);
|
228 |
-
update_option("shortcoder_data", $sc_options);
|
229 |
-
echo '<div class="message updated fade"><p>' . __('Shortcode deleted successfully !', 'shortcoder') . '</p></div>';
|
230 |
-
}
|
231 |
-
}
|
232 |
-
|
233 |
-
|
234 |
-
?>
|
235 |
-
|
236 |
-
<!-- Shortcoder Admin page -->
|
237 |
-
|
238 |
-
<div class="sc_modal">
|
239 |
-
<span class="sc_modal_close"></span>
|
240 |
-
<div></div>
|
241 |
-
</div>
|
242 |
-
|
243 |
-
<div class="wrap">
|
244 |
-
<?php sc_admin_buttons('fbrec'); ?>
|
245 |
-
<h2><img width="32" height="32" src="<?php echo SC_URL; ?>/images/shortcoder.png" align="absmiddle"/> Shortcoder<sup class="smallText"> v<?php echo SC_VERSION; ?></sup></h2>
|
246 |
-
|
247 |
-
<ul class="sc_share_wrap">
|
248 |
-
<li class="sc_donate" data-width="300" data-height="220" data-url="<?php echo SC_URL . '/js/share.php?i=1'; ?>"><a href="#"></a></li>
|
249 |
-
<li class="sc_share" data-width="350" data-height="85" data-url="<?php echo SC_URL . '/js/share.php?i=2'; ?>"><a href="#"></a></li>
|
250 |
-
</ul>
|
251 |
-
|
252 |
-
<div id="content">
|
253 |
-
|
254 |
-
<h3><?php echo $title; ?> <?php if($edit == 1) echo '<span class="button sc_back"><< ' . __( "Back", 'shortcoder' ) . '</span>'; ?> </h3>
|
255 |
-
|
256 |
-
<form method="post" id="sc_form">
|
257 |
-
|
258 |
-
<div class="sc_section">
|
259 |
-
<label for="sc_name" class="sc_fld_title"><?php _e( "Title:", 'shortcoder' ); ?></label>
|
260 |
-
<span class="sc_name_wrap"><input type="text" name="sc_name" id="sc_name" value="<?php echo isset($sc_name_edit) ? $sc_name_edit : ''; ?>" placeholder="Enter a shortcode name" class="widefat" required="required"/><div id="sc_code"></div></span>
|
261 |
-
</div>
|
262 |
-
|
263 |
-
|
264 |
-
<div class="sc_section">
|
265 |
-
<label for="sc_content" class="sc_fld_title"><?php _e( "Content:", 'shortcoder' ); ?></label>
|
266 |
-
<?php wp_editor( $sc_content, 'sc_content', array( 'wpautop'=> false, 'textarea_rows'=> 8 )); ?>
|
267 |
-
</div>
|
268 |
-
|
269 |
-
|
270 |
-
<div class="sc_section"><p><b>Note:</b> Use <strong style="color:#006600">%%someParameter%%</strong> to insert custom parameters. <a href="http://www.aakashweb.com/docs/shortcoder-doc/" target="_blank">Learn More</a></p></div>
|
271 |
-
|
272 |
-
<div class="sc_section">
|
273 |
-
|
274 |
-
<table width="100%"><tr>
|
275 |
-
|
276 |
-
<td width="50%" class="sc_settings"><label><input name="sc_disable" type="checkbox" value="1" <?php echo $sc_disable == "1" ? 'checked="checked"' : ""; ?>/> <?php _e( "Temporarily disable this shortcode", 'shortcoder' ); ?></label>
|
277 |
-
<label><input name="sc_hide_admin" type="checkbox" value="1" <?php echo $sc_hide_admin == "1" ? 'checked="checked"' : ""; ?>/> <?php _e( "Disable this Shortcode to admins", 'shortcoder' ); ?></label></td>
|
278 |
-
|
279 |
-
<td><p align="right"><input type="submit" name="sc_submit" id="sc_submit" class="button-primary" value="<?php echo $button; ?>" /></p></td>
|
280 |
-
|
281 |
-
</tr></table>
|
282 |
-
|
283 |
-
</div>
|
284 |
-
|
285 |
-
<?php wp_nonce_field('shortcoder_create_form'); ?>
|
286 |
-
<input name="sc_form_main" type="hidden" value="1" />
|
287 |
-
</form>
|
288 |
-
|
289 |
-
<h3><?php _e( "Created Shortcodes", 'shortcoder' ); ?> <small>(<?php _e( "Click to edit", 'shortcoder' ); ?>)</small></h3>
|
290 |
-
<form method="post" id="sc_edit_form">
|
291 |
-
<ul id="sc_list" class="clearfix">
|
292 |
-
<?php
|
293 |
-
$sc_options = get_option('shortcoder_data');
|
294 |
-
if(is_array($sc_options)){
|
295 |
-
foreach($sc_options as $key=>$value){
|
296 |
-
echo '<li>' . $key . '</li>';
|
297 |
-
}
|
298 |
-
}
|
299 |
-
?>
|
300 |
-
</ul>
|
301 |
-
|
302 |
-
<?php wp_nonce_field('shortcoder_edit_form'); ?>
|
303 |
-
<input name="sc_form_edit" type="hidden" value="1" />
|
304 |
-
<input name="sc_form_action" id="sc_form_action" type="hidden" value="edit" />
|
305 |
-
<input name="sc_name_edit" id="sc_name_edit" type="hidden" />
|
306 |
-
</form>
|
307 |
-
|
308 |
-
<div id="sc_delete" title="Drag & drop shortcodes to delete"></div>
|
309 |
-
|
310 |
-
</div><!-- Content -->
|
311 |
-
|
312 |
-
<br/>
|
313 |
-
<p align="center">
|
314 |
-
<a href="http://www.aakashweb.com/forum/" target="_blank">Report bugs</a> | <a href="http://www.aakashweb.com/forum/" target="_blank">Support Forum</a> | <a href="http://www.aakashweb.com/wordpress-plugins/shortcoder/" target="_blank">Help</a> | <a href="http://bit.ly/scdonate" target="_blank">Donate</a><br/><br/>
|
315 |
-
<a href="#" class="sc_open_video">(Demo video)</a><br /><br />
|
316 |
-
<a href="https://twitter.com/vaakash" target="_blank">Follow @vaakash</a><br/><br/>
|
317 |
-
<a href="http://www.aakashweb.com/" target="_blank" class="sc_credits">a plugin from Aakash Web</a>
|
318 |
-
</p>
|
319 |
-
|
320 |
-
<script>
|
321 |
-
var sc_version = '<?php echo SC_VERSION; ?>';
|
322 |
-
</script>
|
323 |
-
|
324 |
-
</div><!-- Wrap -->
|
325 |
-
|
326 |
-
<?php
|
327 |
-
}
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
// Helper for SC TinyMCE button
|
332 |
-
function sc_admin_footer(){
|
333 |
-
|
334 |
-
if (isset($_GET['page']) && $_GET['page'] == 'shortcoder')
|
335 |
-
return;
|
336 |
-
|
337 |
-
echo "
|
338 |
-
<script>
|
339 |
-
window.onload = function(){
|
340 |
-
if( typeof QTags === 'function' )
|
341 |
-
QTags.addButton( 'QT_sc_insert', 'Shortcoder', sc_show_insert );
|
342 |
-
}
|
343 |
-
function sc_show_insert(){
|
344 |
-
tb_show('Insert a Shortcode', '" . SC_URL . "/sc-insert.php?TB_iframe=true');
|
345 |
-
}
|
346 |
-
</script>
|
347 |
-
";
|
348 |
-
}
|
349 |
-
add_action('admin_footer', 'sc_admin_footer');
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
function sc_admin_buttons($type){
|
355 |
-
switch($type){
|
356 |
-
case 'fbrec':
|
357 |
-
echo '<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Ffacebook.com%2Faakashweb&send=false&layout=button_count&width=130&show_faces=false&action=recommend&colorscheme=light&font=arial&height=21&appId=106994469342299" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width: 130px; height:21px;float: right;margin-top: 15px;" allowtransparency="true"></iframe>';
|
358 |
-
break;
|
359 |
-
}
|
360 |
-
}
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
// Action Links
|
366 |
-
function sc_plugin_actions($links, $file){
|
367 |
-
static $this_plugin;
|
368 |
-
global $sc_donate_link;
|
369 |
-
|
370 |
-
if(!$this_plugin) $this_plugin = plugin_basename(__FILE__);
|
371 |
-
if( $file == $this_plugin ){
|
372 |
-
$settings_link = "<a href='$sc_donate_link' title='If you like this plugin, then just make a small Donation to continue this plugin development.' target='_blank'>" . __('Make Donations', 'shortcoder') . '</a> ';
|
373 |
-
$links = array_merge(array($settings_link), $links);
|
374 |
-
}
|
375 |
-
return $links;
|
376 |
-
}
|
377 |
-
add_filter('plugin_action_links', 'sc_plugin_actions', 10, 2);
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
// Shortcoder tinyMCE buttons
|
383 |
-
function sc_addbuttons() {
|
384 |
-
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') )
|
385 |
-
return;
|
386 |
-
|
387 |
-
if (isset($_GET['page']) && $_GET['page'] == 'shortcoder')
|
388 |
-
return;
|
389 |
-
|
390 |
-
if ( get_user_option('rich_editing') == 'true') {
|
391 |
-
add_filter("mce_external_plugins", "sc_add_tinymce_plugin");
|
392 |
-
add_filter('mce_buttons', 'sc_register_button');
|
393 |
-
}
|
394 |
-
}
|
395 |
-
|
396 |
-
function sc_register_button($buttons) {
|
397 |
-
array_push($buttons, "separator", "scbutton");
|
398 |
-
return $buttons;
|
399 |
-
}
|
400 |
-
|
401 |
-
function sc_add_tinymce_plugin($plugin_array) {
|
402 |
-
$plugin_array['scbutton'] = SC_URL . '/js/tinymce/editor_plugin.js';
|
403 |
-
return $plugin_array;
|
404 |
-
}
|
405 |
-
add_action('init', 'sc_addbuttons'); // init process for button control
|
406 |
|
407 |
?>
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Shortcoder
|
4 |
+
Plugin URI: https://www.aakashweb.com
|
5 |
Description: Shortcoder is a plugin which allows to create a custom shortcode and store HTML, Javascript and other snippets in it. So if that shortcode is used in any post or pages, then the code stored in the shortcode get exceuted in that place. You can create a shortcode for Youtube videos, adsense ads, buttons and more.
|
6 |
Author: Aakash Chakravarthy
|
7 |
+
Version: 4.0
|
8 |
+
Author URI: https://www.aakashweb.com/
|
9 |
*/
|
10 |
|
11 |
+
define( 'SC_VERSION', '4.0');
|
12 |
+
define( 'SC_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
|
13 |
+
define( 'SC_URL', plugin_dir_url( __FILE__ ) );
|
14 |
+
define( 'SC_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );
|
15 |
+
define( 'SC_BASE_NAME', plugin_basename( __FILE__ ) );
|
16 |
+
|
17 |
+
class Shortcoder{
|
18 |
+
|
19 |
+
public static function init(){
|
20 |
+
|
21 |
+
add_action( 'plugins_loaded', array( __class__, 'load_text_domain' ) );
|
22 |
+
|
23 |
+
register_activation_hook( __FILE__, array( __class__, 'on_activate' ) );
|
24 |
+
|
25 |
+
add_filter( 'the_content', array( __class__, 'wp_44_workaround' ), 5 );
|
26 |
+
|
27 |
+
// Register the shortcode
|
28 |
+
add_shortcode( 'sc', array( __class__, 'execute_shortcode' ) );
|
29 |
+
|
30 |
+
// Include the required
|
31 |
+
self::includes();
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public static function list_all(){
|
36 |
+
|
37 |
+
$shortcodes = get_option( 'shortcoder_data' );
|
38 |
+
|
39 |
+
return empty( $shortcodes ) ? array() : $shortcodes;
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
public static function includes(){
|
44 |
+
|
45 |
+
include_once( SC_PATH . 'includes/metadata.php' );
|
46 |
+
include_once( SC_PATH . 'admin/sc-admin.php' );
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
public static function execute_shortcode( $atts, $content ) {
|
51 |
+
|
52 |
+
$shortcodes = self::list_all();
|
53 |
+
|
54 |
+
if( empty( $shortcodes ) ){
|
55 |
+
return '';
|
56 |
+
}
|
57 |
+
|
58 |
+
// Get the Shortcode name
|
59 |
+
if(isset($atts[0])){
|
60 |
+
$sc_name = str_replace(array('"', "'", ":"), '', $atts[0]);
|
61 |
+
unset($atts[0]);
|
62 |
+
}else{
|
63 |
+
// Old version with "name" param support
|
64 |
+
if(array_key_exists("name", $atts)){
|
65 |
+
$tVal = $atts['name'];
|
66 |
+
if(array_key_exists($tVal, $shortcodes)){
|
67 |
+
$sc_name = $tVal;
|
68 |
+
unset($atts['name']);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
if(!isset($sc_name)){
|
74 |
+
return '';
|
75 |
+
}
|
76 |
+
|
77 |
+
// Check whether shortcoder can execute
|
78 |
+
if( self::check_conditions( $sc_name ) ){
|
79 |
+
|
80 |
+
$sc_content_final = '';
|
81 |
+
|
82 |
+
// If SC has parameters, then replace it
|
83 |
+
if( !empty( $atts ) ){
|
84 |
+
|
85 |
+
$keys = array();
|
86 |
+
$values = array();
|
87 |
+
$i = 0;
|
88 |
+
|
89 |
+
// Seperate key and value from atts
|
90 |
+
foreach( $atts as $k => $v ){
|
91 |
+
if( $k !== 0 ){
|
92 |
+
$keys[$i] = "%%" . $k . "%%";
|
93 |
+
$values[$i] = $v;
|
94 |
+
}
|
95 |
+
$i++;
|
96 |
+
}
|
97 |
+
|
98 |
+
// Replace the params
|
99 |
+
$sc_content = $shortcodes[ $sc_name ][ 'content' ];
|
100 |
+
$sc_content_rep1 = str_ireplace( $keys, $values, $sc_content );
|
101 |
+
$sc_content_final = preg_replace( '/%%[^%\s]+%%/', '', $sc_content_rep1 );
|
102 |
+
|
103 |
+
}
|
104 |
+
else{
|
105 |
+
|
106 |
+
// If the SC has no params, then replace the %%vars%%
|
107 |
+
$sc_content = $shortcodes[ $sc_name ][ 'content' ];
|
108 |
+
$sc_content_final = preg_replace( '/%%[^%\s]+%%/', '', $sc_content );
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
$sc_content_final = self::replace_wp_params( $sc_content_final );
|
113 |
+
return '<!-- Start shortcoder -->' . do_shortcode( $sc_content_final ) . '<!-- End shortcoder v' . SC_VERSION . '-->';
|
114 |
+
|
115 |
+
}else{
|
116 |
+
return '<!-- Shortcoder conditions not met -->';
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
public static function check_conditions( $name ){
|
121 |
+
|
122 |
+
$shortcodes = self::list_all();
|
123 |
+
|
124 |
+
if( array_key_exists( $name, $shortcodes ) ){
|
125 |
+
|
126 |
+
$sc = wp_parse_args( $shortcodes[ $name ], self::defaults() );
|
127 |
+
|
128 |
+
$devices = $sc[ 'devices' ];
|
129 |
+
if( $devices == 'mobile_only' && !wp_is_mobile() ){
|
130 |
+
return false;
|
131 |
+
}
|
132 |
+
|
133 |
+
if( $devices == 'desktop_only' && wp_is_mobile() ){
|
134 |
+
return false;
|
135 |
+
}
|
136 |
+
|
137 |
+
if( $sc[ 'disabled' ] == 0 ){
|
138 |
+
if( current_user_can( 'level_10' ) && $sc[ 'hide_admin' ] == 1 ){
|
139 |
+
return false;
|
140 |
+
}else{
|
141 |
+
return true;
|
142 |
+
}
|
143 |
+
}else{
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
}else{
|
147 |
+
return false;
|
148 |
+
}
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
+
public static function replace_wp_params( $content ){
|
153 |
+
|
154 |
+
$params = self::wp_params_list();
|
155 |
+
$metadata = Shortcoder_Metadata::metadata();
|
156 |
+
$to_replace = array();
|
157 |
+
|
158 |
+
foreach( $params as $id => $name ){
|
159 |
+
if( array_key_exists( $id, $metadata ) ){
|
160 |
+
$placeholder = '$$' . $id . '$$';
|
161 |
+
$to_replace[ $placeholder ] = $metadata[ $id ];
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
$content = strtr( $content, $to_replace );
|
166 |
+
|
167 |
+
return $content;
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
public static function wp_params_list(){
|
172 |
+
return apply_filters( 'sc_mod_wp_params', array(
|
173 |
+
'url' => 'URL of the post/location',
|
174 |
+
'title' => 'Title of the post/location',
|
175 |
+
'short_url' => 'Short URL of the post/location',
|
176 |
+
|
177 |
+
'post_id' => 'Post ID',
|
178 |
+
'post_image' => 'Post featured image URL',
|
179 |
+
'post_excerpt' => 'Post excerpt',
|
180 |
+
'post_author' => 'Post author',
|
181 |
+
'post_date' => 'Post date',
|
182 |
+
'post_comments_count' => 'Post comments count'
|
183 |
+
));
|
184 |
+
}
|
185 |
+
|
186 |
+
public static function on_activate(){
|
187 |
+
|
188 |
+
$shortcodes = self::list_all();
|
189 |
+
$sc_flags = get_option( 'shortcoder_flags' );
|
190 |
+
|
191 |
+
// Move the flag version fix to sc_flags option
|
192 |
+
if( isset( $shortcodes[ '_version_fix' ] ) ){
|
193 |
+
unset( $shortcodes['_version_fix'] );
|
194 |
+
update_option( 'shortcoder_data', $shortcodes );
|
195 |
+
}
|
196 |
+
|
197 |
+
$sc_flags[ 'version' ] = SC_VERSION;
|
198 |
+
update_option( 'shortcoder_flags', $sc_flags );
|
199 |
+
|
200 |
+
}
|
201 |
+
|
202 |
+
public static function defaults(){
|
203 |
+
return array(
|
204 |
+
'content' => '',
|
205 |
+
'disabled' => 0,
|
206 |
+
'hide_admin' => 0,
|
207 |
+
'devices' => 'all'
|
208 |
+
);
|
209 |
+
}
|
210 |
+
|
211 |
+
public static function wp_44_workaround( $content ){
|
212 |
+
return str_replace( '[sc:', '[sc name=', $content );
|
213 |
+
}
|
214 |
+
|
215 |
+
public static function load_text_domain(){
|
216 |
+
|
217 |
+
load_plugin_textdomain( 'shortcoder', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
Shortcoder::init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
|
225 |
?>
|