$v) { if($i == 0) self::$PATH = ""; else self::$PATH .= " ".(self::$PATH_SEPARATOR)." "; if($i == count($array) - 1) { $item = wordwrap($v,40,"\n",true); self::$PATH .= "" . $item . ""; self::$PATH_TITLE = $item; } else self::$PATH .= "getResource('config')->url->base.'~', $k) ? '' : Zend_Registry::get('application')->getBootstrap()->getResource('config')->url->base) . "{$k}'>".wordwrap($v,40,"\n",true).""; $i++; } if (Zend_Registry::isRegistered('listItemsCount')) { self::$PATH .= " (".Zend_Registry::get('listItemsCount').")"; } return self::$PATH; } static public function loadJsPlugin($jsPlugin = 'tabs') { $view = Zend_Layout::getMvcInstance()->getView(); switch ($jsPlugin) { case 'tabs': $helper = new App_Controller_Action_Helper_OnloadEvents(); $helper->onloadEvents("init_tabs()"); break; case 'swfUpload' : $view->headScript() ->appendFile('/js/swfupload.js'); break; case 'ajax-upload': $view->headScript() ->appendFile('/js/JsHttpRequest.js'); break; } } /** * Don't use cache * */ static public function noCache() { header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); } /** * Trigger error 404 * */ static public function pageNotFound() { $front = Zend_Controller_Front::getInstance(); $response = $front->getResponse(); $front->getRequest() ->setParam('requestUri', $front->getRequest()->getRequestUri()) ->setControllerName('page') ->setActionName('not-found') ->setDispatched(false); $response->setRawHeader('HTTP/1.1 404 Not Found') ->setRawHeader('Status: 404') ->sendResponse(); exit(); } /** * Enter description here... * * @param string $area * @param array $fields : key => defValue * @example getParams('admins.actors', array('perPage', 'sortBy')) * @return array */ static public function getParams($area = null, $fields) { if (null === $area) { $request = Zend_Controller_Front::getInstance()->getRequest(); $area = ucwords("{$request->getModuleName()} {$request->getControllerName()} {$request->getActionName()}"); $area = str_replace(' ', '_', $area); } $params = new Zend_Session_Namespace($area); foreach($fields as $field) { if (isset($_POST[$field])) { $params->$field = $_POST[$field]; /*} else if (!isset($_POST[$field]) && isset($params->$field)) { // troubles on ajax search (search projects | search freelancers) $params->$field = '';*/ } else if(!isset($params->$field)) { $params->$field = ''; } } return self::cleanParam($params); } static public function setParamsDefaults(&$params, $defaults) { foreach ($defaults as $key=>$value) { if (empty($params->$key) || $params->$key == '' || null === $params->$key) { $params->$key = $value; } } } /** * Get client IP * * @return string */ static public function getIp() { if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) $ip = getenv("HTTP_CLIENT_IP"); else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) $ip = getenv("REMOTE_ADDR"); else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) $ip = $_SERVER['REMOTE_ADDR']; else $ip = "unknown"; return($ip); } static public function encodeString($text = '') { return $text != '' ? rand(100,999) . "e" . bin2hex($text) . rand(100,999) : $text; } static public function decodeString($text = '') { if ($text != '') { $temp = ''; $text = substr($text, 4, -3); for ($i=0; $i < strlen($text); $i += 2) { $asci = hexdec($text[$i] . $text[$i+1]); $temp .= chr($asci); } } return $temp != '' ? $temp : $text; } static public function unescapeString($string) { // replace numeric entities $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string); $string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string); // replace literal entities $trans_tbl = get_html_translation_table(HTML_ENTITIES); $trans_tbl = array_flip($trans_tbl); return strtr($string, $trans_tbl); } static public function loadModels($models) { $models = array(); $_args = func_get_args(); foreach ($_args as $_arg) { if (is_string($_arg)) { $_arg = array($_arg); } $models = array_merge($models, $_arg); } $loadedModels = Zend_Registry::isRegistered('App_Model') ? Zend_Registry::get('App_Model') : array(); $filter = new Zend_Filter_Word_SeparatorToCamelCase('_'); foreach ($models as $model) { $model = $filter->filter($model); $model[0] = strtolower($model); if (!class_exists($model, false)) { require_once "{$model}.php"; } $out[] = new $model(); } return $out; } static public function getFileExtension($file) { preg_match('~\w+$~si', basename($file), $match); return strtolower($match[0]); } static public function removeDirectory($dirname) { if (is_dir($dirname)) $dir_handle = opendir($dirname); if (!$dir_handle) return false; while($file = readdir($dir_handle)) { if ($file != "." && $file != "..") { if (!is_dir($dirname."/".$file)) unlink($dirname."/".$file); else self::removeDirectory($dirname.'/'.$file); } } closedir($dir_handle); rmdir($dirname); return true; } /*static public function cleanParam($param) { if (is_array($param)) { foreach ($param as $key=>$value) { $value = trim($value); if (empty($value) || null == $value) { unset($param[$key]); } } } else if (empty($param) || null == $param) { $param = null; } return $param; }*/ static public function cleanParam($param) { if (is_array($param) || is_object($param)) { foreach ($param as $key=>&$value) { if (!is_array($value) && !is_object($value) && empty($value)) { if (is_object($param)) { $param->$key = null; } else { unset($param[$key]); } } elseif (is_array($value) || is_object($value)) { if (is_array($param)) { $param[$key] = self::cleanParam($value); } else if (is_object($param) && isset($param->$key)) { $param->$key = self::cleanParam($value); } } } } else { $param = is_numeric($param) ? (int)$param : trim($param); } return $param; } static public function floor($value) { $intCount = strlen((int)$value); $multiplyer = pow(10, $intCount-2); return floor($value/$multiplyer) * $multiplyer ; } static public function ceil($value) { $intCount = strlen((int)$value); $multiplyer = pow(10, $intCount-2); return ceil($value/$multiplyer) * $multiplyer ; } static public function formErrorsToArray($formErrors, $unidimensionalArray = false) { foreach ($formErrors as $fieldName => $fieldErrors) { foreach ($fieldErrors as $errorKey => $errorMessage) { if ($unidimensionalArray) { $out[] = $errorMessage; } else { $out[$fieldName][] = $errorMessage; } } } return $out; } }
Fatal error: Class 'App_Tools' not found in /home/gear/domains/puregear.ws/public_html/application/library/App/Controller/Plugin/MultiLanguage.php on line 115