/** * Determines if any variants exist for the provided view file * * @param unknown $view * @param string $site * @return multitype: */ public function variants($view, $site = 'site') { $return = array(); $view = str_replace(".php", "", $view); $view = str_replace("::", "/", $view); $view = str_replace("\\", "/", $view); $pieces = explode('/', $view); $themes = (array) \Base::instance()->get('dsc.themes.' . $site); foreach ($themes as $theme => $theme_path) { // an overrides folder exists in this theme, let's check for the presence of an override for the requested view file $dir = \Dsc\Filesystem\Path::clean($theme_path . "Overrides/"); if ($dir = \Dsc\Filesystem\Path::real($dir)) { $path = \Dsc\Filesystem\Path::clean($dir . "/" . $view); if ($path = \Dsc\Filesystem\Path::real($path)) { $files = \Dsc\Filesystem\Folder::files($path); if ($files) { $return = \Dsc\ArrayHelper::set($return, $theme, $files); } } } } // now find the requested file's original app, and its corresponding view files $app = $pieces[0]; $apps = (array) \Base::instance()->get('dsc.apps'); if (array_key_exists($app, $apps)) { $dir = $apps[$app]; unset($pieces[0]); $view = implode('/', $pieces); if ($dir = \Dsc\Filesystem\Path::real($dir)) { $path = \Dsc\Filesystem\Path::clean($dir . "/" . $view); if ($path = \Dsc\Filesystem\Path::real($path)) { $files = \Dsc\Filesystem\Folder::files($path); if ($files) { $return = \Dsc\ArrayHelper::set($return, $app, $files); } } } } return $return; }
/** * Assign value to field * @return scalar|FALSE * @param $key string * @param $val scalar **/ function set($key, $val) { return \Dsc\ArrayHelper::set($this->document, $key, $val); }
/** * This method encrypts fields in provided array * * @param $arr Array * field to be encrypted * * @return Array with encrypted fields */ private function encryptFieldsModel($arr) { if (!empty($this->__config['encrypted_fields'])) { $encrypted_fields = $this->__config['encrypted_fields']; if (is_array($encrypted_fields) === false) { $encrypted_fields = array($encrypted_fields); } foreach ($encrypted_fields as $field) { $field_text = \Dsc\ArrayHelper::get($arr, $field); if (!is_null($field_text)) { \Dsc\ArrayHelper::set($arr, $field, $this->encryptTextBase64($field_text)); } } } return $arr; }
/** * Assign value to field * * @return scalar FALSE * @param $key string * @param $val scalar * */ function set($key, $val) { if (!property_exists($this, $key) || $this->isPublic($key)) { \Dsc\ObjectHelper::set($this, $key, $val); } \Dsc\ArrayHelper::set($this->__doc, $key, $val); return $this; }