Version Description
- Tested with wp 3.6.1
- Added a link in the Appearance
- Added header.php to the copied file list
- Added a checkbox in case the user wants to switch to the newly created theme
- Added a checkbox in case the user wants to copy the functions.php from the parent theme
- Removed parent theme's license from the copied list
- Removed the Create Child Theme From themes that are child themes already
- Skipping hidden files (files starting with a dot)
- Copying admin/ from the parent theme if it exists
- Added some security checks if the user actually has permission to install themes
- Fixed some notices
Download this release
Release Info
Developer | lordspace |
Plugin | Child Theme Creator by Orbisius |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- assets/main.css +25 -17
- assets/main.js +0 -0
- nbproject/private/private.xml +0 -4
- orbisius-child-theme-creator.php +510 -255
- readme.txt +24 -2
assets/main.css
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
/* Product of Orbisius.com. Visit http://club.orbisius.com/ */
|
2 |
-
.
|
3 |
display: none;
|
4 |
}
|
5 |
|
6 |
-
.
|
7 |
display: none !important;
|
8 |
}
|
9 |
|
10 |
-
.
|
11 |
border-color: red;
|
12 |
}
|
13 |
|
14 |
-
.
|
15 |
color: red;
|
16 |
font-weight: bold;
|
17 |
}
|
18 |
|
19 |
/* Common */
|
20 |
-
.
|
21 |
background: #D54E21;
|
22 |
border: 1px solid #eee;
|
23 |
color: white;
|
@@ -25,7 +25,7 @@
|
|
25 |
text-align: center;
|
26 |
}
|
27 |
|
28 |
-
.
|
29 |
background: green;
|
30 |
border: 1px solid #eee;
|
31 |
color: white;
|
@@ -33,63 +33,71 @@
|
|
33 |
text-align: center;
|
34 |
}
|
35 |
|
36 |
-
.
|
37 |
color: white;
|
38 |
}
|
39 |
|
40 |
-
.
|
41 |
background: #FFEC8B;
|
42 |
border: 1px solid #eee;
|
43 |
padding: 3px;
|
44 |
text-align: center;
|
45 |
}
|
46 |
|
47 |
-
.
|
48 |
background: green;
|
49 |
color: white;
|
50 |
padding: 3px;
|
51 |
text-decoration: none;
|
52 |
}
|
53 |
|
54 |
-
.
|
55 |
background: red;
|
56 |
color: white;
|
57 |
padding: 3px;
|
58 |
text-decoration: none;
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
61 |
/* dlg button colouring */
|
62 |
-
.
|
63 |
background: green !important;
|
64 |
color: white !important;
|
65 |
}
|
66 |
|
67 |
-
.
|
68 |
background: red !important;
|
69 |
color: white !important;
|
70 |
}
|
71 |
|
72 |
-
.
|
73 |
float: left;
|
74 |
}
|
75 |
|
76 |
-
.
|
77 |
float: right;
|
78 |
}
|
79 |
|
80 |
-
.
|
81 |
padding:10px;
|
82 |
background: #ccc;
|
83 |
margin-top: 15px;
|
84 |
margin-bottom: 15px;
|
85 |
}
|
86 |
|
87 |
-
.
|
88 |
padding:10px;
|
89 |
border: 2px solid white; /* we need this because there is a shift otherwise on hover. */
|
90 |
}
|
91 |
|
92 |
-
.
|
93 |
border: 2px solid #444;
|
94 |
background: #ccc;
|
95 |
}
|
|
|
|
|
|
|
|
1 |
/* Product of Orbisius.com. Visit http://club.orbisius.com/ */
|
2 |
+
.orbisius_child_theme_creator_container .app-hide {
|
3 |
display: none;
|
4 |
}
|
5 |
|
6 |
+
.orbisius_child_theme_creator_container .app-hide-force {
|
7 |
display: none !important;
|
8 |
}
|
9 |
|
10 |
+
.orbisius_child_theme_creator_container .app-form-field-error {
|
11 |
border-color: red;
|
12 |
}
|
13 |
|
14 |
+
.orbisius_child_theme_creator_container .app-serious-notice {
|
15 |
color: red;
|
16 |
font-weight: bold;
|
17 |
}
|
18 |
|
19 |
/* Common */
|
20 |
+
.orbisius_child_theme_creator_container .app-alert-error {
|
21 |
background: #D54E21;
|
22 |
border: 1px solid #eee;
|
23 |
color: white;
|
25 |
text-align: center;
|
26 |
}
|
27 |
|
28 |
+
.orbisius_child_theme_creator_container .app-alert-success {
|
29 |
background: green;
|
30 |
border: 1px solid #eee;
|
31 |
color: white;
|
33 |
text-align: center;
|
34 |
}
|
35 |
|
36 |
+
.orbisius_child_theme_creator_container .app-alert-success a {
|
37 |
color: white;
|
38 |
}
|
39 |
|
40 |
+
.orbisius_child_theme_creator_container .app-alert-notice {
|
41 |
background: #FFEC8B;
|
42 |
border: 1px solid #eee;
|
43 |
padding: 3px;
|
44 |
text-align: center;
|
45 |
}
|
46 |
|
47 |
+
.orbisius_child_theme_creator_container .app-button-positive {
|
48 |
background: green;
|
49 |
color: white;
|
50 |
padding: 3px;
|
51 |
text-decoration: none;
|
52 |
}
|
53 |
|
54 |
+
.orbisius_child_theme_creator_container .app-button-negative {
|
55 |
background: red;
|
56 |
color: white;
|
57 |
padding: 3px;
|
58 |
text-decoration: none;
|
59 |
}
|
60 |
|
61 |
+
.orbisius_child_theme_creator_container .highlight {
|
62 |
+
background: #FFFF33;
|
63 |
+
}
|
64 |
+
|
65 |
/* dlg button colouring */
|
66 |
+
.orbisius_child_theme_creator_container .app-dialog-button-ok {
|
67 |
background: green !important;
|
68 |
color: white !important;
|
69 |
}
|
70 |
|
71 |
+
.orbisius_child_theme_creator_container .app-dialog-button-cancel {
|
72 |
background: red !important;
|
73 |
color: white !important;
|
74 |
}
|
75 |
|
76 |
+
.orbisius_child_theme_creator_container .app-button-left, .app-align-left{
|
77 |
float: left;
|
78 |
}
|
79 |
|
80 |
+
.orbisius_child_theme_creator_container .app-button-right, .orbisius_child_theme_creator_container .app-align-right {
|
81 |
float: right;
|
82 |
}
|
83 |
|
84 |
+
.orbisius_child_theme_creator_container .app-button-container {
|
85 |
padding:10px;
|
86 |
background: #ccc;
|
87 |
margin-top: 15px;
|
88 |
margin-bottom: 15px;
|
89 |
}
|
90 |
|
91 |
+
.orbisius_child_theme_creator_container .available-theme {
|
92 |
padding:10px;
|
93 |
border: 2px solid white; /* we need this because there is a shift otherwise on hover. */
|
94 |
}
|
95 |
|
96 |
+
.orbisius_child_theme_creator_container .available-theme:hover {
|
97 |
border: 2px solid #444;
|
98 |
background: #ccc;
|
99 |
}
|
100 |
+
|
101 |
+
.orbisius_child_theme_creator_container .saving_action {
|
102 |
+
background: #ccc;
|
103 |
+
}
|
assets/main.js
ADDED
File without changes
|
nbproject/private/private.xml
CHANGED
@@ -10,8 +10,4 @@
|
|
10 |
</bookmark>
|
11 |
</file>
|
12 |
</editor-bookmarks>
|
13 |
-
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
|
14 |
-
<file>file:/C:/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/readme.txt</file>
|
15 |
-
<file>file:/C:/projects/default/htdocs/wordpress313/wp-content/plugins/orbisius-child-theme-creator/orbisius-child-theme-creator.php</file>
|
16 |
-
</open-files>
|
17 |
</project-private>
|
10 |
</bookmark>
|
11 |
</file>
|
12 |
</editor-bookmarks>
|
|
|
|
|
|
|
|
|
13 |
</project-private>
|
orbisius-child-theme-creator.php
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name: Orbisius Child Theme Creator
|
4 |
-
Plugin URI: http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/
|
5 |
-
Description: This plugin allows you to quickly create child themes from any theme that you have currently installed on your site/blog.
|
6 |
-
Version: 1.0.
|
7 |
-
Author: Svetoslav Marinov (Slavi)
|
8 |
-
Author URI: http://orbisius.com
|
9 |
-
*/
|
10 |
-
|
11 |
-
/* Copyright 2012 Svetoslav Marinov (Slavi) <slavi@orbisius.com>
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
*/
|
27 |
|
28 |
// Set up plugin
|
29 |
add_action('admin_init', 'orbisius_child_theme_creator_admin_init');
|
@@ -43,12 +43,11 @@ function orbisius_child_theme_creator_admin_notice_message() {
|
|
43 |
|
44 |
// show it everywhere but not on our page.
|
45 |
//if (stripos($_SERVER['REQUEST_URI'], basename(__FILE__)) === false) {
|
46 |
-
if (!$chat_installed
|
47 |
-
|
48 |
-
|
49 |
-
echo "<div class='updated'><p>$name has been installed. To create a child theme go to
|
50 |
<a href='$just_link'><strong>Tools → $name</strong></a></p></div>";
|
51 |
-
|
52 |
}
|
53 |
|
54 |
/**
|
@@ -59,8 +58,16 @@ function orbisius_child_theme_creator_admin_notice_message() {
|
|
59 |
* Also searches tags
|
60 |
*/
|
61 |
function orbisius_child_theme_creator_admin_init() {
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
|
66 |
/**
|
@@ -70,13 +77,13 @@ function orbisius_child_theme_creator_admin_init() {
|
|
70 |
* @since 0.1
|
71 |
*/
|
72 |
function orbisius_child_theme_creator_setup_admin() {
|
73 |
-
add_options_page(
|
|
|
|
|
|
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
// when plugins are show add a settings link near my plugin for a quick access to the settings page.
|
79 |
-
add_filter('plugin_action_links', 'orbisius_child_theme_creator_add_plugin_settings_link', 10, 2);
|
80 |
}
|
81 |
|
82 |
// Add the ? settings link in Plugins page very good
|
@@ -98,20 +105,20 @@ function orbisius_child_theme_creator_settings_page() {
|
|
98 |
<h2>Orbisius Child Theme Creator</h2>
|
99 |
|
100 |
<div class="updated"><p>
|
101 |
-
|
102 |
(<a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=settings_screen&utm_campaign=product"
|
103 |
-
|
104 |
that allows you to setup a test/sandbox
|
105 |
WordPress site in seconds. No technical knowledge is required.
|
106 |
<br/>Join today and test themes and plugins before you actually put them on your live site. For more info go to:
|
107 |
<a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=settings_screen&utm_campaign=product"
|
108 |
target="_blank" title="[new window]">http://qsandbox.com</a>
|
109 |
-
|
110 |
|
111 |
<div class="updated0"><p>
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
<h2>Video Demo</h2>
|
116 |
|
117 |
<p class="orbisius_child_theme_creator_demo_video hide00">
|
@@ -119,74 +126,74 @@ function orbisius_child_theme_creator_settings_page() {
|
|
119 |
|
120 |
<br/>Video Link: <a href="www.youtube.com/watch?v=BZUVq6ZTv-o"
|
121 |
target="_blank">www.youtube.com/watch?v=BZUVq6ZTv-o</a>
|
122 |
-
|
123 |
|
124 |
-
|
125 |
-
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
<h2>Share</h2>
|
132 |
<p>
|
133 |
<!-- AddThis Button BEGIN -->
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
|
151 |
-
|
152 |
-
var addthis_config = {"data_track_clickback":true};
|
153 |
var addthis_share = {
|
154 |
-
templates: {
|
155 |
}
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
** NOTE: ** Support is handled on our site: <a href="http://club.orbisius.com/support/" target="_blank" title="[new window]">http://club.orbisius.com/support/</a>.
|
169 |
Please do NOT use the WordPress forums or other places to seek support.
|
170 |
</p></div>
|
171 |
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
</div>
|
191 |
<?php
|
192 |
}
|
@@ -199,10 +206,10 @@ function orbisius_child_theme_creator_settings_page() {
|
|
199 |
function orbisius_child_theme_creator_get_plugin_data() {
|
200 |
// pull only these vars
|
201 |
$default_headers = array(
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
|
207 |
$plugin_data = get_file_data(__FILE__, $default_headers, 'plugin');
|
208 |
|
@@ -225,9 +232,7 @@ function orbisius_child_theme_creator_generate_ext_content($echo = 1) {
|
|
225 |
$plugin_slug = str_replace('.php', '', $plugin_slug);
|
226 |
$plugin_slug = strtolower($plugin_slug); // jic
|
227 |
|
228 |
-
$domain = !empty($_SERVER['DEV_ENV'])
|
229 |
-
? 'http://orbclub.com.clients.com'
|
230 |
-
: 'http://club.orbisius.com';
|
231 |
|
232 |
$url = $domain . '/wpu/content/wp/' . $plugin_slug . '/';
|
233 |
|
@@ -254,6 +259,24 @@ BUFF_EOF;
|
|
254 |
* @since 1.0
|
255 |
*/
|
256 |
function orbisius_child_theme_creator_tools_action() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
$msg = '';
|
258 |
$errors = $success = array();
|
259 |
$parent_theme_base_dirname = empty($_REQUEST['parent_theme_base_dirname']) ? '' : wp_kses($_REQUEST['parent_theme_base_dirname'], array());
|
@@ -262,6 +285,7 @@ function orbisius_child_theme_creator_tools_action() {
|
|
262 |
$parent_theme_base_dirname = trim($parent_theme_base_dirname);
|
263 |
$parent_theme_base_dirname = preg_replace('#[^\w-]#si', '-', $parent_theme_base_dirname);
|
264 |
$parent_theme_base_dirname = preg_replace('#[_-]+#si', '-', $parent_theme_base_dirname);
|
|
|
265 |
|
266 |
if (!empty($_POST) || !empty($parent_theme_base_dirname)) {
|
267 |
if (!wp_verify_nonce($orbisius_child_theme_creator_nonce, basename(__FILE__) . '-action')) {
|
@@ -276,12 +300,36 @@ function orbisius_child_theme_creator_tools_action() {
|
|
276 |
try {
|
277 |
$installer = new orbisius_child_theme_creator($parent_theme_base_dirname);
|
278 |
|
|
|
|
|
|
|
|
|
|
|
279 |
$installer->check_permissions();
|
280 |
$installer->copy_main_files();
|
281 |
$installer->generate_style();
|
282 |
|
283 |
$success[] = "The child theme has been successfully created.";
|
284 |
$success[] = $installer->get_details();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
} catch (Exception $e) {
|
286 |
$errors[] = "There was an error during the chat installation.";
|
287 |
$errors[] = $e->getMessage();
|
@@ -293,174 +341,235 @@ function orbisius_child_theme_creator_tools_action() {
|
|
293 |
}
|
294 |
}
|
295 |
|
|
|
|
|
|
|
|
|
|
|
296 |
if (!empty($errors)) {
|
297 |
-
$msg
|
298 |
-
} elseif (!empty($success)) {
|
299 |
-
$msg = orbisius_child_theme_creator_util::msg($success, 1);
|
300 |
}
|
301 |
|
|
|
|
|
|
|
302 |
?>
|
303 |
-
<div class="wrap
|
304 |
-
<h2>Orbisius Child Theme Creator
|
305 |
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
that allows you to setup a test/sandbox
|
317 |
-
WordPress site in seconds. No technical knowledge is required.
|
318 |
-
<br/>Join today and test themes and plugins before you actually put them on your live site. For more info go to:
|
319 |
-
<a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=action_screen&utm_campaign=product"
|
320 |
-
target="_blank" title="[new window]">http://qsandbox.com</a>
|
321 |
|
322 |
</div>
|
|
|
323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
|
330 |
-
|
331 |
-
|
|
|
|
|
|
|
|
|
332 |
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
// cleanup old links or refreshes.
|
341 |
-
$create_url = preg_replace('#&parent_theme_base_dirname=[\w-]+#si', '', $create_url);
|
342 |
-
$create_url = preg_replace('#&orbisius_child_theme_creator_nonce=[\w-]+#si', '', $create_url);
|
343 |
-
|
344 |
-
$create_url .= '&parent_theme_base_dirname=' . $parent_theme_base_dirname_fmt;
|
345 |
-
$create_url .= '&orbisius_child_theme_creator_nonce=' . $nonce;
|
346 |
-
|
347 |
-
$buff .= "<div class='available-theme'>\n";
|
348 |
-
$buff .= "<img class='screenshot' src='$src' alt='' />\n";
|
349 |
-
$buff .= "<h3>$theme_obj->Name</h3>\n";
|
350 |
-
$buff .= "<div class='theme-author'>By <a title='Visit author homepage' "
|
351 |
-
. "href='$theme_obj->AuthorURI' target='_blank'>$theme_obj->Author</a></div>\n";
|
352 |
-
$buff .= "<div class='action-links'>\n";
|
353 |
-
$buff .= "<ul>\n";
|
354 |
-
$buff .= "<li><a href='$create_url' class='button button-primary'>Create Child Theme</a></li>\n";
|
355 |
-
$buff .= "<li>Version: $theme_obj->Version</li>\n";
|
356 |
-
$buff .= "</ul>\n";
|
357 |
-
$buff .= "</div> <!-- /action-links -->\n";
|
358 |
-
$buff .= "</div> <!-- /available-theme -->\n";
|
359 |
-
}
|
360 |
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
</form>
|
366 |
|
367 |
<hr />
|
368 |
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
** NOTE: ** We have launched our Club Orbisius site: <a href="http://club.orbisius.com/" target="_blank" title="[new window]">http://club.orbisius.com/</a>
|
373 |
-
which offers lots of free and premium plugins, video tutorials and more. The support is handled there as well.
|
374 |
-
<br/>Please do NOT use the WordPress forums or other places to seek support.
|
375 |
-
</p>
|
376 |
-
</div>
|
377 |
-
|
378 |
-
<h2>Want to hear about future plugins? Join our mailing List! (no spam)</h2>
|
379 |
<p>
|
380 |
-
|
381 |
-
|
382 |
</p>
|
|
|
|
|
|
|
|
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
OR
|
389 |
-
2) by using our QR code. [Scan it with your mobile device].<br/>
|
390 |
-
<img src="<?php echo plugin_dir_url(__FILE__); ?>/i/guNzr.qr.2.png" alt="" />
|
391 |
-
</p>
|
392 |
|
393 |
-
|
394 |
-
<?php
|
395 |
-
$plugin_data = get_plugin_data(__FILE__);
|
396 |
-
|
397 |
-
$app_link = urlencode($plugin_data['PluginURI']);
|
398 |
-
$app_title = urlencode($plugin_data['Name']);
|
399 |
-
$app_descr = urlencode($plugin_data['Description']);
|
400 |
-
?>
|
401 |
-
<h2>Demo</h2>
|
402 |
-
<p>
|
403 |
-
<iframe width="560" height="315" src="http://www.youtube.com/embed/BZUVq6ZTv-o" frameborder="0" allowfullscreen></iframe>
|
404 |
-
|
405 |
-
<br/>Video Link: <a href="http://www.youtube.com/watch?v=BZUVq6ZTv-o&feature=youtu.be" target="_blank">http://www.youtube.com/watch?v=BZUVq6ZTv-o&feature=youtu.be</a>
|
406 |
-
</p>
|
407 |
-
<h2>Share with friends</h2>
|
408 |
<p>
|
409 |
<!-- AddThis Button BEGIN -->
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
var addthis_config = {"data_track_clickback":true};
|
429 |
var addthis_share = {
|
430 |
-
|
431 |
}
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
<?php
|
441 |
}
|
442 |
|
443 |
/**
|
444 |
-
*
|
445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
function orbisius_child_theme_creator_add_plugin_credits() {
|
447 |
// pull only these vars
|
448 |
$default_headers = array(
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
|
453 |
$plugin_data = get_file_data(__FILE__, $default_headers, 'plugin');
|
454 |
|
455 |
$url = $plugin_data['PluginURI'];
|
456 |
$name = $plugin_data['Name'];
|
457 |
-
|
458 |
printf(PHP_EOL . PHP_EOL . '<!-- ' . "Powered by $name | URL: $url " . '-->' . PHP_EOL . PHP_EOL);
|
459 |
}
|
460 |
|
461 |
/**
|
462 |
*/
|
463 |
class orbisius_child_theme_creator {
|
|
|
464 |
public $result = null;
|
465 |
public $target_dir_path; // /var/www/vhosts/domain.com/www/wp-content/themes/Parent-Theme-child-01/
|
466 |
|
@@ -470,9 +579,10 @@ class orbisius_child_theme_creator {
|
|
470 |
*
|
471 |
* @param str $parent_theme_basedir
|
472 |
*/
|
|
|
473 |
public function __construct($parent_theme_basedir = '') {
|
474 |
$all_themes_root = get_theme_root();
|
475 |
-
|
476 |
$this->parent_theme_basedir = $parent_theme_basedir;
|
477 |
$this->parent_theme_dir = $all_themes_root . '/' . $parent_theme_basedir . '/';
|
478 |
|
@@ -485,27 +595,25 @@ class orbisius_child_theme_creator {
|
|
485 |
} while (is_dir($target_dir));
|
486 |
|
487 |
$this->target_dir_path = $target_dir;
|
488 |
-
$this->target_base_dirname =
|
489 |
|
490 |
// this is appended to the new theme's name
|
491 |
$this->target_name_suffix = 'Child ' . sprintf("%02d", $i);
|
492 |
}
|
493 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
/**
|
495 |
* Loads files from a directory but skips . and ..
|
496 |
*/
|
497 |
public function load_files($dir) {
|
498 |
-
$files =
|
499 |
-
$all_files = scandir($dir);
|
500 |
-
|
501 |
-
foreach ($all_files as $file) {
|
502 |
-
if ($file == '.' || $file == '..') {
|
503 |
-
continue;
|
504 |
-
}
|
505 |
-
|
506 |
-
$files[] = $file;
|
507 |
-
}
|
508 |
-
|
509 |
return $files;
|
510 |
}
|
511 |
|
@@ -518,7 +626,7 @@ class orbisius_child_theme_creator {
|
|
518 |
*/
|
519 |
public function check_permissions() {
|
520 |
$target_dir_path = $this->target_dir_path;
|
521 |
-
|
522 |
if (!is_dir($target_dir_path)) {
|
523 |
if (!mkdir($target_dir_path, 0775)) {
|
524 |
throw new Exception("Target child theme directory cannot be created. This is probably a permission error. Cannot continue.");
|
@@ -528,7 +636,7 @@ class orbisius_child_theme_creator {
|
|
528 |
|
529 |
if (count($files) > 0) {
|
530 |
throw new Exception("Target folder already exists and has file(s) in it. Cannot continue. Files: ["
|
531 |
-
|
532 |
}
|
533 |
}
|
534 |
|
@@ -537,6 +645,20 @@ class orbisius_child_theme_creator {
|
|
537 |
throw new Exception("Target directory is not writable.");
|
538 |
}
|
539 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
540 |
|
541 |
/**
|
542 |
* Copy some files from the parent theme.
|
@@ -544,7 +666,8 @@ class orbisius_child_theme_creator {
|
|
544 |
*/
|
545 |
public function copy_main_files() {
|
546 |
$stats = 0;
|
547 |
-
|
|
|
548 |
|
549 |
foreach ($main_files as $file) {
|
550 |
if (!file_exists($this->parent_theme_dir . $file)) {
|
@@ -555,6 +678,11 @@ class orbisius_child_theme_creator {
|
|
555 |
$stat = intval($stat);
|
556 |
$stats += $stat;
|
557 |
}
|
|
|
|
|
|
|
|
|
|
|
558 |
}
|
559 |
|
560 |
/**
|
@@ -564,14 +692,12 @@ class orbisius_child_theme_creator {
|
|
564 |
*/
|
565 |
public function generate_style() {
|
566 |
global $wp_version;
|
567 |
-
|
568 |
$plugin_data = get_plugin_data(__FILE__);
|
569 |
$app_link = $plugin_data['PluginURI'];
|
570 |
$app_title = $plugin_data['Name'];
|
571 |
|
572 |
-
$parent_theme_data = version_compare($wp_version, '3.4', '>=')
|
573 |
-
? wp_get_theme($this->parent_theme_basedir)
|
574 |
-
: (object) get_theme_data($this->target_dir_path . 'style.css');
|
575 |
|
576 |
$buff = '';
|
577 |
$buff .= "/*\n";
|
@@ -587,11 +713,12 @@ class orbisius_child_theme_creator {
|
|
587 |
$buff .= "\n/* Generated by $app_title ($app_link) on " . date('r') . " */ \n\n";
|
588 |
|
589 |
$buff .= "@import url('../$this->parent_theme_basedir/style.css');\n";
|
590 |
-
|
591 |
file_put_contents($this->target_dir_path . 'style.css', $buff);
|
592 |
|
593 |
// RTL langs; make rtl.css to point to the parent file as well
|
594 |
if (file_exists($this->parent_theme_dir . 'rtl.css')) {
|
|
|
595 |
$rtl_buff .= "/*\n";
|
596 |
$rtl_buff .= "Theme Name: $parent_theme_data->Name $this->target_name_suffix\n";
|
597 |
$rtl_buff .= "Template: $this->parent_theme_basedir\n";
|
@@ -624,13 +751,73 @@ class orbisius_child_theme_creator {
|
|
624 |
function log($msg) {
|
625 |
error_log($msg . "\n", 3, ini_get('error_log'));
|
626 |
}
|
|
|
627 |
}
|
628 |
|
|
|
|
|
|
|
629 |
class orbisius_child_theme_creator_util {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
630 |
/**
|
631 |
* Outputs a message (adds some paragraphs).
|
632 |
*/
|
633 |
-
function msg($msg, $status = 0) {
|
634 |
$msg = join("<br/>\n", (array) $msg);
|
635 |
|
636 |
if (empty($status)) {
|
@@ -645,4 +832,72 @@ class orbisius_child_theme_creator_util {
|
|
645 |
|
646 |
return $str;
|
647 |
}
|
|
|
648 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: Orbisius Child Theme Creator
|
4 |
+
Plugin URI: http://club.orbisius.com/products/wordpress-plugins/orbisius-child-theme-creator/
|
5 |
+
Description: This plugin allows you to quickly create child themes from any theme that you have currently installed on your site/blog.
|
6 |
+
Version: 1.0.4
|
7 |
+
Author: Svetoslav Marinov (Slavi)
|
8 |
+
Author URI: http://orbisius.com
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Copyright 2012-2050 Svetoslav Marinov (Slavi) <slavi@orbisius.com>
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
+
*/
|
27 |
|
28 |
// Set up plugin
|
29 |
add_action('admin_init', 'orbisius_child_theme_creator_admin_init');
|
43 |
|
44 |
// show it everywhere but not on our page.
|
45 |
//if (stripos($_SERVER['REQUEST_URI'], basename(__FILE__)) === false) {
|
46 |
+
if (!$chat_installed && (stripos($_SERVER['REQUEST_URI'], 'plugins.php') !== false)) {
|
47 |
+
$just_link = 'tools.php?page=' . plugin_basename(__FILE__);
|
48 |
+
echo "<div class='updated'><p>$name has been installed. To create a child theme go to
|
|
|
49 |
<a href='$just_link'><strong>Tools → $name</strong></a></p></div>";
|
50 |
+
}
|
51 |
}
|
52 |
|
53 |
/**
|
58 |
* Also searches tags
|
59 |
*/
|
60 |
function orbisius_child_theme_creator_admin_init() {
|
61 |
+
$suffix = '';
|
62 |
+
$dev = empty($_SERVER['DEV_ENV']) ? 0 : 1;
|
63 |
+
//$suffix = $dev ? '' : '.min';
|
64 |
+
|
65 |
+
wp_register_style('orbisius_child_theme_creator', plugins_url("/assets/main{$suffix}.css", __FILE__), false);
|
66 |
+
wp_enqueue_style('orbisius_child_theme_creator');
|
67 |
+
|
68 |
+
/* wp_enqueue_script( 'jquery' );
|
69 |
+
wp_register_script( 'orbisius_child_theme_creator', plugins_url("/assets/main{$suffix}.js", __FILE__), array('jquery', ), '1.0', true);
|
70 |
+
wp_enqueue_script( 'orbisius_child_theme_creator' ); */
|
71 |
}
|
72 |
|
73 |
/**
|
77 |
* @since 0.1
|
78 |
*/
|
79 |
function orbisius_child_theme_creator_setup_admin() {
|
80 |
+
add_options_page('Orbisius Child Theme Creator', 'Orbisius Child Theme Creator', 'manage_options', __FILE__, 'orbisius_child_theme_creator_settings_page');
|
81 |
+
add_theme_page('Orbisius Child Theme Creator', 'Orbisius Child Theme Creator', 'manage_options', __FILE__, 'orbisius_child_theme_creator_tools_action');
|
82 |
+
|
83 |
+
add_submenu_page('tools.php', 'Orbisius Child Theme Creator', 'Orbisius Child Theme Creator', 'manage_options', __FILE__, 'orbisius_child_theme_creator_tools_action');
|
84 |
|
85 |
+
// when plugins are show add a settings link near my plugin for a quick access to the settings page.
|
86 |
+
add_filter('plugin_action_links', 'orbisius_child_theme_creator_add_plugin_settings_link', 10, 2);
|
|
|
|
|
|
|
87 |
}
|
88 |
|
89 |
// Add the ? settings link in Plugins page very good
|
105 |
<h2>Orbisius Child Theme Creator</h2>
|
106 |
|
107 |
<div class="updated"><p>
|
108 |
+
Some untested themes and plugin may break your site. We have launched a <strong>free</strong> service
|
109 |
(<a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=settings_screen&utm_campaign=product"
|
110 |
+
target="_blank" title="[new window]">http://qsandbox.com</a>)
|
111 |
that allows you to setup a test/sandbox
|
112 |
WordPress site in seconds. No technical knowledge is required.
|
113 |
<br/>Join today and test themes and plugins before you actually put them on your live site. For more info go to:
|
114 |
<a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=settings_screen&utm_campaign=product"
|
115 |
target="_blank" title="[new window]">http://qsandbox.com</a>
|
116 |
+
</p></div>
|
117 |
|
118 |
<div class="updated0"><p>
|
119 |
+
This plugin doesn't currently have any configuration options. To use it go to <strong>Tools → Orbisius Child Theme Creator</strong>
|
120 |
+
</p></div>
|
121 |
+
|
122 |
<h2>Video Demo</h2>
|
123 |
|
124 |
<p class="orbisius_child_theme_creator_demo_video hide00">
|
126 |
|
127 |
<br/>Video Link: <a href="www.youtube.com/watch?v=BZUVq6ZTv-o"
|
128 |
target="_blank">www.youtube.com/watch?v=BZUVq6ZTv-o</a>
|
129 |
+
</p>
|
130 |
|
131 |
+
<?php
|
132 |
+
$plugin_data = orbisius_child_theme_creator_get_plugin_data();
|
133 |
|
134 |
+
$app_link = urlencode($plugin_data['PluginURI']);
|
135 |
+
$app_title = urlencode($plugin_data['Name']);
|
136 |
+
$app_descr = urlencode($plugin_data['Description']);
|
137 |
+
?>
|
138 |
<h2>Share</h2>
|
139 |
<p>
|
140 |
<!-- AddThis Button BEGIN -->
|
141 |
+
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
|
142 |
+
<a class="addthis_button_facebook" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
143 |
+
<a class="addthis_button_twitter" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
144 |
+
<a class="addthis_button_google_plusone" g:plusone:count="false" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
145 |
+
<a class="addthis_button_linkedin" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
146 |
+
<a class="addthis_button_email" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
147 |
+
<a class="addthis_button_myspace" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
148 |
+
<a class="addthis_button_google" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
149 |
+
<a class="addthis_button_digg" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
150 |
+
<a class="addthis_button_delicious" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
151 |
+
<a class="addthis_button_stumbleupon" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
152 |
+
<a class="addthis_button_tumblr" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
153 |
+
<a class="addthis_button_favorites" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
154 |
+
<a class="addthis_button_compact"></a>
|
155 |
+
</div>
|
156 |
+
<!-- The JS code is in the footer -->
|
157 |
|
158 |
+
<script type="text/javascript">
|
159 |
+
var addthis_config = {"data_track_clickback": true};
|
160 |
var addthis_share = {
|
161 |
+
templates: {twitter: 'Check out {{title}} #WordPress #plugin at {{lurl}} (via @orbisius)'}
|
162 |
}
|
163 |
+
</script>
|
164 |
+
<!-- AddThis Button START part2 -->
|
165 |
+
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=lordspace"></script>
|
166 |
+
<!-- AddThis Button END part2 -->
|
167 |
+
</p>
|
168 |
+
|
169 |
+
<h2>Troubleshooting</h2>
|
170 |
+
If your site becomes broken due to a child theme (mis)configuration. Please check another plugin of ours:
|
171 |
+
<a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-theme-fixer/?utm_source=orbisius-child-theme-creator&utm_medium=settings_troubleshooting&utm_campaign=product" target="_blank" title="[new window]">Orbisius Theme Fixer</a>
|
172 |
+
|
173 |
+
<h2>Support & Feature Requests</h2>
|
174 |
+
<div class="updated"><p>
|
175 |
** NOTE: ** Support is handled on our site: <a href="http://club.orbisius.com/support/" target="_blank" title="[new window]">http://club.orbisius.com/support/</a>.
|
176 |
Please do NOT use the WordPress forums or other places to seek support.
|
177 |
</p></div>
|
178 |
|
179 |
+
<h2>Mailing List</h2>
|
180 |
+
<p>
|
181 |
+
Get the latest news and updates about this and future cool
|
182 |
+
<a href="http://profiles.wordpress.org/lordspace/"
|
183 |
+
target="_blank" title="Opens a page with the pugins we developed. [New Window/Tab]">plugins we develop</a>.
|
184 |
+
</p>
|
185 |
+
<p>
|
186 |
+
<!-- // MAILCHIMP SUBSCRIBE CODE \\ -->
|
187 |
+
1) <a href="http://eepurl.com/guNzr" target="_blank">Subscribe to our newsletter</a>
|
188 |
+
<!-- \\ MAILCHIMP SUBSCRIBE CODE // -->
|
189 |
+
</p>
|
190 |
+
<p>OR</p>
|
191 |
+
<p>
|
192 |
+
2) Subscribe using our QR code. [Scan it with your mobile device].<br/>
|
193 |
+
<img src="<?php echo plugin_dir_url(__FILE__); ?>/i/guNzr.qr.2.png" alt="" />
|
194 |
+
</p>
|
195 |
+
|
196 |
+
<?php orbisius_child_theme_creator_generate_ext_content(); ?>
|
197 |
</div>
|
198 |
<?php
|
199 |
}
|
206 |
function orbisius_child_theme_creator_get_plugin_data() {
|
207 |
// pull only these vars
|
208 |
$default_headers = array(
|
209 |
+
'Name' => 'Plugin Name',
|
210 |
+
'PluginURI' => 'Plugin URI',
|
211 |
+
'Description' => 'Description',
|
212 |
+
);
|
213 |
|
214 |
$plugin_data = get_file_data(__FILE__, $default_headers, 'plugin');
|
215 |
|
232 |
$plugin_slug = str_replace('.php', '', $plugin_slug);
|
233 |
$plugin_slug = strtolower($plugin_slug); // jic
|
234 |
|
235 |
+
$domain = !empty($_SERVER['DEV_ENV']) ? 'http://orbclub.com.clients.com' : 'http://club.orbisius.com';
|
|
|
|
|
236 |
|
237 |
$url = $domain . '/wpu/content/wp/' . $plugin_slug . '/';
|
238 |
|
259 |
* @since 1.0
|
260 |
*/
|
261 |
function orbisius_child_theme_creator_tools_action() {
|
262 |
+
// ACL checks *borrowed* from wp-admin/theme-install.php
|
263 |
+
if ( ! current_user_can('install_themes') ) {
|
264 |
+
wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
|
265 |
+
}
|
266 |
+
|
267 |
+
if ( is_multisite() && ! is_network_admin() ) {
|
268 |
+
$next_url = network_admin_url( 'theme-install.php' );
|
269 |
+
|
270 |
+
if (headers_sent()) {
|
271 |
+
$success = "You need more permissions. <a href='$next_url'>Continue</a>";
|
272 |
+
wp_die($success);
|
273 |
+
} else {
|
274 |
+
wp_redirect($next_url);
|
275 |
+
}
|
276 |
+
|
277 |
+
exit();
|
278 |
+
}
|
279 |
+
|
280 |
$msg = '';
|
281 |
$errors = $success = array();
|
282 |
$parent_theme_base_dirname = empty($_REQUEST['parent_theme_base_dirname']) ? '' : wp_kses($_REQUEST['parent_theme_base_dirname'], array());
|
285 |
$parent_theme_base_dirname = trim($parent_theme_base_dirname);
|
286 |
$parent_theme_base_dirname = preg_replace('#[^\w-]#si', '-', $parent_theme_base_dirname);
|
287 |
$parent_theme_base_dirname = preg_replace('#[_-]+#si', '-', $parent_theme_base_dirname);
|
288 |
+
$parent_theme_base_dirname = trim($parent_theme_base_dirname, '-');
|
289 |
|
290 |
if (!empty($_POST) || !empty($parent_theme_base_dirname)) {
|
291 |
if (!wp_verify_nonce($orbisius_child_theme_creator_nonce, basename(__FILE__) . '-action')) {
|
300 |
try {
|
301 |
$installer = new orbisius_child_theme_creator($parent_theme_base_dirname);
|
302 |
|
303 |
+
// Does the user want to copy the functions.php?
|
304 |
+
if (!empty($_REQUEST['copy_functions_php'])) {
|
305 |
+
$installer->add_files('functions.php');
|
306 |
+
}
|
307 |
+
|
308 |
$installer->check_permissions();
|
309 |
$installer->copy_main_files();
|
310 |
$installer->generate_style();
|
311 |
|
312 |
$success[] = "The child theme has been successfully created.";
|
313 |
$success[] = $installer->get_details();
|
314 |
+
|
315 |
+
if (!empty($_REQUEST['switch'])) {
|
316 |
+
$child_theme_base_dir = $installer->get_child_base_dir();
|
317 |
+
$theme = wp_get_theme($child_theme_base_dir);
|
318 |
+
|
319 |
+
if (!$theme->exists() || !$theme->is_allowed()) {
|
320 |
+
throw new Exception('Cannot switch to the new theme for some reason.');
|
321 |
+
}
|
322 |
+
|
323 |
+
switch_theme($theme->get_stylesheet());
|
324 |
+
$next_url = admin_url('themes.php?activated=true');
|
325 |
+
|
326 |
+
if (headers_sent()) {
|
327 |
+
$success = "Child theme created and switched. <a href='$next_url'>Continue</a>";
|
328 |
+
} else {
|
329 |
+
wp_safe_redirect($next_url);
|
330 |
+
exit;
|
331 |
+
}
|
332 |
+
}
|
333 |
} catch (Exception $e) {
|
334 |
$errors[] = "There was an error during the chat installation.";
|
335 |
$errors[] = $e->getMessage();
|
341 |
}
|
342 |
}
|
343 |
|
344 |
+
if ( is_multisite() ) {
|
345 |
+
$msg .= orbisius_child_theme_creator_util::msg("You are running WordPress in MultiSite configuration.
|
346 |
+
Orbisius Child Theme Creator hasn't been tested in WordPress multisite setup.", 2);
|
347 |
+
}
|
348 |
+
|
349 |
if (!empty($errors)) {
|
350 |
+
$msg .= orbisius_child_theme_creator_util::msg($errors);
|
|
|
|
|
351 |
}
|
352 |
|
353 |
+
if (!empty($success)) {
|
354 |
+
$msg .= orbisius_child_theme_creator_util::msg($success, 1);
|
355 |
+
}
|
356 |
?>
|
357 |
+
<div class="wrap orbisius_child_theme_creator_container">
|
358 |
+
<h2>Orbisius Child Theme Creator
|
359 |
|
360 |
+
<div class="" style="float: right;padding: 3px; _border: 1px solid #D54E21;">
|
361 |
+
Cool Links:
|
362 |
+
<a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-theme-editor/?utm_source=orbisius-child-theme-creator&utm_medium=action_screen&utm_campaign=product"
|
363 |
+
target="_blank" title="Opens in new tab/window. This plugin allows you to quickly edit two theme files at once and copy snippets from each one. Try it.">Orbisius Theme Editor</a>
|
364 |
+
|
365 |
+
| <a href="http://qsandbox.com/?utm_source=orbisius-child-theme-creator&utm_medium=action_screen&utm_campaign=product"
|
366 |
+
target="_blank" title="Opens in new tab/window. qSandbox is a FREE service that allows you to setup a test/sandbox WordPress site in 2 seconds. No technical knowledge is required.
|
367 |
+
Test themes and plugins before you actually put them on your site">Free Test WordPress Site</a> (2sec)
|
368 |
+
|
369 |
+
| <a href="#help" title="[new window]">Help</a>
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
</div>
|
372 |
+
</h2>
|
373 |
|
374 |
+
<hr />
|
375 |
+
<?php echo $msg; ?>
|
376 |
+
<div class="updated">
|
377 |
+
<p>
|
378 |
+
Choose a parent theme from the list below and click on the <strong>Create Child Theme</strong> button.
|
379 |
+
</p>
|
380 |
+
</div>
|
381 |
|
382 |
+
<?php
|
383 |
+
$buff = '';
|
384 |
+
$buff .= "<div id='availablethemes' class='theme_container'>\n";
|
385 |
+
$nonce = wp_create_nonce(basename(__FILE__) . '-action');
|
386 |
+
|
387 |
+
$args = array();
|
388 |
+
$themes = wp_get_themes($args);
|
389 |
+
|
390 |
+
// we use the same CSS as in WP's appearances but put only the buttons we want.
|
391 |
+
foreach ($themes as $theme_basedir_name => $theme_obj) {
|
392 |
+
// get the web uri for the current theme and go 1 level up
|
393 |
+
$src = dirname(get_template_directory_uri()) . "/$theme_basedir_name/screenshot.png";
|
394 |
+
$functions_file = dirname(get_template_directory()) . "/$theme_basedir_name/functions.php";
|
395 |
+
$parent_theme_base_dirname_fmt = urlencode($theme_basedir_name);
|
396 |
+
$create_url = $_SERVER['REQUEST_URI'];
|
397 |
+
|
398 |
+
// cleanup old links or refreshes.
|
399 |
+
$create_url = preg_replace('#&parent_theme_base_dirname=[\w-]+#si', '', $create_url);
|
400 |
+
$create_url = preg_replace('#&orbisius_child_theme_creator_nonce=[\w-]+#si', '', $create_url);
|
401 |
+
|
402 |
+
$create_url .= '&parent_theme_base_dirname=' . $parent_theme_base_dirname_fmt;
|
403 |
+
$create_url .= '&orbisius_child_theme_creator_nonce=' . $nonce;
|
404 |
+
|
405 |
+
/* $create_url2 = esc_url( add_query_arg(
|
406 |
+
array( 'parent_theme_base_dirname' => $parent_theme_base_dirname_fmt,
|
407 |
+
), admin_url( 'themes.php' ) ) ); */
|
408 |
+
|
409 |
+
$author_name = $theme_obj->get('Author');
|
410 |
+
$author_name = strip_tags($author_name);
|
411 |
+
$author_name = empty($author_name) ? 'n/a' : $author_name;
|
412 |
+
|
413 |
+
$author_uri = $theme_obj->get('AuthorURI');
|
414 |
+
$author_line = empty($author_uri)
|
415 |
+
? $author_name
|
416 |
+
: "<a title='Visit author homepage' href='$author_uri' target='_blank'>$author_name</a>";
|
417 |
+
|
418 |
+
$buff .= "<div class='available-theme'>\n";
|
419 |
+
$buff .= "<form action='$create_url' method='post'>\n";
|
420 |
+
$buff .= "<img class='screenshot' src='$src' alt='' />\n";
|
421 |
+
$buff .= "<h3>$theme_obj->Name</h3>\n";
|
422 |
+
$buff .= "<div class='theme-author'>By $author_line</div>\n";
|
423 |
+
$buff .= "<div class='action-links'>\n";
|
424 |
+
$buff .= "<ul>\n";
|
425 |
+
|
426 |
+
$parent_theme = $theme_obj->get('Template');
|
427 |
+
|
428 |
+
if (empty($parent_theme)) { // Normal themes / no child ones
|
429 |
+
if (file_exists($functions_file)) {
|
430 |
+
$adv_container_id = md5($src);
|
431 |
+
|
432 |
+
$buff .= "
|
433 |
+
<li><a href='javascript:void(0)' onclick='jQuery(\"#orbisius_ctc_act_adv_$adv_container_id\").slideToggle(\"slow\");'>+ Advanced</a> (show/hide)
|
434 |
+
<div id='orbisius_ctc_act_adv_$adv_container_id' class='app-hide'>
|
435 |
+
<label><input type='checkbox' id='orbisius_child_theme_creator_copy_functions_php' name='copy_functions_php' value='1' /> Copy functons.php
|
436 |
+
(<span class='app-serious-notice'><strong>Danger</strong>: if the theme doesn't support
|
437 |
+
<a href='http://wp.tutsplus.com/tutorials/creative-coding/understanding-wordpress-pluggable-functions-and-their-usage/'
|
438 |
+
target='_blank'>pluggable functions</a> this <strong>will crash your site</strong>.</span>)</label>
|
439 |
+
</li>\n
|
440 |
+
";
|
441 |
+
}
|
442 |
|
443 |
+
$buff .= "<li><label><input type='checkbox' id='orbisius_child_theme_creator_switch' name='switch' value='1' /> Switch theme to the new theme after it is created</label></li>\n";
|
444 |
+
$buff .= "<li> <button type='submit' class='button button-primary'>Create Child Theme</button> </li>\n";
|
445 |
+
} else {
|
446 |
+
$buff .= "<li> </li>\n";
|
447 |
+
$buff .= "<li>[child theme]</li>\n";
|
448 |
+
}
|
449 |
|
450 |
+
$buff .= "<li>Version: $theme_obj->Version</li>\n";
|
451 |
+
$buff .= "</ul>\n";
|
452 |
+
$buff .= "</div> <!-- /action-links -->\n";
|
453 |
+
$buff .= "</form> <!-- /form -->\n";
|
454 |
+
$buff .= "</div> <!-- /available-theme -->\n";
|
455 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
|
457 |
+
$buff .= "</div> <!-- /availablethemes -->\n";
|
458 |
+
//var_dump($themes);
|
459 |
+
echo $buff;
|
460 |
+
?>
|
|
|
461 |
|
462 |
<hr />
|
463 |
|
464 |
+
<a name="help"></a>
|
465 |
+
<h2>Support & Premium Plugins</h2>
|
466 |
+
<div class="updated">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
<p>
|
468 |
+
The support is handled on our Club Orbisius site: <a href="http://club.orbisius.com/" target="_blank" title="[new window]">http://club.orbisius.com/</a>.
|
469 |
+
Please do NOT use the WordPress forums or other places to seek support.
|
470 |
</p>
|
471 |
+
</div>
|
472 |
+
<?php if (1) : ?>
|
473 |
+
<?php
|
474 |
+
$plugin_data = get_plugin_data(__FILE__);
|
475 |
|
476 |
+
$app_link = urlencode($plugin_data['PluginURI']);
|
477 |
+
$app_title = urlencode($plugin_data['Name']);
|
478 |
+
$app_descr = urlencode($plugin_data['Description']);
|
479 |
+
?>
|
|
|
|
|
|
|
|
|
480 |
|
481 |
+
<h2>Like this plugin? Share it with your friends</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
<p>
|
483 |
<!-- AddThis Button BEGIN -->
|
484 |
+
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
|
485 |
+
<a class="addthis_button_facebook" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
486 |
+
<a class="addthis_button_twitter" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
487 |
+
<a class="addthis_button_google_plusone" g:plusone:count="false" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
488 |
+
<a class="addthis_button_linkedin" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
489 |
+
<a class="addthis_button_email" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
490 |
+
<a class="addthis_button_myspace" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
491 |
+
<a class="addthis_button_google" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
492 |
+
<a class="addthis_button_digg" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
493 |
+
<a class="addthis_button_delicious" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
494 |
+
<a class="addthis_button_stumbleupon" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
495 |
+
<a class="addthis_button_tumblr" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
496 |
+
<a class="addthis_button_favorites" addthis:url="<?php echo $app_link ?>" addthis:title="<?php echo $app_title ?>" addthis:description="<?php echo $app_descr ?>"></a>
|
497 |
+
<a class="addthis_button_compact"></a>
|
498 |
+
</div>
|
499 |
+
<!-- The JS code is in the footer -->
|
500 |
+
|
501 |
+
<script type="text/javascript">
|
502 |
+
var addthis_config = {"data_track_clickback": true};
|
503 |
var addthis_share = {
|
504 |
+
templates: {twitter: 'Check out {{title}} #wordpress #plugin at {{lurl}} (via @orbisius)'}
|
505 |
}
|
506 |
+
</script>
|
507 |
+
<!-- AddThis Button START part2 -->
|
508 |
+
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>
|
509 |
+
<!-- AddThis Button END part2 -->
|
510 |
+
</p>
|
511 |
+
<?php endif ?>
|
512 |
+
|
513 |
+
<h2>Want to hear about future plugins? Join our mailing List! (no spam)</h2>
|
514 |
+
<p>
|
515 |
+
Get the latest news and updates about this and future cool <a href="http://profiles.wordpress.org/lordspace/"
|
516 |
+
target="_blank" title="Opens a page with the pugins we developed. [New Window/Tab]">plugins we develop</a>.
|
517 |
+
</p>
|
518 |
+
|
519 |
+
<p>
|
520 |
+
<!-- // MAILCHIMP SUBSCRIBE CODE \\ -->
|
521 |
+
1) Subscribe by going to <a href="http://eepurl.com/guNzr" target="_blank">http://eepurl.com/guNzr</a>
|
522 |
+
<!-- \\ MAILCHIMP SUBSCRIBE CODE // -->
|
523 |
+
OR
|
524 |
+
2) by using our QR code. [Scan it with your mobile device].<br/>
|
525 |
+
<img src="<?php echo plugin_dir_url(__FILE__); ?>/i/guNzr.qr.2.png" alt="" />
|
526 |
+
</p>
|
527 |
+
|
528 |
+
<h2>Demo</h2>
|
529 |
+
<p>
|
530 |
+
<iframe width="560" height="315" src="http://www.youtube.com/embed/BZUVq6ZTv-o" frameborder="0" allowfullscreen></iframe>
|
531 |
+
|
532 |
+
<br/>Video Link: <a href="http://www.youtube.com/watch?v=BZUVq6ZTv-o&feature=youtu.be" target="_blank">http://www.youtube.com/watch?v=BZUVq6ZTv-o&feature=youtu.be</a>
|
533 |
+
</p>
|
534 |
+
</div>
|
535 |
<?php
|
536 |
}
|
537 |
|
538 |
/**
|
539 |
+
* It seems WP intentionally adds slashes for consistency with php.
|
540 |
+
* Please note: WordPress Core and most plugins will still be expecting slashes, and the above code will confuse and break them.
|
541 |
+
* If you must unslash, consider only doing it to your own data which isn't used by others:
|
542 |
+
* @see http://codex.wordpress.org/Function_Reference/stripslashes_deep
|
543 |
+
*/
|
544 |
+
function orbisius_child_theme_creator_get_request() {
|
545 |
+
$req = $_REQUEST;
|
546 |
+
$req = stripslashes_deep($req);
|
547 |
+
|
548 |
+
return $req;
|
549 |
+
}
|
550 |
+
|
551 |
+
/**
|
552 |
+
* adds some HTML comments in the page so people would know that this plugin powers their site.
|
553 |
+
*/
|
554 |
function orbisius_child_theme_creator_add_plugin_credits() {
|
555 |
// pull only these vars
|
556 |
$default_headers = array(
|
557 |
+
'Name' => 'Plugin Name',
|
558 |
+
'PluginURI' => 'Plugin URI',
|
559 |
+
);
|
560 |
|
561 |
$plugin_data = get_file_data(__FILE__, $default_headers, 'plugin');
|
562 |
|
563 |
$url = $plugin_data['PluginURI'];
|
564 |
$name = $plugin_data['Name'];
|
565 |
+
|
566 |
printf(PHP_EOL . PHP_EOL . '<!-- ' . "Powered by $name | URL: $url " . '-->' . PHP_EOL . PHP_EOL);
|
567 |
}
|
568 |
|
569 |
/**
|
570 |
*/
|
571 |
class orbisius_child_theme_creator {
|
572 |
+
|
573 |
public $result = null;
|
574 |
public $target_dir_path; // /var/www/vhosts/domain.com/www/wp-content/themes/Parent-Theme-child-01/
|
575 |
|
579 |
*
|
580 |
* @param str $parent_theme_basedir
|
581 |
*/
|
582 |
+
|
583 |
public function __construct($parent_theme_basedir = '') {
|
584 |
$all_themes_root = get_theme_root();
|
585 |
+
|
586 |
$this->parent_theme_basedir = $parent_theme_basedir;
|
587 |
$this->parent_theme_dir = $all_themes_root . '/' . $parent_theme_basedir . '/';
|
588 |
|
595 |
} while (is_dir($target_dir));
|
596 |
|
597 |
$this->target_dir_path = $target_dir;
|
598 |
+
$this->target_base_dirname = basename($target_dir);
|
599 |
|
600 |
// this is appended to the new theme's name
|
601 |
$this->target_name_suffix = 'Child ' . sprintf("%02d", $i);
|
602 |
}
|
603 |
|
604 |
+
/**
|
605 |
+
* @param void
|
606 |
+
* @return string returns the dirname (not abs) of the child theme
|
607 |
+
*/
|
608 |
+
public function get_child_base_dir() {
|
609 |
+
return $this->target_base_dirname;
|
610 |
+
}
|
611 |
+
|
612 |
/**
|
613 |
* Loads files from a directory but skips . and ..
|
614 |
*/
|
615 |
public function load_files($dir) {
|
616 |
+
$files = orbisius_child_theme_creator_util::load_files();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
617 |
return $files;
|
618 |
}
|
619 |
|
626 |
*/
|
627 |
public function check_permissions() {
|
628 |
$target_dir_path = $this->target_dir_path;
|
629 |
+
|
630 |
if (!is_dir($target_dir_path)) {
|
631 |
if (!mkdir($target_dir_path, 0775)) {
|
632 |
throw new Exception("Target child theme directory cannot be created. This is probably a permission error. Cannot continue.");
|
636 |
|
637 |
if (count($files) > 0) {
|
638 |
throw new Exception("Target folder already exists and has file(s) in it. Cannot continue. Files: ["
|
639 |
+
. join(',', array_slice($files, 0, 5)) . ' ... ]');
|
640 |
}
|
641 |
}
|
642 |
|
645 |
throw new Exception("Target directory is not writable.");
|
646 |
}
|
647 |
}
|
648 |
+
|
649 |
+
/**
|
650 |
+
* What files do we have to copy from the parent theme.
|
651 |
+
* @var array
|
652 |
+
*/
|
653 |
+
private $main_files = array('screenshot.png', 'header.php', 'footer.php', );
|
654 |
+
|
655 |
+
/**
|
656 |
+
*
|
657 |
+
*/
|
658 |
+
public function add_files($files) {
|
659 |
+
$files = (array) $files;
|
660 |
+
$this->main_files = array_merge($files, $this->main_files);
|
661 |
+
}
|
662 |
|
663 |
/**
|
664 |
* Copy some files from the parent theme.
|
666 |
*/
|
667 |
public function copy_main_files() {
|
668 |
$stats = 0;
|
669 |
+
|
670 |
+
$main_files = $this->main_files;
|
671 |
|
672 |
foreach ($main_files as $file) {
|
673 |
if (!file_exists($this->parent_theme_dir . $file)) {
|
678 |
$stat = intval($stat);
|
679 |
$stats += $stat;
|
680 |
}
|
681 |
+
|
682 |
+
// Some themes have admin files for control panel stuff. So Let's copy it as well.
|
683 |
+
if (is_dir($this->parent_theme_dir . 'admin/')) {
|
684 |
+
orbisius_child_theme_creator_util::copy($this->parent_theme_dir . 'admin/', $this->target_dir_path . 'admin/');
|
685 |
+
}
|
686 |
}
|
687 |
|
688 |
/**
|
692 |
*/
|
693 |
public function generate_style() {
|
694 |
global $wp_version;
|
695 |
+
|
696 |
$plugin_data = get_plugin_data(__FILE__);
|
697 |
$app_link = $plugin_data['PluginURI'];
|
698 |
$app_title = $plugin_data['Name'];
|
699 |
|
700 |
+
$parent_theme_data = version_compare($wp_version, '3.4', '>=') ? wp_get_theme($this->parent_theme_basedir) : (object) get_theme_data($this->target_dir_path . 'style.css');
|
|
|
|
|
701 |
|
702 |
$buff = '';
|
703 |
$buff .= "/*\n";
|
713 |
$buff .= "\n/* Generated by $app_title ($app_link) on " . date('r') . " */ \n\n";
|
714 |
|
715 |
$buff .= "@import url('../$this->parent_theme_basedir/style.css');\n";
|
716 |
+
|
717 |
file_put_contents($this->target_dir_path . 'style.css', $buff);
|
718 |
|
719 |
// RTL langs; make rtl.css to point to the parent file as well
|
720 |
if (file_exists($this->parent_theme_dir . 'rtl.css')) {
|
721 |
+
$rtl_buff = '';
|
722 |
$rtl_buff .= "/*\n";
|
723 |
$rtl_buff .= "Theme Name: $parent_theme_data->Name $this->target_name_suffix\n";
|
724 |
$rtl_buff .= "Template: $this->parent_theme_basedir\n";
|
751 |
function log($msg) {
|
752 |
error_log($msg . "\n", 3, ini_get('error_log'));
|
753 |
}
|
754 |
+
|
755 |
}
|
756 |
|
757 |
+
/**
|
758 |
+
* Util funcs
|
759 |
+
*/
|
760 |
class orbisius_child_theme_creator_util {
|
761 |
+
/**
|
762 |
+
* Recursive function to copy (all subdirectories and contents).
|
763 |
+
* It doesn't create folder in the target folder.
|
764 |
+
* Note: this may be slow if there are a lot of files.
|
765 |
+
* The native call might be quicker.
|
766 |
+
*
|
767 |
+
* Example: src: folder/1/ target: folder/2/
|
768 |
+
* @see http://stackoverflow.com/questions/5707806/recursive-copy-of-directory
|
769 |
+
*/
|
770 |
+
static public function copy($src, $dest, $perm = 0775) {
|
771 |
+
if (!is_dir($dest)) {
|
772 |
+
mkdir($dest, $perm, 1);
|
773 |
+
}
|
774 |
+
|
775 |
+
if (is_dir($src)) {
|
776 |
+
$dir = opendir($src);
|
777 |
+
|
778 |
+
while ( false !== ( $file = readdir($dir) ) ) {
|
779 |
+
if ( $file == '.' || $file == '..' || $file == '.git' || $file == '.svn' ) {
|
780 |
+
continue;
|
781 |
+
}
|
782 |
+
|
783 |
+
$new_src = rtrim($src, '/') . '/' . $file;
|
784 |
+
$new_dest = rtrim($dest, '/') . '/' . $file;
|
785 |
+
|
786 |
+
if ( is_dir( $new_src ) ) {
|
787 |
+
self::copy( $new_src, $new_dest );
|
788 |
+
} else {
|
789 |
+
copy( $new_src, $new_dest );
|
790 |
+
}
|
791 |
+
}
|
792 |
+
|
793 |
+
closedir($dir);
|
794 |
+
} else { // can also handle simple copy commands
|
795 |
+
copy($src, $dest);
|
796 |
+
}
|
797 |
+
}
|
798 |
+
|
799 |
+
/**
|
800 |
+
* Loads files from a directory but skips . and ..
|
801 |
+
*/
|
802 |
+
public static function load_files($dir) {
|
803 |
+
$files = array();
|
804 |
+
$all_files = scandir($dir);
|
805 |
+
|
806 |
+
foreach ($all_files as $file) {
|
807 |
+
if ($file == '.' || $file == '..' || substr($file, 0, 1) == '.') { // skip hidden files
|
808 |
+
continue;
|
809 |
+
}
|
810 |
+
|
811 |
+
$files[] = $file;
|
812 |
+
}
|
813 |
+
|
814 |
+
return $files;
|
815 |
+
}
|
816 |
+
|
817 |
/**
|
818 |
* Outputs a message (adds some paragraphs).
|
819 |
*/
|
820 |
+
static public function msg($msg, $status = 0) {
|
821 |
$msg = join("<br/>\n", (array) $msg);
|
822 |
|
823 |
if (empty($status)) {
|
832 |
|
833 |
return $str;
|
834 |
}
|
835 |
+
|
836 |
}
|
837 |
+
|
838 |
+
/**
|
839 |
+
* HTML related methods
|
840 |
+
*/
|
841 |
+
class orbisius_child_theme_creator_html {
|
842 |
+
|
843 |
+
/**
|
844 |
+
*
|
845 |
+
* Appends a parameter to an url; uses '?' or '&'. It's the reverse of parse_str().
|
846 |
+
* If no URL is supplied no prefix is added (? or &)
|
847 |
+
*
|
848 |
+
* @param string $url
|
849 |
+
* @param array $params
|
850 |
+
* @return string
|
851 |
+
*/
|
852 |
+
public static function add_url_params($url, $params = array()) {
|
853 |
+
$str = $query_start = '';
|
854 |
+
|
855 |
+
$params = (array) $params;
|
856 |
+
|
857 |
+
if (empty($params)) {
|
858 |
+
return $url;
|
859 |
+
}
|
860 |
+
|
861 |
+
if (!empty($url)) {
|
862 |
+
$query_start = (strpos($url, '?') === false) ? '?' : '&';
|
863 |
+
}
|
864 |
+
|
865 |
+
$str = $url . $query_start . http_build_query($params);
|
866 |
+
|
867 |
+
return $str;
|
868 |
+
}
|
869 |
+
|
870 |
+
// generates HTML select
|
871 |
+
public static function html_select($name = '', $sel = null, $options = array(), $attr = '') {
|
872 |
+
$name = trim($name);
|
873 |
+
$elem_name = $name;
|
874 |
+
$elem_name = strtolower($elem_name);
|
875 |
+
$elem_name = preg_replace('#[^\w]#si', '_', $elem_name);
|
876 |
+
$elem_name = trim($elem_name, '_');
|
877 |
+
|
878 |
+
$html = "\n" . '<select id="' . esc_attr($elem_name) . '" name="' . esc_attr($name) . '" ' . $attr . '>' . "\n";
|
879 |
+
|
880 |
+
foreach ($options as $key => $label) {
|
881 |
+
$selected = $sel == $key ? ' selected="selected"' : '';
|
882 |
+
|
883 |
+
// if the key contains underscores that means these are labels
|
884 |
+
// and should be readonly
|
885 |
+
if (strpos($key, '__') !== false) {
|
886 |
+
$selected .= ' disabled="disabled" ';
|
887 |
+
}
|
888 |
+
|
889 |
+
if (preg_match('#__sys_([\w-]+)#si', $label, $matches)) {
|
890 |
+
$label = str_replace($matches[0], '', $label);
|
891 |
+
$selected .= " class='$matches[1]' ";
|
892 |
+
}
|
893 |
+
|
894 |
+
$html .= "\t<option value='$key' $selected>$label</option>\n";
|
895 |
+
}
|
896 |
+
|
897 |
+
$html .= '</select>';
|
898 |
+
$html .= "\n";
|
899 |
+
|
900 |
+
return $html;
|
901 |
+
}
|
902 |
+
|
903 |
+
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: lordspace
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7APYDVPBCSY9A
|
4 |
Tags: child theme, childtheme,childthemes,child themes,CSS, styling,resposive design,design,custom themeing, shared hosting, theme,themes,wp,wordpress,orbisius,theme creator
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.6
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
This plugin allows you to quickly create child themes from any theme that you have currently installed on your site/blog.
|
@@ -73,11 +73,33 @@ Then click on a theme and the plugin will create a child theme for you.
|
|
73 |
If your site becomes broken due to a child theme (mis)configuration. Please check another plugin of ours:
|
74 |
<a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-theme-fixer/?utm_source=orbisius-child-theme-creator&utm_medium=readme_troubleshooting&utm_campaign=product" target="_blank" title="[new window]">Orbisius Theme Fixer</a>
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
= What to do next? =
|
77 |
Go to http://club.orbisius.com and post suggestions in our forum for new features that you'd like to see in this plugin or its extensions.
|
78 |
|
79 |
== Changelog ==
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
= 1.0.3 =
|
82 |
* Tested with wp 3.6
|
83 |
* Added settings page in case users want to check it.
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7APYDVPBCSY9A
|
4 |
Tags: child theme, childtheme,childthemes,child themes,CSS, styling,resposive design,design,custom themeing, shared hosting, theme,themes,wp,wordpress,orbisius,theme creator
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.6.1
|
7 |
+
Stable tag: 1.0.4
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
This plugin allows you to quickly create child themes from any theme that you have currently installed on your site/blog.
|
73 |
If your site becomes broken due to a child theme (mis)configuration. Please check another plugin of ours:
|
74 |
<a href="http://club.orbisius.com/products/wordpress-plugins/orbisius-theme-fixer/?utm_source=orbisius-child-theme-creator&utm_medium=readme_troubleshooting&utm_campaign=product" target="_blank" title="[new window]">Orbisius Theme Fixer</a>
|
75 |
|
76 |
+
= The child theme is created but doesn't have some styles or doesn't show the admin panel of the parent theme =
|
77 |
+
OK. Please contact the theme author if his/her theme is child theme friendly.
|
78 |
+
Also which files does the theme need in order to work well.
|
79 |
+
|
80 |
+
= My Site is Broken =
|
81 |
+
!@$@!$. Ok. Calm down. When you created the theme did you click on copy functions.php from advanced options?
|
82 |
+
Ok. You'll need to use FTP client and go to in the wordpress folder and then wp-content/themes/AAAAA-child-01/ and delete functions.php
|
83 |
+
AAAAA is of course the directory of your parent theme.
|
84 |
+
|
85 |
= What to do next? =
|
86 |
Go to http://club.orbisius.com and post suggestions in our forum for new features that you'd like to see in this plugin or its extensions.
|
87 |
|
88 |
== Changelog ==
|
89 |
|
90 |
+
= 1.0.4 =
|
91 |
+
* Tested with wp 3.6.1
|
92 |
+
* Added a link in the Appearance
|
93 |
+
* Added header.php to the copied file list
|
94 |
+
* Added a checkbox in case the user wants to switch to the newly created theme
|
95 |
+
* Added a checkbox in case the user wants to copy the functions.php from the parent theme
|
96 |
+
* Removed parent theme's license from the copied list
|
97 |
+
* Removed the Create Child Theme From themes that are child themes already
|
98 |
+
* Skipping hidden files (files starting with a dot)
|
99 |
+
* Copying admin/ from the parent theme if it exists
|
100 |
+
* Added some security checks if the user actually has permission to install themes
|
101 |
+
* Fixed some notices
|
102 |
+
|
103 |
= 1.0.3 =
|
104 |
* Tested with wp 3.6
|
105 |
* Added settings page in case users want to check it.
|