Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/workspace/packages/ |
<?php /** * Gets an attribute of a package * * @param string $signature The signature of the package * @param string $attr The attribute to select * * @package modx * @subpackage processors.workspace.packages */ class modPackageGetAttributeProcessor extends modProcessor { /** @var modTransportPackage $package */ public $package; /** @var xPDOTransport $transport */ public $transport; public function checkPermissions() { return $this->modx->hasPermission('packages'); } public function getLanguageTopics() { return array('workspace'); } public function initialize() { $signature = $this->getProperty('signature'); if (empty($signature)) return $this->modx->lexicon('package_err_ns'); $this->package = $this->modx->getObject('transport.modTransportPackage',$signature); if (empty($this->package)) return $this->modx->lexicon('package_err_nf'); $this->transport = $this->package->getTransport(); if (!$this->transport) { return $this->modx->lexicon('package_err_nf'); } return true; } public function process() { $attributes = array(); $attributesToGet = explode(',',$this->getProperty('attributes','')); foreach ($attributesToGet as $attribute) { $attributes[$attribute] = $this->transport->getAttribute($attribute); /* if setup options, include setup file */ if ($attribute == 'setup-options') { @ob_start(); $options = $this->package->toArray(); $options[xPDOTransport::PACKAGE_ACTION] = $this->package->previousVersionInstalled() ? xPDOTransport::ACTION_UPGRADE : xPDOTransport::ACTION_INSTALL; $attributeFile = $this->modx->getOption('core_path').'packages/'.$this->package->signature.'/'.$attribute.'.php'; if (file_exists($attributeFile) && $attribute != '') { $modx =& $this->modx; $attributes['setup-options'] = include $attributeFile; } @ob_end_clean(); } else if (in_array($attribute,array('readme','license','changelog'))) { $attributes[$attribute] = htmlentities($attributes[$attribute],ENT_COMPAT,'UTF-8'); } } return $this->success('',$attributes); } } return 'modPackageGetAttributeProcessor';