本文整理汇总了PHP中getSnippetContent函数的典型用法代码示例。如果您正苦于以下问题:PHP getSnippetContent函数的具体用法?PHP getSnippetContent怎么用?PHP getSnippetContent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSnippetContent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: flush
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);
开发者ID:ksneo,项目名称:modHybridAuth,代码行数:31,代码来源:transport.snippets.php
示例2: array
<?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;
开发者ID:sfgoo,项目名称:xPoller2,代码行数:14,代码来源:transport.snippets.php
示例3: array
*
* 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
*/
/**
* 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;
开发者ID:Monogon,项目名称:atom-modx-revolution,代码行数:31,代码来源:transport.snippets.php
示例4: getSnippetContent
* 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;
开发者ID:mooror,项目名称:MyComponent,代码行数:31,代码来源:transport.snippets.php
示例5: count
$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;
开发者ID:jiripavlicek,项目名称:UrlHistory,代码行数:31,代码来源:transport.plugins.php
示例6: array
<?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;
开发者ID:node-migrator-bot,项目名称:AlohaX,代码行数:29,代码来源:transport.snippets.php
示例7: getSnippetContent
<?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;
开发者ID:jpdevries,项目名称:mxCalendar,代码行数:16,代码来源:transport.snippets.php
示例8: array
<?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;
开发者ID:ksneo,项目名称:modHybridAuth,代码行数:25,代码来源:transport.plugins.php
示例9: array
<?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;
开发者ID:Oetzie,项目名称:TinyMCE,代码行数:12,代码来源:transport.snippets.php
示例10: array
* 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;
开发者ID:vgrish,项目名称:AjaxUpload,代码行数:31,代码来源:transport.snippets.php
示例11: array
<?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;
开发者ID:vgrish,项目名称:XRouting,代码行数:25,代码来源:transport.plugins.php
示例12: modPackageBuilder
$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);
开发者ID:jenswittmann,项目名称:mapsTv,代码行数:31,代码来源:build.transport.php
示例13: array
*
* @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;
开发者ID:chrisdempsey,项目名称:Tools,代码行数:31,代码来源:transport.snippets.php
示例14: getSnippetContent
* 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;
开发者ID:alexzem,项目名称:syntaxhighlighter,代码行数:31,代码来源:transport.snippets.php
示例15: getSnippetContent
* 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;
开发者ID:netProphET,项目名称:LogPageNotFound,代码行数:31,代码来源:transport.snippets.php
示例16: array
<?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;
开发者ID:MODX-Club,项目名称:modResourceField,代码行数:24,代码来源:transport.chunks.php
示例17: modX
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',
开发者ID:g3force,项目名称:modActiveDirectory,代码行数:31,代码来源:build.transport.php
示例18: getSnippetContent
<?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;
开发者ID:pelargo,项目名称:MODX-mChimpX,代码行数:22,代码来源:transport.snippets.php
示例19: trim
$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;
开发者ID:alaingab,项目名称:modx,代码行数:31,代码来源:transport.plugins.php
示例20: array
*
* Copyright 2010 by Shaun McCormick <[email protected]>
*
* 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;
开发者ID:himza,项目名称:eventsCalendar2,代码行数:31,代码来源:transport.snippets.php
注:本文中的getSnippetContent函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论