00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 define('SECOND', 1);
00033 define('MINUTE', 60 * SECOND);
00034 define('HOUR', 60 * MINUTE);
00035 define('DAY', 24 * HOUR);
00036 define('WEEK', 7 * DAY);
00037 define('MONTH', 30 * DAY);
00038 define('YEAR', 365 * DAY);
00039
00040
00041
00042 if (!function_exists('clone')) {
00043 if (version_compare(phpversion(), '5.0') < 0) {
00044 eval ('
00045 function clone($object)
00046 {
00047 return $object;
00048 }');
00049 }
00050 }
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 function config() {
00062 $args = func_get_args();
00063 foreach ($args as $arg) {
00064 if (('database' == $arg) && file_exists(CONFIGS . $arg . '.php')) {
00065 include_once(CONFIGS . $arg . '.php');
00066 } elseif (file_exists(CONFIGS . $arg . '.php')) {
00067 include_once(CONFIGS . $arg . '.php');
00068
00069 if (count($args) == 1) {
00070 return true;
00071 }
00072 } else {
00073 if (count($args) == 1) {
00074 return false;
00075 }
00076 }
00077 }
00078 return true;
00079 }
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 function uses() {
00091 $args = func_get_args();
00092 foreach ($args as $file) {
00093 require_once(LIBS . strtolower($file) . '.php');
00094 }
00095 }
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 function debug($var = false, $showHtml = false, $showFrom = true) {
00106 if (Configure::read() > 0) {
00107 if ($showFrom) {
00108 $calledFrom = debug_backtrace();
00109 print "<strong>".substr(r(ROOT, "", $calledFrom[0]['file']), 1)."</strong> (line <strong>".$calledFrom[0]['line']."</strong>)";
00110 }
00111 print "\n<pre class=\"cake-debug\">\n";
00112 $var = print_r($var, true);
00113
00114 if ($showHtml) {
00115 $var = str_replace('<', '<', str_replace('>', '>', $var));
00116 }
00117 print "{$var}\n</pre>\n";
00118 }
00119 }
00120 if (!function_exists('getMicrotime')) {
00121
00122
00123
00124
00125
00126 function getMicrotime() {
00127 list($usec, $sec) = explode(" ", microtime());
00128 return ((float)$usec + (float)$sec);
00129 }
00130 }
00131 if (!function_exists('sortByKey')) {
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 function sortByKey(&$array, $sortby, $order = 'asc', $type = SORT_NUMERIC) {
00142 if (!is_array($array)) {
00143 return null;
00144 }
00145
00146 foreach ($array as $key => $val) {
00147 $sa[$key] = $val[$sortby];
00148 }
00149
00150 if ($order == 'asc') {
00151 asort($sa, $type);
00152 } else {
00153 arsort($sa, $type);
00154 }
00155
00156 foreach ($sa as $key => $val) {
00157 $out[] = $array[$key];
00158 }
00159 return $out;
00160 }
00161 }
00162 if (!function_exists('array_combine')) {
00163
00164
00165
00166
00167
00168
00169
00170
00171 function array_combine($a1, $a2) {
00172 $a1 = array_values($a1);
00173 $a2 = array_values($a2);
00174 $c1 = count($a1);
00175 $c2 = count($a2);
00176
00177 if ($c1 != $c2) {
00178 return false;
00179 }
00180 if ($c1 <= 0) {
00181 return false;
00182 }
00183
00184 $output=array();
00185 for ($i = 0; $i < $c1; $i++) {
00186 $output[$a1[$i]] = $a2[$i];
00187 }
00188 return $output;
00189 }
00190 }
00191
00192
00193
00194
00195
00196
00197
00198 function h($text, $charset = null) {
00199 if (is_array($text)) {
00200 return array_map('h', $text);
00201 }
00202 if (empty($charset)) {
00203 $charset = Configure::read('App.encoding');
00204 }
00205 if (empty($charset)) {
00206 $charset = 'UTF-8';
00207 }
00208 return htmlspecialchars($text, ENT_QUOTES, $charset);
00209 }
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225 function a() {
00226 $args = func_get_args();
00227 return $args;
00228 }
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244 function aa() {
00245 $args = func_get_args();
00246 for ($l = 0, $c = count($args); $l < $c; $l++) {
00247 if ($l + 1 < count($args)) {
00248 $a[$args[$l]] = $args[$l + 1];
00249 } else {
00250 $a[$args[$l]] = null;
00251 }
00252 $l++;
00253 }
00254 return $a;
00255 }
00256
00257
00258
00259
00260
00261 function e($text) {
00262 echo $text;
00263 }
00264
00265
00266
00267
00268
00269
00270 function low($str) {
00271 return strtolower($str);
00272 }
00273
00274
00275
00276
00277
00278
00279 function up($str) {
00280 return strtoupper($str);
00281 }
00282
00283
00284
00285
00286
00287
00288
00289
00290 function r($search, $replace, $subject) {
00291 return str_replace($search, $replace, $subject);
00292 }
00293
00294
00295
00296
00297
00298
00299
00300
00301 function pr($var) {
00302 if (Configure::read() > 0) {
00303 echo "<pre>";
00304 print_r($var);
00305 echo "</pre>";
00306 }
00307 }
00308
00309
00310
00311
00312
00313
00314 function params($p) {
00315 if (!is_array($p) || count($p) == 0) {
00316 return null;
00317 } else {
00318 if (is_array($p[0]) && count($p) == 1) {
00319 return $p[0];
00320 } else {
00321 return $p;
00322 }
00323 }
00324 }
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334 function am() {
00335 $r = array();
00336 foreach (func_get_args()as $a) {
00337 if (!is_array($a)) {
00338 $a = array($a);
00339 }
00340 $r = array_merge($r, $a);
00341 }
00342 return $r;
00343 }
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353 function env($key) {
00354 if ($key == 'HTTPS') {
00355 if (isset($_SERVER) && !empty($_SERVER)) {
00356 return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on');
00357 } else {
00358 return (strpos(env('SCRIPT_URI'), 'https:
00359 }
00360 }
00361
00362 if ($key == 'SCRIPT_NAME') {
00363 if (env('CGI_MODE') && isset($_ENV['SCRIPT_URL'])) {
00364 $key = 'SCRIPT_URL';
00365 }
00366 }
00367
00368 $val = null;
00369 if (isset($_SERVER[$key])) {
00370 $val = $_SERVER[$key];
00371 } elseif (isset($_ENV[$key])) {
00372 $val = $_ENV[$key];
00373 } elseif (getenv($key) !== false) {
00374 $val = getenv($key);
00375 }
00376
00377 if ($key == 'REMOTE_ADDR' && $val == env('SERVER_ADDR')) {
00378 $addr = env('HTTP_PC_REMOTE_ADDR');
00379 if ($addr != null) {
00380 $val = $addr;
00381 }
00382 }
00383
00384 if ($val !== null) {
00385 return $val;
00386 }
00387
00388 switch ($key) {
00389 case 'SCRIPT_FILENAME':
00390 if (defined('SERVER_IIS') && SERVER_IIS === true){
00391 return str_replace('\\\\', '\\', env('PATH_TRANSLATED') );
00392 }
00393 break;
00394 case 'DOCUMENT_ROOT':
00395 $offset = 0;
00396 if (!strpos(env('SCRIPT_NAME'), '.php')) {
00397 $offset = 4;
00398 }
00399 return substr(env('SCRIPT_FILENAME'), 0, strlen(env('SCRIPT_FILENAME')) - (strlen(env('SCRIPT_NAME')) + $offset));
00400 break;
00401 case 'PHP_SELF':
00402 return r(env('DOCUMENT_ROOT'), '', env('SCRIPT_FILENAME'));
00403 break;
00404 case 'CGI_MODE':
00405 return (substr(php_sapi_name(), 0, 3) == 'cgi');
00406 break;
00407 case 'HTTP_BASE':
00408 return preg_replace ('/^([^.])*/i', null, env('HTTP_HOST'));
00409 break;
00410 }
00411 return null;
00412 }
00413 if (!function_exists('file_put_contents')) {
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423 function file_put_contents($fileName, $data) {
00424 if (is_array($data)) {
00425 $data = join('', $data);
00426 }
00427 $res = @fopen($fileName, 'w+b');
00428 if ($res) {
00429 $write = @fwrite($res, $data);
00430 if ($write === false) {
00431 return false;
00432 } else {
00433 @fclose($res);
00434 return $write;
00435 }
00436 }
00437 return false;
00438 }
00439 }
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450 function cache($path, $data = null, $expires = '+1 day', $target = 'cache') {
00451 if (Configure::read('Cache.disable')) {
00452 return null;
00453 }
00454 $now = time();
00455
00456 if (!is_numeric($expires)) {
00457 $expires = strtotime($expires, $now);
00458 }
00459
00460 switch(low($target)) {
00461 case 'cache':
00462 $filename = CACHE . $path;
00463 break;
00464 case 'public':
00465 $filename = WWW_ROOT . $path;
00466 break;
00467 case 'tmp':
00468 $filename = TMP . $path;
00469 break;
00470 }
00471 $timediff = $expires - $now;
00472 $filetime = false;
00473
00474 if (file_exists($filename)) {
00475 $filetime = @filemtime($filename);
00476 }
00477
00478 if ($data === null) {
00479 if (file_exists($filename) && $filetime !== false) {
00480 if ($filetime + $timediff < $now) {
00481 @unlink($filename);
00482 } else {
00483 $data = @file_get_contents($filename);
00484 }
00485 }
00486 } elseif (is_writable(dirname($filename))) {
00487 @file_put_contents($filename, $data);
00488 }
00489 return $data;
00490 }
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502 function clearCache($params = null, $type = 'views', $ext = '.php') {
00503 if (is_string($params) || $params === null) {
00504 $params = preg_replace('/\/\
00505 $cache = CACHE . $type . DS . $params;
00506
00507 if (is_file($cache . $ext)) {
00508 @unlink($cache . $ext);
00509 return true;
00510 } elseif (is_dir($cache)) {
00511 $files = glob("$cache*");
00512
00513 if ($files === false) {
00514 return false;
00515 }
00516
00517 foreach ($files as $file) {
00518 if (is_file($file)) {
00519 @unlink($file);
00520 }
00521 }
00522 return true;
00523 } else {
00524 $cache = CACHE . $type . DS . '*' . $params . $ext;
00525 $files = glob($cache);
00526
00527 $cache = CACHE . $type . DS . '*' . $params . '_*' . $ext;
00528
00529 if ($files === false) {
00530 return false;
00531 }
00532
00533 $files = array_merge($files, glob($cache));
00534
00535 foreach ($files as $file) {
00536 if (is_file($file)) {
00537 @unlink($file);
00538 }
00539 }
00540 return true;
00541 }
00542 } elseif (is_array($params)) {
00543 foreach ($params as $key => $file) {
00544 clearCache($file, $type, $ext);
00545 }
00546 return true;
00547 }
00548 return false;
00549 }
00550
00551
00552
00553
00554
00555
00556 function stripslashes_deep($value) {
00557 if (is_array($value)) {
00558 $return = array_map('stripslashes_deep', $value);
00559 return $return;
00560 } else {
00561 $return = stripslashes($value);
00562 return $return ;
00563 }
00564 }
00565
00566
00567
00568
00569
00570
00571
00572 function __($singular, $return = false) {
00573 if (!$singular) {
00574 return;
00575 }
00576 if (!class_exists('I18n')) {
00577 App::import('Core', 'i18n');
00578 }
00579
00580 if ($return === false) {
00581 echo I18n::translate($singular);
00582 } else {
00583 return I18n::translate($singular);
00584 }
00585 }
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596 function __n($singular, $plural, $count, $return = false) {
00597 if (!$singular) {
00598 return;
00599 }
00600 if (!class_exists('I18n')) {
00601 App::import('Core', 'i18n');
00602 }
00603
00604 if ($return === false) {
00605 echo I18n::translate($singular, $plural, null, 5, $count);
00606 } else {
00607 return I18n::translate($singular, $plural, null, 5, $count);
00608 }
00609 }
00610
00611
00612
00613
00614
00615
00616
00617
00618 function __d($domain, $msg, $return = false) {
00619 if (!$msg) {
00620 return;
00621 }
00622 if (!class_exists('I18n')) {
00623 App::import('Core', 'i18n');
00624 }
00625
00626 if ($return === false) {
00627 echo I18n::translate($msg, null, $domain);
00628 } else {
00629 return I18n::translate($msg, null, $domain);
00630 }
00631 }
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644 function __dn($domain, $singular, $plural, $count, $return = false) {
00645 if (!$singular) {
00646 return;
00647 }
00648 if (!class_exists('I18n')) {
00649 App::import('Core', 'i18n');
00650 }
00651
00652 if ($return === false) {
00653 echo I18n::translate($singular, $plural, $domain, 5, $count);
00654 } else {
00655 return I18n::translate($singular, $plural, $domain, 5, $count);
00656 }
00657 }
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680 function __dc($domain, $msg, $category, $return = false) {
00681 if (!$msg) {
00682 return;
00683 }
00684 if (!class_exists('I18n')) {
00685 App::import('Core', 'i18n');
00686 }
00687
00688 if ($return === false) {
00689 echo I18n::translate($msg, null, $domain, $category);
00690 } else {
00691 return I18n::translate($msg, null, $domain, $category);
00692 }
00693 }
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720 function __dcn($domain, $singular, $plural, $count, $category, $return = false) {
00721 if (!$singular) {
00722 return;
00723 }
00724 if (!class_exists('I18n')) {
00725 App::import('Core', 'i18n');
00726 }
00727
00728 if ($return === false) {
00729 echo I18n::translate($singular, $plural, $domain, $category, $count);
00730 } else {
00731 return I18n::translate($singular, $plural, $domain, $category, $count);
00732 }
00733 }
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752 function __c($msg, $category, $return = false) {
00753 if (!$msg) {
00754 return;
00755 }
00756 if (!class_exists('I18n')) {
00757 App::import('Core', 'i18n');
00758 }
00759
00760 if ($return === false) {
00761 echo I18n::translate($msg, null, null, $category);
00762 } else {
00763 return I18n::translate($msg, null, null, $category);
00764 }
00765 }
00766
00767
00768
00769
00770
00771
00772
00773 if (!function_exists('array_diff_key')) {
00774 function array_diff_key() {
00775 $valuesDiff = array();
00776
00777 if (func_num_args() < 2) {
00778 return false;
00779 }
00780
00781 foreach (func_get_args() as $param) {
00782 if (!is_array($param)) {
00783 return false;
00784 }
00785 }
00786
00787 $args = func_get_args();
00788 foreach ($args[0] as $valueKey => $valueData) {
00789 for ($i = 1; $i < func_num_args(); $i++) {
00790 if (isset($args[$i][$valueKey])) {
00791 continue 2;
00792 }
00793 }
00794 $valuesDiff[$valueKey] = $valueData;
00795 }
00796 return $valuesDiff;
00797 }
00798 }
00799
00800
00801
00802
00803
00804
00805
00806 if (!function_exists('array_intersect_key')) {
00807 function array_intersect_key($arr1, $arr2) {
00808 $res = array();
00809 foreach ($arr1 as $key=>$value) {
00810 if (array_key_exists($key, $arr2)) {
00811 $res[$key] = $arr1[$key];
00812 }
00813 }
00814 return $res;
00815 }
00816 }
00817
00818
00819
00820
00821
00822 function LogError($message) {
00823 if (!class_exists('CakeLog')) {
00824 App::import('Core', 'CakeLog');
00825 }
00826 $bad = array("\n", "\r", "\t");
00827 $good = ' ';
00828 CakeLog::write('error', str_replace($bad, $good, $message));
00829 }
00830
00831
00832
00833
00834
00835
00836 function fileExistsInPath($file) {
00837 $paths = explode(PATH_SEPARATOR, ini_get('include_path'));
00838 foreach ($paths as $path) {
00839 $fullPath = $path . DIRECTORY_SEPARATOR . $file;
00840
00841 if (file_exists($fullPath)) {
00842 return $fullPath;
00843 } elseif (file_exists($file)) {
00844 return $file;
00845 }
00846 }
00847 return false;
00848 }
00849
00850
00851
00852
00853
00854
00855 function convertSlash($string) {
00856 $string = trim($string,"/");
00857 $string = preg_replace('/\/\
00858 $string = str_replace('/', '_', $string);
00859 return $string;
00860 }
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871 if (!function_exists('http_build_query')) {
00872 function http_build_query($data, $prefix = null, $argSep = null, $baseKey = null) {
00873 if (empty($argSep)) {
00874 $argSep = ini_get('arg_separator.output');
00875 }
00876 if (is_object($data)) {
00877 $data = get_object_vars($data);
00878 }
00879 $out = array();
00880
00881 foreach ((array)$data as $key => $v) {
00882 if (is_numeric($key) && !empty($prefix)) {
00883 $key = $prefix . $key;
00884 }
00885 $key = urlencode($key);
00886
00887 if (!empty($baseKey)) {
00888 $key = $baseKey . '[' . $key . ']';
00889 }
00890
00891 if (is_array($v) || is_object($v)) {
00892 $out[] = http_build_query($v, $prefix, $argSep, $key);
00893 } else {
00894 $out[] = $key . '=' . urlencode($v);
00895 }
00896 }
00897 return implode($argSep, $out);
00898 }
00899 }
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913 function ife($condition, $val1 = null, $val2 = null) {
00914 if (!empty($condition)) {
00915 return $val1;
00916 }
00917 return $val2;
00918 }
00919
00920
00921
00922
00923 function loadView($name) {
00924 trigger_error('loadView is deprecated see App::import(\'View\', \'ViewName\');', E_USER_WARNING);
00925 return App::import('View', $name);
00926 }
00927
00928
00929
00930
00931 function loadModel($name = null) {
00932 trigger_error('loadModel is deprecated see App::import(\'Model\', \'ModelName\');', E_USER_WARNING);
00933 return App::import('Model', $name);
00934 }
00935
00936
00937
00938
00939 function loadController($name) {
00940 trigger_error('loadController is deprecated see App::import(\'Controller\', \'ControllerName\');', E_USER_WARNING);
00941 return App::import('Controller', $name);
00942 }
00943
00944
00945
00946
00947 function loadHelper($name) {
00948 trigger_error('loadHelper is deprecated see App::import(\'Helper\', \'PluginName.HelperName\');', E_USER_WARNING);
00949 return App::import('Helper', $name);
00950 }
00951
00952
00953
00954
00955 function loadPluginHelper($plugin, $helper) {
00956 trigger_error('loadPluginHelper is deprecated see App::import(\'Helper\', \'PluginName.HelperName\');', E_USER_WARNING);
00957 return App::import('Helper', $plugin . '.' . $helper);
00958 }
00959
00960
00961
00962
00963 function loadComponent($name) {
00964 trigger_error('loadComponent is deprecated see App::import(\'Component\', \'ComponentName\');', E_USER_WARNING);
00965 return App::import('Component', $name);
00966 }
00967
00968
00969
00970
00971 function loadPluginComponent($plugin, $component) {
00972 trigger_error('loadPluginComponent is deprecated see App::import(\'Component\', \'PluginName.ComponentName\');', E_USER_WARNING);
00973 return App::import('Component', $plugin . '.' . $component);
00974 }
00975
00976
00977
00978
00979 function loadBehavior($name) {
00980 trigger_error('loadBehavior is deprecated see App::import(\'Behavior\', $name);', E_USER_WARNING);
00981 return App::import('Behavior', $name);
00982 }
00983
00984
00985
00986
00987
00988 function loadModels() {
00989 $loadModels = array();
00990 if (func_num_args() > 0) {
00991 $args = func_get_args();
00992 foreach($args as $arg) {
00993 if (is_array($arg)) {
00994 $loadModels = am($loadModels, $arg);
00995 } else {
00996 $loadModels[] = $arg;
00997 }
00998 }
00999 }
01000
01001 if (empty($loadModels)) {
01002 $loadModels = Configure::listObjects('model');
01003 }
01004 App::import('Model', $loadModels);
01005 trigger_error('loadModels is deprecated see $model = Configure::listObjects(\'model\'); and App::import(\'Model\', $models);', E_USER_WARNING);
01006 return $loadModels;
01007 }
01008
01009
01010
01011
01012 function loadPluginModels($plugin) {
01013 if (!class_exists('AppModel')) {
01014 loadModel();
01015 }
01016 $plugin = Inflector::underscore($plugin);
01017 $pluginAppModel = Inflector::camelize($plugin . '_app_model');
01018 $pluginAppModelFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_model.php';
01019
01020 if (!class_exists($pluginAppModel)) {
01021 if (file_exists($pluginAppModelFile)) {
01022 require($pluginAppModelFile);
01023 Overloadable::overload($pluginAppModel);
01024 }
01025 }
01026
01027 $pluginModelDir = APP . 'plugins' . DS . $plugin . DS . 'models' . DS;
01028 if (is_dir($pluginModelDir)) {
01029 foreach (listClasses($pluginModelDir)as $modelFileName) {
01030 list($name) = explode('.', $modelFileName);
01031 $className = Inflector::camelize($name);
01032
01033 if (!class_exists($className)) {
01034 require($pluginModelDir . $modelFileName);
01035 Overloadable::overload($className);
01036 }
01037 }
01038 }
01039 trigger_error('loadPluginModels is deprecated see App::import(\'Model\', \'PluginName.PluginModel\');', E_USER_WARNING);
01040 }
01041
01042
01043
01044
01045
01046 function loadControllers() {
01047 $loadControllers = array();
01048 if (func_num_args() > 0) {
01049 $args = func_get_args();
01050 foreach($args as $arg) {
01051 if (is_array($arg)) {
01052 $loadControllers = am($loadControllers, $arg);
01053 } else {
01054 $loadControllers[] = $arg;
01055 }
01056 }
01057 }
01058
01059 if (empty($loadControllers)) {
01060 $loadControllers = Configure::listObjects('controller');
01061 }
01062 App::import('Controller', $loadControllers);
01063 trigger_error('loadControllers is deprecated see $controllers = Configure::listObjects(\'controller\'); and App::import(\'Controller\', $controllers);', E_USER_WARNING);
01064 return $loadControllers;
01065 }
01066
01067
01068
01069
01070 function listClasses($path ) {
01071 trigger_error('listClasses is deprecated see Configure::listObjects(\'file\', $path);', E_USER_WARNING);
01072 return Configure::listObjects('file', $path);
01073 }
01074
01075
01076
01077
01078 function paths() {
01079 $directories = Configure::getInstance();
01080 $paths = array();
01081
01082 foreach ($directories->modelPaths as $path) {
01083 $paths['Models'][] = $path;
01084 }
01085 foreach ($directories->behaviorPaths as $path) {
01086 $paths['Behaviors'][] = $path;
01087 }
01088 foreach ($directories->controllerPaths as $path) {
01089 $paths['Controllers'][] = $path;
01090 }
01091 foreach ($directories->componentPaths as $path) {
01092 $paths['Components'][] = $path;
01093 }
01094 foreach ($directories->helperPaths as $path) {
01095 $paths['Helpers'][] = $path;
01096 }
01097
01098 if (!class_exists('Folder')) {
01099 App::import('Core', 'Folder');
01100 }
01101
01102 $folder =& new Folder(APP.'plugins'.DS);
01103 $plugins = $folder->ls();
01104 $classPaths = array('models', 'models'.DS.'behaviors', 'controllers', 'controllers'.DS.'components', 'views'.DS.'helpers');
01105
01106 foreach ($plugins[0] as $plugin) {
01107 foreach ($classPaths as $path) {
01108 if (strpos($path, DS) !== false) {
01109 $key = explode(DS, $path);
01110 $key = $key[1];
01111 } else {
01112 $key = $path;
01113 }
01114 $folder->path = APP.'plugins'.DS.$plugin.DS.$path;
01115 $paths[Inflector::camelize($plugin)][Inflector::camelize($key)][] = $folder->path;
01116 }
01117 }
01118 return $paths;
01119 }
01120
01121
01122
01123 function vendor() {
01124 trigger_error('(vendor) Deprecated, see App::import(\'Vendor\', \'...\');', E_USER_WARNING);
01125 $args = func_get_args();
01126 $c = func_num_args();
01127
01128 for ($i = 0; $i < $c; $i++) {
01129 $arg = $args[$i];
01130
01131 if (strpos($arg, '.') !== false) {
01132 $file = explode('.', $arg);
01133 $plugin = Inflector::underscore($file[0]);
01134 unset($file[0]);
01135 $file = implode('.', $file);
01136 if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'vendors' . DS . $file . '.php')) {
01137 require_once(APP . 'plugins' . DS . $plugin . DS . 'vendors' . DS . $file . '.php');
01138 continue;
01139 }
01140 }
01141
01142 if (file_exists(APP . 'vendors' . DS . $arg . '.php')) {
01143 require_once(APP . 'vendors' . DS . $arg . '.php');
01144 } elseif (file_exists(VENDORS . $arg . '.php')) {
01145 require_once(VENDORS . $arg . '.php');
01146 } else {
01147 return false;
01148 }
01149 }
01150 return true;
01151 }
01152
01153
01154
01155
01156 function setUri() {
01157 return null;
01158 }
01159
01160
01161
01162
01163 function setUrl() {
01164 return null;
01165 }
01166 ?>