n_exists('__')) { /** * Returns a translated string if one is found; Otherwise, the submitted message. * * @param string $singular Text to translate * @param mixed $args Array with arguments or multiple arguments in function * @return mixed translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__ */ function __($singular, $args = null) { if (!$singular) { return; } App::uses('I18n', 'I18n'); $translated = I18n::translate($singular); if ($args === null) { return $translated; } elseif (!is_array($args)) { $args = array_slice(func_get_args(), 1); } return vsprintf($translated, $args); } } if (!function_exists('__n')) { /** * Returns correct plural form of message identified by $singular and $plural for count $count. * Some languages have more than one form for plural messages dependent on the count. * * @param string $singular Singular text to translate * @param string $plural Plural text * @param integer $count Count * @param mixed $args Array with arguments or multiple arguments in function * @return mixed plural form of translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__n */ function __n($singular, $plural, $count, $args = null) { if (!$singular) { return; } App::uses('I18n', 'I18n'); $translated = I18n::translate($singular, $plural, null, 6, $count); if ($args === null) { return $translated; } elseif (!is_array($args)) { $args = array_slice(func_get_args(), 3); } return vsprintf($translated, $args); } } if (!function_exists('__d')) { /** * Allows you to override the current domain for a single message lookup. * * @param string $domain Domain * @param string $msg String to translate * @param mixed $args Array with arguments or multiple arguments in function * @return translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__d */ function __d($domain, $msg, $args = null) { if (!$msg) { return; } App::uses('I18n', 'I18n'); $translated = I18n::translate($msg, null, $domain); if ($args === null) { return $translated; } elseif (!is_array($args)) { $args = array_slice(func_get_args(), 2); } return vsprintf($translated, $args); } } if (!function_exists('__dn')) { /** * Allows you to override the current domain for a single plural message lookup. * Returns correct plural form of message identified by $singular and $plural for count $count * from domain $domain. * * @param string $domain Domain * @param string $singular Singular string to translate * @param string $plural Plural * @param integer $count Count * @param mixed $args Array with arguments or multiple arguments in function * @return plural form of translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dn */ function __dn($domain, $singular, $plural, $count, $args = null) { if (!$singular) { return; } App::uses('I18n', 'I18n'); $translated = I18n::translate($singular, $plural, $domain, 6, $count); if ($args === null) { return $translated; } elseif (!is_array($args)) { $args = array_slice(func_get_args(), 4); } return vsprintf($translated, $args); } } if (!function_exists('__dc')) { /** * Allows you to override the current domain for a single message lookup. * It also allows you to specify a category. * * The category argument allows a specific category of the locale settings to be used for fetching a message. * Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL. * * Note that the category must be specified with a numeric value, instead of the constant name. The values are: * * - LC_ALL 0 * - LC_COLLATE 1 * - LC_CTYPE 2 * - LC_MONETARY 3 * - LC_NUMERIC 4 * - LC_TIME 5 * - LC_MESSAGES 6 * * @param string $domain Domain * @param string $msg Message to translate * @param integer $category Category * @param mixed $args Array with arguments or multiple arguments in function * @return translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dc */ function __dc($domain, $msg, $category, $args = null) { if (!$msg) { return; } App::uses('I18n', 'I18n'); $translated = I18n::translate($msg, null, $domain, $category); if ($args === null) { return $translated; } elseif (!is_array($args)) { $args = array_slice(func_get_args(), 3); } return vsprintf($translated, $args); } } if (!function_exists('__dcn')) { /** * Allows you to override the current domain for a single plural message lookup. * It also allows you to specify a category. * Returns correct plural form of message identified by $singular and $plural for count $count * from domain $domain. * * The category argument allows a specific category of the locale settings to be used for fetching a message. * Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL. * * Note that the category must be specified with a numeric value, instead of the constant name. The values are: * * - LC_ALL 0 * - LC_COLLATE 1 * - LC_CTYPE 2 * - LC_MONETARY 3 * - LC_NUMERIC 4 * - LC_TIME 5 * - LC_MESSAGES 6 * * @param string $domain Domain * @param string $singular Singular string to translate * @param string $plural Plural * @param integer $count Count * @param integer $category Category * @param mixed $args Array with arguments or multiple arguments in function * @return plural form of translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dcn */ function __dcn($domain, $singular, $plural, $count, $category, $args = null) { if (!$singular) { return; } App::uses('I18n', 'I18n'); $translated = I18n::translate($singular, $plural, $domain, $category, $count); if ($args === null) { return $translated; } elseif (!is_array($args)) { $args = array_slice(func_get_args(), 5); } return vsprintf($translated, $args); } } if (!function_exists('__c')) { /** * The category argument allows a specific category of the locale settings to be used for fetching a message. * Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL. * * Note that the category must be specified with a numeric value, instead of the constant name. The values are: * * - LC_ALL 0 * - LC_COLLATE 1 * - LC_CTYPE 2 * - LC_MONETARY 3 * - LC_NUMERIC 4 * - LC_TIME 5 * - LC_MESSAGES 6 * * @param string $msg String to translate * @param integer $category Category * @param mixed $args Array with arguments or multiple arguments in function * @return translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__c */ function __c($msg, $category, $args = null) { if (!$msg) { return; } App::uses('I18n', 'I18n'); $translated = I18n::translate($msg, null, null, $category); if ($args === null) { return $translated; } elseif (!is_array($args)) { $args = array_slice(func_get_args(), 2); } return vsprintf($translated, $args); } } if (!function_exists('LogError')) { /** * Shortcut to Log::write. * * @param string $message Message to write to log * @return void * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#LogError */ function LogError($message) { App::uses('CakeLog', 'Log'); $bad = array("\n", "\r", "\t"); $good = ' '; CakeLog::write('error', str_replace($bad, $good, $message)); } } if (!function_exists('fileExistsInPath')) { /** * Searches include path for files. * * @param string $file File to look for * @return Full path to file if exists, otherwise false * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#fileExistsInPath */ function fileExistsInPath($file) { $paths = explode(PATH_SEPARATOR, ini_get('include_path')); foreach ($paths as $path) { $fullPath = $path . DS . $file; if (file_exists($fullPath)) { return $fullPath; } elseif (file_exists($file)) { return $file; } } return false; } } if (!function_exists('convertSlash')) { /** * Convert forward slashes to underscores and removes first and last underscores in a string * * @param string String to convert * @return string with underscore remove from start and end of string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#convertSlash */ function convertSlash($string) { $string = trim($string, '/'); $string = preg_replace('/\/\//', '/', $string); $string = str_replace('/', '_', $string); return $string; } } iØ]Ì9ffff N˜Äalse, //[optional] use file locking * 'serialize' => true, [optional] * )); * * APC (http://pecl.php.net/package/APC) * * Cache::config('default', array( * 'engine' => 'Apc', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * )); * * Xcache (http://xcache.lighttpd.net/) * * Cache::config('default', array( * 'engine' => 'Xcache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * 'user' => 'user', //user from xcache.admin.user settings * 'password' => 'password', //plaintext password (xcache.admin.pass) * )); * * Memcache (http://memcached.org/) * * Cache::config('default', array( * 'engine' => 'Memcache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * 'servers' => array( * '127.0.0.1:11211' // localhost, default port 11211 * ), //[optional] * 'persistent' => true, // [optional] set this to false for non-persistent connections * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory) * )); * * Wincache (http://php.net/wincache) * * Cache::config('default', array( * 'engine' => 'Wincache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * )); */ /** * Pick the caching engine to use. If APC is enabled use it. * If running via cli - apc is disabled by default. ensure it's available and enabled in this case * */ $engine = 'File'; if (extension_loaded('apc') && function_exists('apc_dec') && (php_sapi_name() !== 'cli' || ini_get('apc.enable_cli'))) { $engine = 'Apc'; } // In development mode, caches should expire quickly. $duration = '+999 days'; if (Configure::read('debug') >= 1) { $duration = '+10 seconds'; } /** * Configure the cache used for general framework caching. Path information, * object listings, and translation cache files are stored with this configuration. */ Cache::config('_cake_core_', array( 'engine' => $engine, 'prefix' => 'cake_core_', 'path' => CACHE . 'persistent' . DS, 'serialize' => ($engine === 'File'), 'duration' => $duration )); /** * Configure the cache for model and datasource caches. This cache configuration * is used to store schema descriptions, and table listings in connections. */ Cache::config('_cake_model_', array( 'engine' => $engine, 'prefix' => 'cake_model_', 'path' => CACHE . 'models' . DS, 'serialize' => ($engine === 'File'), 'duration' => $duration )); /** * Custom global vars */ if ($_SERVER['HTTP_HOST'] == "atlas") { define("ARTICLEIMAGE", "http://atlas/img_article/"); define("BOTTLESHOT", "http://atlas/"); define("BOTTLESHOT_DIR", "d:\\bottles\\"); define("BOTTLESHOT_SQ", "http://atlas/bottles_sq/"); define("BOTTLESHOT_SQ_DIR", "d:\\bottles_sq\\"); define("FILECENTER_DIR", "D:\\file_center_test\\"); define("PH_ROOT", "http://atlas/planetaryherbals/"); define("SENDER_EMAIL", 'webcontact@thresholdent.com'); define("CS_EMAIL", "mattw@thresholdent.com"); } else if (($_SERVER['HTTP_HOST'] == 'test.planetaryherbals.com') || ($_SERVER['HTTP_HOST'] == 'test.planetaryformulas.com')) { define("ARTICLEIMAGE", "/img_article/"); define("BOTTLESHOT", "/bottles/"); define("BOTTLESHOT_DIR", "c:\\websites\\bottles\\"); define("BOTTLESHOT_SQ", "/bottles_sq/"); define("BOTTLESHOT_SQ_DIR", "c:\\websites\\bottles_sq\\"); // define("FILECENTER_DIR", "\\websites\\file_center_test\\"); define("FILECENTER_DIR", "\\websites\\file_center\\"); define("PH_ROOT", "https://test.planetaryherbals.com/"); define("SENDER_EMAIL", 'webcontact@thresholdent.com'); define("CS_EMAIL", "mattw@thresholdent.com"); } else { define("ARTICLEIMAGE", "/img_article/"); define("BOTTLESHOT", "/bottles/"); define("BOTTLESHOT_DIR", "c:\\websites\\bottles\\"); define("BOTTLESHOT_SQ", "/bottles_sq/"); define("BOTTLESHOT_SQ_DIR", "c:\\websites\\bottles_sq\\"); define("FILECENTER_DIR", "\\websites\\file_center\\"); define("PH_ROOT", "https://planetaryherbals.com/"); define("SENDER_EMAIL", 'webcontact@thresholdent.com'); define("CS_EMAIL", "csp1@thresholdent.com"); } define("SITE", "PF"); //define("BRAND", 287); define ("BRAND_CODE", "PH");