-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,038 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
phpThumbOn 1.0.0 (02.08.2013) | ||
===================================== | ||
- Имя файла превьюхи максимально вычищенно от непонятных последовательностей символов | ||
- Картинки семантично раскладываются по папкам в соответствии с оригинальными картинками | ||
- Удалены постоянные проверки и отчистки всего кеша | ||
- Отключена поддержка AWS Amazon | ||
- Добавлен ряд параметров отвечающих за качество и тип превьюхи по умолчанию | ||
- Код сниппета оптимизирован под множественные вызовы |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* phpThumbOn | ||
* Создание превьюх картинок | ||
* | ||
* Copyright 2013 by Agel_Nash <[email protected]> | ||
* | ||
* @category images | ||
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html | ||
* @author Agel_Nash <[email protected]> | ||
* @date 02.08.2013 | ||
* @version 1.0.0 | ||
* | ||
*/ | ||
/** | ||
* @package phpThumbOn | ||
* @subpackage build | ||
*/ | ||
|
||
define('MODX_BASE_PATH', dirname(dirname(dirname(__FILE__))).'/'); | ||
define('MODX_CORE_PATH', MODX_BASE_PATH . 'core/'); | ||
define('MODX_MANAGER_PATH', MODX_BASE_PATH . 'manager/'); | ||
define('MODX_CONNECTORS_PATH', MODX_BASE_PATH . 'connectors/'); | ||
define('MODX_ASSETS_PATH', MODX_BASE_PATH . 'assets/'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?php | ||
/** | ||
* phpThumbOn | ||
* Создание превьюх картинок | ||
* | ||
* Copyright 2013 by Agel_Nash <[email protected]> | ||
* | ||
* @category images | ||
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html | ||
* @author Agel_Nash <[email protected]> | ||
* @date 02.08.2013 | ||
* @version 1.0. | ||
* | ||
*/ | ||
/** | ||
* @package phpThumbOn | ||
* @subpackage build | ||
*/ | ||
$mtime = microtime(); | ||
$mtime = explode(" ", $mtime); | ||
$mtime = $mtime[1] + $mtime[0]; | ||
$tstart = $mtime; | ||
set_time_limit(0); | ||
|
||
/* set package defines */ | ||
define('PKG_NAME','phpThumbOn'); | ||
define('PKG_NAME_LOWER',strtolower(PKG_NAME)); | ||
define('PKG_VERSION','1.0.0'); | ||
define('PKG_RELEASE','pl'); | ||
|
||
/* override with your own defines here (see build.config.sample.php) */ | ||
require_once dirname(__FILE__) . '/build.config.php'; | ||
require_once MODX_CORE_PATH . 'model/modx/modx.class.php'; | ||
require_once dirname(__FILE__). '/includes/functions.php'; | ||
|
||
$modx= new modX(); | ||
$root = dirname(dirname(__FILE__)).'/'; | ||
$assets = MODX_ASSETS_PATH.'components/'.PKG_NAME_LOWER.'/'; | ||
$sources= array ( | ||
'root' => $root, | ||
'build' => $root .'_build/', | ||
'resolvers' => $root . '_build/resolvers/', | ||
'data' => $root . '_build/data/', | ||
'properties' => $root . '_build/properties/', | ||
'events' => $root . '_build/data/events/', | ||
'source_core' => $root.'core/components/'.PKG_NAME_LOWER, | ||
'source_assets' => $root.'assets/components/'.PKG_NAME_LOWER, | ||
'plugins' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/plugins/', | ||
'snippets' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/snippets/', | ||
'lexicon' => $root.'core/components/'.PKG_NAME_LOWER.'/lexicon/', | ||
'docs' => $root.'core/components/'.PKG_NAME_LOWER.'/docs/', | ||
); | ||
unset($root); | ||
|
||
$modx->initialize('mgr'); | ||
echo '<pre>'; | ||
$modx->setLogLevel(modX::LOG_LEVEL_INFO); | ||
$modx->setLogTarget('ECHO'); | ||
|
||
$modx->loadClass('transport.modPackageBuilder','',false, true); | ||
$builder = new modPackageBuilder($modx); | ||
$builder->createPackage(PKG_NAME,PKG_VERSION,PKG_RELEASE); | ||
$builder->registerNamespace(PKG_NAME_LOWER,false,true,'{core_path}components/'.PKG_NAME_LOWER.'/'); | ||
|
||
/* package snippets */ | ||
$snippets = include $sources['data'].'transport.snippets.php'; | ||
if (!is_array($snippets)) { $modx->log(modX::LOG_LEVEL_FATAL,'Adding snippets failed.'); } | ||
$attr = array( | ||
xPDOTransport::PRESERVE_KEYS => false, | ||
xPDOTransport::UPDATE_OBJECT => true, | ||
xPDOTransport::UNIQUE_KEY => 'name', | ||
); | ||
$i = 1; | ||
foreach ($snippets as $snippet) { | ||
$vehicle = $builder->createVehicle($snippet,$attr); | ||
if ($i == count($snippets)) { | ||
$vehicle->resolve('file',array( | ||
'source' => $sources['source_core'], | ||
'target' => "return MODX_CORE_PATH . 'components/';", | ||
)); | ||
$vehicle->resolve('file',array( | ||
'source' => $sources['source_assets'], | ||
'target' => "return MODX_ASSETS_PATH . 'components/';", | ||
)); | ||
} | ||
$builder->putVehicle($vehicle); | ||
$i++; | ||
} | ||
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($snippets).' Snippets.'); flush(); | ||
|
||
/* load system settings */ | ||
$settings = include_once $sources['data'].'transport.settings.php'; | ||
if (!is_array($settings)) $modx->log(modX::LOG_LEVEL_FATAL,'No settings returned.'); | ||
$attributes= array( | ||
xPDOTransport::UNIQUE_KEY => 'key', | ||
xPDOTransport::PRESERVE_KEYS => true, | ||
xPDOTransport::UPDATE_OBJECT => false, | ||
); | ||
foreach ($settings as $setting) { | ||
$vehicle = $builder->createVehicle($setting,$attributes); | ||
$builder->putVehicle($vehicle); | ||
} | ||
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($settings).' System Settings.'); flush(); | ||
unset($settings,$setting,$attributes); | ||
|
||
/* now pack in the license file, readme and setup options */ | ||
$builder->setPackageAttributes(array( | ||
'license' => file_get_contents($sources['docs'] . 'license.txt'), | ||
'readme' => file_get_contents($sources['docs'] . 'readme.txt'), | ||
'changelog' => file_get_contents($sources['docs'] . 'changelog.txt'), | ||
)); | ||
|
||
$builder->pack(); | ||
|
||
$mtime= microtime(); | ||
$mtime= explode(" ", $mtime); | ||
$mtime= $mtime[1] + $mtime[0]; | ||
$tend= $mtime; | ||
$totalTime= ($tend - $tstart); | ||
$totalTime= sprintf("%2.4f s", $totalTime); | ||
|
||
$modx->log(modX::LOG_LEVEL_INFO,"\n<br />Package Built.<br />\nExecution time: {$totalTime}\n"); | ||
|
||
exit (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
/** | ||
* phpThumbOn | ||
* Создание превьюх картинок | ||
* | ||
* Copyright 2013 by Agel_Nash <[email protected]> | ||
* | ||
* @category images | ||
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html | ||
* @author Agel_Nash <[email protected]> | ||
* @date 02.08.2013 | ||
* @version 1.0.0 | ||
* | ||
*/ | ||
/** | ||
* @package phpThumbOn | ||
* @subpackage build | ||
*/ | ||
|
||
$settings = array(); | ||
|
||
//Имя папки с картинками | ||
$settings['phpthumbon.images_dir']= $modx->newObject('modSystemSetting'); | ||
$settings['phpthumbon.images_dir']->fromArray(array( | ||
'key' => 'phpthumbon.images_dir', | ||
'value' => 'images', | ||
'xtype' => 'textfield', | ||
'namespace' => 'phpthumbon', | ||
'area' => 'paths', | ||
),'',true,true); | ||
|
||
//Качество картинки по умолчанию | ||
$settings['phpthumbon.quality']= $modx->newObject('modSystemSetting'); | ||
$settings['phpthumbon.quality']->fromArray(array( | ||
'key' => 'phpthumbon.quality', | ||
'value' => '96', | ||
'xtype' => 'textfield', | ||
'namespace' => 'phpthumbon', | ||
'area' => 'general', | ||
),'',true,true); | ||
|
||
//Имя папки кеша | ||
$settings['phpthumbon.cache_dir']= $modx->newObject('modSystemSetting'); | ||
$settings['phpthumbon.cache_dir']->fromArray(array( | ||
'key' => 'phpthumbon.cache_dir', | ||
'value' => 'cache_image', | ||
'xtype' => 'textfield', | ||
'namespace' => 'phpthumbon', | ||
'area' => 'path', | ||
),'',true,true); | ||
|
||
//Тип картинки по умолчанию | ||
$settings['phpthumbon.ext']= $modx->newObject('modSystemSetting'); | ||
$settings['phpthumbon.ext']->fromArray(array( | ||
'key' => 'phpthumbon.ext', | ||
'value' => 'jpeg', | ||
'xtype' => 'textfield', | ||
'namespace' => 'phpthumbon', | ||
'area' => 'general', | ||
),'',true,true); | ||
|
||
//Путь к картинки с изображением "картинка не существует" | ||
$settings['phpthumbon.noimage']= $modx->newObject('modSystemSetting'); | ||
$settings['phpthumbon.noimage']->fromArray(array( | ||
'key' => 'phpthumbon.noimage', | ||
'value' => '{assets_path}components/phpthumbon/noimage.jpg', | ||
'xtype' => 'textfield', | ||
'namespace' => 'phpthumbon', | ||
'area' => 'path', | ||
),'',true,true); | ||
|
||
return $settings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* phpThumbOn | ||
* Создание превьюх картинок | ||
* | ||
* Copyright 2013 by Agel_Nash <[email protected]> | ||
* | ||
* @category images | ||
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html | ||
* @author Agel_Nash <[email protected]> | ||
* @date 02.08.2013 | ||
* @version 1.0.0 | ||
* | ||
*/ | ||
/** | ||
* @package phpThumbOn | ||
* @subpackage build | ||
*/ | ||
$snippets = array(); | ||
|
||
$snippets[0]= $modx->newObject('modSnippet'); | ||
$snippets[0]->fromArray(array( | ||
'id' => 0, | ||
'name' => PKG_NAME_LOWER, | ||
'description' => 'Создание превьюх картинок', | ||
'snippet' => getSnippetContent($sources['source_core'].'/elements/snippets/snippet.phpthumbon.php'), | ||
)); | ||
$snippets[0]->setProperties(array( | ||
array( | ||
'name' => 'input', | ||
'value' => '', | ||
'type' => 'textfield', | ||
'desc' => 'phpthumbon.input', | ||
'lexicon' => 'phpthumbon:properties' | ||
),array( | ||
'name' => 'options', | ||
'value' => '', | ||
'type' => 'textfield', | ||
'desc' => 'phpthumbon.folder', | ||
'lexicon' => 'phpthumbon:properties' | ||
)) | ||
); | ||
return $snippets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
/** | ||
* Functions for building | ||
*/ | ||
function getSnippetContent($filename) { | ||
$o = file_get_contents($filename); | ||
$o = str_replace('<?php','',$o); | ||
$o = str_replace('?>','',$o); | ||
$o = trim($o); | ||
return $o; | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
phpThumbOn 1.0.0 (02.08.2013) | ||
===================================== | ||
- Имя файла превьюхи максимально вычищенно от непонятных последовательностей символов | ||
- Картинки семантично раскладываются по папкам в соответствии с оригинальными картинками | ||
- Удалены постоянные проверки и отчистки всего кеша | ||
- Отключена поддержка AWS Amazon | ||
- Добавлен ряд параметров отвечающих за качество и тип превьюхи по умолчанию | ||
- Код сниппета оптимизирован под множественные вызовы |
Oops, something went wrong.