/** * method: checkRequiredRules * * todo: write documentation */ protected function hasRequiredRules() { return is_array($this->rules) ? in_array(true, Amslib_Array::pluck($this->rules, "required")) : false; }
/** * method: selectValue * * todo: write documentation * * notes: * Anxo has explained that perhaps it's unnecessary that in the query to put the field if you are going to put * the field you want in the first parameter, so in the query you can just put a "$field $query" and it'll * select only what you want, without duplication. He's clever sometimes. */ public function selectValue($field, $query, $params = array(), $numResults = 0, $optimise = false) { $field = trim($field); $values = $this->select($query, $params, $numResults, $optimise); if ($numResults == 1 && $optimise) { return isset($values[$field]) ? $values[$field] : NULL; } // TODO: This hasn't been tested yet, it might not return exactly what I want if ($numResults != 1 && !$optimise) { // FIXME? Why am I optimising the array, when optimise is being tested for false? // NOTE: I think the reason I never found this issue before was I always using 1,true for numResults/optimise return Amslib_Array::pluck($values, $field); } return $values; }
/** * method: listJavascript * * todo: write documentation */ public function listJavascript($key = "file") { return $key !== false ? Amslib_Array::pluck($this->javascript, $key) : $this->javascript; }