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/element/tv/renders/ |
<?php /** * Grabs a list of output renders for the tv. * * @param string $context (optional) The context by which to grab renders from. Defaults to web. * * @package modx * @subpackage processors.element.tv.renders */ if (!$modx->hasPermission('view_tv')) return $modx->error->failure($modx->lexicon('permission_denied')); $modx->lexicon->load('tv_widget'); $context = (isset($scriptProperties['context']) && !empty($scriptProperties['context'])) ? $scriptProperties['context'] : 'web'; $renderDirectories = array( dirname(__FILE__).'/'.$context.'/output/', ); /* allow for custom directories */ $pluginResult = $modx->invokeEvent('OnTVOutputRenderList',array( 'context' => $context, )); if (!is_array($pluginResult) && !empty($pluginResult)) { $pluginResult = array($pluginResult); } if (!empty($pluginResult)) { $renderDirectories = array_merge($renderDirectories,$pluginResult); } /* search directories */ $types = array(); foreach ($renderDirectories as $renderDirectory) { if (empty($renderDirectory) || !is_dir($renderDirectory)) continue; try { $dirIterator = new DirectoryIterator($renderDirectory); foreach ($dirIterator as $file) { if (!$file->isReadable() || !$file->isFile()) continue; $type = str_replace(array('.php','.class','.class.php'),'',$file->getFilename()); $types[$type] = array( 'name' => $modx->lexicon($type), 'value' => $type, ); } } catch (UnexpectedValueException $e) {} } /* sort types */ ksort($types); $otypes = array(); foreach ($types as $type) { $otypes[] = $type; } return $this->outputArray($otypes);