/** * This is where the magic happens... modx snippet should always call this * method to execute the snippet. * * @return string */ public final function run() { try { $this->beginProfiling(); $this->defineParams(); /* @var $param ModSync\Element\Parameter\ParameterAbstract */ foreach ($this->getParams() as $param) { if (isset($this->_args['properties'][strtolower($param->getName())]) && !empty($this->_args['properties'][strtolower($param->getName())])) { $param->setValue($this->_args['properties'][strtolower($param->getName())]); } else { if ($param->isRequired()) { throw new ModSync\Element\Parameter\Exception('Parameter (' . $param->getName() . ') is required'); } } } $this->beforeDispatch(); $this->_output = $this->dispatch(); $this->afterDispatch(); $this->reportProfiling(); return $this->_output; } catch (ModSync\Exception $e) { $msg = 'Snippet (' . $this->getName() . ') failed: ' . $e->getMessage(); ModSync\Logger::error($msg); die($msg); } }
/** * Disable plugin * * @param string $name */ public static final function disable($name) { ModSync\Logger::error('Missing plugin source: ' . $name); /* @var $plugin \modPlugin */ $plugin = self::getModX()->getObject('modPlugin', array('name' => $name)); $plugin->set('disabled', true); $plugin->save(); self::getModX()->getCacheManager()->refresh(); }