/** * method: translateExtended * * todo: write documentation */ public function translateExtended($n, $i, $l = NULL) { $v = parent::translateExtended($n, $i, $l); if ($v == $n && is_numeric($i)) { $i = intval($i); $l = $this->getIdLang($l); $n = $this->database->escape($n); $r = $this->database->select("value from {$this->table} where name='{$n}' and id_object={$i} and id_lang='{$l}'"); $v = ""; if (is_array($r)) { if (count($r) > 1) { Amslib_Keystore::add(__METHOD__, "Multiple conflicting translations for key({$n}),id_object({$i}) and language({$l})"); } else { if (isset($r[0]["value"])) { $v = trim($r[0]["value"]); } } parent::learnExtended($n, $i, $v, $l); } else { $v = $n; } } else { die("FAIL 1: " . Amslib_Debug::pdump(true, $n, $i, $l, $v)); } return $v; }
public static function count($count) { $length = intval(Amslib_Keystore::get("pager_length")); $count = intval($count); return $length ? ceil($count / $length) : $length; }
/** * method: openFile * * todo: write documentation */ public function openFile($filename) { // NOTE: Added a call to Amslib_Website::abs to fix finding the file, because in some cases, // the file cannot be found. But I am not sure of the side-effects (if any) of doing this $this->filename = Amslib_File::find(Amslib_Website::absolute($filename), true); $document = new DOMDocument('1.0', 'UTF-8'); if (is_file($this->filename) && $document->load($this->filename)) { $this->xpath = new DOMXPath($document); return true; } Amslib_Keystore::add("error", "Amslib_XML::openFile[{$filename}], path[{$this->filename}] failed"); return false; }