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/resource/ |
<?php /** * Retrieves a resource by its ID. * * @param integer $id The ID of the resource to grab * @return modResource * * @package modx * @subpackage processors.resource */ class modResourceGetProcessor extends modObjectGetProcessor { public $classKey = 'modResource'; public $languageTopics = array('resource'); public $objectType = 'resource'; public function process() { $resourceArray = $this->object->toArray(); $this->formatDates($resourceArray); return $this->success('',$resourceArray); } public function formatDates(array &$resourceArray) { if (!empty($resourceArray['pub_date']) && $resourceArray['pub_date'] != '0000-00-00 00:00:00') { $resourceArray['pub_date'] = strftime('%Y-%m-%d %H:%M:%S',strtotime($resourceArray['pub_date'])); } else $resourceArray['pub_date'] = ''; if (!empty($resourceArray['unpub_date']) && $resourceArray['unpub_date'] != '0000-00-00 00:00:00') { $resourceArray['unpub_date'] = strftime('%Y-%m-%d %H:%M:%S',strtotime($resourceArray['unpub_date'])); } else $resourceArray['unpub_date'] = ''; if (!empty($resourceArray) && $resourceArray['publishedon'] != '0000-00-00 00:00:00') { $resourceArray['publishedon'] = strftime('%Y-%m-%d %H:%M:%S',strtotime($resourceArray['publishedon'])); } else $resourceArray['publishedon'] = ''; } } return 'modResourceGetProcessor';