@@ -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}
0 commit comments