Skip to content

Commit 88134d4

Browse files
author
David Ryan
committed
all the things 🌮
1 parent 87ae7ed commit 88134d4

File tree

581 files changed

+74128
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

581 files changed

+74128
-113
lines changed

.gitignore

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/

app/admin/class-auth-assets.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace PHX_WP_DEVKIT\V_1_2\Admin;
3+
namespace PHX_WP_DEVKIT\V_2_1\Admin;
44

55
/**
66
* Register and enqueue assets used in the WordPress Admin or only when a user is authenticated here.

app/admin/class-generators-page.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace PHX_WP_DEVKIT\V_1_2\Admin;
3+
namespace PHX_WP_DEVKIT\V_2_1\Admin;
44

55
class Generators_Page {
66
/**
@@ -51,7 +51,6 @@ function __construct( $installed_dir, $installed_url, $version ) {
5151
*/
5252
function process_download() {
5353
$data = $this->gather_submitted_data();
54-
error_log( var_export( $data, true ) );
5554
$plugin = isset( $data['plugin_arch_type'] ) ? $data['plugin_arch_type'] : 'simple';
5655
$data['generator_version'] = $this->version;
5756
new Product_Machine(

app/admin/class-init.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace PHX_WP_DEVKIT\V_1_2\Admin;
3+
namespace PHX_WP_DEVKIT\V_2_1\Admin;
44

55
/**
66
* Class Init

app/admin/class-plugin-generator-form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace PHX_WP_DEVKIT\V_1_2\Admin;
3+
namespace PHX_WP_DEVKIT\V_2_1\Admin;
44

55
class Plugin_Generator_Form {
66

app/admin/class-product-machine.php

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace PHX_WP_DEVKIT\V_1_2\Admin;
3+
namespace PHX_WP_DEVKIT\V_2_1\Admin;
44

55
use RecursiveDirectoryIterator;
66
use RecursiveIteratorIterator;
@@ -25,10 +25,9 @@ public function __construct( $filename, $origin_dir, $tmp_dir, $data, $config )
2525
/**
2626
* Each file gets passed through this filter for processing
2727
*/
28-
add_filter(
29-
'wp_phx_plugingen_file_contents',
30-
array( $this, 'process_file_contents_via_filter' )
31-
);
28+
add_filter( 'wp_phx_plugingen_file_contents', array( $this, 'process_file_contents_via_filter' ) );
29+
30+
// make zip download
3231
self::make_zip_download( $filename, $origin_dir, $tmp_dir, $data, $config );
3332
}
3433

@@ -54,6 +53,7 @@ static function make_zip_download( $filename, $origin_dir, $tmp_dir, $data, $con
5453
if ( $creation_success ) {
5554
// write json containing configuration data
5655
$plugin_data = apply_filters( 'wp_phx_plugingen_datazip', array( 'data' => $data, 'config' => $config ) );
56+
5757
$zip->addFromString( 'plugin-data.json', json_encode( $plugin_data ) );
5858
// maybe include license
5959
if ( 'gpl' === $data['plugin_license'] ) {
@@ -68,12 +68,14 @@ static function make_zip_download( $filename, $origin_dir, $tmp_dir, $data, $con
6868

6969
// VITAL FOR ALL FILES: give file relative path for zip
7070
$current_file_stub = str_replace( trailingslashit( $origin_dir ), '', $current_file );
71+
7172
// Run WordPress Filter on File
7273
$processed_file = apply_filters( 'wp_phx_plugingen_file_contents', [
7374
'contents' => file_get_contents( $current_file ), // modified
7475
'filename' => $current_file_stub, // modified
7576
'data' => $data, // data passthru, for read only
7677
] );
78+
7779
// add maybe renamed, maybe rebuilt file to new zip
7880
if ( is_array( $processed_file ) && ! empty( $processed_file['contents'] ) && is_string( $processed_file['contents'] ) ) {
7981
$zip->addFromString( $processed_file['filename'], $processed_file['contents'] );
@@ -105,6 +107,12 @@ static function make_zip_download( $filename, $origin_dir, $tmp_dir, $data, $con
105107
}
106108
}
107109

110+
/**
111+
* Main file processor used by generator to filter a file's contents and filename
112+
* @param $file
113+
*
114+
* @return array
115+
*/
108116
function process_file_contents_via_filter( $file ) {
109117
if (
110118
empty( $file )
@@ -122,6 +130,11 @@ function process_file_contents_via_filter( $file ) {
122130
return $file;
123131
}
124132

133+
/**
134+
* @param $file
135+
*
136+
* @return mixed
137+
*/
125138
static function process_file_contents( $file ) {
126139
$contents = $file['contents'];
127140
$d = $file['data'];
@@ -138,12 +151,15 @@ static function process_file_contents( $file ) {
138151
$important_files = apply_filters( 'wp_phx_plugingen_file_contents', array(
139152
'main.php',
140153
'README.md',
154+
'composer.json',
141155
) );
142156

143157
if ( in_array( $filename, $important_files ) ) {
144158
$contents = str_ireplace( '<%= AUTHORS %>', $d['plugin_authors'], $contents );
159+
$contents = str_ireplace( '<%= TEAM_NAME %>', ! empty( $d['plugin_teamorg'] ) ? $d['plugin_teamorg'] : '', $contents );
145160
$contents = str_ireplace( '<%= TEAM %>', ! empty( $d['plugin_teamorg'] ) ? ' - ' . $d['plugin_teamorg'] : '', $contents );
146161
$contents = str_ireplace( '<%= LICENSE_TEXT %>', self::version_text( $d ), $contents );
162+
$contents = str_ireplace( '<%= LICENSE_COMPOSER_STR %>', self::version_composer( $d ), $contents );
147163
$contents = str_ireplace( '<%= VERSION %>', ! empty( $d['plugin_ver'] ) ? $d['plugin_ver'] : '0.1.0', $contents );
148164
$contents = str_ireplace( '<%= DESC %>', $d['plugin_description'], $contents );
149165
if ( ! empty( $d['plugin_url'] ) ) {
@@ -179,6 +195,22 @@ static function version_text( $data ) {
179195
}
180196
}
181197

198+
static function version_composer( $data ) {
199+
if ( isset( $data['plugin_license'] ) ) {
200+
switch ( $data['plugin_license'] ) {
201+
case 'private':
202+
return 'proprietary';
203+
break;
204+
case 'gpl':
205+
default:
206+
return 'GPL-3.0-or-later';
207+
break;
208+
}
209+
} else {
210+
return 'proprietary';
211+
}
212+
}
213+
182214
static function process_filename( $file ) {
183215
if ( 'main.php' === $file['filename'] ) {
184216
return $file['data']['mainFilename'] . '.php';

app/admin/class-toolkit-dashboard-page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace PHX_WP_DEVKIT\V_1_2\Admin;
3+
namespace PHX_WP_DEVKIT\V_2_1\Admin;
44

55
class Toolkit_Dashboard_Page {
66
/**

app/admin/js/generator.js

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@ jQuery( document ).ready( function( $ ) {
33
var appData = window.wpPhxGenerator || {};
44
var appTemplate = wp.template( 'generator-app' );
55
var appContainer = $( '#generator-app' ).fadeIn();
6-
var dependencyLoader = $( '#plugin_autoload-wrap' );
7-
var versionField = $( '#plugin_ver-wrap' );
8-
var teamField = $( '#plugin_teamorg-wrap' );
9-
var githubField = $( '#plugin_repo_url-wrap' );
10-
var includeOptionsPanel = $( '#plugin_opts_panel-wrap' );
11-
var includeRest = $( '#plugin_rest_api-wrap' );
12-
var adminMarkdown = $( '#plugin_admin_pages-wrap' );
13-
var blankAdmin = $( '#plugin_admin_blank-wrap' );
14-
var assetScaffold = $( '#plugin_register_enqueue_assets-wrap' );
156

167
if ( 'true' === appData.doLocalAlert ) {
178
if ( confirm( 'Hmm... appears you\'re running this on a live server. It\'s' +
@@ -27,48 +18,6 @@ jQuery( document ).ready( function( $ ) {
2718

2819
function initApp() {
2920
appContainer.html( appTemplate( appData ) );
30-
31-
$( '#field-builder_show_adv' ).bind( 'change', function( evt ) {
32-
var isChecked = $( this ).prop( 'checked' );
33-
advToggle( isChecked );
34-
} );
35-
36-
$( '#field-plugin_opts_panel' ).bind( 'change', function( evt ) {
37-
var isChecked = $( this ).prop( 'checked' );
38-
panelToggle( isChecked );
39-
} );
40-
$( '#field-plugin_assets' ).bind( 'change', function( evt ) {
41-
var isChecked = $( this ).prop( 'checked' );
42-
if ( isChecked ) {
43-
$( '#plugin_assets_enqueue-wrap' ).fadeIn();
44-
} else {
45-
$( '#plugin_assets_enqueue-wrap' ).fadeOut();
46-
}
47-
} );
48-
}
49-
50-
function advToggle( toggle ) {
51-
var advFields = [
52-
dependencyLoader, versionField, teamField, githubField,
53-
includeOptionsPanel, includeRest, adminMarkdown, blankAdmin, assetScaffold
54-
];
55-
if ( toggle ) {
56-
$.each( advFields, function( val, field ) {
57-
$( field.selector ).fadeIn();
58-
} );
59-
} else {
60-
$.each( advFields, function( val, field ) {
61-
$( field.selector ).fadeOut();
62-
} );
63-
}
64-
}
65-
66-
function panelToggle( toggle ) {
67-
if ( toggle ) {
68-
$( '#plugin_opts_panel_type-wrap' ).fadeIn();
69-
} else {
70-
$( '#plugin_opts_panel_type-wrap' ).fadeOut();
71-
}
7221
}
7322

7423
} );

app/admin/plugin-generator-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"app": {
3-
"generator_version": "1.0.0",
3+
"generator_version": "2.1.0",
44
"generator_version_release_dates": {
55
"1.0.0": "11/13/2017"
66
},

app/boilerplates/simple/app/admin/class-app.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Admin;
44

5-
// protect file source
6-
defined( 'ABSPATH' ) or die();
7-
85
/**
96
* Class App
107
* @package <%= PKG %>

0 commit comments

Comments
 (0)