This repository has been archived by the owner on May 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
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
0 parents
commit 4b2d57a
Showing
15 changed files
with
393 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,2 @@ | ||
.git | ||
/_build/build.config.php |
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,141 @@ | ||
<?php | ||
|
||
|
||
$mtime= microtime(); | ||
$mtime= explode(" ", $mtime); | ||
$mtime= $mtime[1] + $mtime[0]; | ||
$tstart = $mtime; | ||
|
||
|
||
print '<pre>'; | ||
require_once dirname(__FILE__). '/build.config.php'; | ||
|
||
|
||
$modx= new modX(); | ||
|
||
|
||
$modx->initialize('mgr'); | ||
$modx->setLogLevel(modX::LOG_LEVEL_INFO); | ||
$modx->setLogTarget('ECHO'); echo '<pre>'; flush(); | ||
|
||
$modx->loadClass('transport.modPackageBuilder','',false, true); | ||
$builder = new modPackageBuilder($modx); | ||
$builder->createPackage(PKG_NAME_LOWER,PKG_VERSION,PKG_RELEASE); | ||
$builder->registerNamespace(PKG_NAME_LOWER,false,true,'{core_path}components/'.PKG_NAME_LOWER.'/'); | ||
$modx->getService('lexicon','modLexicon'); | ||
$modx->lexicon->load(PKG_NAME_LOWER.':properties'); | ||
|
||
/* load action/menu */ | ||
$attributes = array ( | ||
xPDOTransport::PRESERVE_KEYS => true, | ||
xPDOTransport::UPDATE_OBJECT => true, | ||
xPDOTransport::UNIQUE_KEY => 'text', | ||
xPDOTransport::RELATED_OBJECTS => true, | ||
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array ( | ||
'Action' => array ( | ||
xPDOTransport::PRESERVE_KEYS => false, | ||
xPDOTransport::UPDATE_OBJECT => true, | ||
xPDOTransport::UNIQUE_KEY => array ('namespace','controller'), | ||
), | ||
), | ||
); | ||
|
||
|
||
/* add namespace */ | ||
$namespace = $modx->newObject('modNamespace'); | ||
$namespace->set('name', NAMESPACE_NAME); | ||
$namespace->set('path',"{core_path}components/".PKG_NAME_LOWER."/"); | ||
$namespace->set('assets_path',"{assets_path}components/".PKG_NAME_LOWER."/"); | ||
$vehicle = $builder->createVehicle($namespace,array( | ||
xPDOTransport::UNIQUE_KEY => 'name', | ||
xPDOTransport::PRESERVE_KEYS => true, | ||
xPDOTransport::UPDATE_OBJECT => true, | ||
)); | ||
$builder->putVehicle($vehicle); | ||
$modx->log(modX::LOG_LEVEL_INFO,"Packaged in ".NAMESPACE_NAME." namespace."); flush(); | ||
unset($vehicle,$namespace); | ||
|
||
/* create category */ | ||
$category= $modx->newObject('modCategory'); | ||
$category->set('id',1); | ||
$category->set('category',PKG_NAME); | ||
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in category.'); flush(); | ||
|
||
/* menus */ | ||
$menus = include $sources['data'].'transport.menu.php'; | ||
foreach($menus as $menu){ | ||
$vehicle= $builder->createVehicle($menu, $attributes); | ||
$builder->putVehicle($vehicle); | ||
$modx->log(modX::LOG_LEVEL_INFO,"Packaged in ".$menu->text." menu."); | ||
} | ||
unset($vehicle,$action); | ||
|
||
/* create category vehicle */ | ||
$attr = array( | ||
xPDOTransport::UNIQUE_KEY => 'category', | ||
xPDOTransport::PRESERVE_KEYS => false, | ||
xPDOTransport::UPDATE_OBJECT => true, | ||
xPDOTransport::RELATED_OBJECTS => true, | ||
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array ( | ||
'Snippets' => array( | ||
xPDOTransport::PRESERVE_KEYS => false, | ||
xPDOTransport::UPDATE_OBJECT => true, | ||
xPDOTransport::UNIQUE_KEY => 'name', | ||
), | ||
'Plugins' => array( | ||
xPDOTransport::PRESERVE_KEYS => false, | ||
xPDOTransport::UPDATE_OBJECT => true, | ||
xPDOTransport::UNIQUE_KEY => 'name', | ||
), | ||
'PluginEvents' => array( | ||
xPDOTransport::PRESERVE_KEYS => true, | ||
xPDOTransport::UPDATE_OBJECT => false, | ||
xPDOTransport::UNIQUE_KEY => array('pluginid','event'), | ||
), | ||
) | ||
); | ||
|
||
|
||
$vehicle = $builder->createVehicle($category,$attr); | ||
$vehicle->resolve('file',array( | ||
'source' => $sources['source_core'], | ||
'target' => "return MODX_CORE_PATH . 'components/';", | ||
)); | ||
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in CorePath'); flush(); | ||
|
||
$vehicle->resolve('file',array( | ||
'source' => $sources['source_assets'], | ||
'target' => "return MODX_ASSETS_PATH . 'components/';", | ||
)); | ||
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in AssetsPath'); flush(); | ||
|
||
|
||
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in resolvers.'); | ||
|
||
flush(); | ||
|
||
$builder->putVehicle($vehicle); | ||
|
||
/* 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'), | ||
)); | ||
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in package attributes.'); flush(); | ||
|
||
$modx->log(modX::LOG_LEVEL_INFO,'Packing...'); flush(); | ||
$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,41 @@ | ||
<?php | ||
$menus = array(); | ||
|
||
/* | ||
* Основной контроллер | ||
*/ | ||
|
||
$action= $modx->newObject('modAction'); | ||
$action->fromArray(array( | ||
'id' => 1, | ||
'namespace' => NAMESPACE_NAME, | ||
'parent' => 0, | ||
'controller' => 'console', | ||
'haslayout' => 1, | ||
'lang_topics' => 'console:default', | ||
'assets' => '', | ||
),'',true,true); | ||
|
||
/* load action into menu */ | ||
$menu= $modx->newObject('modMenu'); | ||
$menu->fromArray(array( | ||
'text' => 'console', | ||
'parent' => 'components', | ||
'description' => 'console_desc', | ||
'icon' => 'images/icons/plugin.gif', | ||
'menuindex' => 0, | ||
'params' => '', | ||
'handler' => '', | ||
'permissions' => 'console', | ||
),'',true,true); | ||
$menu->addOne($action); | ||
unset($action); | ||
|
||
$menus[] = $menu; | ||
|
||
|
||
|
||
|
||
$menus[] = $menu; | ||
|
||
return $menus; |
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,40 @@ | ||
<?php | ||
/** | ||
* modExtra | ||
* | ||
* Copyright 2010 by Shaun McCormick <[email protected]> | ||
* | ||
* modExtra is free software; you can redistribute it and/or modify it under the | ||
* terms of the GNU General Public License as published by the Free Software | ||
* Foundation; either version 2 of the License, or (at your option) any later | ||
* version. | ||
* | ||
* modExtra is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* modExtra; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
* Place, Suite 330, Boston, MA 02111-1307 USA | ||
* | ||
* @package modextra | ||
*/ | ||
/** | ||
* Helper method for grabbing files | ||
* | ||
* @package modextra | ||
* @subpackage build | ||
*/ | ||
|
||
/** | ||
* @param string $filename | ||
* @return mixed|string | ||
*/ | ||
function getSnippetContent($filename) { | ||
// print "<br />Try to open file: {$filename}<br />\n"; | ||
$o = file_get_contents($filename); | ||
$o = str_replace('<?php','',$o); | ||
$o = str_replace('?>','',$o); | ||
$o = trim($o); | ||
return $o; | ||
} |
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,12 @@ | ||
<?php | ||
require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.core.php'; | ||
require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php'; | ||
require_once MODX_CONNECTORS_PATH.'index.php'; | ||
|
||
|
||
$processor_path = $modx->getOption('console.core_path', null, $modx->getOption('core_path').'components/console/').'processors/'; | ||
|
||
$modx->request->handleRequest(array( | ||
'processors_path' => $processor_path, | ||
'location' => '' | ||
)); |
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,16 @@ | ||
<?php | ||
|
||
class ConsoleManagerController extends modExtraManagerController{ | ||
|
||
function __construct(modX &$modx, $config = array()) { | ||
parent::__construct($modx, $config); | ||
$this->config['namespace_assets_path'] = $modx->call('modNamespace','translatePath',array(&$modx, $this->config['namespace_assets_path'])); | ||
$this->config['assets_url'] = $modx->getOption('console.assets_url', null, $modx->getOption('assets_url').'components/console/'); | ||
$this->config['connector_url'] = $this->config['assets_url'].'connectors/'; | ||
} | ||
|
||
function getTemplate($tpl) { | ||
return $this->config['namespace_path']."templates/default/{$tpl}"; | ||
} | ||
} | ||
?> |
Empty file.
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,16 @@ | ||
<?php | ||
|
||
class ConsoleIndexManagerController extends ConsoleManagerController{ | ||
|
||
function process(array $scriptProperties = array()) { | ||
$this->modx->invokeEvent('OnSnipFormPrerender'); | ||
return array( | ||
"config" => $this->modx->toJSON($this->config), | ||
); | ||
} | ||
|
||
function getTemplateFile() { | ||
return $this->getTemplate('index.tpl'); | ||
} | ||
} | ||
?> |
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,3 @@ | ||
Console-1.1.0-rc | ||
============================================================= | ||
|
Empty file.
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,4 @@ | ||
Console | ||
===================================================== | ||
|
||
Console allow to execute php-code in front-end by simple interface. |
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,5 @@ | ||
<?php | ||
|
||
$_lang['console'] = 'Console'; | ||
$_lang['console_desc'] = 'Console for execution php-code'; | ||
|
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,5 @@ | ||
<?php | ||
|
||
$_lang['console'] = 'Console'; | ||
$_lang['console_desc'] = 'Консоль для выполнения php-кода'; | ||
|
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,22 @@ | ||
<?php | ||
|
||
class ConsoleExecProcessor extends modProcessor{ | ||
var $permission = 'console'; | ||
|
||
function checkPermissions() { | ||
if(!$this->modx->hasPermission($this->permission)){ | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
public function process() { | ||
$modx = & $this->modx; | ||
$code = $this->getProperty('code'); | ||
$code = preg_replace('/^ *(<\?php|<\?)/mi', '', $code); | ||
return eval($code); | ||
} | ||
} | ||
|
||
return 'ConsoleExecProcessor'; | ||
?> |
Oops, something went wrong.