本文整理汇总了PHP中getSnippetContent函数的典型用法代码示例。如果您正苦于以下问题:PHP getSnippetContent函数的具体用法?PHP getSnippetContent怎么用?PHP getSnippetContent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSnippetContent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
示例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;
示例3: array
*
* Copyright 2010 by Shaun McCormick <shaun+modextra@modx.com>
*
* 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;
示例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;
示例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;
示例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;
示例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;
示例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;
示例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;
示例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;
示例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;
示例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);
示例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;
示例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;
示例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;