/** * Write data in json file. * * @return void */ protected function _write() { $this->_bufferActivated(); $this->_bufferLoaded(); $JSON = new JSON($this->_buffer); $file = Path::loadedFolder() . $this->_config['file']; $File = new File($file); $File->write($JSON->write()); }
/** * Id folder path. * * @param $id * @param string $separator * @return string */ public function idFolder($id, $separator = '/') { return Path::intForPath($id, $separator) . Inflector::singularize($this->_prefix) . '_' . $id . $separator; }
/** * Find plugin form field folder. * * @param $name * @return bool|string */ protected function _plgFormFieldPath($name) { $plugin = null; list($first, $second) = pluginSplit($name); if (Plugin::loaded($first) === true) { $name = $second; $plugin = $first; } if ($name && $plugin) { $path = Path::plgXmlPath($plugin) . $name . DS; return $path; } return false; }
/** * Setup xml form data. * * @return $this */ protected function _setXmlData() { $path = $this->_path; if (!$path) { $path = Path::xmlActionForm($this->request); } $xmlForm = Form::getInstance($this->_name, $path, $this->_View); $xmlForm->bind($this->_entity); $this->_xml = $xmlForm; return $this; }
<?php /** * This is a simple content management system based on CakePHP. * * @version 1.0.x * @copyright Copyright (C) by cool-code.ru * @license http://www.opensource.org/licenses/mit-license.php MIT License * @author Segrey Kalistratov <*****@*****.**> */ use Cake\Core\Configure; use Union\Core\Lib\Plugin; use Union\Core\Utility\Path; // Default plugins. $plugins = ['Search', 'Union/Menus', 'Union/Community', 'Union/Extensions', 'Union/TinyMce', 'Union/Modules', 'Union/FileManager']; $activatedTheme = Path::loadedFolder() . 'themes.json'; // Check activated themes. if (file_exists($activatedTheme)) { $jsonData = file_get_contents($activatedTheme); $themes = json_decode($jsonData, true); $plugins += $themes['activated']; if (isset($themes['activated'])) { Configure::write('Theme', $themes['activated']); } } Plugin::load($plugins);