Skip to content

Commit 667555b

Browse files
author
David Ryan
committed
new generator bump
1 parent 130abb5 commit 667555b

33 files changed

+255
-789
lines changed

app/admin/class-auth-assets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ function __construct( $dir, $url, $version ) {
5050
/**
5151
* Register Assets
5252
*/
53-
add_action( 'init', array( $this, 'register_stylesheets' ) );
54-
add_action( 'init', array( $this, 'register_scripts' ) );
53+
add_action( 'App', array( $this, 'register_stylesheets' ) );
54+
add_action( 'App', array( $this, 'register_scripts' ) );
5555
}
5656

5757
/**

app/admin/class-product-machine.php

Lines changed: 8 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,7 @@ static function make_zip_download( $filename, $origin_dir, $tmp_dir, $data, $con
5959
if ( !! stristr( strval( $current_file ), 'ds_store' ) ) {
6060
continue; // skip system files
6161
}
62-
if ( ( // no assets or simple build AND is .css, .js or class-assets.php, then skip
63-
! isset( $data['plugin_register_enqueue_assets'] )
64-
|| 'simple' === $data['plugin_arch_type']
65-
)
66-
&& (
67-
!! stristr( strval( $current_file ), '.css' )
68-
|| !! stristr( strval( $current_file ), '.js' )
69-
|| !! stristr( strval( $current_file ), 'class-assets.php' )
70-
)
71-
) {
72-
continue;
73-
}
74-
// if simple AND isn't main.php, class-plugin.php or in wpphx dir, then skip
75-
if ( 'simple' === $data['plugin_arch_type']
76-
&& (
77-
! stristr( strval( $current_file ), 'main.php' )
78-
&& ! stristr( strval( $current_file ), 'class-plugin.php' )
79-
&& ! stristr( strval( $current_file ), 'wordpress-phoenix' )
80-
)
81-
) {
82-
continue;
83-
}
62+
8463
// VITAL FOR ALL FILES: give file relative path for zip
8564
$current_file_stub = str_replace( trailingslashit( $origin_dir ), '', $current_file );
8665
// Run WordPress Filter on File
@@ -96,24 +75,11 @@ static function make_zip_download( $filename, $origin_dir, $tmp_dir, $data, $con
9675
}
9776

9877
// only run these operations for standard plugins
99-
if ( 'simple' !== $data['plugin_arch_type'] ) {
100-
// add empties to key directories
101-
$blank_file = '<?php ' . PHP_EOL . '// *gentle wave* not the code you\'re looking for..' . PHP_EOL;
102-
$idx = '/index.php';
103-
$zip->addFromString( 'app' . $idx, $blank_file );
104-
$zip->addFromString( 'vendor' . $idx, $blank_file );
105-
$zip->addFromString( 'app/admin' . $idx, $blank_file );
106-
$zip->addFromString( 'app/assets' . $idx, $blank_file );
107-
$zip->addFromString( 'app/includes' . $idx, $blank_file );
108-
109-
// include options panel
110-
if ( isset( $data['plugin_opts_panel'] ) && 'on' === $data['plugin_opts_panel'] ) {
111-
$zip->addFromString(
112-
'vendor/wordpress-phoenix/wordpress-options-builder-class/wordpress-phoenix-options-panel.php',
113-
file_get_contents( dirname( __FILE__ ) . '/templates/wpop.php' )
114-
);
115-
}
116-
}
78+
// add empties to key directories
79+
$blank_file = '<?php ' . PHP_EOL . '// *gentle wave* not the code you\'re looking for..' . PHP_EOL;
80+
$idx = '/index.php';
81+
$zip->addFromString( 'app' . $idx, $blank_file );
82+
$zip->addFromString( 'app/admin' . $idx, $blank_file );
11783

11884
// close zip
11985
$zip->close();
@@ -159,7 +125,8 @@ static function process_file_contents( $file ) {
159125
$contents = str_ireplace( '<%= PRIMARY_NAMESPACE %>', $d['plugin_primary_namespace'], $contents );
160126
$contents = str_ireplace( '<%= SECONDARY_NAMESPACE %>', $d['plugin_secondary_namespace'], $contents );
161127
$sanitized_name = sanitize_title_with_dashes( $d['plugin_name'] );
162-
$contents = str_ireplace( '<%= SLUG %>', $sanitized_name, $contents );
128+
$contents = str_ireplace( '<%= DASHES_SLUG %>', $sanitized_name, $contents );
129+
$contents = str_ireplace( '<%= US_SLUG %>', strtolower( str_ireplace( '-', '_', $sanitized_name ) ), $contents );
163130
$contents = str_ireplace( '<%= PKG %>', str_ireplace( '-', '_', ucwords( $sanitized_name ) ), $contents );
164131

165132
if ( 'main.php' === $filename || 'README.md' === $filename ) {
@@ -180,58 +147,6 @@ static function process_file_contents( $file ) {
180147
$contents = str_ireplace( '<%= YEAR %>', current_time( "Y" ), $contents );
181148
$contents = str_ireplace( '<%= CURRENT_TIME %>', current_time( 'l jS \of F Y h:i:s A' ), $contents );
182149
$contents = str_ireplace( '<%= GENERATOR_VERSION %>', $d['generator_version'], $contents );
183-
184-
$panel_str = '';
185-
if ( isset( $d['plugin_opts_panel'] ) && 'on' === $d['plugin_opts_panel'] ) {
186-
$panel_str = "
187-
188-
// Load Options Panel
189-
if ( ! class_exists( 'WPOP\\V_3_1\\\Page' ) ) {
190-
include_once trailingslashit( dirname( __FILE__ ) ) . 'vendor/wordpress-phoenix/wordpress-options-builder-class/wordpress-phoenix-options-panel.php';
191-
}";
192-
}
193-
$contents = str_ireplace( '<%= INSTANTIATE_OPTIONS_PANEL %>', $panel_str, $contents );
194-
}
195-
196-
if ( stripos( $filename, 'class-plugin.php' ) ) {
197-
if ( 'simple' === $d['plugin_arch_type'] ) {
198-
$includes_init = '';
199-
$admin_init = '';
200-
201-
} else {
202-
$includes_init = 'new Includes\Init(
203-
trailingslashit( $this->installed_dir ),
204-
trailingslashit( $this->installed_url ),
205-
$this->version
206-
);';
207-
$admin_init = 'new Admin\Init(
208-
trailingslashit( $this->installed_dir ),
209-
trailingslashit( $this->installed_url ),
210-
$this->version
211-
);';
212-
}
213-
214-
$contents = str_ireplace( '<%= INCLUDES_INIT %>', $includes_init, $contents );
215-
$contents = str_ireplace( '<%= ADMIN_INIT %>', $admin_init, $contents );
216-
}
217-
218-
if ( ! isset( $d['plugin_register_enqueue_assets'] ) && stripos( $filename, 'class-init.php' ) ) {
219-
$initStr = '
220-
// handle global assets
221-
new Assets(
222-
$this->installed_dir,
223-
$this->installed_url,
224-
$version
225-
);';
226-
$contents = str_ireplace( $initStr, '', $contents );
227-
$authInit = '
228-
// handle authenticated stylesheets and scripts
229-
new Auth_Assets(
230-
$this->installed_dir,
231-
$this->installed_url,
232-
$this->version
233-
);';
234-
$contents = str_ireplace( $authInit, '', $contents );
235150
}
236151

237152
return $contents;
@@ -258,10 +173,6 @@ static function process_filename( $file ) {
258173
return $file['data']['mainFilename'] . '.php';
259174
}
260175

261-
if ( stripos( $file['filename'], '.css' ) || stripos( $file['filename'], '.js' ) ) {
262-
return str_ireplace( 'plugin-', $file['data']['mainFilename'] . '-', $file['filename'] );
263-
}
264-
265176
return $file['filename'];
266177
}
267178
}

app/admin/css/generator.css

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ td.primary {
4242
}
4343

4444

45-
#plugin_opts_panel_type-wrap,
46-
#plugin_autoload-wrap,
47-
#plugin_ver-wrap,
48-
#plugin_teamorg-wrap,
49-
#plugin_repo_url-wrap,
50-
#plugin_opts_panel-wrap,
51-
#plugin_rest_api-wrap,
52-
#plugin_admin_pages-wrap,
53-
#plugin_admin_blank-wrap,
54-
#plugin_register_enqueue_assets-wrap {
55-
display: none;
56-
}
45+
/*#plugin_opts_panel_type-wrap,*/
46+
/*#plugin_autoload-wrap,*/
47+
/*#plugin_ver-wrap,*/
48+
/*#plugin_teamorg-wrap,*/
49+
/*#plugin_repo_url-wrap,*/
50+
/*#plugin_opts_panel-wrap,*/
51+
/*#plugin_rest_api-wrap,*/
52+
/*#plugin_admin_pages-wrap,*/
53+
/*#plugin_admin_blank-wrap,*/
54+
/*#plugin_register_enqueue_assets-wrap {*/
55+
/*display: none;*/
56+
/*}*/
5757

5858

5959
.onoffswitch-wrap {

app/admin/plugin-generator-config.json

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@
5656
"key": "plugin_arch_type",
5757
"label": "Plugin Type",
5858
"choices": {
59-
"simple": "Simple",
60-
"standard": "Standard"
59+
"simple": "Simple"
6160
},
6261
"desc": "",
63-
"default": "standard",
64-
"placehold": "standard"
62+
"default": "simple",
63+
"placehold": "simple"
6564
},
6665
{
6766
"type": "radios",
@@ -90,28 +89,6 @@
9089
"default": "",
9190
"placehold": ""
9291
},
93-
{
94-
"type": "input",
95-
"inputType": "checkbox",
96-
"key": "builder_show_adv",
97-
"label": "Show Advanced Options",
98-
"desc": "Modify periphery defaults and include additional code",
99-
"default": "false",
100-
"placehold": ""
101-
},
102-
103-
{
104-
"type": "radios",
105-
"key": "plugin_autoload",
106-
"label": "Dependency Loader",
107-
"choices": {
108-
"manual": "Manual"
109-
},
110-
"desc": "Loader for 3rd party dependency packages <small>(doesn't affect default PSR-4 plugin file autoloading)</small>",
111-
"default": "manual",
112-
"placehold": "manual"
113-
},
114-
11592
{
11693
"type": "input",
11794
"inputType": "text",
@@ -136,22 +113,6 @@
136113
"desc": "What is your github plugin URL?",
137114
"default": "http://github.com/wordpress-phoenix",
138115
"placehold": "https://github.com/wordpress-phoenix/your-plugin-repo"
139-
},
140-
{
141-
"type": "input",
142-
"inputType": "checkbox",
143-
"key": "plugin_opts_panel",
144-
"label": "Include Options Panel",
145-
"desc": "Include and initialize an options panel to configure.",
146-
"default": "false"
147-
},
148-
{
149-
"type": "input",
150-
"inputType": "checkbox",
151-
"key": "plugin_register_enqueue_assets",
152-
"label": "Register and Enqueue Assets",
153-
"desc": "Provide CSS and JavaScript files for public and authenticated use.",
154-
"default": "true"
155116
}
156117
]
157118
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="timeinc-wp-plugin">
3+
<description>Custom plugin codesniffer exceptions.</description>
4+
<exclude-pattern>vendor/*</exclude-pattern>
5+
<exclude-pattern>lib/composer/*</exclude-pattern>
6+
<exclude-pattern>assets/*</exclude-pattern>
7+
<rule ref="WordPress-VIP"></rule>
8+
</ruleset>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
version: 2
2+
3+
jobs:
4+
build:
5+
docker:
6+
- image: circleci/php:7.1-node-browsers
7+
working_directory: ~/repo
8+
steps:
9+
- checkout
10+
- run: sudo chmod 777 -R ~
11+
- run: echo $PWD
12+
- run: ls -lart
13+
- run: env COMPOSER=composer-test.json composer install --prefer-source --no-interaction
14+
- run: sudo ./bin/phpcs --config-set installed_paths $(readlink -f vendor/wp-coding-standards/wpcs/)
15+
- run: env COMPOSER=composer-test.json composer test
16+
notify:
17+
docker:
18+
- image: circleci/node:latest
19+
steps:
20+
- run: sudo apt-get install httpie -y
21+
- run:
22+
name: Notify Slack Channel
23+
command: |
24+
date=$(date +"%s $*")
25+
if [ -z "${DEV_GROUP}" ]; then DEV_GROUP=${CIRCLE_PROJECT_USERNAME}; fi
26+
http POST $SLACK_WEBHOOK \
27+
channel='#seths-slack-bots' \
28+
username="${DEV_GROUP}-Deploybot" \
29+
icon_emoji=':octocat:' \
30+
attachments:="
31+
[{
32+
\"text\":\"CircleCI build ${CIRCLE_BUILD_NUM}. Release notes coming soon.\",
33+
\"author_name\":\"Github User: ${CIRCLE_USERNAME}\",
34+
\"author_link\":\"https://github.com/${CIRCLE_USERNAME}\",
35+
\"author_icon\":\"\",
36+
\"ts\":\"${date}\",
37+
\"color\":\"#36a64f\",
38+
\"fallback\":\"'t'\",
39+
\"title\":\"'Released ${CIRCLE_PROJECT_REPONAME} version ${CIRCLE_TAG} '\",
40+
\"title_link\":\"${CIRCLE_BUILD_URL}\",
41+
\"footer\":\"'${DEV_GROUP} CircleCI Deployment'\",
42+
\"footer_icon\":\"https://logo.clearbit.com/circleci.com/?size=64\"
43+
}]
44+
" \
45+
-v
46+
47+
workflows:
48+
version: 2
49+
build-n-notify:
50+
jobs:
51+
- build:
52+
filters:
53+
tags:
54+
only: /.*/
55+
- notify:
56+
requires:
57+
- build
58+
filters:
59+
tags:
60+
only: /.*/
61+
branches:
62+
ignore: /.*/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Expected Behavior
2+
<!--- If you're describing a bug, tell us what should happen -->
3+
<!--- If you're suggesting a change/improvement, tell us how it should work -->
4+
5+
## Current Behavior
6+
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
7+
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
8+
9+
## Steps to Reproduce (for bugs)
10+
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
11+
<!--- reproduce this bug. Include code to reproduce, if relevant -->
12+
1.
13+
2.
14+
3.
15+
4.
16+
17+
## Other Notes?
18+
<!--- How has this issue affected you? What are you trying to accomplish? -->
19+
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Description
2+
A few sentences describing the overall goals of the pull request. Please include any relevant JIRA tickets.
3+
4+
## Steps to Test or Reproduce
5+
Outline the steps to test the pull request and reproduce the original issue.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# dirs
2+
/bin/
3+
4+
# circle ci
5+
/lib/*/.circleci
6+
7+
# composer
8+
composer.phar
9+
/vendor/
10+
/lib/autoload.php
11+
!/lib/composer/
12+
!/lib/composer/installed.json
13+
/lib/composer/*
14+
15+
# windows junk
16+
Thumbs.db
17+
ehthumbs.db
18+
19+
# apple junk
20+
.DS_STORE
21+
.ds_store
22+
23+
# folder config file
24+
Desktop.ini
25+
26+
# sublime
27+
*.sublime-project
28+
*.sublime-workspace
29+
30+
# phpstorm
31+
.idea/

0 commit comments

Comments
 (0)