本文整理汇总了PHP中Symphony::ExtensionManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Symphony::ExtensionManager方法的具体用法?PHP Symphony::ExtensionManager怎么用?PHP Symphony::ExtensionManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symphony
的用法示例。
在下文中一共展示了Symphony::ExtensionManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enable
public function enable()
{
if (Symphony::ExtensionManager() instanceof ExtensionManager) {
PLHDatasourceManager::editAllNavDssTo('PLH');
}
return true;
}
示例2: fetchMemberFromID
/**
* Given a Member ID, return Member
*
* @param integer $member_id
* @return Entry
*/
public function fetchMemberFromID($member_id)
{
if (!Identity::$driver instanceof Extension) {
Identity::$driver = Symphony::ExtensionManager()->create('members');
}
return Identity::$driver->getMemberDriver()->initialiseMemberObject($member_id);
}
示例3: displayPublishPanel
function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
{
$label = Widget::Label($this->get('label'));
if ($this->get('required') != 'yes') {
$label->appendChild(new XMLElement('i', __('Optional')));
}
$textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, $this->get('size'), '50', strlen($data['value']) != 0 ? General::sanitize($data['value']) : NULL);
if ($this->get('formatter') != 'none') {
$textarea->setAttribute('class', $this->get('formatter'));
}
/**
* Allows developers modify the textarea before it is rendered in the publish forms
*
* @delegate ModifyTextareaFieldPublishWidget
* @param string $context
* '/backend/'
* @param Field $field
* @param Widget $label
* @param Widget $textarea
*/
Symphony::ExtensionManager()->notifyMembers('ModifyTextareaFieldPublishWidget', '/backend/', array('field' => &$this, 'label' => &$label, 'textarea' => &$textarea));
$label->appendChild($textarea);
if ($flagWithError != NULL) {
$wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
} else {
$wrapper->appendChild($label);
}
}
示例4: view
public function view()
{
$name = General::sanitize($_REQUEST['name']);
$section = General::sanitize($_REQUEST['section']);
$filters = self::processFilters($_REQUEST['filters']);
$rootelement = Lang::createHandle($name);
$doc_parts = array();
// Add Documentation (Success/Failure)
$this->addEntrySuccessDoc($doc_parts, $rootelement, $filters);
$this->addEntryFailureDoc($doc_parts, $rootelement, $filters);
// Filters
$this->addDefaultFiltersDoc($doc_parts, $rootelement, $filters);
// Frontend Markup
$this->addFrontendMarkupDoc($doc_parts, $rootelement, $section, $filters);
$this->addSendMailFilterDoc($doc_parts, $filters);
/**
* Allows adding documentation for new filters. A reference to the $documentation
* array is provided, along with selected filters
*
* @delegate AppendEventFilterDocumentation
* @param string $context
* '/blueprints/events/(edit|new|info)/'
* @param array $selected
* An array of all the selected filters for this Event
* @param array $documentation
* An array of all the documentation XMLElements, passed by reference
* @param string $rootelment
* The name of this event, as a handle.
*/
Symphony::ExtensionManager()->notifyMembers('AppendEventFilterDocumentation', '/blueprints/events/', array('selected' => $filters, 'documentation' => &$doc_parts, 'rootelement' => $rootelement));
$documentation = join(PHP_EOL, array_map(create_function('$x', 'return rtrim($x->generate(true, 4));'), $doc_parts));
$documentation = str_replace('\'', '\\\'', $documentation);
$documentation = '<fieldset id="event-documentation" class="settings"><legend>' . __('Documentation') . '</legend>' . $documentation . '</fieldset>';
$this->_Result = $documentation;
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->_name = 'S3 Upload';
$this->_driver = Symphony::ExtensionManager()->create('s3upload_field');
$this->S3 = new S3($this->_driver->getAmazonS3AccessKeyId(), $this->_driver->getAmazonS3SecretAccessKey());
}
示例6: listTypes
public function listTypes()
{
static $result;
if (is_array($result)) {
return $result;
}
$extensions = Symphony::ExtensionManager()->listInstalledHandles();
if (!is_array($extensions) || empty($extensions)) {
return array();
}
$result = array();
foreach ($extensions as $e) {
$path = EXTENSIONS . "/{$e}/template";
if (!is_dir($path)) {
continue;
}
$structure = General::listStructure($path, '/^formatter.[\\w-]+.tpl$/', false, 'ASC', $path);
if (is_array($structure['filelist']) && !empty($structure['filelist'])) {
foreach ($structure['filelist'] as $t) {
$type = preg_replace(array('/^formatter./i', '/.tpl$/i'), '', $t);
$result[$type] = array('path' => $path);
}
}
}
return $result;
}
示例7: initialize
public function initialize($context)
{
$conf = Symphony::Configuration();
$result = MobileDetector::detect();
$cookie = $conf->get(self::CONF_COOKIE, self::CONF);
$url = $conf->get(self::CONF_URL, self::CONF);
$devices = $conf->get(self::CONF_DEVICES, self::CONF);
if ($devices) {
$devices = explode(', ', $devices);
} else {
$devices = array();
}
/**
* Allows other extensions to override when and where a mobile device is redirected.
*
* @delegate MobileRedirection
* @param string $context /frontend/
* @param string $url
* @param array $devices
* @param MobileDetectorResults $result
*/
Symphony::ExtensionManager()->notifyMembers('MobileRedirection', '/frontend/', array('url' => &$url, 'devices' => &$devices, 'result' => $result));
// User is requesting mobile redirection be enabled:
if (isset($_GET['is-mobile']) && isset($_SESSION[$cookie])) {
unset($_SESSION[$cookie]);
}
// User is requesting mobile redirection be disabled:
if (isset($_GET['not-mobile']) || isset($_SESSION[$cookie])) {
// Not a mobile, this request only:
if ($_GET['not-mobile'] == 'once') {
return;
}
// Not a mobile permenantly:
$_SESSION[$cookie] = 'yes';
return;
}
$can_redirect = $url && $result->passed();
// Device was not detected, stop.
if ($devices) {
$can_redirect = false;
foreach ($devices as $name) {
if (!isset($result->devices()->{$name})) {
continue;
}
if (!$result->devices()->{$name}->detected) {
continue;
}
$can_redirect = true;
break;
}
}
if ($can_redirect) {
$current = $this->sanitizeUrl(getCurrentPage());
$redirect = $this->sanitizeUrl($url);
if ($redirect !== $current && strpos($current, $redirect) !== 0) {
redirect($redirect);
}
}
}
示例8: renderer_json
function renderer_json($mode)
{
if (strtolower($mode) == 'administration') {
throw new Lib\Exceptions\InvalidModeException('JSON Renderer launcher is only available on the frontend');
}
$renderer = Frontend::instance();
// Check if we should enable exception debug information
$exceptionDebugEnabled = Symphony::isLoggedIn();
// Use the JSON exception and error handlers instead of the Symphony one.
Lib\ExceptionHandler::initialise($exceptionDebugEnabled);
Lib\ErrorHandler::initialise($exceptionDebugEnabled);
// #1808
if (isset($_SERVER['HTTP_MOD_REWRITE'])) {
throw new Exception("mod_rewrite is required, however is not enabled.");
}
$output = $renderer->display(getCurrentPage());
cleanup_session_cookies();
if (in_array('JSON', Frontend::Page()->pageData()['type'])) {
// Load the output into a SimpleXML Container and convert to JSON
try {
$xml = new SimpleXMLElement($output, LIBXML_NOCDATA);
// Convert the XML to a plain array. This step is necessary as we cannot
// use JSON_PRETTY_PRINT directly on a SimpleXMLElement object
$outputArray = json_decode(json_encode($xml), true);
// Get the transforer object ready. Other extensions will
// add their transormations to this.
$transformer = new Lib\Transformer();
/**
* Allow other extensions to add their own transformers
*/
Symphony::ExtensionManager()->notifyMembers('APIFrameworkJSONRendererAppendTransformations', '/frontend/', ['transformer' => &$transformer]);
// Apply transformations
$outputArray = $transformer->run($outputArray);
// Now put the array through a json_encode
$output = json_encode($outputArray, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
} catch (\Exception $e) {
// This happened because the input was not valid XML. This could
// occur for a few reasons, but there are two scenarios
// we are interested in.
// 1) This is a devkit page (profile, debug etc). We want the data
// to be passed through and displayed rather than converted into
// JSON. There is no easy way in Symphony to tell if a devkit has
// control over the page, so instead lets inspect the output for
// any signs a devkit is rendering the page.
// 2) It is actually bad XML. In that case we need to let the error
// bubble through.
// Currently the easiest method is to check for the devkit.min.css
// in the output. This may fail in the furture if this file is
// renamed or moved.
if (!preg_match("@\\/symphony\\/assets\\/css\\/devkit.min.css@", $output)) {
throw $e;
}
}
}
echo $output;
return $renderer;
}
示例9: __construct
public function __construct()
{
parent::__construct();
$this->_name = __('Geocoding');
$this->_driver = Symphony::ExtensionManager()->create('geocodingfield');
// Set defaults:
$this->set('show_column', 'yes');
$this->set('hide', 'no');
}
示例10: __construct
public function __construct()
{
parent::__construct();
// Validate request passes XSRF checks if extension is enabled.
$status = Symphony::ExtensionManager()->fetchStatus(array("handle" => "xsrf_protection"));
if (in_array(EXTENSION_ENABLED, $status) || in_array(EXTENSION_REQUIRES_UPDATE, $status)) {
XSRF::validateRequest();
}
}
示例11: __construct
public function __construct(&$parent)
{
parent::__construct($parent);
$this->_required = true;
$this->set('required', 'yes');
if (!self::$driver instanceof Extension) {
self::$driver = Symphony::ExtensionManager()->create('members');
}
}
示例12: __construct
public function __construct(&$parent)
{
parent::__construct($parent);
$this->_name = 'Bi-Link';
$this->_required = true;
$this->_driver = Symphony::ExtensionManager()->create('bilinkfield');
// Set defaults:
$this->set('show_column', 'yes');
}
示例13: __construct
/**
* The constructor for Frontend calls the parent Symphony constructor.
*
* @see core.Symphony#__construct()
* @deprecated The constructor creates backwards compatible references
* to `$this->Database`, `$this->ExtensionManager` and `$this->Configuration`
* that act as alias for `Symphony::Database()`, `Symphony::ExtensionManager()`
* and `Symphony::Configuration()`. These will be removed in the
* next Symphony release
*/
protected function __construct()
{
parent::__construct();
$this->_env = array();
// Need this part for backwards compatiblity
$this->Database = Symphony::Database();
$this->Configuration = Symphony::Configuration();
$this->ExtensionManager = Symphony::ExtensionManager();
}
示例14: __construct
/**
*
* Class constructor
* @param object $parent
* @param array $env
* @param boolean $process_params
*/
public function __construct(array $env = null, $process_params = true)
{
parent::__construct($env, $process_params);
// detect if multilangual field AND language redirect is enabled
$this->isMultiLangual = Symphony::ExtensionManager()->fetchStatus('page_lhandles') == EXTENSION_ENABLED && Symphony::ExtensionManager()->fetchStatus('language_redirect') == EXTENSION_ENABLED;
// add a ref to the Language redirect
if ($this->isMultiLangual) {
require_once EXTENSIONS . '/language_redirect/lib/class.languageredirect.php';
}
}
示例15: upgrade
static function upgrade()
{
// [#702] Update to include Admin Path configuration
if (version_compare(self::$existing_version, '2.4beta2', '<=')) {
// Add missing config value for index view string length
Symphony::Configuration()->set('cell_truncation_length', '75', 'symphony');
// Add admin-path to configuration
Symphony::Configuration()->set('admin-path', 'symphony', 'symphony');
}
// [#1626] Update all tables to be UTF-8 encoding/collation
// @link https://gist.github.com/michael-e/5789168
$tables = Symphony::Database()->fetch("SHOW TABLES");
if (is_array($tables) && !empty($tables)) {
foreach ($tables as $table) {
$table = current($table);
// If it's not a Symphony table, ignore it
if (!preg_match('/^' . Symphony::Database()->getPrefix() . '/', $table)) {
continue;
}
Symphony::Database()->query(sprintf("ALTER TABLE `%s` CHARACTER SET utf8 COLLATE utf8_unicode_ci", $table));
Symphony::Database()->query(sprintf("ALTER TABLE `%s` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci", $table));
}
}
// [#1420] Change date field to be a varchar instead of an ENUM to support prepopulation
try {
Symphony::Database()->query('
ALTER TABLE `tbl_fields_date`
CHANGE `pre_populate` `pre_populate` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL;
');
} catch (Exception $ex) {
}
// [#1997] Add filtering column to the Sections table
if (!Symphony::Database()->tableContainsField('tbl_sections', 'filter')) {
Symphony::Database()->query("\n\t\t\t\t\tALTER TABLE `tbl_sections`\n\t\t\t\t\tADD `filter` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes';\n\t\t\t\t");
}
$installed_extensions = Symphony::ExtensionManager()->listInstalledHandles();
if (in_array('publishfiltering', $installed_extensions)) {
Symphony::ExtensionManager()->uninstall('publishfiltering');
self::$publish_filtering_disabled = true;
}
// [#1874] XSRF/CRSF options
if (version_compare(self::$existing_version, '2.4beta3', '<=')) {
// How long should a XSRF token be valid
Symphony::Configuration()->set('token_lifetime', '15 minutes', 'symphony');
// Should the token be removed as soon as it has been used?
Symphony::Configuration()->set('invalidate_tokens_on_request', false, 'symphony');
}
// [#1874] XSRF/CRSF options
if (version_compare(self::$existing_version, '2.4RC1', '<=')) {
// On update, disable XSRF for compatibility purposes
Symphony::Configuration()->set('enable_xsrf', 'no', 'symphony');
}
// Update the version information
return parent::upgrade();
}