if (!empty($content)) { $snippet = $modx->newObject('modSnippet'); $snippet->fromArray(array('name' => $snippet_name, 'description' => $snippet_name . '_desc', 'snippet' => $content), '', true, true); $modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . $snippet_name . ' snippet.'); flush(); $path = $sources['properties'] . "{$snippet_name}.snippet.properties.php"; if (is_file($path)) { $properties = (include $path); $snippet->setProperties($properties); $modx->log(modX::LOG_LEVEL_INFO, 'Adding properties for ' . $snippet_name . ' snippet.'); flush(); } $snippets[] = $snippet; } $snippet_name = 'modHybridAuth.Register'; $content = getSnippetContent($sources['snippets'] . 'modHybridAuth.Register.php'); if (!empty($content)) { $snippet = $modx->newObject('modSnippet'); $snippet->fromArray(array('name' => $snippet_name, 'description' => $snippet_name . '_desc', 'snippet' => $content), '', true, true); $modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . $snippet_name . ' snippet.'); flush(); $path = $sources['properties'] . "{$snippet_name}.snippet.properties.php"; if (is_file($path)) { $properties = (include $path); $snippet->setProperties($properties); $modx->log(modX::LOG_LEVEL_INFO, 'Adding properties for ' . $snippet_name . ' snippet.'); flush(); } $snippets[] = $snippet; } unset($properties, $snippet, $path, $snippet_name, $content, $list);
<?php $snippets = array(); $tmp = array('xPoller2' => array('file' => 'xpoller2', 'description' => '')); foreach ($tmp as $k => $v) { /* @avr modSnippet $snippet */ $snippet = $modx->newObject('modSnippet'); $snippet->fromArray(array('id' => 0, 'name' => $k, 'description' => @$v['description'], 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.' . $v['file'] . '.php'), 'static' => BUILD_SNIPPET_STATIC, 'source' => 1, 'static_file' => 'core/components/' . PKG_NAME_LOWER . '/elements/snippets/snippet.' . $v['file'] . '.php'), '', true, true); $properties = (include $sources['build'] . 'properties/properties.' . $v['file'] . '.php'); $snippet->setProperties($properties); $snippets[] = $snippet; } unset($tmp, $properties); return $snippets;
* * Copyright 2010 by Shaun McCormick <*****@*****.**> * * 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 */ /** * Add snippets to build * * @package modextra * @subpackage build */ $snippets = array(); $snippets[0] = $modx->newObject('modSnippet'); $snippets[0]->fromArray(array('id' => 0, 'name' => 'modExtra', 'description' => 'Displays Items.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.modextra.php')), '', true, true); $properties = (include $sources['build'] . 'properties/properties.modextra.php'); $snippets[0]->setProperties($properties); unset($properties); return $snippets;
* Place, Suite 330, Boston, MA 02111-1307 USA * * @package mycomponent */ /** * Description: Array of snippet objects for MyComponent package * @package mycomponent * @subpackage build */ if (!function_exists('getSnippetContent')) { function getSnippetContent($filename) { $o = file_get_contents($filename); $o = str_replace('<?php', '', $o); $o = str_replace('?>', '', $o); $o = trim($o); return $o; } } $snippets = array(); $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => 'MySnippet1', 'description' => 'MySnippet1 for MyComponent.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/mysnippet1.snippet.php')), '', true, true); $properties = (include $sources['data'] . '/properties/properties.mysnippet1.php'); $snippets[1]->setProperties($properties); unset($properties); $snippets[2] = $modx->newObject('modSnippet'); $snippets[2]->fromArray(array('id' => 2, 'name' => 'MySnippet2', 'description' => 'MySnippet2 for MyComponent.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/mysnippet2.snippet.php')), '', true, true); $properties = (include $sources['data'] . '/properties/properties.mysnippet2.php'); $snippets[2]->setProperties($properties); unset($properties); return $snippets;
$events['OnDocFormSave'] = $modx->newObject('modPluginEvent'); $events['OnDocFormSave']->fromArray(array('event' => 'OnDocFormSave', 'priority' => 0, 'propertyset' => 0), '', true, true); $events['OnResourceSort'] = $modx->newObject('modPluginEvent'); $events['OnResourceSort']->fromArray(array('event' => 'OnResourceSort', 'priority' => 0, 'propertyset' => 0), '', true, true); if (is_array($events) && !empty($events)) { $plugins[0]->addMany($events); $modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugin Events for UrlHistory.'); flush(); } else { $modx->log(xPDO::LOG_LEVEL_ERROR, 'Could not find plugin events for UrlHistory!'); } unset($events); /* create the plugin object */ $plugins[1] = $modx->newObject('modPlugin'); $plugins[1]->set('id', 2); $plugins[1]->set('name', 'UrlHistory404'); $plugins[1]->set('description', 'Handles 404 and redirects form old urls.'); $plugins[1]->set('plugincode', getSnippetContent($sources['plugins'] . 'urlhistory404.plugin.php')); $plugins[1]->set('category', 0); $events = array(); $events['OnPageNotFound'] = $modx->newObject('modPluginEvent'); $events['OnPageNotFound']->fromArray(array('event' => 'OnPageNotFound', 'priority' => 0, 'propertyset' => 0), '', true, true); if (is_array($events) && !empty($events)) { $plugins[1]->addMany($events); $modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugin Events for UrlHistory404.'); flush(); } else { $modx->log(xPDO::LOG_LEVEL_ERROR, 'Could not find plugin events for UrlHistory404!'); } unset($events); return $plugins;
<?php /* * AholaX * * Copyright 2011 by Digital Butter <www.butter.com.hk> * * This file is part of AholaX, a port of Ahola Editor (ahola-editor.com) for MODX Revolution. * * AholaX 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. * * AholaX 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 * AholaX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, * Suite 330, Boston, MA 02111-1307 USA * */ $snippets = array(); $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => PKG_NAME, 'description' => 'AlohaX is a very front-end editing snippet powered by Aloha.', 'snippet' => getSnippetContent($sources['snippets'] . 'alohax.snippet.php'))); //$properties = include $sources['data'].'properties/properties.cmcampers.php'; //$snippets[1]->setProperties($properties); return $snippets;
<?php function getSnippetContent($filename) { $o = file_get_contents($filename); $o = trim(str_replace(array('<?php', '?>'), '', $o)); return $o; } $snippets = array(); //-- Add the main snippet (1) $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => 'mxcalendar', 'description' => 'Displays events in either calendar, list, or detail view.', 'snippet' => getSnippetContent($sources['elements'] . 'snippets/snippet.mxcalendars.php')), '', true, true); $properties = (include $sources['data'] . 'properties/properties.mxcalendars.php'); $snippets[1]->setProperties($properties); unset($properties); return $snippets;
<?php $plugins = array(); $plugin_name = PKG_NAME_LOWER; $content = getSnippetContent($sources['plugins'] . $plugin_name . '.plugin.php'); if (!empty($content)) { /* * New plugin */ $plugin = $modx->newObject('modPlugin'); $plugin->set('id', 1); $plugin->set('name', $plugin_name); $plugin->set('description', $plugin_name . '_desc'); $plugin->set('plugincode', $content); /* add plugin events */ $events = array(); $events['OnHandleRequest'] = $modx->newObject('modPluginEvent'); $events['OnHandleRequest']->fromArray(array('event' => 'OnHandleRequest', 'priority' => 0, 'propertyset' => 0), '', true, true); $plugin->addMany($events, 'PluginEvents'); $modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugin Events.'); flush(); $plugins[] = $plugin; } unset($plugin, $events, $plugin_name, $content); return $plugins;
<?php $snippets = array(); foreach (glob($sources['snippets'] . '/*.php') as $key => $value) { $name = str_replace('.snippet.php', '', substr($value, strrpos($value, '/') + 1, strlen($value))); $snippets[$name] = $modx->newObject('modSnippet'); $snippets[$name]->fromArray(array('id' => 1, 'name' => ucfirst($name), 'description' => PKG_NAME . ' ' . PKG_VERSION . '-' . PKG_RELEASE . ' snippet for MODx Revolution', 'content' => getSnippetContent($value))); if (file_exists(__DIR__ . '/properties/' . $name . '.snippet.properties.php')) { $snippets[$name]->setProperties(include_once __DIR__ . '/properties/' . $name . '.snippet.properties.php'); } } return $snippets;
* AjaxUpload 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 * AjaxUpload; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @package ajaxupload * @subpackage build * * snippets for AjaxUpload package */ $snippets = array(); $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => 'AjaxUpload', 'description' => 'Upload button for uploading multiple files with progress-bar.', 'snippet' => getSnippetContent($sources['snippets'] . 'ajaxupload.snippet.php')), '', TRUE, TRUE); $properties = (include $sources['properties'] . 'ajaxupload.properties.php'); $snippets[1]->setProperties($properties); unset($properties); $snippets[2] = $modx->newObject('modSnippet'); $snippets[2]->fromArray(array('id' => 2, 'name' => 'Formit2AjaxUpload', 'description' => 'AjaxUpload Formit preHook. Prefill the upload queue from Formit field.', 'snippet' => getSnippetContent($sources['snippets'] . 'formit2ajaxupload.snippet.php')), '', TRUE, TRUE); $properties = (include $sources['properties'] . 'formit2ajaxupload.properties.php'); $snippets[2]->setProperties($properties); unset($properties); $snippets[3] = $modx->newObject('modSnippet'); $snippets[3]->fromArray(array('id' => 3, 'name' => 'AjaxUpload2Formit', 'description' => 'AjaxUpload Formit hook. Save the upload queue into Formit field.', 'snippet' => getSnippetContent($sources['snippets'] . 'ajaxupload2formit.snippet.php')), '', TRUE, TRUE); $properties = (include $sources['properties'] . 'ajaxupload2formit.properties.php'); $snippets[3]->setProperties($properties); unset($properties); return $snippets;
<?php $plugins = array(); /* create the plugin object */ $plugins[0] = $modx->newObject('modPlugin'); $plugins[0]->fromArray(array('id' => 1, 'name' => 'XRouting', 'description' => 'XRouting is a simple plugin that handles requests for different contexts. It automatically switches the context based on a (sub)domain AND/OR subfolder.', 'plugincode' => getSnippetContent($sources['plugins'] . 'xrouting.plugin.php')), '', true, true); $events = array(); $events['OnHandleRequest'] = $modx->newObject('modPluginEvent'); $events['OnHandleRequest']->fromArray(array('event' => 'OnHandleRequest', 'priority' => 0, 'propertyset' => 0), '', true, true); $events['OnContextSave'] = $modx->newObject('modPluginEvent'); $events['OnContextSave']->fromArray(array('event' => 'OnContextSave', 'priority' => 0, 'propertyset' => 0), '', true, true); $events['OnContextRemove'] = $modx->newObject('modPluginEvent'); $events['OnContextRemove']->fromArray(array('event' => 'OnContextRemove', 'priority' => 0, 'propertyset' => 0), '', true, true); $events['OnSiteRefresh'] = $modx->newObject('modPluginEvent'); $events['OnSiteRefresh']->fromArray(array('event' => 'OnSiteRefresh', 'priority' => 0, 'propertyset' => 0), '', true, true); if (is_array($events) && !empty($events)) { $plugins[0]->addMany($events); $modx->log(xPDO::LOG_LEVEL_INFO, 'Added ' . count($events) . ' Plugin Events for the XRouting plugin.'); flush(); } else { $modx->log(xPDO::LOG_LEVEL_ERROR, 'Could not find plugin events for XRouting!'); flush(); } unset($events); return $plugins;
$modx->setLogLevel(modX::LOG_LEVEL_INFO); $modx->setLogTarget('ECHO'); $modx->loadClass('transport.modPackageBuilder', '', false, true); $builder = new modPackageBuilder($modx); $builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE); // Register namespace for this extra ------------------------------------------------- $builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/' . PKG_NAME_LOWER . '/'); /* create category */ $category = $modx->newObject('modCategory'); $category->set('id', 1); $category->set('category', 'MapsTv'); /* add snippets */ $modx->log(modX::LOG_LEVEL_INFO, 'Adding in snippets.'); $snippets = array(); $snippets[0] = $modx->newObject('modSnippet'); $snippets[0]->fromArray(array('id' => 1, 'name' => 'JSONtoChunk', 'description' => 'Custom output filter. If the input is an JSON array it will output the chunk you specified with placeholders for all the values.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/JSONtoChunk.snippet.php'))); if (is_array($snippets)) { $category->addMany($snippets); } else { $modx->log(modX::LOG_LEVEL_FATAL, 'Adding snippets failed.'); } /* 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'))); $vehicle = $builder->createVehicle($category, $attr); $builder->putVehicle($vehicle); // /* create category */ // $category= $modx->newObject('modCategory'); // $category->set('id',1); // $category->set('category',PKG_NAME); // $vehicle = $builder->createVehicle($category); // $category->addMany($plugin);
* * @package tools */ /** * Add snippets to build * * @package tools * @subpackage build */ $snippets = array(); $snippets[0] = $modx->newObject('modSnippet'); $snippets[0]->fromArray(array('id' => 0, 'name' => 'Executioner', 'description' => 'Quickly check execution time of a particular Snippet or Chunk.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.executioner.php')), '', true, true); $properties = (include $sources['build'] . 'properties/properties.executioner.php'); $snippets[0]->setProperties($properties); unset($properties); $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => 'inc', 'description' => 'Includes & process files (chunks/templates/php).', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.inc.php')), '', true, true); $properties = (include $sources['build'] . 'properties/properties.inc.php'); $snippets[1]->setProperties($properties); unset($properties); $snippets[2] = $modx->newObject('modSnippet'); $snippets[2]->fromArray(array('id' => 2, 'name' => 'now', 'description' => 'Return actual unix timestamp.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.now.php')), '', true, true); /*$properties = include $sources['build'].'properties/properties.tools.php'; $snippets[2]->setProperties($properties); unset($properties);*/ $snippets[3] = $modx->newObject('modSnippet'); $snippets[3]->fromArray(array('id' => 3, 'name' => 'om.locale', 'description' => 'Output modifier to bypass the setLocale plugin.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/outputmodifier.locale.php')), '', true, true); /*$properties = include $sources['build'].'properties/properties.tools.php'; $snippets[3]->setProperties($properties); unset($properties);*/ return $snippets;
* 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 * SyntaxHighlighter; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * * @package syntaxhighlighter */ /** * Description: Array of snippet objects for SyntaxHighlighter package * @package syntaxhighlighter * @subpackage build */ if (!function_exists('getSnippetContent')) { function getSnippetContent($filename) { $o = file_get_contents($filename); $o = str_replace('<?php', '', $o); $o = str_replace('?>', '', $o); $o = trim($o); return $o; } } $snippets = array(); $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => 'SyntaxHighlighter', 'description' => 'SyntaxHighlighter ' . PKG_VERSION . '-' . PKG_RELEASE . " A Revolution version of Alex Gorbatchev's JS Syntax Highlighter", 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/syntaxhighlighter.snippet.php')), '', true, true); $properties = (include $sources['data'] . '/properties/properties.syntaxhighlighter.php'); $snippets[1]->setProperties($properties); unset($properties); return $snippets;
* 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 * LogPageNotFound; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * * @package logpagenotfound */ /** * Description: Array of snippet objects for LogPageNotFound package * @package logpagenotfound * @subpackage build */ if (!function_exists('getSnippetContent')) { function getSnippetContent($filename) { $o = file_get_contents($filename); $o = str_replace('<?php', '', $o); $o = str_replace('?>', '', $o); $o = trim($o); return $o; } } $snippets = array(); $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => 'PageNotFoundLogReport', 'description' => 'PageNotFoundLogReport snippet for LogPageNotFound.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/pagenotfoundlogreport.snippet.php')), '', true, true); $properties = (include $sources['data'] . '/properties/properties.pagenotfoundlogreport.php'); $snippets[1]->setProperties($properties); unset($properties); return $snippets;
<?php $chunks = array(); /*$chunk_name = PKG_NAME_LOWER; $content = getSnippetContent($sources['chunks'] . $chunk_name . '.chunk.tpl'); if(!empty($content)){ $chunk = $modx->newObject('modChunk', array( 'name' => $chunk_name, 'description' => $chunk_name.'_desc', 'snippet' => $content, )); $chunks[] = $chunk; }*/ $list = array(PKG_NAME_LOWER); foreach ($list as $v) { $chunk_name = $v; $content = getSnippetContent($sources['chunks'] . $chunk_name . '.chunk.tpl'); if (!empty($content)) { $chunk = $modx->newObject('modChunk', array('name' => $chunk_name, 'description' => $chunk_name . '_desc', 'snippet' => $content)); $chunks[] = $chunk; } } unset($chunk, $chunk_name, $content); return $chunks;
require_once MODX_CORE_PATH . 'model/modx/modx.class.php'; require_once $sources['build'] . '/includes/functions.php'; $modx = new modX(); $modx->initialize('mgr'); echo '<pre>'; /* used for nice formatting of log messages */ $modx->setLogLevel(modX::LOG_LEVEL_INFO); $modx->setLogTarget('ECHO'); $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->log(modX::LOG_LEVEL_INFO, 'Created Transport Package and Namespace.'); /* add plugin */ $plugin = $modx->newObject('modPlugin'); $plugin->fromArray(array('id' => 1, 'name' => 'ActiveDirectory', 'description' => '', 'plugincode' => getSnippetContent($sources['plugins'] . 'plugin.activedirectory.php')), '', true, true); $events = (include $sources['data'] . 'events/events.activedirectory.php'); if (is_array($events) && !empty($events)) { $modx->log(modX::LOG_LEVEL_INFO, 'Added ' . count($events) . ' events to ActiveDirectory plugin.'); $plugin->addMany($events); } unset($events); $attributes = array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name', xPDOTransport::RELATED_OBJECTS => true, xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array('PluginEvents' => array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false, xPDOTransport::UNIQUE_KEY => array('pluginid', 'event')))); $vehicle = $builder->createVehicle($plugin, $attributes); $modx->log(modX::LOG_LEVEL_INFO, 'Adding file resolvers to plugin...'); $vehicle->resolve('file', array('source' => $sources['source_assets'], 'target' => "return MODX_ASSETS_PATH . 'components/';")); $vehicle->resolve('file', array('source' => $sources['source_core'], 'target' => "return MODX_CORE_PATH . 'components/';")); $vehicle->resolve('php', array('source' => $sources['resolvers'] . 'resolver.extpack.php')); /* $vehicle->resolve('php',array( 'source' => $sources['resolvers'] . 'resolver.patch.php',
<?php /** * Description: Array of snippet objects for mChimpX package * @package mchimpx * @subpackage build */ if (!function_exists('getSnippetContent')) { function getSnippetContent($filename) { $o = file_get_contents($filename); $o = str_replace('<?php', '', $o); $o = str_replace('?>', '', $o); $o = trim($o); return $o; } } $snippets = array(); $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => 'mChimpXSubscribe', 'description' => 'Subscribe users to the Mailchimp mailing list', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/mchimpxsubscribe.snippet.php')), '', true, true); unset($properties); return $snippets;
$o = trim($o); return $o; } } // Save Timings to Database ////////////////////////////////////////////////////////////////////////////////////////////////////////// $i = 0; $plugins[$i] = $modx->newObject('modPlugin'); $plugins[$i]->fromArray(array('id' => $i, 'name' => 'LogTimings', 'description' => 'Log Timings in Modx', 'plugincode' => getSnippetContent($sources['plugins'] . 'logtimings.plugins.php'), 'category' => 0), '', true, true); // Add Events for Plugin $events[0] = $modx->newObject('modPluginEvent'); $events[0]->fromArray(array('event' => 'OnWebPageComplete', 'priority' => 0, 'propertyset' => 0), '', true, true); $plugins[$i]->addMany($events); $modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugin Events for LogTimings.'); flush(); unset($events); // Collect Assets ////////////////////////////////////////////////////////////////////////////////////////////////////////// $i++; $plugins[$i] = $modx->newObject('modPlugin'); $plugins[$i]->fromArray(array('id' => $i, 'name' => 'CollectAssets', 'description' => 'Get JS and CSS content, that should be published', 'plugincode' => getSnippetContent($sources['plugins'] . 'collectassets.plugins.php'), 'category' => 0), '', true, true); // Add Events for Collect Assets Plugin $events[0] = $modx->newObject('modPluginEvent'); $events[1] = $modx->newObject('modPluginEvent'); $events[0]->fromArray(array('event' => 'OnLoadWebDocument', 'priority' => 0, 'propertyset' => 0), '', true, true); $events[0]->fromArray(array('event' => 'OnWebPagePrerender', 'priority' => 0, 'propertyset' => 0), '', true, true); $plugins[$i]->addMany($events); $modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugin Events for CollectAssets.'); flush(); unset($events); return $plugins;
* * Copyright 2010 by Shaun McCormick <*****@*****.**> * * eventsCalendar2 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. * * eventsCalendar2 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 * eventsCalendar2; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * * @package eventscalendar2 */ /** * Add snippets to build * * @package eventscalendar2 * @subpackage build */ $snippets = array(); $snippets[0] = $modx->newObject('modSnippet'); $snippets[0]->fromArray(array('id' => 0, 'name' => 'eventsCalendar2', 'description' => 'Displays calendar with your resources as events.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.eventscalendar2.php')), '', true, true); //$properties = include $sources['build'].'properties/properties.eventscalendar2.php'; //$snippets[0]->setProperties($properties); //unset($properties); return $snippets;
<?php /** * Package in plugins * * @package mSearch * @subpackage build */ $plugins = array(); /* create the plugin object */ $plugins[0] = $modx->newObject('modPlugin'); $plugins[0]->set('id', 1); $plugins[0]->set('name', 'mSearchIndexer'); $plugins[0]->set('description', 'Indexing of your resources on save'); $plugins[0]->set('plugincode', getSnippetContent($sources['plugins'] . 'plugin.indexer.php')); $plugins[0]->set('category', 0); $events = array(); $events['OnDocFormSave'] = $modx->newObject('modPluginEvent'); $events['OnDocFormSave']->fromArray(array('event' => 'OnDocFormSave', 'priority' => 0, 'propertyset' => 0), '', true, true); $events['OnDocFormDelete'] = $modx->newObject('modPluginEvent'); $events['OnDocFormDelete']->fromArray(array('event' => 'OnDocFormDelete', 'priority' => 0, 'propertyset' => 0), '', true, true); $events['OnSiteRefresh'] = $modx->newObject('modPluginEvent'); $events['OnSiteRefresh']->fromArray(array('event' => 'OnSiteRefresh', 'priority' => 0, 'propertyset' => 0), '', true, true); if (is_array($events) && !empty($events)) { $plugins[0]->addMany($events); $modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugin Events for mSearchIndexer.'); flush(); } else { $modx->log(xPDO::LOG_LEVEL_ERROR, 'Could not find plugin events for mSearchIndexer!'); } unset($events);
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO); $modx->setLogTarget('ECHO'); echo "<pre>\n"; /* load builder */ $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 . '/'); /* create plugin object */ $modx->log(xPDO::LOG_LEVEL_INFO, 'Adding in snippet.'); flush(); $object = $modx->newObject('modSnippet'); $object->set('name', PKG_NAME); $object->set('description', '<strong>' . PKG_VERSION . '-' . PKG_RELEASE . '</strong> Basic snippet for ' . PKG_NAME . '.'); $object->set('category', 0); $object->set('snippet', getSnippetContent($sources['snippets'] . 'snippet.multimedialibrary.php')); $properties = (include $sources['data'] . 'snippet.multimedialibrary.properties.php'); $object->setProperties($properties); unset($properties); /* create a transport vehicle for the data object */ $vehicle = $builder->createVehicle($object, array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name')); $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); /* SYSTEM SETTING */ /* ------------------------------------------------------ */ $modx->log(xPDO::LOG_LEVEL_INFO, 'Adding in system setting.'); flush(); $settings = array(); $settings = (include $sources['data'] . 'system.settings.php'); foreach ($settings as $setting) {
<?php $plugins = array(); /** create the plugin object */ $plugins[0] = $modx->newObject('modPlugin'); $plugins[0]->set('name', 'checkblock'); $plugins[0]->set('description', 'Simple Checkbox Input Type ContentBlocks.'); $plugins[0]->set('plugincode', getSnippetContent($sources['plugins'] . 'checkblock.plugin.php')); $events = (include $sources['data'] . 'transport.plugin.events.php'); if (is_array($events) && !empty($events)) { $plugins[0]->addMany($events); $modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugin Events for checkblock.'); flush(); } else { $modx->log(xPDO::LOG_LEVEL_ERROR, 'Could not find plugin events for checkblock!'); } unset($events); return $plugins;
<?php global $modx, $sources; $plugins = array(); $plugin = $modx->newObject('modPlugin'); $plugin->set('id', null); $plugin->set('name', 'modxSmarty'); $plugin->set('description', 'Основнойплагин компонента modxSmarty'); $plugin->set('plugincode', getSnippetContent($sources['source_core'] . '/elements/plugins/modxsmarty.plugin.php')); //print $sources['source_core'].'/elements/plugins/modlivestreet.plugin.php'; // exit; /* add plugin events */ $events = (include $sources['data'] . 'transport.plugins.events.php'); if (is_array($events) && !empty($events)) { $plugin->addMany($events, 'PluginEvents'); $modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugin Events.'); flush(); } else { $modx->log(xPDO::LOG_LEVEL_ERROR, 'Could not find plugin events!'); } $plugins[] = $plugin; return $plugins;
* faqMan 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. * * faqMan 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 * faqMan; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * * @package faqman */ /** * Add snippets to build * * @package faqman * @subpackage build */ $snippets = array(); $snippets[0] = $modx->newObject('modSnippet'); $snippets[0]->fromArray(array('id' => 0, 'name' => 'faqMan', 'description' => 'Displays FAQs.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.faqman.php')), '', true, true); $properties = (include $sources['build'] . 'properties/properties.faqman.php'); $snippets[0]->setProperties($properties); unset($properties); $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => 'faqManSets', 'description' => 'Displays FAQs sets and their questions.', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.faqmansets.php')), '', true, true); unset($properties); return $snippets;
<?php /** * phpThumbOn * Создание превьюх картинок * * Copyright 2013 by Agel_Nash <*****@*****.**> * * @category images * @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html * @author Agel_Nash <*****@*****.**> * */ /** * @package phpThumbOn * @subpackage build */ $snippet = $modx->newObject('modSnippet'); $snippet->fromArray(array('id' => 0, 'name' => PKG_NAME_LOWER, 'description' => 'Создание превьюх картинок', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.phpthumbon.php'))); $snippet->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 $snippet;
<?php function getSnippetContent($filename) { $o = file_get_contents($filename); $o = trim(str_replace(array('<?php', '?>'), '', $o)); return $o; } $snippets = array(); $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => 'Hits', 'description' => 'Displays a list of Hits.', 'snippet' => getSnippetContent($sources['elements'] . 'snippets/snippet.hits.php')), '', true, true); $properties = (include $sources['data'] . 'properties/properties.hits.php'); $snippets[1]->setProperties($properties); unset($properties); return $snippets;
$vehicle = $builder->createVehicle($plugin, array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name', xPDOTransport::RELATED_OBJECTS => true, xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array('PluginEvents' => array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false, xPDOTransport::UNIQUE_KEY => array('pluginid', 'event'))))); $modx->log(modX::LOG_LEVEL_INFO, 'Adding file resolvers to plugin...'); $vehicle->resolve('file', array('source' => $sources['source_assets'], 'target' => "return MODX_ASSETS_PATH . 'components/';")); $vehicle->resolve('file', array('source' => $sources['source_core'], 'target' => "return MODX_CORE_PATH . 'components/';")); $vehicle->resolve('php', array('source' => $sources['resolvers'] . 'resolver.modldap.php')); $builder->putVehicle($vehicle); unset($vehicle, $plugin); /* SNIPPETS */ /* ------------------------------------------------------ */ $modx->log(xPDO::LOG_LEVEL_INFO, 'Adding in plugin.'); flush(); $snippets = $modx->newObject('modSnippet'); $snippets->set('name', PKG_NAME . 'Debug'); $snippets->set('description', '<strong>' . PKG_VERSION . '-' . PKG_RELEASE . '</strong> Output data entries from LDAP'); $snippets->set('category', 0); $snippets->set('snippet', getSnippetContent($sources['snippets'] . 'snippet.modldapdebug.php')); //add properties to snippet $properties = (include $sources['data'] . 'snippet.modldapdebug.properties.php'); $snippets->setProperties($properties); unset($properties); //create vehicle for plugin $modx->log(modX::LOG_LEVEL_INFO, 'Create snippet vehicle'); flush(); $vehicle = $builder->createVehicle($snippets, array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name')); /* $modx->log(modX::LOG_LEVEL_INFO,'Adding file resolvers to snippet...'); $vehicle->resolve('file',array( 'source' => $sources['source_assets'], 'target' => "return MODX_ASSETS_PATH . 'components/';", )); $vehicle->resolve('file',array(
<?php $plugins = array(); $tmp = array('elementNotes' => array('file' => 'elementnotes', 'description' => '', 'events' => array('OnTempFormPrerender' => array(), 'OnChunkFormPrerender' => array(), 'OnSnipFormPrerender' => array(), 'OnPluginFormPrerender' => array(), 'OnChunkRemove' => array(), 'OnPluginRemove' => array(), 'OnSnippetRemove' => array(), 'OnTemplateRemove' => array()))); foreach ($tmp as $k => $v) { /* @avr modplugin $plugin */ $plugin = $modx->newObject('modPlugin'); $plugin->fromArray(array('name' => $k, 'category' => 0, 'description' => @$v['description'], 'plugincode' => getSnippetContent($sources['source_core'] . '/elements/plugins/plugin.' . $v['file'] . '.php'), 'static' => BUILD_PLUGIN_STATIC, 'source' => 1, 'static_file' => 'core/components/' . PKG_NAME_LOWER . '/elements/plugins/plugin.' . $v['file'] . '.php'), '', true, true); $events = array(); if (!empty($v['events'])) { foreach ($v['events'] as $k2 => $v2) { /* @var modPluginEvent $event */ $event = $modx->newObject('modPluginEvent'); $event->fromArray(array_merge(array('event' => $k2, 'priority' => 0, 'propertyset' => 0), $v2), '', true, true); $events[] = $event; } unset($v['events']); } if (!empty($events)) { $plugin->addMany($events); } $plugins[] = $plugin; } unset($tmp, $properties); return $plugins;
* Gallery 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 * Gallery; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * * @package gallery */ /** * @package gallery * @subpackage build */ $snippets = array(); $snippets[0] = $modx->newObject('modSnippet'); $snippets[0]->fromArray(array('id' => 0, 'name' => 'Gallery', 'description' => '', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.gallery.php')), '', true, true); $properties = (include $sources['build'] . 'properties/properties.gallery.php'); $snippets[0]->setProperties($properties); unset($properties); $snippets[1] = $modx->newObject('modSnippet'); $snippets[1]->fromArray(array('id' => 1, 'name' => 'GalleryAlbums', 'description' => '', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.galleryalbums.php')), '', true, true); $properties = (include $sources['build'] . 'properties/properties.galleryalbums.php'); $snippets[1]->setProperties($properties); unset($properties); $snippets[2] = $modx->newObject('modSnippet'); $snippets[2]->fromArray(array('id' => 2, 'name' => 'GalleryItem', 'description' => '', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.galleryitem.php')), '', true, true); $properties = (include $sources['build'] . 'properties/properties.galleryitem.php'); $snippets[2]->setProperties($properties); unset($properties); return $snippets;