Skip to content
Permalink
Browse files

Save theme screenshot from repo

  • Loading branch information...
Ayoola FALOLA
Ayoola FALOLA committed May 18, 2019
1 parent 98f997e commit d8381a994a9cce81452c51be34fc927a2e5e5e90
Showing with 19 additions and 1 deletion.
  1. +19 −1 pagecarton/core/library/Ayoola/Extension/Import/Repository.php
@@ -89,13 +89,17 @@ protected function init()
$content = self::fetchLink( $link, array( 'time_out' => 28800, 'connect_time_out' => 28800, 'raw_response_header' => true, 'return_as_array' => true, ) );
$filename = tempnam( CACHE_DIR, __CLASS__ ) . '';
if(preg_match('/Content-Disposition: .*filename=([^ ]+)/', $content['options']['raw_response_header'], $matches)) {
if(preg_match('/Content-Disposition: .*filename=([^0-9A-Za-z_-.]+)/', $content['options']['raw_response_header'], $matches)) {
$filename .= $matches[1];
// var_export( $matches );
}
else
{
$filename .= '.tar.gz';
}
// var_export( $filename );
// var_export( $content['options'] );
// exit();
@@ -104,6 +108,20 @@ protected function init()
file_put_contents( $filename, $content['response'] );
$values = static::getOtherInstallOptions( $filename );
copy( $filename, $filename . '.copy.tar.gz' );
// add screenshot
$repository = 'Ayoola_Phar_Data';
$repository = new $repository( $filename );
// var_export( $filename );
$repository->startBuffering();
$repository['screenshot.jpg'] = file_get_contents( $photoUrl );
$repository->stopBuffering();
// $repository->compress( Ayoola_Phar::GZ );
// var_export( Ayoola_Doc::getFiles( dirname( $filename ) ) );
// exit();
try
{
$class = new static::$_pluginClass( array( 'xno_init' => true, 'fake_values' => $values, 'path' => $filename, ) );

0 comments on commit d8381a9

Please sign in to comment.
You can’t perform that action at this time.