Browse Source

Merge pull request #1286 from hamiltont/fix-php-fuel

PHP: Update fuel
Hamilton Turner 10 years ago
parent
commit
49786076d6
100 changed files with 165 additions and 6781 deletions
  1. 1 1
      .travis.yml
  2. 6 0
      frameworks/PHP/fuel/.gitignore
  3. 0 0
      frameworks/PHP/fuel/.gitmodules
  4. 0 0
      frameworks/PHP/fuel/CHANGELOG.md
  5. 0 0
      frameworks/PHP/fuel/CONTRIBUTING.md
  6. 0 0
      frameworks/PHP/fuel/README.md
  7. 0 0
      frameworks/PHP/fuel/TESTING.md
  8. 0 0
      frameworks/PHP/fuel/__init__.py
  9. 0 0
      frameworks/PHP/fuel/bash_profile.sh
  10. 0 0
      frameworks/PHP/fuel/benchmark_config
  11. 0 0
      frameworks/PHP/fuel/build.xml
  12. 146 0
      frameworks/PHP/fuel/composer.json
  13. 0 0
      frameworks/PHP/fuel/deploy/nginx.conf
  14. 0 0
      frameworks/PHP/fuel/deploy/php-fuel
  15. 0 0
      frameworks/PHP/fuel/fuel/.htaccess
  16. 0 0
      frameworks/PHP/fuel/fuel/LICENSE
  17. 0 0
      frameworks/PHP/fuel/fuel/app/bootstrap.php
  18. 0 0
      frameworks/PHP/fuel/fuel/app/cache/.gitkeep
  19. 0 0
      frameworks/PHP/fuel/fuel/app/cache/fuel/agent/browscap.cache
  20. 0 0
      frameworks/PHP/fuel/fuel/app/classes/controller/.gitkeep
  21. 0 0
      frameworks/PHP/fuel/fuel/app/classes/controller/bench.php
  22. 0 0
      frameworks/PHP/fuel/fuel/app/classes/controller/welcome.php
  23. 0 0
      frameworks/PHP/fuel/fuel/app/classes/model/.gitkeep
  24. 0 0
      frameworks/PHP/fuel/fuel/app/classes/model/fortune.php
  25. 0 0
      frameworks/PHP/fuel/fuel/app/classes/model/world.php
  26. 0 0
      frameworks/PHP/fuel/fuel/app/classes/view/welcome/404.php
  27. 0 0
      frameworks/PHP/fuel/fuel/app/classes/view/welcome/hello.php
  28. 0 0
      frameworks/PHP/fuel/fuel/app/config/config.php
  29. 0 0
      frameworks/PHP/fuel/fuel/app/config/db.php
  30. 0 0
      frameworks/PHP/fuel/fuel/app/config/development/db.php
  31. 0 0
      frameworks/PHP/fuel/fuel/app/config/production/db.php
  32. 0 0
      frameworks/PHP/fuel/fuel/app/config/routes.php
  33. 0 0
      frameworks/PHP/fuel/fuel/app/config/staging/db.php
  34. 0 0
      frameworks/PHP/fuel/fuel/app/config/test/db.php
  35. 0 0
      frameworks/PHP/fuel/fuel/app/lang/en/.gitkeep
  36. 0 0
      frameworks/PHP/fuel/fuel/app/logs/.gitkeep
  37. 0 0
      frameworks/PHP/fuel/fuel/app/migrations/.gitkeep
  38. 0 0
      frameworks/PHP/fuel/fuel/app/modules/.gitkeep
  39. 0 0
      frameworks/PHP/fuel/fuel/app/tasks/robots.php
  40. 0 0
      frameworks/PHP/fuel/fuel/app/tests/controller/.gitkeep
  41. 0 0
      frameworks/PHP/fuel/fuel/app/tests/model/.gitkeep
  42. 0 0
      frameworks/PHP/fuel/fuel/app/tests/view/.gitkeep
  43. 0 0
      frameworks/PHP/fuel/fuel/app/tmp/.gitkeep
  44. 0 0
      frameworks/PHP/fuel/fuel/app/vendor/.gitkeep
  45. 0 0
      frameworks/PHP/fuel/fuel/app/views/.gitkeep
  46. 0 0
      frameworks/PHP/fuel/fuel/app/views/bench/fortunes.php
  47. 0 0
      frameworks/PHP/fuel/fuel/app/views/welcome/404.php
  48. 0 0
      frameworks/PHP/fuel/fuel/app/views/welcome/hello.php
  49. 0 0
      frameworks/PHP/fuel/fuel/app/views/welcome/index.php
  50. 0 0
      frameworks/PHP/fuel/fuel/packages/.gitkeep
  51. 12 0
      frameworks/PHP/fuel/install.sh
  52. 0 0
      frameworks/PHP/fuel/oil
  53. 0 0
      frameworks/PHP/fuel/public/.htaccess
  54. 0 0
      frameworks/PHP/fuel/public/assets/css/bootstrap-LICENSE
  55. 0 0
      frameworks/PHP/fuel/public/assets/css/bootstrap-responsive.css
  56. 0 0
      frameworks/PHP/fuel/public/assets/css/bootstrap-responsive.min.css
  57. 0 0
      frameworks/PHP/fuel/public/assets/css/bootstrap.css
  58. 0 0
      frameworks/PHP/fuel/public/assets/css/bootstrap.min.css
  59. 0 0
      frameworks/PHP/fuel/public/assets/css/index.html
  60. 0 0
      frameworks/PHP/fuel/public/assets/img/glyphicons-halflings-white.png
  61. 0 0
      frameworks/PHP/fuel/public/assets/img/glyphicons-halflings.png
  62. 0 0
      frameworks/PHP/fuel/public/assets/img/index.html
  63. 0 0
      frameworks/PHP/fuel/public/assets/js/bootstrap.js
  64. 0 0
      frameworks/PHP/fuel/public/assets/js/bootstrap.min.js
  65. 0 0
      frameworks/PHP/fuel/public/assets/js/index.html
  66. 0 0
      frameworks/PHP/fuel/public/index.php
  67. 0 0
      frameworks/PHP/fuel/setup.sh
  68. 0 0
      frameworks/PHP/fuel/source_code
  69. 0 0
      frameworks/PHP/fuel/web.config
  70. 0 5
      frameworks/PHP/lithium/setup.sh
  71. 0 15
      frameworks/PHP/php-fuel/fuel/core/.gitignore
  72. 0 366
      frameworks/PHP/php-fuel/fuel/core/base.php
  73. 0 255
      frameworks/PHP/php-fuel/fuel/core/bootstrap.php
  74. 0 42
      frameworks/PHP/php-fuel/fuel/core/bootstrap_phpunit.php
  75. 0 537
      frameworks/PHP/php-fuel/fuel/core/classes/agent.php
  76. 0 896
      frameworks/PHP/php-fuel/fuel/core/classes/arr.php
  77. 0 252
      frameworks/PHP/php-fuel/fuel/core/classes/asset.php
  78. 0 531
      frameworks/PHP/php-fuel/fuel/core/classes/asset/instance.php
  79. 0 368
      frameworks/PHP/php-fuel/fuel/core/classes/autoloader.php
  80. 0 140
      frameworks/PHP/php-fuel/fuel/core/classes/cache.php
  81. 0 36
      frameworks/PHP/php-fuel/fuel/core/classes/cache/handler/driver.php
  82. 0 44
      frameworks/PHP/php-fuel/fuel/core/classes/cache/handler/json.php
  83. 0 32
      frameworks/PHP/php-fuel/fuel/core/classes/cache/handler/serialized.php
  84. 0 30
      frameworks/PHP/php-fuel/fuel/core/classes/cache/handler/string.php
  85. 0 16
      frameworks/PHP/php-fuel/fuel/core/classes/cache/notfound.php
  86. 0 357
      frameworks/PHP/php-fuel/fuel/core/classes/cache/storage/apc.php
  87. 0 420
      frameworks/PHP/php-fuel/fuel/core/classes/cache/storage/driver.php
  88. 0 333
      frameworks/PHP/php-fuel/fuel/core/classes/cache/storage/file.php
  89. 0 412
      frameworks/PHP/php-fuel/fuel/core/classes/cache/storage/memcached.php
  90. 0 490
      frameworks/PHP/php-fuel/fuel/core/classes/cache/storage/redis.php
  91. 0 460
      frameworks/PHP/php-fuel/fuel/core/classes/cli.php
  92. 0 231
      frameworks/PHP/php-fuel/fuel/core/classes/config.php
  93. 0 207
      frameworks/PHP/php-fuel/fuel/core/classes/config/file.php
  94. 0 34
      frameworks/PHP/php-fuel/fuel/core/classes/config/ini.php
  95. 0 10
      frameworks/PHP/php-fuel/fuel/core/classes/config/interface.php
  96. 0 35
      frameworks/PHP/php-fuel/fuel/core/classes/config/json.php
  97. 0 38
      frameworks/PHP/php-fuel/fuel/core/classes/config/php.php
  98. 0 40
      frameworks/PHP/php-fuel/fuel/core/classes/config/yml.php
  99. 0 75
      frameworks/PHP/php-fuel/fuel/core/classes/controller.php
  100. 0 73
      frameworks/PHP/php-fuel/fuel/core/classes/controller/bench.php

+ 1 - 1
.travis.yml

@@ -94,7 +94,7 @@ env:
     - "TESTDIR=PHP/php"
     - "TESTDIR=PHP/codeigniter"
     - "TESTDIR=PHP/php-fatfree"
-    - "TESTDIR=PHP/php-fuel"
+    - "TESTDIR=PHP/fuel"
     - "TESTDIR=PHP/kohana"
     - "TESTDIR=PHP/php-laravel"
     - "TESTDIR=PHP/lithium"

+ 6 - 0
frameworks/PHP/php-fuel/.gitignore → frameworks/PHP/fuel/.gitignore

@@ -7,3 +7,9 @@
 .DS_Store
 /tags
 .idea
+docs
+vendor
+fuel/core
+fuel/vendor
+fuel/packages
+deploy/php-fpm.pid

+ 0 - 0
frameworks/PHP/php-fuel/.gitmodules → frameworks/PHP/fuel/.gitmodules


+ 0 - 0
frameworks/PHP/php-fuel/CHANGELOG.md → frameworks/PHP/fuel/CHANGELOG.md


+ 0 - 0
frameworks/PHP/php-fuel/CONTRIBUTING.md → frameworks/PHP/fuel/CONTRIBUTING.md


+ 0 - 0
frameworks/PHP/php-fuel/README.md → frameworks/PHP/fuel/README.md


+ 0 - 0
frameworks/PHP/php-fuel/TESTING.md → frameworks/PHP/fuel/TESTING.md


+ 0 - 0
frameworks/PHP/php-fuel/__init__.py → frameworks/PHP/fuel/__init__.py


+ 0 - 0
frameworks/PHP/php-fuel/bash_profile.sh → frameworks/PHP/fuel/bash_profile.sh


+ 0 - 0
frameworks/PHP/php-fuel/benchmark_config → frameworks/PHP/fuel/benchmark_config


+ 0 - 0
frameworks/PHP/php-fuel/build.xml → frameworks/PHP/fuel/build.xml


+ 146 - 0
frameworks/PHP/fuel/composer.json

@@ -0,0 +1,146 @@
+{
+  "repositories": [
+      {
+          "type": "package",
+          "package": {
+              "name": "fuel/auth",
+              "type": "fuel-package",
+              "version": "1.7.2",
+              "dist": {
+                  "url": "https://github.com/fuel/auth/archive/1.7/master.zip",
+                  "type": "zip"
+              },
+              "source": {
+                  "url": "https://github.com/fuel/auth.git",
+                  "type": "git",
+                  "reference": "1.8/develop"
+              }
+          }
+      },
+      {
+          "type": "package",
+          "package": {
+              "name": "fuel/email",
+              "type": "fuel-package",
+              "version": "1.7.2",
+              "dist": {
+                  "url": "https://github.com/fuel/email/archive/1.7/master.zip",
+                  "type": "zip"
+              },
+              "source": {
+                  "url": "https://github.com/fuel/email.git",
+                  "type": "git",
+                  "reference": "1.8/develop"
+              }
+          }
+      },
+      {
+          "type": "package",
+          "package": {
+              "name": "fuel/oil",
+              "type": "fuel-package",
+              "version": "1.7.2",
+              "dist": {
+                  "url": "https://github.com/fuel/oil/archive/1.7/master.zip",
+                  "type": "zip"
+              },
+              "source": {
+                  "url": "https://github.com/fuel/oil.git",
+                  "type": "git",
+                  "reference": "1.8/develop"
+              }
+          }
+      },
+      {
+          "type": "package",
+          "package": {
+              "name": "fuel/orm",
+              "type": "fuel-package",
+              "version": "1.7.2",
+              "dist": {
+                  "url": "https://github.com/fuel/orm/archive/1.7/master.zip",
+                  "type": "zip"
+              },
+              "source": {
+                  "url": "https://github.com/fuel/orm.git",
+                  "type": "git",
+                  "reference": "1.8/develop"
+              }
+          }
+      },
+      {
+          "type": "package",
+          "package": {
+              "name": "fuel/parser",
+              "type": "fuel-package",
+              "version": "1.7.2",
+              "dist": {
+                  "url": "https://github.com/fuel/parser/archive/1.7/master.zip",
+                  "type": "zip"
+              },
+              "source": {
+                  "url": "https://github.com/fuel/parser.git",
+                  "type": "git",
+                  "reference": "1.8/develop"
+              }
+          }
+      },
+      {
+          "type": "package",
+          "package": {
+              "name": "fuel/core",
+              "type": "fuel-package",
+              "version": "1.7.2",
+              "dist": {
+                  "url": "https://github.com/fuel/core/archive/1.7/master.zip",
+                  "type": "zip"
+              },
+              "source": {
+                  "url": "https://github.com/fuel/core.git",
+                  "type": "git",
+                  "reference": "1.8/develop"
+              }
+          }
+      },
+      {
+          "type": "package",
+          "package": {
+              "name": "fuel/docs",
+              "type": "fuel-package",
+              "version": "1.7.2",
+              "dist": {
+                  "url": "https://github.com/fuel/docs/archive/1.7/master.zip",
+                  "type": "zip"
+              },
+              "source": {
+                  "url": "https://github.com/fuel/docs.git",
+                  "type": "git",
+                  "reference": "1.8/develop"
+              }
+          }
+      }
+  ],
+  "_README_": [
+    "If you want to download everything",
+    "documentation,examples,etc, then require fuel/fuel",
+    "instead of just fuel/core",
+    "WARN: fuel/log"
+  ]
+  ,
+  "require": {
+    "composer/installers": "~1.0",
+    "fuel/core": "1.7.2",
+    "fuel/auth": "1.7.2",
+    "fuel/parser": "1.7.2",
+    "fuel/oil": "1.7.2",
+    "fuel/orm": "1.7.2"
+  },
+  "config": {
+    "vendor-dir": "fuel/vendor"
+  },
+  "extra": {
+      "installer-paths": {
+          "fuel/{$name}": ["fuel/core"]
+      }
+  }
+}

+ 0 - 0
frameworks/PHP/php-fuel/deploy/nginx.conf → frameworks/PHP/fuel/deploy/nginx.conf


+ 0 - 0
frameworks/PHP/php-fuel/deploy/php-fuel → frameworks/PHP/fuel/deploy/php-fuel


+ 0 - 0
frameworks/PHP/php-fuel/fuel/.htaccess → frameworks/PHP/fuel/fuel/.htaccess


+ 0 - 0
frameworks/PHP/php-fuel/fuel/LICENSE → frameworks/PHP/fuel/fuel/LICENSE


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/bootstrap.php → frameworks/PHP/fuel/fuel/app/bootstrap.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/cache/.gitkeep → frameworks/PHP/fuel/fuel/app/cache/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/cache/fuel/agent/browscap.cache → frameworks/PHP/fuel/fuel/app/cache/fuel/agent/browscap.cache


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/classes/controller/.gitkeep → frameworks/PHP/fuel/fuel/app/classes/controller/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/classes/controller/bench.php → frameworks/PHP/fuel/fuel/app/classes/controller/bench.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/classes/controller/welcome.php → frameworks/PHP/fuel/fuel/app/classes/controller/welcome.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/classes/model/.gitkeep → frameworks/PHP/fuel/fuel/app/classes/model/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/classes/model/fortune.php → frameworks/PHP/fuel/fuel/app/classes/model/fortune.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/classes/model/world.php → frameworks/PHP/fuel/fuel/app/classes/model/world.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/classes/view/welcome/404.php → frameworks/PHP/fuel/fuel/app/classes/view/welcome/404.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/classes/view/welcome/hello.php → frameworks/PHP/fuel/fuel/app/classes/view/welcome/hello.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/config/config.php → frameworks/PHP/fuel/fuel/app/config/config.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/config/db.php → frameworks/PHP/fuel/fuel/app/config/db.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/config/development/db.php → frameworks/PHP/fuel/fuel/app/config/development/db.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/config/production/db.php → frameworks/PHP/fuel/fuel/app/config/production/db.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/config/routes.php → frameworks/PHP/fuel/fuel/app/config/routes.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/config/staging/db.php → frameworks/PHP/fuel/fuel/app/config/staging/db.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/config/test/db.php → frameworks/PHP/fuel/fuel/app/config/test/db.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/lang/en/.gitkeep → frameworks/PHP/fuel/fuel/app/lang/en/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/logs/.gitkeep → frameworks/PHP/fuel/fuel/app/logs/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/migrations/.gitkeep → frameworks/PHP/fuel/fuel/app/migrations/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/modules/.gitkeep → frameworks/PHP/fuel/fuel/app/modules/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/tasks/robots.php → frameworks/PHP/fuel/fuel/app/tasks/robots.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/tests/controller/.gitkeep → frameworks/PHP/fuel/fuel/app/tests/controller/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/tests/model/.gitkeep → frameworks/PHP/fuel/fuel/app/tests/model/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/tests/view/.gitkeep → frameworks/PHP/fuel/fuel/app/tests/view/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/tmp/.gitkeep → frameworks/PHP/fuel/fuel/app/tmp/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/vendor/.gitkeep → frameworks/PHP/fuel/fuel/app/vendor/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/views/.gitkeep → frameworks/PHP/fuel/fuel/app/views/.gitkeep


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/views/bench/fortunes.php → frameworks/PHP/fuel/fuel/app/views/bench/fortunes.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/views/welcome/404.php → frameworks/PHP/fuel/fuel/app/views/welcome/404.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/views/welcome/hello.php → frameworks/PHP/fuel/fuel/app/views/welcome/hello.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/app/views/welcome/index.php → frameworks/PHP/fuel/fuel/app/views/welcome/index.php


+ 0 - 0
frameworks/PHP/php-fuel/fuel/core/lang/.gitkeep → frameworks/PHP/fuel/fuel/packages/.gitkeep


+ 12 - 0
frameworks/PHP/fuel/install.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+
+export PHP_HOME=${IROOT}/php-5.5.17
+export PHP_FPM=$PHP_HOME/sbin/php-fpm
+export NGINX_HOME=${IROOT}/nginx
+
+
+fw_depends php nginx composer
+
+${PHP_HOME}/bin/php $IROOT/composer.phar install \
+  --no-interaction --working-dir $TROOT \
+  --no-progress --optimize-autoloader 

+ 0 - 0
frameworks/PHP/php-fuel/oil → frameworks/PHP/fuel/oil


+ 0 - 0
frameworks/PHP/php-fuel/public/.htaccess → frameworks/PHP/fuel/public/.htaccess


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/css/bootstrap-LICENSE → frameworks/PHP/fuel/public/assets/css/bootstrap-LICENSE


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/css/bootstrap-responsive.css → frameworks/PHP/fuel/public/assets/css/bootstrap-responsive.css


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/css/bootstrap-responsive.min.css → frameworks/PHP/fuel/public/assets/css/bootstrap-responsive.min.css


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/css/bootstrap.css → frameworks/PHP/fuel/public/assets/css/bootstrap.css


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/css/bootstrap.min.css → frameworks/PHP/fuel/public/assets/css/bootstrap.min.css


+ 0 - 0
frameworks/PHP/php-fuel/fuel/core/config/index.html → frameworks/PHP/fuel/public/assets/css/index.html


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/img/glyphicons-halflings-white.png → frameworks/PHP/fuel/public/assets/img/glyphicons-halflings-white.png


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/img/glyphicons-halflings.png → frameworks/PHP/fuel/public/assets/img/glyphicons-halflings.png


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/css/index.html → frameworks/PHP/fuel/public/assets/img/index.html


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/js/bootstrap.js → frameworks/PHP/fuel/public/assets/js/bootstrap.js


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/js/bootstrap.min.js → frameworks/PHP/fuel/public/assets/js/bootstrap.min.js


+ 0 - 0
frameworks/PHP/php-fuel/public/assets/img/index.html → frameworks/PHP/fuel/public/assets/js/index.html


+ 0 - 0
frameworks/PHP/php-fuel/public/index.php → frameworks/PHP/fuel/public/index.php


+ 0 - 0
frameworks/PHP/php-fuel/setup.sh → frameworks/PHP/fuel/setup.sh


+ 0 - 0
frameworks/PHP/php-fuel/source_code → frameworks/PHP/fuel/source_code


+ 0 - 0
frameworks/PHP/php-fuel/web.config → frameworks/PHP/fuel/web.config


+ 0 - 5
frameworks/PHP/lithium/setup.sh

@@ -1,17 +1,12 @@
 #!/bin/bash
 
 export PHP_HOME=${IROOT}/php-5.5.17
-
 export PHP_FPM=$PHP_HOME/sbin/php-fpm
-
 export NGINX_HOME=${IROOT}/nginx
 
-
 sed -i 's|192.168.100.102|'"${DBHOST}"'|g' app/config/bootstrap/connections.php
 sed -i 's|root .*/FrameworkBenchmarks/php-lithium|root '"${TROOT}"'|g' deploy/nginx.conf
 sed -i 's|/usr/local/nginx/|'"${IROOT}"'/nginx/|g' deploy/nginx.conf
 
-export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"
-
 $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid
 $NGINX_HOME/sbin/nginx -c $TROOT/deploy/nginx.conf

+ 0 - 15
frameworks/PHP/php-fuel/fuel/core/.gitignore

@@ -1,15 +0,0 @@
-*~
-*.bak
-Thumbs.db
-desktop.ini
-.DS_Store
-.buildpath
-.project
-.settings
-fuel/app/logs/*/*/*
-fuel/app/cache/*/*
-nbproject/
-.idea
-*.tmproj
-*.sublime-project
-*.sublime-workspace

+ 0 - 366
frameworks/PHP/php-fuel/fuel/core/base.php

@@ -1,366 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-/**
- * Loads in a core class and optionally an app class override if it exists.
- *
- * @param   string  $path
- * @param   string  $folder
- * @return  void
- */
-if ( ! function_exists('import'))
-{
-	function import($path, $folder = 'classes')
-	{
-		$path = str_replace('/', DIRECTORY_SEPARATOR, $path);
-		require_once COREPATH.$folder.DIRECTORY_SEPARATOR.$path.'.php';
-
-		if (is_file(APPPATH.$folder.DIRECTORY_SEPARATOR.$path.'.php'))
-		{
-			require_once APPPATH.$folder.DIRECTORY_SEPARATOR.$path.'.php';
-		}
-	}
-}
-
-
-if ( ! function_exists('logger'))
-{
-	function logger($level, $msg, $method = null)
-	{
-		static $labels = array(
-			100 => 'DEBUG',
-			200 => 'INFO',
-			250 => 'NOTICE',
-			300 => 'WARNING',
-			400 => 'ERROR',
-			500 => 'CRITICAL',
-			550 => 'ALERT',
-			600 => 'EMERGENCY',
-			700 => 'ALL',
-		);
-
-		// make sure $level has the correct value
-		if ((is_int($level) and ! isset($labels[$level])) or (is_string($level) and ! array_search(strtoupper($level), $labels)))
-		{
-			throw new \FuelException('Invalid level "'.$level.'" passed to logger()');
-		}
-
-		// get the levels defined to be logged
-		$loglabels = \Config::get('log_threshold');
-
-		// bail out if we don't need logging at all
-		if ($loglabels == \Fuel::L_NONE)
-		{
-			return false;
-		}
-
-		// if profiling is active log the message to the profile
-		if (\Config::get('profiling'))
-		{
-			\Console::log($method.' - '.$msg);
-		}
-
-		// if it's not an array, assume it's an "up to" level
-		if ( ! is_array($loglabels))
-		{
-			$a = array();
-			foreach ($labels as $l => $label)
-			{
-				$l >= $loglabels and $a[] = $l;
-			}
-			$loglabels = $a;
-		}
-
-		// do we need to log the message with this level?
-		if ( ! in_array($level, $loglabels))
-		{
-			return false;
-		}
-
-		! class_exists('Log') and \Package::load('log');
-
-		return \Log::instance()->log($level, (empty($method) ? '' : $method.' - ').$msg);
-	}
-}
-
-
-/**
- * Takes an array of attributes and turns it into a string for an html tag
- *
- * @param	array	$attr
- * @return	string
- */
-if ( ! function_exists('array_to_attr'))
-{
-	function array_to_attr($attr)
-	{
-		$attr_str = '';
-
-		foreach ((array) $attr as $property => $value)
-		{
-			// Ignore null/false
-			if ($value === null or $value === false)
-			{
-				continue;
-			}
-
-			// If the key is numeric then it must be something like selected="selected"
-			if (is_numeric($property))
-			{
-				$property = $value;
-			}
-
-			$attr_str .= $property.'="'.$value.'" ';
-		}
-
-		// We strip off the last space for return
-		return trim($attr_str);
-	}
-}
-
-/**
- * Create a XHTML tag
- *
- * @param	string			The tag name
- * @param	array|string	The tag attributes
- * @param	string|bool		The content to place in the tag, or false for no closing tag
- * @return	string
- */
-if ( ! function_exists('html_tag'))
-{
-	function html_tag($tag, $attr = array(), $content = false)
-	{
-		$has_content = (bool) ($content !== false and $content !== null);
-		$html = '<'.$tag;
-
-		$html .= ( ! empty($attr)) ? ' '.(is_array($attr) ? array_to_attr($attr) : $attr) : '';
-		$html .= $has_content ? '>' : ' />';
-		$html .= $has_content ? $content.'</'.$tag.'>' : '';
-
-		return $html;
-	}
-}
-
-/**
- * A case-insensitive version of in_array.
- *
- * @param	mixed	$needle
- * @param	array	$haystack
- * @return	bool
- */
-if ( ! function_exists('in_arrayi'))
-{
-	function in_arrayi($needle, $haystack)
-	{
-		return in_array(strtolower($needle), array_map('strtolower', $haystack));
-	}
-}
-
-/**
- * Gets all the public vars for an object.  Use this if you need to get all the
- * public vars of $this inside an object.
- *
- * @return	array
- */
-if ( ! function_exists('get_object_public_vars'))
-{
-	function get_object_public_vars($obj)
-	{
-		return get_object_vars($obj);
-	}
-}
-
-/**
- * Renders a view and returns the output.
- *
- * @param   string	The view name/path
- * @param   array	The data for the view
- * @param   bool    Auto filter override
- * @return  string
- */
-if ( ! function_exists('render'))
-{
-	function render($view, $data = null, $auto_filter = null)
-	{
-		return \View::forge($view, $data, $auto_filter)->render();
-	}
-}
-
-/**
- * A wrapper function for Lang::get()
- *
- * @param	mixed	The string to translate
- * @param	array	The parameters
- * @return	string
- */
-if ( ! function_exists('__'))
-{
-	function __($string, $params = array(), $default = null)
-	{
-		return \Lang::get($string, $params, $default);
-	}
-}
-
-/**
- * Encodes the given string.  This is just a wrapper function for Security::htmlentities()
- *
- * @param	mixed	The string to encode
- * @return	string
- */
-if ( ! function_exists('e'))
-{
-	function e($string)
-	{
-		return Security::htmlentities($string);
-	}
-}
-
-/**
- * Takes a classname and returns the actual classname for an alias or just the classname
- * if it's a normal class.
- *
- * @param   string  classname to check
- * @return  string  real classname
- */
-if ( ! function_exists('get_real_class'))
-{
-	function get_real_class($class)
-	{
-		static $classes = array();
-
-		if ( ! array_key_exists($class, $classes))
-		{
-			$reflect = new ReflectionClass($class);
-			$classes[$class] = $reflect->getName();
-		}
-
-		return $classes[$class];
-	}
-}
-
-/**
- * Takes an associative array in the layout of parse_url, and constructs a URL from it
- *
- * see http://www.php.net/manual/en/function.http-build-url.php#96335
- *
- * @param   mixed   (Part(s) of) an URL in form of a string or associative array like parse_url() returns
- * @param   mixed   Same as the first argument
- * @param   int     A bitmask of binary or'ed HTTP_URL constants (Optional)HTTP_URL_REPLACE is the default
- * @param   array   If set, it will be filled with the parts of the composed url like parse_url() would return
- *
- * @return  string  constructed URL
- */
-if (!function_exists('http_build_url'))
-{
-	define('HTTP_URL_REPLACE', 1);				// Replace every part of the first URL when there's one of the second URL
-	define('HTTP_URL_JOIN_PATH', 2);			// Join relative paths
-	define('HTTP_URL_JOIN_QUERY', 4);			// Join query strings
-	define('HTTP_URL_STRIP_USER', 8);			// Strip any user authentication information
-	define('HTTP_URL_STRIP_PASS', 16);			// Strip any password authentication information
-	define('HTTP_URL_STRIP_AUTH', 32);			// Strip any authentication information
-	define('HTTP_URL_STRIP_PORT', 64);			// Strip explicit port numbers
-	define('HTTP_URL_STRIP_PATH', 128);			// Strip complete path
-	define('HTTP_URL_STRIP_QUERY', 256);		// Strip query string
-	define('HTTP_URL_STRIP_FRAGMENT', 512);		// Strip any fragments (#identifier)
-	define('HTTP_URL_STRIP_ALL', 1024);			// Strip anything but scheme and host
-
-	function http_build_url($url, $parts = array(), $flags = HTTP_URL_REPLACE, &$new_url = false)
-	{
-		$keys = array('user','pass','port','path','query','fragment');
-
-		// HTTP_URL_STRIP_ALL becomes all the HTTP_URL_STRIP_Xs
-		if ($flags & HTTP_URL_STRIP_ALL)
-		{
-			$flags |= HTTP_URL_STRIP_USER;
-			$flags |= HTTP_URL_STRIP_PASS;
-			$flags |= HTTP_URL_STRIP_PORT;
-			$flags |= HTTP_URL_STRIP_PATH;
-			$flags |= HTTP_URL_STRIP_QUERY;
-			$flags |= HTTP_URL_STRIP_FRAGMENT;
-		}
-		// HTTP_URL_STRIP_AUTH becomes HTTP_URL_STRIP_USER and HTTP_URL_STRIP_PASS
-		else if ($flags & HTTP_URL_STRIP_AUTH)
-		{
-			$flags |= HTTP_URL_STRIP_USER;
-			$flags |= HTTP_URL_STRIP_PASS;
-		}
-
-		// parse the original URL
-		$parse_url = is_array($url) ? $url : parse_url($url);
-
-		// make sure we always have a scheme, host and path
-		empty($parse_url['scheme']) and $parse_url['scheme'] = 'http';
-		empty($parse_url['host']) and $parse_url['host'] = \Input::server('http_host');
-		isset($parse_url['path']) or $parse_url['path'] = '';
-
-		// make the path absolute if needed
-		if ( ! empty($parse_url['path']) and substr($parse_url['path'], 0, 1) != '/')
-		{
-			$parse_url['path'] = '/'.$parse_url['path'];
-		}
-
-		// scheme and host are always replaced
-		isset($parts['scheme']) and $parse_url['scheme'] = $parts['scheme'];
-		isset($parts['host']) and $parse_url['host'] = $parts['host'];
-
-		// replace the original URL with it's new parts (if applicable)
-		if ($flags & HTTP_URL_REPLACE)
-		{
-			foreach ($keys as $key)
-			{
-				if (isset($parts[$key]))
-					$parse_url[$key] = $parts[$key];
-			}
-		}
-		else
-		{
-			// join the original URL path with the new path
-			if (isset($parts['path']) && ($flags & HTTP_URL_JOIN_PATH))
-			{
-				if (isset($parse_url['path']))
-					$parse_url['path'] = rtrim(str_replace(basename($parse_url['path']), '', $parse_url['path']), '/') . '/' . ltrim($parts['path'], '/');
-				else
-					$parse_url['path'] = $parts['path'];
-			}
-
-			// join the original query string with the new query string
-			if (isset($parts['query']) && ($flags & HTTP_URL_JOIN_QUERY))
-			{
-				if (isset($parse_url['query']))
-					$parse_url['query'] .= '&' . $parts['query'];
-				else
-					$parse_url['query'] = $parts['query'];
-			}
-		}
-
-		// strips all the applicable sections of the URL
-		// note: scheme and host are never stripped
-		foreach ($keys as $key)
-		{
-			if ($flags & (int)constant('HTTP_URL_STRIP_' . strtoupper($key)))
-				unset($parse_url[$key]);
-		}
-
-
-		$new_url = $parse_url;
-
-		return
-			 ((isset($parse_url['scheme'])) ? $parse_url['scheme'] . '://' : '')
-			.((isset($parse_url['user'])) ? $parse_url['user'] . ((isset($parse_url['pass'])) ? ':' . $parse_url['pass'] : '') .'@' : '')
-			.((isset($parse_url['host'])) ? $parse_url['host'] : '')
-			.((isset($parse_url['port'])) ? ':' . $parse_url['port'] : '')
-			.((isset($parse_url['path'])) ? $parse_url['path'] : '')
-			.((isset($parse_url['query'])) ? '?' . $parse_url['query'] : '')
-			.((isset($parse_url['fragment'])) ? '#' . $parse_url['fragment'] : '')
-		;
-	}
-}

+ 0 - 255
frameworks/PHP/php-fuel/fuel/core/bootstrap.php

@@ -1,255 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-define('DS', DIRECTORY_SEPARATOR);
-define('CRLF', chr(13).chr(10));
-
-setup_autoloader();
-
-// Load the base functions
-require COREPATH.'base.php';
-
-/**
- * Do we have access to mbstring?
- * We need this in order to work with UTF-8 strings
- */
-define('MBSTRING', function_exists('mb_get_info'));
-
-/**
- * Register all the error/shutdown handlers
- */
-register_shutdown_function(function ()
-{
-	// reset the autoloader
-	\Autoloader::_reset();
-
-	// Fire off the shutdown events
-	Event::shutdown();
-
-	return \Error::shutdown_handler();
-});
-
-set_exception_handler(function (\Exception $e)
-{
-	// reset the autoloader
-	\Autoloader::_reset();
-
-	return \Error::exception_handler($e);
-});
-
-set_error_handler(function ($severity, $message, $filepath, $line)
-{
-	// reset the autoloader
-	\Autoloader::_reset();
-
-	return \Error::error_handler($severity, $message, $filepath, $line);
-});
-
-function setup_autoloader()
-{
-	Autoloader::add_namespace('Fuel\\Core', COREPATH.'classes/');
-
-	Autoloader::add_namespace('PHPSecLib', COREPATH.'vendor'.DS.'phpseclib'.DS, true);
-
-	Autoloader::add_classes(array(
-		'Fuel\\Core\\Agent'           => COREPATH.'classes/agent.php',
-
-		'Fuel\\Core\\Arr'             => COREPATH.'classes/arr.php',
-
-		'Fuel\\Core\\Asset'           => COREPATH.'classes/asset.php',
-		'Fuel\\Core\\Asset_Instance'  => COREPATH.'classes/asset/instance.php',
-
-		'Fuel\\Core\\Cache'                     => COREPATH.'classes/cache.php',
-		'Fuel\\Core\\CacheNotFoundException'    => COREPATH.'classes/cache/notfound.php',
-		'Fuel\\Core\\CacheExpiredException'     => COREPATH.'classes/cache.php',
-		'Fuel\\Core\\Cache_Handler_Driver'      => COREPATH.'classes/cache/handler/driver.php',
-		'Fuel\\Core\\Cache_Handler_Json'        => COREPATH.'classes/cache/handler/json.php',
-		'Fuel\\Core\\Cache_Handler_Serialized'  => COREPATH.'classes/cache/handler/serialized.php',
-		'Fuel\\Core\\Cache_Handler_String'      => COREPATH.'classes/cache/handler/string.php',
-		'Fuel\\Core\\Cache_Storage_Driver'      => COREPATH.'classes/cache/storage/driver.php',
-		'Fuel\\Core\\Cache_Storage_Apc'         => COREPATH.'classes/cache/storage/apc.php',
-		'Fuel\\Core\\Cache_Storage_File'        => COREPATH.'classes/cache/storage/file.php',
-		'Fuel\\Core\\Cache_Storage_Memcached'   => COREPATH.'classes/cache/storage/memcached.php',
-		'Fuel\\Core\\Cache_Storage_Redis'       => COREPATH.'classes/cache/storage/redis.php',
-
-		'Fuel\\Core\\Config'               => COREPATH.'classes/config.php',
-		'Fuel\\Core\\ConfigException'      => COREPATH.'classes/config.php',
-		'Fuel\\Core\\Config_File'          => COREPATH.'classes/config/file.php',
-		'Fuel\\Core\\Config_Ini'           => COREPATH.'classes/config/ini.php',
-		'Fuel\\Core\\Config_Json'          => COREPATH.'classes/config/json.php',
-		'Fuel\\Core\\Config_Interface'     => COREPATH.'classes/config/interface.php',
-		'Fuel\\Core\\Config_Php'           => COREPATH.'classes/config/php.php',
-		'Fuel\\Core\\Config_Yml'          => COREPATH.'classes/config/yml.php',
-
-		'Fuel\\Core\\Controller'           => COREPATH.'classes/controller.php',
-		'Fuel\\Core\\Controller_Rest'      => COREPATH.'classes/controller/rest.php',
-		'Fuel\\Core\\Controller_Template'  => COREPATH.'classes/controller/template.php',
-		'Fuel\\Core\\Controller_Hybrid'    => COREPATH.'classes/controller/hybrid.php',
-
-		'Fuel\\Core\\Cookie'               => COREPATH.'classes/cookie.php',
-
-		'Fuel\\Core\\DB'      => COREPATH.'classes/db.php',
-		'Fuel\\Core\\DBUtil'  => COREPATH.'classes/dbutil.php',
-
-		'Fuel\\Core\\Database_Connection'            => COREPATH.'classes/database/connection.php',
-		'Fuel\\Core\\Database_Exception'             => COREPATH.'classes/database/exception.php',
-		'Fuel\\Core\\Database_Expression'            => COREPATH.'classes/database/expression.php',
-		'Fuel\\Core\\Database_Pdo_Connection'        => COREPATH.'classes/database/pdo/connection.php',
-		'Fuel\\Core\\Database_Query'                 => COREPATH.'classes/database/query.php',
-		'Fuel\\Core\\Database_Query_Builder'         => COREPATH.'classes/database/query/builder.php',
-		'Fuel\\Core\\Database_Query_Builder_Insert'  => COREPATH.'classes/database/query/builder/insert.php',
-		'Fuel\\Core\\Database_Query_Builder_Delete'  => COREPATH.'classes/database/query/builder/delete.php',
-		'Fuel\\Core\\Database_Query_Builder_Update'  => COREPATH.'classes/database/query/builder/update.php',
-		'Fuel\\Core\\Database_Query_Builder_Select'  => COREPATH.'classes/database/query/builder/select.php',
-		'Fuel\\Core\\Database_Query_Builder_Where'   => COREPATH.'classes/database/query/builder/where.php',
-		'Fuel\\Core\\Database_Query_Builder_Join'    => COREPATH.'classes/database/query/builder/join.php',
-		'Fuel\\Core\\Database_Result'                => COREPATH.'classes/database/result.php',
-		'Fuel\\Core\\Database_Result_Cached'         => COREPATH.'classes/database/result/cached.php',
-		'Fuel\\Core\\Database_Mysql_Connection'      => COREPATH.'classes/database/mysql/connection.php',
-		'Fuel\\Core\\Database_MySQL_Result'          => COREPATH.'classes/database/mysql/result.php',
-		'Fuel\\Core\\Database_Mysqli_Connection'     => COREPATH.'classes/database/mysqli/connection.php',
-		'Fuel\\Core\\Database_MySQLi_Result'         => COREPATH.'classes/database/mysqli/result.php',
-
-		'Fuel\\Core\\Fuel'           => COREPATH.'classes/fuel.php',
-		'Fuel\\Core\\FuelException'  => COREPATH.'classes/fuel.php',
-
-		'Fuel\\Core\\Finder'         => COREPATH.'classes/finder.php',
-
-		'Fuel\\Core\\Date' => COREPATH.'classes/date.php',
-
-		'Fuel\\Core\\Debug'   => COREPATH.'classes/debug.php',
-
-		'Fuel\\Core\\Cli'     => COREPATH.'classes/cli.php',
-
-		'Fuel\\Core\\Crypt'   => COREPATH.'classes/crypt.php',
-
-		'Fuel\\Core\\Event'            => COREPATH.'classes/event.php',
-		'Fuel\\Core\\Event_Instance'   => COREPATH.'classes/event/instance.php',
-
-		'Fuel\\Core\\Error'               => COREPATH.'classes/error.php',
-		'Fuel\\Core\\PhpErrorException'   => COREPATH.'classes/error.php',
-
-		'Fuel\\Core\\Format'  => COREPATH.'classes/format.php',
-
-		'Fuel\\Core\\Fieldset'        => COREPATH.'classes/fieldset.php',
-		'Fuel\\Core\\Fieldset_Field'  => COREPATH.'classes/fieldset/field.php',
-
-		'Fuel\\Core\\File'                    => COREPATH.'classes/file.php',
-		'Fuel\\Core\\FileAccessException'     => COREPATH.'classes/file.php',
-		'Fuel\\Core\\OutsideAreaException'    => COREPATH.'classes/file.php',
-		'Fuel\\Core\\InvalidPathException'    => COREPATH.'classes/file.php',
-		'Fuel\\Core\\File_Area'               => COREPATH.'classes/file/area.php',
-		'Fuel\\Core\\File_Handler_File'       => COREPATH.'classes/file/handler/file.php',
-		'Fuel\\Core\\File_Handler_Directory'  => COREPATH.'classes/file/handler/directory.php',
-
-		'Fuel\\Core\\Form'           => COREPATH.'classes/form.php',
-		'Fuel\\Core\\Form_Instance'  => COREPATH.'classes/form/instance.php',
-
-		'Fuel\\Core\\Ftp'                     => COREPATH.'classes/ftp.php',
-		'Fuel\\Core\\FtpConnectionException'  => COREPATH.'classes/ftp.php',
-		'Fuel\\Core\\FtpFileAccessException'  => COREPATH.'classes/ftp.php',
-
-		'Fuel\\Core\\HttpException'             => COREPATH.'classes/httpexception.php',
-		'Fuel\\Core\\HttpNotFoundException'     => COREPATH.'classes/httpexceptions.php',
-		'Fuel\\Core\\HttpServerErrorException'  => COREPATH.'classes/httpexceptions.php',
-
-		'Fuel\\Core\\Html'  => COREPATH.'classes/html.php',
-
-		'Fuel\\Core\\Image'              => COREPATH.'classes/image.php',
-		'Fuel\\Core\\Image_Driver'       => COREPATH.'classes/image/driver.php',
-		'Fuel\\Core\\Image_Gd'           => COREPATH.'classes/image/gd.php',
-		'Fuel\\Core\\Image_Imagemagick'  => COREPATH.'classes/image/imagemagick.php',
-		'Fuel\\Core\\Image_Imagick'      => COREPATH.'classes/image/imagick.php',
-
-		'Fuel\\Core\\Inflector'  => COREPATH.'classes/inflector.php',
-
-		'Fuel\\Core\\Input'      => COREPATH.'classes/input.php',
-
-		'Fuel\\Core\\Lang'               => COREPATH.'classes/lang.php',
-		'Fuel\\Core\\LangException'      => COREPATH.'classes/lang.php',
-		'Fuel\\Core\\Lang_File'          => COREPATH.'classes/lang/file.php',
-		'Fuel\\Core\\Lang_Ini'           => COREPATH.'classes/lang/ini.php',
-		'Fuel\\Core\\Lang_Json'          => COREPATH.'classes/lang/json.php',
-		'Fuel\\Core\\Lang_Interface'     => COREPATH.'classes/lang/interface.php',
-		'Fuel\\Core\\Lang_Php'           => COREPATH.'classes/lang/php.php',
-		'Fuel\\Core\\Lang_Yml'           => COREPATH.'classes/lang/yml.php',
-
-		'Fuel\\Core\\Markdown'   => COREPATH.'classes/markdown.php',
-
-		'Fuel\\Core\\Migrate'    => COREPATH.'classes/migrate.php',
-
-		'Fuel\\Core\\Model'      => COREPATH.'classes/model.php',
-		'Fuel\\Core\\Model_Crud' => COREPATH.'classes/model/crud.php',
-
-		'Fuel\\Core\\Module'                    => COREPATH.'classes/module.php',
-		'Fuel\\Core\\ModuleNotFoundException'   => COREPATH.'classes/module.php',
-
-		'Fuel\\Core\\Mongo_Db'           => COREPATH.'classes/mongo/db.php',
-		'Fuel\\Core\\Mongo_DbException'  => COREPATH.'classes/mongo/db.php',
-
-		'Fuel\\Core\\Output'               => COREPATH.'classes/output.php',
-
-		'Fuel\\Core\\Package'                   => COREPATH.'classes/package.php',
-		'Fuel\\Core\\PackageNotFoundException'  => COREPATH.'classes/package.php',
-
-		'Fuel\\Core\\Pagination'           => COREPATH.'classes/pagination.php',
-
-		'Fuel\\Core\\Profiler'             => COREPATH.'classes/profiler.php',
-
-		'Fuel\\Core\\Request'                 => COREPATH.'classes/request.php',
-		'Fuel\\Core\\Request_Driver'          => COREPATH.'classes/request/driver.php',
-		'Fuel\\Core\\RequestException'        => COREPATH.'classes/request/driver.php',
-		'Fuel\\Core\\RequestStatusException'  => COREPATH.'classes/request/driver.php',
-		'Fuel\\Core\\Request_Curl'            => COREPATH.'classes/request/curl.php',
-		'Fuel\\Core\\Request_Soap'            => COREPATH.'classes/request/soap.php',
-
-		'Fuel\\Core\\Redis'                   => COREPATH.'classes/redis.php',
-		'Fuel\\Core\\RedisException'          => COREPATH.'classes/redis.php',
-
-		'Fuel\\Core\\Response'  => COREPATH.'classes/response.php',
-
-		'Fuel\\Core\\Route'     => COREPATH.'classes/route.php',
-		'Fuel\\Core\\Router'    => COREPATH.'classes/router.php',
-
-		'Fuel\\Core\\Security'  => COREPATH.'classes/security.php',
-
-		'Fuel\\Core\\Session'            => COREPATH.'classes/session.php',
-		'Fuel\\Core\\Session_Driver'     => COREPATH.'classes/session/driver.php',
-		'Fuel\\Core\\Session_Db'         => COREPATH.'classes/session/db.php',
-		'Fuel\\Core\\Session_Cookie'     => COREPATH.'classes/session/cookie.php',
-		'Fuel\\Core\\Session_File'       => COREPATH.'classes/session/file.php',
-		'Fuel\\Core\\Session_Memcached'  => COREPATH.'classes/session/memcached.php',
-		'Fuel\\Core\\Session_Redis'      => COREPATH.'classes/session/redis.php',
-		'Fuel\\Core\\Session_Exception'  => COREPATH.'classes/session/exception.php',
-
-		'Fuel\\Core\\Num'       => COREPATH.'classes/num.php',
-
-		'Fuel\\Core\\Str'       => COREPATH.'classes/str.php',
-
-		'Fuel\\Core\\TestCase'  => COREPATH.'classes/testcase.php',
-
-		'Fuel\\Core\\Theme'          => COREPATH.'classes/theme.php',
-		'Fuel\\Core\\ThemeException' => COREPATH.'classes/theme.php',
-
-		'Fuel\\Core\\Uri'       => COREPATH.'classes/uri.php',
-
-		'Fuel\\Core\\Unzip'     => COREPATH.'classes/unzip.php',
-
-		'Fuel\\Core\\Upload'    => COREPATH.'classes/upload.php',
-
-		'Fuel\\Core\\Validation'        => COREPATH.'classes/validation.php',
-		'Fuel\\Core\\Validation_Error'  => COREPATH.'classes/validation/error.php',
-
-		'Fuel\\Core\\View'       => COREPATH.'classes/view.php',
-		'Fuel\\Core\\ViewModel'  => COREPATH.'classes/viewmodel.php',
-	));
-};

+ 0 - 42
frameworks/PHP/php-fuel/fuel/core/bootstrap_phpunit.php

@@ -1,42 +0,0 @@
-<?php
-
-// Load the PUPUnit Autoloader
-include_once('PHPUnit/Autoload.php');
-
-/**
- * Set error reporting and display errors settings.  You will want to change these when in production.
- */
-error_reporting(E_ALL);
-ini_set('display_errors', 1);
-
-$app_path		= rtrim($_SERVER['app_path'], '/').'/';
-$package_path	= rtrim($_SERVER['package_path'], '/').'/';
-$core_path		= rtrim($_SERVER['core_path'], '/').'/';
-
-/**
- * Website docroot
- */
-define('DOCROOT', realpath(__DIR__.DIRECTORY_SEPARATOR.$_SERVER['doc_root']).DIRECTORY_SEPARATOR);
-
-( ! is_dir($app_path) and is_dir(DOCROOT.$app_path)) and $app_path = DOCROOT.$app_path;
-( ! is_dir($core_path) and is_dir(DOCROOT.$core_path)) and $core_path = DOCROOT.$core_path;
-( ! is_dir($package_path) and is_dir(DOCROOT.$package_path)) and $package_path = DOCROOT.$package_path;
-
-define('APPPATH', realpath($app_path).DIRECTORY_SEPARATOR);
-define('PKGPATH', realpath($package_path).DIRECTORY_SEPARATOR);
-define('COREPATH', realpath($core_path).DIRECTORY_SEPARATOR);
-
-unset($app_path, $core_path, $package_path, $_SERVER['app_path'], $_SERVER['core_path'], $_SERVER['package_path']);
-
-// Get the start time and memory for use later
-defined('FUEL_START_TIME') or define('FUEL_START_TIME', microtime(true));
-defined('FUEL_START_MEM') or define('FUEL_START_MEM', memory_get_usage());
-
-// Boot the app
-require_once APPPATH.'bootstrap.php';
-
-// Set test mode
-Fuel::$is_test = true;
-
-// Import the TestCase class
-import('testcase');

+ 0 - 537
frameworks/PHP/php-fuel/fuel/core/classes/agent.php

@@ -1,537 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-/**
- * Identifies the platform, browser, robot, or mobile device from the user agent string
- *
- * This class uses PHP's get_browser() to get details from the browsers user agent
- * string. If not available, it can use a coded alternative using the php_browscap.ini
- * file from http://browsers.garykeith.com.
- *
- * @package	    Fuel
- * @subpackage  Core
- * @category    Core
- * @author      Harro Verton
- */
-
-class Agent
-{
-
-	/**
-	 * @var  array  information about the current browser
-	 */
-	protected static $properties = array(
-		'browser'             => 'unknown',
-		'version'             => 0,
-		'majorver'            => 0,
-		'minorver'            => 0,
-		'platform'            => 'unknown',
-		'alpha'               => false,
-		'beta'                => false,
-		'win16'               => false,
-		'win32'               => false,
-		'win64'               => false,
-		'frames'              => false,
-		'iframes'             => false,
-		'tables'              => false,
-		'cookies'             => false,
-		'backgroundsounds'    => false,
-		'javascript'          => false,
-		'vbscript'            => false,
-		'javaapplets'         => false,
-		'activexcontrols'     => false,
-		'isbanned'            => false,
-		'ismobiledevice'      => false,
-		'issyndicationreader' => false,
-		'crawler'             => false,
-		'cssversion'          => 0,
-		'aolversion'          => 0,
-	);
-
-	/**
-	 * @var  array  property to cache key mapping
-	 */
-	protected static $keys = array(
-		'browser'             => 'A',
-		'version'             => 'B',
-		'majorver'            => 'C',
-		'minorver'            => 'D',
-		'platform'            => 'E',
-		'alpha'               => 'F',
-		'beta'                => 'G',
-		'win16'               => 'H',
-		'win32'               => 'I',
-		'win64'               => 'J',
-		'frames'              => 'K',
-		'iframes'             => 'L',
-		'tables'              => 'M',
-		'cookies'             => 'N',
-		'backgroundsounds'    => 'O',
-		'javascript'          => 'P',
-		'vbscript'            => 'Q',
-		'javaapplets'         => 'R',
-		'activexcontrols'     => 'S',
-		'isbanned'            => 'T',
-		'ismobiledevice'      => 'U',
-		'issyndicationreader' => 'V',
-		'crawler'             => 'W',
-		'cssversion'          => 'X',
-		'aolversion'          => 'Y',
-	);
-
-	/**
-	 * @var	array	global config defaults
-	 */
-	protected static $defaults = array(
-		'browscap' => array(
-			'enabled' => true,
-			'url' => 'http://browsers.garykeith.com/stream.asp?Lite_PHP_BrowsCapINI',
-			'method' => 'wrapper',
-			'file' => '',
-		),
-		'cache' => array(
-			'driver' => '',
-			'expiry' => 604800,
-			'identifier' => 'fuel.agent',
-		),
-	);
-
-	/**
-	 * @var	array	global config items
-	 */
-	protected static $config = array(
-	);
-
-	/**
-	 * @var	string	detected user agent string
-	 */
-	protected static $user_agent = '';
-
-	// --------------------------------------------------------------------
-	// public static methods
-	// --------------------------------------------------------------------
-
-	/**
-	 * map the user agent string to browser specifications
-	 *
-	 * @return void
-	 */
-	public static function _init()
-	{
-		// fetch and store the user agent
-		static::$user_agent = \Input::server('http_user_agent', '');
-
-		// fetch and process the configuration
-		\Config::load('agent', true);
-
-		static::$config = array_merge(static::$defaults, \Config::get('agent', array()));
-
-		// validate the browscap configuration
-		if ( ! is_array(static::$config['browscap']))
-		{
-			static::$config['browscap'] = static::$defaults['browscap'];
-		}
-		else
-		{
-			if ( ! array_key_exists('enabled', static::$config['browscap']) or ! is_bool(static::$config['browscap']['enabled']))
-			{
-				static::$config['browscap']['enabled'] = true;
-			}
-
-			if ( ! array_key_exists('url', static::$config['browscap']) or ! is_string(static::$config['browscap']['url']))
-			{
-				static::$config['browscap']['url'] = static::$defaults['browscap']['url'];
-			}
-
-			if ( ! array_key_exists('file', static::$config['browscap']) or ! is_string(static::$config['browscap']['file']))
-			{
-				static::$config['browscap']['file'] = static::$defaults['browscap']['file'];
-			}
-
-			if ( ! array_key_exists('method', static::$config['browscap']) or ! is_string(static::$config['browscap']['method']))
-			{
-				static::$config['browscap']['method'] = static::$defaults['browscap']['method'];
-			}
-			static::$config['browscap']['method'] = strtolower(static::$config['browscap']['method']);
-		}
-
-		// validate the cache configuration
-		if ( ! is_array(static::$config['cache']))
-		{
-			static::$config['cache'] = static::$defaults['cache'];
-		}
-		else
-		{
-			if ( ! array_key_exists('driver', static::$config['cache']) or ! is_string(static::$config['cache']['driver']))
-			{
-				static::$config['cache']['driver'] = static::$defaults['cache']['driver'];
-			}
-
-			if ( ! array_key_exists('expiry', static::$config['cache']) or ! is_numeric(static::$config['cache']['expiry']) or static::$config['cache']['expiry'] < 7200)
-			{
-				static::$config['cache']['expiry'] = static::$defaults['cache']['expiry'];
-			}
-
-			if ( ! array_key_exists('identifier', static::$config['cache']) or ! is_string(static::$config['cache']['identifier']))
-			{
-				static::$config['cache']['identifier'] = static::$defaults['cache']['identifier'];
-			}
-		}
-
-		// try the build in get_browser() method
-		if (ini_get('browscap') == '' or false === $browser = get_browser(null, true))
-		{
-			// if it fails, emulate get_browser()
-			$browser = static::get_from_browscap();
-		}
-
-		if ($browser)
-		{
-			// save it for future reference
-			static::$properties = array_change_key_case($browser);
-		}
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * get the normalized browser name
-	 *
-	 * @return	string
-	 */
-	public static function browser()
-	{
-		return static::$properties['browser'];
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Get the browser platform
-	 *
-	 * @return	string
-	 */
-	public static function platform()
-	{
-		return static::$properties['platform'];
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Get the Browser Version
-	 *
-	 * @return	string
-	 */
-	public static function version()
-	{
-		return static::$properties['version'];
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Get any browser property
-	 *
-	 * @return	string
-	 */
-	public static function property($property = null)
-	{
-		$property = strtolower($property);
-		return array_key_exists($property, static::$properties) ? static::$properties[$property] : null;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Get all browser properties
-	 *
-	 * @return	array
-	 */
-	public static function properties()
-	{
-		return static::$properties;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * check if the current browser is a robot or crawler
-	 *
-	 * @return	bool
-	 */
-	public static function is_robot()
-	{
-		return static::$properties['crawler'];
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * check if the current browser is mobile device
-	 *
-	 * @return	bool
-	 */
-	public static function is_mobiledevice()
-	{
-		return static::$properties['ismobiledevice'];
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * check if the current browser accepts a specific language
-	 *
-	 * @param	string $language	optional ISO language code, defaults to 'en'
-	 * @return	bool
-	 */
-	public static function accepts_language($language = 'en')
-	{
-		return (in_array(strtolower($language), static::languages(), true)) ? true : false;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * check if the current browser accepts a specific character set
-	 *
-	 * @param	string $charset	optional character set, defaults to 'utf-8'
-	 * @return	bool
-	 */
-	public static function accepts_charset($charset = 'utf-8')
-	{
-		return (in_array(strtolower($charset), static::charsets(), true)) ? true : false;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * get the list of browser accepted languages
-	 *
-	 * @return	array
-	 */
-	public static function languages()
-	{
-		return explode(',', preg_replace('/(;q=[0-9\.]+)/i', '', strtolower(trim(\Input::server('http_accept_language')))));
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * get the list of browser accepted charactersets
-	 *
-	 * @return	array
-	 */
-	public static function charsets()
-	{
-		return explode(',', preg_replace('/(;q=.+)/i', '', strtolower(trim(\Input::server('http_accept_charset')))));
-	}
-
-	// --------------------------------------------------------------------
-	// internal static methods
-	// --------------------------------------------------------------------
-
-	/**
-	 * use the parsed php_browscap.ini file to find a user agent match
-	 *
-	 * @return	mixed	array if a match is found, of false if not cached yet
-	 */
-	protected static function get_from_browscap()
-	{
-		$cache = \Cache::forge(static::$config['cache']['identifier'].'.browscap', static::$config['cache']['driver']);
-
-		// load the cached browscap data
-		try
-		{
-			$browscap = $cache->get();
-		}
-		// browscap not cached
-		catch (\Exception $e)
-		{
-			$browscap = static::$config['browscap']['enabled'] ? static::parse_browscap() : array();
-		}
-
-		$search = array('\*', '\?');
-		$replace = array('.*', '.');
-
-		$result = false;
-
-		// find a match for the user agent string
-		foreach($browscap as $browser => $properties)
-		{
-			$pattern = '@^'.str_replace($search, $replace, preg_quote($browser, '@')).'$@i';
-			if (preg_match($pattern, static::$user_agent))
-			{
-				// store the browser name
-				$properties['browser'] = $browser;
-
-				// fetch possible parent info
-				if (array_key_exists('Parent', $properties))
-				{
-					if ($properties['Parent'] > 0)
-					{
-						$parent = array_slice($browscap, $properties['Parent'], 1);
-						unset($properties['Parent']);
-						$properties = array_merge(current($parent), $properties);
-
-						// store the browser name
-						$properties['browser'] = key($parent);
-					}
-				}
-
-				// normalize keys
-				$properties = \Arr::replace_key($properties, array_flip(static::$keys));
-
-				// merge it with the defaults to add missing values
-				$result = array_merge(static::$properties, $properties);
-
-				break;
-			}
-		}
-
-		return $result;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * download and parse the browscap file
-	 *
-	 * @return	array	array with parsed download info, or empty if the download is disabled of failed
-	 */
-	protected static function parse_browscap()
-	{
-		// get the browscap.ini file
-		switch (static::$config['browscap']['method'])
-		{
-			case 'local':
-				if ( ! file_exists(static::$config['browscap']['file']) or filesize(static::$config['browscap']['file']) == 0)
-				{
-					throw new \Exception('Agent class: could not open the local browscap.ini file.');
-				}
-				$data = @file_get_contents(static::$config['browscap']['file']);
-			break;
-
-			// socket connections are not implemented yet!
-			case 'sockets':
-				$data = false;
-			break;
-
-			case 'curl':
-				$curl = curl_init();
-				curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);
-				curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
-				curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
-				curl_setopt($curl, CURLOPT_MAXREDIRS, 5);
-				curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
-				curl_setopt($curl, CURLOPT_HEADER, 0);
-				curl_setopt($curl, CURLOPT_USERAGENT, 'Fuel PHP framework - Agent class (http://fuelphp.com)');
-				curl_setopt($curl, CURLOPT_URL, static::$config['browscap']['url']);
-				$data = curl_exec($curl);
-				curl_close($curl);
-			break;
-
-			case 'wrapper':
-				ini_set('user_agent', 'Fuel PHP framework - Agent class (http://fuelphp.com)');
-				try
-				{
-					$data = file_get_contents(static::$config['browscap']['url']);
-				}
-				catch (\ErrorException $e)
-				{
-					$data = false;
-				}
-			default:
-
-			break;
-		}
-
-		if ($data === false)
-		{
-			logger(\Fuel::L_ERROR, 'Failed to download browscap.ini file.', 'Agent::parse_browscap');
-		}
-
-		// parse the downloaded data
-		$browsers = @parse_ini_string($data, true, INI_SCANNER_RAW) or $browsers = array();
-
-		// remove the version and timestamp entry
-		array_shift($browsers);
-
-		$result = array();
-
-		// reverse sort on key string length
-		uksort($browsers, function($a, $b) { return strlen($a) < strlen($b) ? 1 : -1; } );
-
-		$index = array();
-		$count = 0;
-
-		// reduce the array keys
-		foreach($browsers as $browser => $properties)
-		{
-			$index[$browser] = $count++;
-
-			// fix any type issues
-			foreach ($properties as $var => $value)
-			{
-				if (is_numeric($value))
-				{
-					$properties[$var] = $value + 0;
-				}
-				elseif ($value == 'true')
-				{
-					$properties[$var] = true;
-				}
-				elseif ($value == 'false')
-				{
-					$properties[$var] = false;
-				}
-			}
-
-			$result[$browser] = \Arr::replace_key($properties, static::$keys);
-
-		}
-
-		// reduce parent links to
-		foreach($result as $browser => &$properties)
-		{
-			if (array_key_exists('Parent', $properties))
-			{
-				if ($properties['Parent'] == 'DefaultProperties')
-				{
-					unset($properties['Parent']);
-				}
-				else
-				{
-					if (array_key_exists($properties['Parent'], $index))
-					{
-						$properties['Parent'] = $index[$properties['Parent']];
-					}
-					else
-					{
-						unset($properties['Parent']);
-					}
-				}
-			}
-		}
-
-		// save the result to the cache
-		if ( ! empty($result))
-		{
-			$cache = \Cache::forge(static::$config['cache']['identifier'].'.browscap', static::$config['cache']['driver']);
-			$cache->set($result, static::$config['cache']['expiry']);
-		}
-
-		return $result;
-	}
-}

+ 0 - 896
frameworks/PHP/php-fuel/fuel/core/classes/arr.php

@@ -1,896 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-/**
- * The Arr class provides a few nice functions for making
- * dealing with arrays easier
- *
- * @package     Fuel
- * @subpackage  Core
- */
-class Arr
-{
-
-	/**
-	 * Gets a dot-notated key from an array, with a default value if it does
-	 * not exist.
-	 *
-	 * @param   array   $array    The search array
-	 * @param   mixed   $key      The dot-notated key or array of keys
-	 * @param   string  $default  The default value
-	 * @return  mixed
-	 */
-	public static function get($array, $key, $default = null)
-	{
-		if ( ! is_array($array) and ! $array instanceof \ArrayAccess)
-		{
-			throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
-		}
-
-		if (is_null($key))
-		{
-			return $array;
-		}
-
-		if (is_array($key))
-		{
-			$return = array();
-			foreach ($key as $k)
-			{
-				$return[$k] = static::get($array, $k, $default);
-			}
-			return $return;
-		}
-
-		foreach (explode('.', $key) as $key_part)
-		{
-			if (($array instanceof \ArrayAccess and isset($array[$key_part])) === false)
-			{
-				if ( ! is_array($array) or ! array_key_exists($key_part, $array))
-				{
-					return \Fuel::value($default);
-				}
-			}
-
-			$array = $array[$key_part];
-		}
-
-		return $array;
-	}
-
-	/**
-	 * Set an array item (dot-notated) to the value.
-	 *
-	 * @param   array   $array  The array to insert it into
-	 * @param   mixed   $key    The dot-notated key to set or array of keys
-	 * @param   mixed   $value  The value
-	 * @return  void
-	 */
-	public static function set(&$array, $key, $value = null)
-	{
-		if (is_null($key))
-		{
-			$array = $value;
-			return;
-		}
-
-		if (is_array($key))
-		{
-			foreach ($key as $k => $v)
-			{
-				static::set($array, $k, $v);
-			}
-		}
-		else
-		{
-			$keys = explode('.', $key);
-
-			while (count($keys) > 1)
-			{
-				$key = array_shift($keys);
-
-				if ( ! isset($array[$key]) or ! is_array($array[$key]))
-				{
-					$array[$key] = array();
-				}
-
-				$array =& $array[$key];
-			}
-
-			$array[array_shift($keys)] = $value;
-		}
-	}
-
-	/**
-	 * Pluck an array of values from an array.
-	 *
-	 * @param  array   $array  collection of arrays to pluck from
-	 * @param  string  $key    key of the value to pluck
-	 * @param  string  $index  optional return array index key, true for original index
-	 * @return array   array of plucked values
-	 */
-	public static function pluck($array, $key, $index = null)
-	{
-		$return = array();
-		$get_deep = strpos($key, '.') !== false;
-
-		if ( ! $index)
-		{
-			foreach ($array as $i => $a)
-			{
-				$return[] = (is_object($a) and ! ($a instanceof \ArrayAccess)) ? $a->{$key} :
-					($get_deep ? static::get($a, $key) : $a[$key]);
-			}
-		}
-		else
-		{
-			foreach ($array as $i => $a)
-			{
-				$index !== true and $i = (is_object($a) and ! ($a instanceof \ArrayAccess)) ? $a->{$index} : $a[$index];
-				$return[$i] = (is_object($a) and ! ($a instanceof \ArrayAccess)) ? $a->{$key} :
-					($get_deep ? static::get($a, $key) : $a[$key]);
-			}
-		}
-
-		return $return;
-	}
-
-	/**
-	 * Array_key_exists with a dot-notated key from an array.
-	 *
-	 * @param   array   $array    The search array
-	 * @param   mixed   $key      The dot-notated key or array of keys
-	 * @return  mixed
-	 */
-	public static function key_exists($array, $key)
-	{
-		foreach (explode('.', $key) as $key_part)
-		{
-			if ( ! is_array($array) or ! array_key_exists($key_part, $array))
-			{
-				return false;
-			}
-
-			$array = $array[$key_part];
-		}
-
-		return true;
-	}
-
-	/**
-	 * Unsets dot-notated key from an array
-	 *
-	 * @param   array   $array    The search array
-	 * @param   mixed   $key      The dot-notated key or array of keys
-	 * @return  mixed
-	 */
-	public static function delete(&$array, $key)
-	{
-		if (is_null($key))
-		{
-			return false;
-		}
-
-		if (is_array($key))
-		{
-			$return = array();
-			foreach ($key as $k)
-			{
-				$return[$k] = static::delete($array, $k);
-			}
-			return $return;
-		}
-
-		$key_parts = explode('.', $key);
-
-		if ( ! is_array($array) or ! array_key_exists($key_parts[0], $array))
-		{
-			return false;
-		}
-
-		$this_key = array_shift($key_parts);
-
-		if ( ! empty($key_parts))
-		{
-			$key = implode('.', $key_parts);
-			return static::delete($array[$this_key], $key);
-		}
-		else
-		{
-			unset($array[$this_key]);
-		}
-
-		return true;
-	}
-
-	/**
-	 * Converts a multi-dimensional associative array into an array of key => values with the provided field names
-	 *
-	 * @param   array   $assoc      the array to convert
-	 * @param   string  $key_field  the field name of the key field
-	 * @param   string  $val_field  the field name of the value field
-	 * @return  array
-	 * @throws  \InvalidArgumentException
-	 */
-	public static function assoc_to_keyval($assoc, $key_field, $val_field)
-	{
-		if ( ! is_array($assoc) and ! $assoc instanceof \Iterator)
-		{
-			throw new \InvalidArgumentException('The first parameter must be an array.');
-		}
-
-		$output = array();
-		foreach ($assoc as $row)
-		{
-			if (isset($row[$key_field]) and isset($row[$val_field]))
-			{
-				$output[$row[$key_field]] = $row[$val_field];
-			}
-		}
-
-		return $output;
-	}
-
-	/**
-	 * Converts the given 1 dimensional non-associative array to an associative
-	 * array.
-	 *
-	 * The array given must have an even number of elements or null will be returned.
-	 *
-	 *     Arr::to_assoc(array('foo','bar'));
-	 *
-	 * @param   string      $arr  the array to change
-	 * @return  array|null  the new array or null
-	 * @throws  \BadMethodCallException
-	 */
-	public static function to_assoc($arr)
-	{
-		if (($count = count($arr)) % 2 > 0)
-		{
-			throw new \BadMethodCallException('Number of values in to_assoc must be even.');
-		}
-		$keys = $vals = array();
-
-		for ($i = 0; $i < $count - 1; $i += 2)
-		{
-			$keys[] = array_shift($arr);
-			$vals[] = array_shift($arr);
-		}
-		return array_combine($keys, $vals);
-	}
-
-	/**
-	 * Checks if the given array is an assoc array.
-	 *
-	 * @param   array  $arr  the array to check
-	 * @return  bool   true if its an assoc array, false if not
-	 */
-	public static function is_assoc($arr)
-	{
-		if ( ! is_array($arr))
-		{
-			throw new \InvalidArgumentException('The parameter must be an array.');
-		}
-
-		$counter = 0;
-		foreach ($arr as $key => $unused)
-		{
-			if ( ! is_int($key) or $key !== $counter++)
-			{
-				return true;
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * Flattens a multi-dimensional associative array down into a 1 dimensional
-	 * associative array.
-	 *
-	 * @param   array   the array to flatten
-	 * @param   string  what to glue the keys together with
-	 * @param   bool    whether to reset and start over on a new array
-	 * @param   bool    whether to flatten only associative array's, or also indexed ones
-	 * @return  array
-	 */
-	public static function flatten($array, $glue = ':', $reset = true, $indexed = true)
-	{
-		static $return = array();
-		static $curr_key = array();
-
-		if ($reset)
-		{
-			$return = array();
-			$curr_key = array();
-		}
-
-		foreach ($array as $key => $val)
-		{
-			$curr_key[] = $key;
-			if (is_array($val) and ($indexed or array_values($val) !== $val))
-			{
-				static::flatten_assoc($val, $glue, false);
-			}
-			else
-			{
-				$return[implode($glue, $curr_key)] = $val;
-			}
-			array_pop($curr_key);
-		}
-		return $return;
-	}
-
-	/**
-	 * Flattens a multi-dimensional associative array down into a 1 dimensional
-	 * associative array.
-	 *
-	 * @param   array   the array to flatten
-	 * @param   string  what to glue the keys together with
-	 * @param   bool    whether to reset and start over on a new array
-	 * @return  array
-	 */
-	public static function flatten_assoc($array, $glue = ':', $reset = true)
-	{
-		return static::flatten($array, $glue, $reset, false);
-	}
-
-	/**
-	 * Reverse a flattened array in its original form.
-	 *
-	 * @param   array   $array  flattened array
-	 * @param   string  $glue   glue used in flattening
-	 * @return  array   the unflattened array
-	 */
-	public static function reverse_flatten($array, $glue = ':')
-	{
-		$return = array();
-
-		foreach ($array as $key => $value)
-		{
-			if (stripos($key, $glue) !== false)
-			{
-				$keys = explode($glue, $key);
-				$temp =& $return;
-				while (count($keys) > 1)
-				{
-					$key = array_shift($keys);
-					$key = is_numeric($key) ? (int) $key : $key;
-					if ( ! isset($temp[$key]) or ! is_array($temp[$key]))
-					{
-						$temp[$key] = array();
-					}
-					$temp =& $temp[$key];
-				}
-
-				$key = array_shift($keys);
-				$key = is_numeric($key) ? (int) $key : $key;
-				$temp[$key] = $value;
-			}
-			else
-			{
-				$key = is_numeric($key) ? (int) $key : $key;
-				$return[$key] = $value;
-			}
-		}
-
-		return $return;
-	}
-
-	/**
-	 * Filters an array on prefixed associative keys.
-	 *
-	 * @param   array   the array to filter.
-	 * @param   string  prefix to filter on.
-	 * @param   bool    whether to remove the prefix.
-	 * @return  array
-	 */
-	public static function filter_prefixed($array, $prefix, $remove_prefix = true)
-	{
-		$return = array();
-		foreach ($array as $key => $val)
-		{
-			if (preg_match('/^'.$prefix.'/', $key))
-			{
-				if ($remove_prefix === true)
-				{
-					$key = preg_replace('/^'.$prefix.'/','',$key);
-				}
-				$return[$key] = $val;
-			}
-		}
-		return $return;
-	}
-
-	/**
-	 * Recursive version of PHP's array_filter()
-	 *
-	 * @param   array   the array to filter.
-	 * @param   callback   the callback that determines whether or not a value is filtered
-	 * @return  array
-	 */
-	public static function filter_recursive($array, $callback = null)
-	{
-		foreach ($array as &$value)
-		{
-			if (is_array($value))
-			{
-				$value = $callback === null ? static::filter_recursive($value) : static::filter_recursive($value, $callback);
-			}
-		}
-
-		return $callback === null ? array_filter($array) : array_filter($array, $callback);
-   	}
-
-	/**
-	 * Removes items from an array that match a key prefix.
-	 *
-	 * @param   array   the array to remove from
-	 * @param   string  prefix to filter on
-	 * @return  array
-	 */
-	public static function remove_prefixed($array, $prefix)
-	{
-		foreach ($array as $key => $val)
-		{
-			if (preg_match('/^'.$prefix.'/', $key))
-			{
-				unset($array[$key]);
-			}
-		}
-		return $array;
-	}
-
-	/**
-	 * Filters an array on suffixed associative keys.
-	 *
-	 * @param   array   the array to filter.
-	 * @param   string  suffix to filter on.
-	 * @param   bool    whether to remove the suffix.
-	 * @return  array
-	 */
-	public static function filter_suffixed($array, $suffix, $remove_suffix = true)
-	{
-		$return = array();
-		foreach ($array as $key => $val)
-		{
-			if (preg_match('/'.$suffix.'$/', $key))
-			{
-				if ($remove_suffix === true)
-				{
-					$key = preg_replace('/'.$suffix.'$/','',$key);
-				}
-				$return[$key] = $val;
-			}
-		}
-		return $return;
-	}
-
-	/**
-	 * Removes items from an array that match a key suffix.
-	 *
-	 * @param   array   the array to remove from
-	 * @param   string  suffix to filter on
-	 * @return  array
-	 */
-	public static function remove_suffixed($array, $suffix)
-	{
-		foreach ($array as $key => $val)
-		{
-			if (preg_match('/'.$suffix.'$/', $key))
-			{
-				unset($array[$key]);
-			}
-		}
-		return $array;
-	}
-
-	/**
-	 * Filters an array by an array of keys
-	 *
-	 * @param   array   the array to filter.
-	 * @param   array   the keys to filter
-	 * @param   bool    if true, removes the matched elements.
-	 * @return  array
-	 */
-	public static function filter_keys($array, $keys, $remove = false)
-	{
-		$return = array();
-		foreach ($keys as $key)
-		{
-			if (array_key_exists($key, $array))
-			{
-				$remove or $return[$key] = $array[$key];
-				if($remove)
-				{
-					unset($array[$key]);
-				}
-			}
-		}
-		return $remove ? $array : $return;
-	}
-
-	/**
-	 * Insert value(s) into an array, mostly an array_splice alias
-	 * WARNING: original array is edited by reference, only boolean success is returned
-	 *
-	 * @param   array        the original array (by reference)
-	 * @param   array|mixed  the value(s) to insert, if you want to insert an array it needs to be in an array itself
-	 * @param   int          the numeric position at which to insert, negative to count from the end backwards
-	 * @return  bool         false when array shorter then $pos, otherwise true
-	 */
-	public static function insert(array &$original, $value, $pos)
-	{
-		if (count($original) < abs($pos))
-		{
-			\Error::notice('Position larger than number of elements in array in which to insert.');
-			return false;
-		}
-
-		array_splice($original, $pos, 0, $value);
-
-		return true;
-	}
-
-	/**
-	 * Insert value(s) into an array, mostly an array_splice alias
-	 * WARNING: original array is edited by reference, only boolean success is returned
-	 *
-	 * @param   array        the original array (by reference)
-	 * @param   array|mixed  the value(s) to insert, if you want to insert an array it needs to be in an array itself
-	 * @param   int          the numeric position at which to insert, negative to count from the end backwards
-	 * @return  bool         false when array shorter then $pos, otherwise true
-	 */
-	public static function insert_assoc(array &$original, array $values, $pos)
-	{
-		if (count($original) < abs($pos))
-		{
-			return false;
-		}
-
-		$original = array_slice($original, 0, $pos, true) + $values + array_slice($original, $pos, null, true);
-
-		return true;
-	}
-
-	/**
-	 * Insert value(s) into an array before a specific key
-	 * WARNING: original array is edited by reference, only boolean success is returned
-	 *
-	 * @param   array        the original array (by reference)
-	 * @param   array|mixed  the value(s) to insert, if you want to insert an array it needs to be in an array itself
-	 * @param   string|int   the key before which to insert
-	 * @param   bool         wether the input is an associative array
-	 * @return  bool         false when key isn't found in the array, otherwise true
-	 */
-	public static function insert_before_key(array &$original, $value, $key, $is_assoc = false)
-	{
-		$pos = array_search($key, array_keys($original));
-
-		if ($pos === false)
-		{
-			\Error::notice('Unknown key before which to insert the new value into the array.');
-			return false;
-		}
-
-		return $is_assoc ? static::insert_assoc($original, $value, $pos) : static::insert($original, $value, $pos);
-	}
-
-	/**
-	 * Insert value(s) into an array after a specific key
-	 * WARNING: original array is edited by reference, only boolean success is returned
-	 *
-	 * @param   array        the original array (by reference)
-	 * @param   array|mixed  the value(s) to insert, if you want to insert an array it needs to be in an array itself
-	 * @param   string|int   the key after which to insert
-	 * @param   bool         wether the input is an associative array
-	 * @return  bool         false when key isn't found in the array, otherwise true
-	 */
-	public static function insert_after_key(array &$original, $value, $key, $is_assoc = false)
-	{
-		$pos = array_search($key, array_keys($original));
-
-		if ($pos === false)
-		{
-			\Error::notice('Unknown key after which to insert the new value into the array.');
-			return false;
-		}
-
-		return $is_assoc ? static::insert_assoc($original, $value, $pos + 1) : static::insert($original, $value, $pos + 1);
-	}
-
-	/**
-	 * Insert value(s) into an array after a specific value (first found in array)
-	 *
-	 * @param   array        the original array (by reference)
-	 * @param   array|mixed  the value(s) to insert, if you want to insert an array it needs to be in an array itself
-	 * @param   string|int   the value after which to insert
-	 * @param   bool         wether the input is an associative array
-	 * @return  bool         false when value isn't found in the array, otherwise true
-	 */
-	public static function insert_after_value(array &$original, $value, $search, $is_assoc = false)
-	{
-		$key = array_search($search, $original);
-
-		if ($key === false)
-		{
-			\Error::notice('Unknown value after which to insert the new value into the array.');
-			return false;
-		}
-
-		return static::insert_after_key($original, $value, $key, $is_assoc);
-	}
-
-	/**
-	 * Insert value(s) into an array before a specific value (first found in array)
-	 *
-	 * @param   array        the original array (by reference)
-	 * @param   array|mixed  the value(s) to insert, if you want to insert an array it needs to be in an array itself
-	 * @param   string|int   the value after which to insert
-	 * @param   bool         wether the input is an associative array
-	 * @return  bool         false when value isn't found in the array, otherwise true
-	 */
-	public static function insert_before_value(array &$original, $value, $search, $is_assoc = false)
-	{
-		$key = array_search($search, $original);
-
-		if ($key === false)
-		{
-			\Error::notice('Unknown value before which to insert the new value into the array.');
-			return false;
-		}
-
-		return static::insert_before_key($original, $value, $key, $is_assoc);
-	}
-
-	/**
-	 * Sorts a multi-dimensional array by it's values.
-	 *
-	 * @access	public
-	 * @param	array	The array to fetch from
-	 * @param	string	The key to sort by
-	 * @param	string	The order (asc or desc)
-	 * @param	int		The php sort type flag
-	 * @return	array
-	 */
-	public static function sort($array, $key, $order = 'asc', $sort_flags = SORT_REGULAR)
-	{
-		if ( ! is_array($array))
-		{
-			throw new \InvalidArgumentException('Arr::sort() - $array must be an array.');
-		}
-
-		if (empty($array))
-		{
-			return $array;
-		}
-
-		foreach ($array as $k => $v)
-		{
-			$b[$k] = static::get($v, $key);
-		}
-
-		switch ($order)
-		{
-			case 'asc':
-				asort($b, $sort_flags);
-			break;
-
-			case 'desc':
-				arsort($b, $sort_flags);
-			break;
-
-			default:
-				throw new \InvalidArgumentException('Arr::sort() - $order must be asc or desc.');
-			break;
-		}
-
-		foreach ($b as $key => $val)
-		{
-			$c[] = $array[$key];
-		}
-
-		return $c;
-	}
-
-	/**
-	 * Sorts an array on multitiple values, with deep sorting support.
-	 *
-	 * @param   array  $array        collection of arrays/objects to sort
-	 * @param   array  $conditions   sorting conditions
-	 * @param   bool   @ignore_case  wether to sort case insensitive
-	 */
-	public static function multisort($array, $conditions, $ignore_case = false)
-	{
-		$temp = array();
-		$keys = array_keys($conditions);
-
-		foreach($keys as $key)
-		{
-			$temp[$key] = static::pluck($array, $key, true);
-			is_array($conditions[$key]) or $conditions[$key] = array($conditions[$key]);
-		}
-
-		$args = array();
-		foreach ($keys as $key)
-		{
-			$args[] = $ignore_case ? array_map('strtolower', $temp[$key]) : $temp[$key];
-			foreach($conditions[$key] as $flag)
-			{
-				$args[] = $flag;
-			}
-		}
-
-		$args[] = &$array;
-
-		call_user_func_array('array_multisort', $args);
-		return $array;
-	}
-
-	/**
-	 * Find the average of an array
-	 *
-	 * @param   array    the array containing the values
-	 * @return  numeric  the average value
-	 */
-	public static function average($array)
-	{
-		// No arguments passed, lets not divide by 0
-		if ( ! ($count = count($array)) > 0)
-		{
-			return 0;
-		}
-
-		return (array_sum($array) / $count);
-	}
-
-	/**
-	 * Replaces key names in an array by names in $replace
-	 *
-	 * @param   array			the array containing the key/value combinations
-	 * @param   array|string	key to replace or array containing the replacement keys
-	 * @param   string			the replacement key
-	 * @return  array			the array with the new keys
-	 */
-	public static function replace_key($source, $replace, $new_key = null)
-	{
-		if(is_string($replace))
-		{
-			$replace = array($replace => $new_key);
-		}
-
-		if ( ! is_array($source) or ! is_array($replace))
-		{
-			throw new \InvalidArgumentException('Arr::replace_key() - $source must an array. $replace must be an array or string.');
-		}
-
-		$result = array();
-
-		foreach ($source as $key => $value)
-		{
-			if (array_key_exists($key, $replace))
-			{
-				$result[$replace[$key]] = $value;
-			}
-			else
-			{
-				$result[$key] = $value;
-			}
-		}
-
-		return $result;
-	}
-
-	/**
-	 * Merge 2 arrays recursively, differs in 2 important ways from array_merge_recursive()
-	 * - When there's 2 different values and not both arrays, the latter value overwrites the earlier
-	 *   instead of merging both into an array
-	 * - Numeric keys that don't conflict aren't changed, only when a numeric key already exists is the
-	 *   value added using array_push()
-	 *
-	 * @param   array  multiple variables all of which must be arrays
-	 * @return  array
-	 * @throws  \InvalidArgumentException
-	 */
-	public static function merge()
-	{
-		$array  = func_get_arg(0);
-		$arrays = array_slice(func_get_args(), 1);
-
-		if ( ! is_array($array))
-		{
-			throw new \InvalidArgumentException('Arr::merge() - all arguments must be arrays.');
-		}
-
-		foreach ($arrays as $arr)
-		{
-			if ( ! is_array($arr))
-			{
-				throw new \InvalidArgumentException('Arr::merge() - all arguments must be arrays.');
-			}
-
-			foreach ($arr as $k => $v)
-			{
-				// numeric keys are appended
-				if (is_int($k))
-				{
-					array_key_exists($k, $array) ? array_push($array, $v) : $array[$k] = $v;
-				}
-				elseif (is_array($v) and array_key_exists($k, $array) and is_array($array[$k]))
-				{
-					$array[$k] = static::merge($array[$k], $v);
-				}
-				else
-				{
-					$array[$k] = $v;
-				}
-			}
-		}
-
-		return $array;
-	}
-
-	/**
-	 * Prepends a value with an asociative key to an array.
-	 * Will overwrite if the value exists.
-	 *
-	 * @param   array           $arr     the array to prepend to
-	 * @param   string|array    $key     the key or array of keys and values
-	 * @param   mixed           $valye   the value to prepend
-	 */
-	public static function prepend(&$arr, $key, $value = null)
-	{
-		$arr = (is_array($key) ? $key : array($key => $value)) + $arr;
-	}
-
-	/**
-	 * Recursive in_array
-	 *
-	 * @param   mixed  $needle    what to search for
-	 * @param   array  $haystack  array to search in
-	 * @return  bool   wether the needle is found in the haystack.
-	 */
-	public static function in_array_recursive($needle, $haystack, $strict = false)
-	{
-		foreach ($haystack as $value)
-		{
-			if ( ! $strict and $needle == $value)
-			{
-				return true;
-			}
-			elseif ($needle === $value)
-			{
-				return true;
-			}
-			elseif (is_array($value) and static::in_array_recursive($needle, $value, $strict))
-			{
-				return true;
-			}
-		}
-
-		return false;
-	}
-
-	/**
-	 * Checks if the given array is a multidimensional array.
-	 *
-	 * @param   array  $arr       the array to check
-	 * @param   array  $all_keys  if true, check that all elements are arrays
-	 * @return  bool   true if its a multidimensional array, false if not
-	 */
-	public static function is_multi($arr, $all_keys = false)
-	{
-		$values = array_filter($arr, 'is_array');
-		return $all_keys ? count($arr) === count($values) : count($values) > 0;
-	}
-}

+ 0 - 252
frameworks/PHP/php-fuel/fuel/core/classes/asset.php

@@ -1,252 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-/**
- * The Asset class allows you to easily work with your apps assets.
- * It allows you to specify multiple paths to be searched for the
- * assets.
- *
- * You can configure the paths by copying the core/config/asset.php
- * config file into your app/config folder and changing the settings.
- *
- * @package     Fuel
- * @subpackage  Core
- */
-class Asset
-{
-
-	/**
-	 * default instance
-	 *
-	 * @var  array
-	 */
-	protected static $_instance = null;
-
-	/**
-	 * All the Asset instances
-	 *
-	 * @var  array
-	 */
-	protected static $_instances = array();
-
-	/**
-	 * Default configuration values
-	 *
-	 * @var  array
-	 */
-	protected static $default_config = array(
-		'paths' => array('assets/'),
-		'img_dir' => 'img/',
-		'js_dir' => 'js/',
-		'css_dir' => 'css/',
-		'folders' => array(
-			'css' => array(),
-			'js'  => array(),
-			'img' => array(),
-		),
-		'url' => '/',
-		'add_mtime' => true,
-		'indent_level' => 1,
-		'indent_with' => "\t",
-		'auto_render' => true,
-		'fail_silently' => false,
-	);
-
-	/**
-	 * This is called automatically by the Autoloader.  It loads in the config
-	 *
-	 * @return  void
-	 */
-	public static function _init()
-	{
-		\Config::load('asset', true, false, true);
-	}
-
-	/**
-	 * Return a specific instance, or the default instance (is created if necessary)
-	 *
-	 * @param   string  instance name
-	 * @return  Asset_Instance
-	 */
-	public static function instance($instance = null)
-	{
-		if ($instance !== null)
-		{
-			if ( ! array_key_exists($instance, static::$_instances))
-			{
-				return false;
-			}
-
-			return static::$_instances[$instance];
-		}
-
-		if (static::$_instance === null)
-		{
-			static::$_instance = static::forge();
-		}
-
-		return static::$_instance;
-	}
-
-	/**
-	 * Gets a new instance of the Asset class.
-	 *
-	 * @param   string  instance name
-	 * @param   array  $config  default config overrides
-	 * @return  Asset_Instance
-	 */
-	public static function forge($name = 'default', array $config = array())
-	{
-		if ($exists = static::instance($name))
-		{
-			\Error::notice('Asset with this name exists already, cannot be overwritten.');
-			return $exists;
-		}
-
-		static::$_instances[$name] = new \Asset_Instance(array_merge(static::$default_config, \Config::get('asset'), $config));
-
-		if ($name == 'default')
-		{
-			static::$_instance = static::$_instances[$name];
-		}
-
-		return static::$_instances[$name];
-	}
-
-	/**
-	 * Adds the given path to the front of the asset paths array.  It adds paths
-	 * in a way so that asset paths are used First in Last Out.
-	 *
-	 * @param   string  the path to add
-	 * @return  void
-	 */
-	public static function add_path($path, $type = null)
-	{
-		static::instance()->add_path($path, $type);
-	}
-
-	/**
-	 * Removes the given path from the asset paths array
-	 *
-	 * @param   string  the path to remove
-	 * @return  void
-	 */
-	public static function remove_path($path, $type = null)
-	{
-		static::instance()->remove_path($path, $type);
-	}
-
-	/**
-	 * Renders the given group.  Each tag will be separated by a line break.
-	 * You can optionally tell it to render the files raw.  This means that
-	 * all CSS and JS files in the group will be read and the contents included
-	 * in the returning value.
-	 *
-	 * @param   mixed   the group to render
-	 * @param   bool    whether to return the raw file or not
-	 * @return  string  the group's output
-	 */
-	public static function render($group = null, $raw = false)
-	{
-		return static::instance()->render($group, $raw);
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * CSS
-	 *
-	 * Either adds the stylesheet to the group, or returns the CSS tag.
-	 *
-	 * @access	public
-	 * @param	mixed	The file name, or an array files.
-	 * @param	array	An array of extra attributes
-	 * @param	string	The asset group name
-	 * @return	string
-	 */
-	public static function css($stylesheets = array(), $attr = array(), $group = NULL, $raw = false)
-	{
-		return static::instance()->css($stylesheets, $attr, $group, $raw);
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * JS
-	 *
-	 * Either adds the javascript to the group, or returns the script tag.
-	 *
-	 * @access	public
-	 * @param	mixed	The file name, or an array files.
-	 * @param	array	An array of extra attributes
-	 * @param	string	The asset group name
-	 * @return	string
-	 */
-	public static function js($scripts = array(), $attr = array(), $group = NULL, $raw = false)
-	{
-		return static::instance()->js($scripts, $attr, $group, $raw);
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Img
-	 *
-	 * Either adds the image to the group, or returns the image tag.
-	 *
-	 * @access	public
-	 * @param	mixed	The file name, or an array files.
-	 * @param	array	An array of extra attributes
-	 * @param	string	The asset group name
-	 * @return	string
-	 */
-	public static function img($images = array(), $attr = array(), $group = NULL)
-	{
-		return static::instance()->img($images, $attr, $group);
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Get File
-	 *
-	 * Locates a file in all the asset paths, and return it relative to the docroot
-	 *
-	 * @access	public
-	 * @param	string	The filename to locate
-	 * @param	string	The sub-folder to look in (optional)
-	 * @return	mixed	Either the path to the file or false if not found
-	 */
-	public static function get_file($file, $type, $folder = '')
-	{
-		return static::instance()->get_file($file, $type, $folder);
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Find File
-	 *
-	 * Locates a file in all the asset paths.
-	 *
-	 * @access	public
-	 * @param	string	The filename to locate
-	 * @param	string	The sub-folder to look in (optional)
-	 * @return	mixed	Either the path to the file or false if not found
-	 */
-	public static function find_file($file, $type, $folder = '')
-	{
-		return static::instance()->find_file($file, $type, $folder);
-	}
-}

+ 0 - 531
frameworks/PHP/php-fuel/fuel/core/classes/asset/instance.php

@@ -1,531 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-/**
- * The Asset class allows you to easily work with your apps assets.
- * It allows you to specify multiple paths to be searched for the
- * assets.
- *
- * You can configure the paths by copying the core/config/asset.php
- * config file into your app/config folder and changing the settings.
- *
- * @package     Fuel
- * @subpackage  Core
- */
-class Asset_Instance
-{
-
-	/**
-	 * @var  array  the asset paths to be searched
-	 */
-	protected $_asset_paths = array(
-		'css' => array(),
-		'js' => array(),
-		'img' => array(),
-	);
-
-	/**
-	 * @var  array  the sub-folders to be searched
-	 */
-	protected $_path_folders = array(
-		'css' => 'css/',
-		'js' => 'js/',
-		'img' => 'img/',
-	);
-
-	/**
-	 * @var  string  the URL to be prepended to all assets
-	 */
-	protected $_asset_url = '/';
-
-	/**
-	 * @var  bool  whether to append the file mtime to the url
-	 */
-	protected $_add_mtime = true;
-
-	/**
-	 * @var  array  holds the groups of assets
-	 */
-	protected $_groups = array();
-
-	/**
-	 * @var  string  prefix for generated output to provide proper indentation
-	 */
-	protected $_ident = '';
-
-	/**
-	 * @var  bool  if true, directly renders the output of no group name is given
-	 */
-	protected $_auto_render = true;
-
-	/**
-	 * @var  bool  if true the 'not found' exception will not be thrown and the asset is ignored.
-	 */
-	protected $_fail_silently = false;
-
-	/**
-	 * Parse the config and initialize the object instance
-	 *
-	 * @return  void
-	 */
-	public function __construct($config)
-	{
-		//global search path folders
-		isset($config['css_dir']) and $this->_path_folders['css'] = $this->_unify_path($config['css_dir']);
-		isset($config['js_dir']) and $this->_path_folders['js'] = $this->_unify_path($config['js_dir']);
-		isset($config['img_dir']) and $this->_path_folders['img'] = $this->_unify_path($config['img_dir']);
-
-		// global search paths
-		foreach ($config['paths'] as $path)
-		{
-			$this->add_path($path);
-		}
-
-		// per-type search paths
-		foreach ($config['folders'] as $type => $folders)
-		{
-			is_array($folders) or $folders = array($folders);
-
-			foreach ($folders as $path)
-			{
-				$this->add_path($path, $type);
-			}
-		}
-
-		$this->_add_mtime = $config['add_mtime'];
-		$this->_asset_url = $config['url'];
-		$this->_indent = str_repeat($config['indent_with'], $config['indent_level']);
-		$this->_auto_render = $config['auto_render'];
-		$this->_fail_silently = $config['fail_silently'];
-	}
-
-	/**
-	 * Adds a new asset type to the list so we can load files of this type
-	 *
-	 * @param   string  new path type
-	 * @param   string  optional default path
-	 * @return  object  current instance
-	 */
-	public function add_type($type, $path = null)
-	{
-		isset($this->_asset_paths[$type]) or $this->_asset_paths[$type] = array();
-		isset($this->_path_folders[$type]) or $this->_path_folders[$type] = $type.'/';
-
-		if ( ! is_null($path))
-		{
-			$path = $this->_unify_path($path);
-			$this->_asset_paths[$type][] = $path;
-		}
-
-		return $this;
-	}
-
-	/**
-	 * Adds the given path to the front of the asset paths array.  It adds paths
-	 * in a way so that asset paths are used First in Last Out.
-	 *
-	 * @param   string  the path to add
-	 * @param   string  optional path type (js, css or img)
-	 * @return  object  current instance
-	 */
-	public function add_path($path, $type = null)
-	{
-		is_null($type) and $type = $this->_path_folders;
-		empty($path) and $path = DOCROOT;
-
-		if( is_array($type))
-		{
-			foreach ($type as $key => $folder)
-			{
-				is_numeric($key) and $key = $folder;
-				$folder = $this->_unify_path($path).ltrim($this->_unify_path($folder),DS);
-				array_unshift($this->_asset_paths[$key], $folder);
-			}
-		}
-		else
-		{
-			// create the asset type if it doesn't exist
-			if ( ! isset($this->_asset_paths[$type]))
-			{
-				$this->_asset_paths[$type] = array();
-				$this->_path_folders[$type] = $type.'/';
-			}
-
-			$path = $this->_unify_path($path);
-			array_unshift($this->_asset_paths[$type], $path);
-		}
-		return $this;
-	}
-
-	/**
-	 * Removes the given path from the asset paths array
-	 *
-	 * @param   string  the path to remove
-	 * @param   string  optional path type (js, css or img)
-	 * @return  object  current instance
-	 */
-	public function remove_path($path, $type = null)
-	{
-		is_null($type) and $type = $this->_path_folders;
-
-		if( is_array($type))
-		{
-			foreach ($type as $key => $folder)
-			{
-				is_numeric($key) and $key = $folder;
-				$folder = $this->_unify_path($path).ltrim($this->_unify_path($folder),DS);
-				if (($found = array_search($folder, $this->_asset_paths[$key])) !== false)
-				{
-					unset($this->_asset_paths[$key][$found]);
-				}
-			}
-		}
-		else
-		{
-			$path = $this->_unify_path($path);
-			if (($key = array_search($path, $this->_asset_paths[$type])) !== false)
-			{
-				unset($this->_asset_paths[$type][$key]);
-			}
-		}
-
-		return $this;
-	}
-
-	/**
-	 * Renders the given group.  Each tag will be separated by a line break.
-	 * You can optionally tell it to render the files raw.  This means that
-	 * all CSS and JS files in the group will be read and the contents included
-	 * in the returning value.
-	 *
-	 * @param   mixed   the group to render
-	 * @param   bool    whether to return the raw file or not
-	 * @return  string  the group's output
-	 */
-	public function render($group = null, $raw = false)
-	{
-		is_null($group) and $group = '_default_';
-
-		if (is_string($group))
-		{
-			isset($this->_groups[$group]) and $group = $this->_groups[$group];
-		}
-
-		is_array($group) or $group = array();
-
-		$css = '';
-		$js = '';
-		$img = '';
-		foreach ($group as $key => $item)
-		{
-			$type = $item['type'];
-			$filename = $item['file'];
-			$attr = $item['attr'];
-
-			// only do a file search if the asset is not a URI
-			if ( ! preg_match('|^(\w+:)?//|', $filename))
-			{
-				// and only if the asset is local to the applications base_url
-				if ( ! preg_match('|^(\w+:)?//|', $this->_asset_url) or strpos($this->_asset_url, \Config::get('base_url')) === 0)
-				{
-					if ( ! ($file = $this->find_file($filename, $type)))
-					{
-						if ($this->_fail_silently)
-						{
-							continue;
-						}
-
-						throw new \FuelException('Could not find asset: '.$filename);
-					}
-
-					$raw or $file = $this->_asset_url.$file.($this->_add_mtime ? '?'.filemtime($file) : '');
-				}
-				else
-				{
-					$raw or $file = $this->_asset_url.$filename;
-				}
-			}
-			else
-			{
-				$file = $filename;
-			}
-
-			switch($type)
-			{
-				case 'css':
-					$attr['type'] = 'text/css';
-					if ($raw)
-					{
-						$css .= html_tag('style', $attr, PHP_EOL.file_get_contents($file).PHP_EOL).PHP_EOL;
-					}
-					else
-					{
-						if ( ! isset($attr['rel']) or empty($attr['rel']))
-						{
-							$attr['rel'] = 'stylesheet';
-						}
-						$attr['href'] = $file;
-
-						$css .= $this->_indent.html_tag('link', $attr).PHP_EOL;
-					}
-				break;
-				case 'js':
-					$attr['type'] = 'text/javascript';
-					if ($raw)
-					{
-						$js .= html_tag('script', $attr, PHP_EOL.file_get_contents($file).PHP_EOL).PHP_EOL;
-					}
-					else
-					{
-						$attr['src'] = $file;
-
-						$js .= $this->_indent.html_tag('script', $attr, '').PHP_EOL;
-					}
-				break;
-				case 'img':
-					$attr['src'] = $file;
-					$attr['alt'] = isset($attr['alt']) ? $attr['alt'] : '';
-
-					$img .= html_tag('img', $attr );
-				break;
-			}
-
-		}
-
-		// return them in the correct order
-		return $css.$js.$img;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * CSS
-	 *
-	 * Either adds the stylesheet to the group, or returns the CSS tag.
-	 *
-	 * @access	public
-	 * @param	mixed	       The file name, or an array files.
-	 * @param	array	       An array of extra attributes
-	 * @param	string	       The asset group name
-	 * @return	string|object  Rendered asset or current instance when adding to group
-	 */
-	public function css($stylesheets = array(), $attr = array(), $group = null, $raw = false)
-	{
-		static $temp_group = 1000000;
-
-		if ($group === null)
-		{
-			$render = $this->_auto_render;
-			$group = $render ? (string) (++$temp_group) : '_default_';
-		}
-		else
-		{
-			$render = false;
-		}
-
-		$this->_parse_assets('css', $stylesheets, $attr, $group);
-
-		if ($render)
-		{
-			return $this->render($group, $raw);
-		}
-
-		return $this;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * JS
-	 *
-	 * Either adds the javascript to the group, or returns the script tag.
-	 *
-	 * @access	public
-	 * @param	mixed	       The file name, or an array files.
-	 * @param	array	       An array of extra attributes
-	 * @param	string	       The asset group name
-	 * @return	string|object  Rendered asset or current instance when adding to group
-	 */
-	public function js($scripts = array(), $attr = array(), $group = null, $raw = false)
-	{
-		static $temp_group = 2000000;
-
-		if ( ! isset($group))
-		{
-			$render = $this->_auto_render;
-			$group = $render ? (string) (++$temp_group) : '_default_';
-		}
-		else
-		{
-			$render = false;
-		}
-
-		$this->_parse_assets('js', $scripts, $attr, $group);
-
-		if ($render)
-		{
-			return $this->render($group, $raw);
-		}
-
-		return $this;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Img
-	 *
-	 * Either adds the image to the group, or returns the image tag.
-	 *
-	 * @access	public
-	 * @param	mixed	       The file name, or an array files.
-	 * @param	array	       An array of extra attributes
-	 * @param	string	       The asset group name
-	 * @return	string|object  Rendered asset or current instance when adding to group
-	 */
-	public function img($images = array(), $attr = array(), $group = null)
-	{
-		static $temp_group = 3000000;
-
-		if ( ! isset($group))
-		{
-			$render = $this->_auto_render;
-			$group = $render ? (string) (++$temp_group) : '_default_';
-		}
-		else
-		{
-			$render = false;
-		}
-
-		$this->_parse_assets('img', $images, $attr, $group);
-
-		if ($render)
-		{
-			return $this->render($group);
-		}
-
-		return $this;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Find File
-	 *
-	 * Locates a file in all the asset paths.
-	 *
-	 * @access	public
-	 * @param	string	The filename to locate
-	 * @param	string	The sub-folder to look in (optional)
-	 * @return	mixed	Either the path to the file or false if not found
-	 */
-	public function find_file($file, $type, $folder = '')
-	{
-		foreach ($this->_asset_paths[$type] as $path)
-		{
-			empty($folder) or $folder = $this->_unify_path($folder);
-
-			if (is_file($newfile = $path.$folder.$this->_unify_path($file, null, false)))
-			{
-				strpos($newfile, DOCROOT) === 0 and $newfile = substr($newfile, strlen(DOCROOT));
-
-				// return the file found, make sure it uses forward slashes on Windows
-				return str_replace(DS, '/', $newfile);
-			}
-		}
-
-		return false;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Get File
-	 *
-	 * Locates a file in all the asset paths, and return it relative to the docroot
-	 *
-	 * @access	public
-	 * @param	string	The filename to locate
-	 * @param	string	The sub-folder to look in (optional)
-	 * @return	mixed	Either the path to the file or false if not found
-	 */
-	public function get_file($file, $type, $folder = '')
-	{
-		if ($file = $this->find_file($file, $type, $folder))
-		{
-			return $this->_asset_url.$file;
-		}
-
-		return false;
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Parse Assets
-	 *
-	 * Pareses the assets and adds them to the group
-	 *
-	 * @access	private
-	 * @param	string	The asset type
-	 * @param	mixed	The file name, or an array files.
-	 * @param	array	An array of extra attributes
-	 * @param	string	The asset group name
-	 * @return	string
-	 */
-	protected function _parse_assets($type, $assets, $attr, $group)
-	{
-		if ( ! is_array($assets))
-		{
-			$assets = array($assets);
-		}
-
-		foreach ($assets as $key => $asset)
-		{
-			// Prevent duplicate files in a group.
-			if (\Arr::get($this->_groups, "$group.$key.file") == $asset)
-			{
-				continue;
-			}
-
-			$this->_groups[$group][] = array(
-				'type'	=>	$type,
-				'file'	=>	$asset,
-				'attr'	=>	(array) $attr
-			);
-		}
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Unify the path
-	 *
-	 * make sure the directory separator in the path is correct for the
-	 * platform used, is terminated with a directory separator, and all
-	 * relative path references are removed
-	 *
-	 * @access	private
-	 * @param	string	The path
-	 * @param	mixed	Optional directory separator
-	 * @return	string
-	 */
-	protected function _unify_path($path, $ds = null, $trailing = true)
-	{
-		$ds === null and $ds = DS;
-
-		return rtrim(str_replace(array('\\', '/'), $ds, $path), $ds).($trailing ? $ds : '');
-	}
-
-}

+ 0 - 368
frameworks/PHP/php-fuel/fuel/core/classes/autoloader.php

@@ -1,368 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-/**
- * The Autloader is responsible for all class loading.  It allows you to define
- * different load paths based on namespaces.  It also lets you set explicit paths
- * for classes to be loaded from.
- *
- * @package     Fuel
- * @subpackage  Core
- */
-class Autoloader
-{
-
-	/**
-	 * @var  array  $classes  holds all the classes and paths
-	 */
-	protected static $classes = array();
-
-	/**
-	 * @var  array  holds all the namespace paths
-	 */
-	protected static $namespaces = array();
-
-	/**
-	 * Holds all the PSR-0 compliant namespaces.  These namespaces should
-	 * be loaded according to the PSR-0 standard.
-	 *
-	 * @var  array
-	 */
-	protected static $psr_namespaces = array();
-
-	/**
-	 * @var  array  list off namespaces of which classes will be aliased to global namespace
-	 */
-	protected static $core_namespaces = array(
-		'Fuel\\Core'
-	);
-
-	/**
-	 * @var  array  the default path to look in if the class is not in a package
-	 */
-	protected static $default_path = null;
-
-	/**
-	 * @var  bool  whether to initialize a loaded class
-	 */
-	protected static $auto_initialize = null;
-
-	/**
-	 * Adds a namespace search path.  Any class in the given namespace will be
-	 * looked for in the given path.
-	 *
-	 * @param   string  the namespace
-	 * @param   string  the path
-	 * @return  void
-	 */
-	public static function add_namespace($namespace, $path, $psr = false)
-	{
-		static::$namespaces[$namespace] = $path;
-		if ($psr)
-		{
-			static::$psr_namespaces[$namespace] = $path;
-		}
-	}
-
-	/**
-	 * Adds an array of namespace paths. See {add_namespace}.
-	 *
-	 * @param   array  the namespaces
-	 * @param   bool   whether to prepend the namespace to the search path
-	 * @return  void
-	 */
-	public static function add_namespaces(array $namespaces, $prepend = false)
-	{
-		if ( ! $prepend)
-		{
-			static::$namespaces = array_merge(static::$namespaces, $namespaces);
-		}
-		else
-		{
-			static::$namespaces = $namespaces + static::$namespaces;
-		}
-	}
-
-	/**
-	 * Returns the namespace's path or false when it doesn't exist.
-	 *
-	 * @param   string      the namespace to get the path for
-	 * @return  array|bool  the namespace path or false
-	 */
-	public static function namespace_path($namespace)
-	{
-		if ( ! array_key_exists($namespace, static::$namespaces))
-		{
-			return false;
-		}
-
-		return static::$namespaces[$namespace];
-	}
-
-	/**
-	 * Adds a classes load path.  Any class added here will not be searched for
-	 * but explicitly loaded from the path.
-	 *
-	 * @param   string  the class name
-	 * @param   string  the path to the class file
-	 * @return  void
-	 */
-	public static function add_class($class, $path)
-	{
-		static::$classes[$class] = $path;
-	}
-
-	/**
-	 * Adds multiple class paths to the load path. See {@see Autoloader::add_class}.
-	 *
-	 * @param   array  the class names and paths
-	 * @return  void
-	 */
-	public static function add_classes($classes)
-	{
-		foreach ($classes as $class => $path)
-		{
-			static::$classes[$class] = $path;
-		}
-	}
-
-	/**
-	 * Aliases the given class into the given Namespace.  By default it will
-	 * add it to the global namespace.
-	 *
-	 * <code>
-	 * Autoloader::alias_to_namespace('Foo\\Bar');
-	 * Autoloader::alias_to_namespace('Foo\\Bar', '\\Baz');
-	 * </code>
-	 *
-	 * @param  string  $class      the class name
-	 * @param  string  $namespace  the namespace to alias to
-	 */
-	public static function alias_to_namespace($class, $namespace = '')
-	{
-		empty($namespace) or $namespace = rtrim($namespace, '\\').'\\';
-		$parts = explode('\\', $class);
-		$root_class = $namespace.array_pop($parts);
-		class_alias($class, $root_class);
-	}
-
-	/**
-	 * Register's the autoloader to the SPL autoload stack.
-	 *
-	 * @return	void
-	 */
-	public static function register()
-	{
-		spl_autoload_register('Autoloader::load', true, true);
-	}
-
-	/**
-	 * Returns the class with namespace prefix when available
-	 *
-	 * @param	string
-	 * @return	bool|string
-	 */
-	protected static function find_core_class($class)
-	{
-		foreach (static::$core_namespaces as $ns)
-		{
-			if (array_key_exists($ns_class = $ns.'\\'.$class, static::$classes))
-			{
-				return $ns_class;
-			}
-		}
-
-		return false;
-	}
-
-	/**
-	 * Add a namespace for which classes may be used without the namespace prefix and
-	 * will be auto-aliased to the global namespace.
-	 * Prefixing the classes will overwrite core classes and previously added namespaces.
-	 *
-	 * @param	string
-	 * @param	bool
-	 * @return	void
-	 */
-	public static function add_core_namespace($namespace, $prefix = true)
-	{
-		if ($prefix)
-		{
-			array_unshift(static::$core_namespaces, $namespace);
-		}
-		else
-		{
-			array_push(static::$core_namespaces, $namespace);
-		}
-	}
-
-	/**
-	 * Loads a class.
-	 *
-	 * @param   string  $class  Class to load
-	 * @return  bool    If it loaded the class
-	 */
-	public static function load($class)
-	{
-		// deal with funny is_callable('static::classname') side-effect
-		if (strpos($class, 'static::') === 0)
-		{
-			// is called from within the class, so it's already loaded
-			return true;
-		}
-
-		$loaded = false;
-		$class = ltrim($class, '\\');
-		$namespaced = ($pos = strripos($class, '\\')) !== false;
-
-		if (empty(static::$auto_initialize))
-		{
-			static::$auto_initialize = $class;
-		}
-
-		if (isset(static::$classes[$class]))
-		{
-			include str_replace('/', DS, static::$classes[$class]);
-			static::init_class($class);
-			$loaded = true;
-		}
-		elseif ($full_class = static::find_core_class($class))
-		{
-			if ( ! class_exists($full_class, false) and ! interface_exists($full_class, false))
-			{
-				include static::prep_path(static::$classes[$full_class]);
-			}
-			class_alias($full_class, $class);
-			static::init_class($class);
-			$loaded = true;
-		}
-		else
-		{
-			$full_ns = substr($class, 0, $pos);
-
-			if ($full_ns)
-			{
-				foreach (static::$namespaces as $ns => $path)
-				{
-					$ns = ltrim($ns, '\\');
-					if (stripos($full_ns, $ns) === 0)
-					{
-						$path .= static::class_to_path(
-							substr($class, strlen($ns) + 1),
-							array_key_exists($ns, static::$psr_namespaces)
-						);
-						if (is_file($path))
-						{
-							require $path;
-							static::init_class($class);
-							$loaded = true;
-							break;
-						}
-					}
-				}
-			}
-
-			if ( ! $loaded)
-			{
-				$path = APPPATH.'classes/'.static::class_to_path($class);
-
-				if (file_exists($path))
-				{
-					include $path;
-					static::init_class($class);
-					$loaded = true;
-				}
-			}
-		}
-
-		// Prevent failed load from keeping other classes from initializing
-		if (static::$auto_initialize == $class)
-		{
-			static::$auto_initialize = null;
-		}
-
-		return $loaded;
-	}
-
-	/**
-	 * Reset the auto initialize state after an autoloader exception.
-	 * This method is called by the exception handler, and is considered an
-	 * internal method!
-	 *
-	 * @access protected
-	 */
-	public static function _reset()
-	{
-		static::$auto_initialize = null;
-	}
-
-	/**
-	 * Takes a class name and turns it into a path.  It follows the PSR-0
-	 * standard, except for makes the entire path lower case, unless you
-	 * tell it otherwise.
-	 *
-	 * Note: This does not check if the file exists...just gets the path
-	 *
-	 * @param   string  $class  Class name
-	 * @param   bool    $psr    Whether this is a PSR-0 compliant class
-	 * @return  string  Path for the class
-	 */
-	protected static function class_to_path($class, $psr = false)
-	{
-		$file  = '';
-		if ($last_ns_pos = strripos($class, '\\'))
-		{
-			$namespace = substr($class, 0, $last_ns_pos);
-			$class = substr($class, $last_ns_pos + 1);
-			$file = str_replace('\\', DS, $namespace).DS;
-		}
-		$file .= str_replace('_', DS, $class).'.php';
-
-		if ( ! $psr)
-		{
-			$file = strtolower($file);
-		}
-
-		return $file;
-	}
-
-	/**
-	 * Prepares a given path by making sure the directory separators are correct.
-	 *
-	 * @param   string  $path  Path to prepare
-	 * @return  string  Prepped path
-	 */
-	protected static function prep_path($path)
-	{
-		return str_replace(array('/', '\\'), DS, $path);
-	}
-
-	/**
-	 * Checks to see if the given class has a static _init() method.  If so then
-	 * it calls it.
-	 *
-	 * @param	string	the class name
-	 */
-	protected static function init_class($class)
-	{
-		if (static::$auto_initialize === $class)
-		{
-			static::$auto_initialize = null;
-			if (method_exists($class, '_init') and is_callable($class.'::_init'))
-			{
-				call_user_func($class.'::_init');
-			}
-		}
-	}
-}

+ 0 - 140
frameworks/PHP/php-fuel/fuel/core/classes/cache.php

@@ -1,140 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-
-// Exception thrown when the Cache was found but expired (auto deleted)
-class CacheExpiredException extends \CacheNotFoundException {}
-
-
-class Cache
-{
-
-	/**
-	 * Loads any default caching settings when available
-	 */
-	public static function _init()
-	{
-		\Config::load('cache', true);
-	}
-
-	/**
-	 * Creates a new cache instance.
-	 *
-	 * @param   mixed                 The identifier of the cache, can be anything but empty
-	 * @param   array|string          Either an array of settings or the storage driver to be used
-	 * @return  Cache_Storage_Driver  The new cache object
-	 */
-	public static function forge($identifier, $config = array())
-	{
-		// load the default config
-		$defaults = \Config::get('cache', array());
-
-		// $config can be either an array of config settings or the name of the storage driver
-		if ( ! empty($config) and ! is_array($config) and ! is_null($config))
-		{
-			$config = array('driver' => $config);
-		}
-
-		// Overwrite default values with given config
-		$config = array_merge($defaults, (array) $config);
-
-		if (empty($config['driver']))
-		{
-			throw new \FuelException('No cache driver given or no default cache driver set.');
-		}
-
-		$class = '\\Cache_Storage_'.ucfirst($config['driver']);
-
-		// Convert the name to a string when necessary
-		$identifier = call_user_func($class.'::stringify_identifier', $identifier);
-
-		// Return instance of the requested cache object
-		return new $class($identifier, $config);
-	}
-
-	/**
-	 * Front for writing the cache, ensures interchangebility of storage drivers. Actual writing
-	 * is being done by the _set() method which needs to be extended.
-	 *
-	 * @param   mixed  The identifier of the cache, can be anything but empty
-	 * @param   mixed  The content to be cached
-	 * @param   int    The time in seconds until the cache will expire, =< 0 or null means no expiration
-	 * @param   array  Contains the identifiers of caches this one will depend on (not supported by all drivers!)
-	 * @return  Cache_Storage_Driver  The new Cache object
-	 */
-	public static function set($identifier, $contents = null, $expiration = false, $dependencies = array())
-	{
-		$contents = \Fuel::value($contents);
-
-		$cache = static::forge($identifier);
-		return $cache->set($contents, $expiration, $dependencies);
-	}
-
-	/**
-	 * Does get() & set() in one call that takes a callback and it's arguements to generate the contents
-	 *
-	 * @param   mixed         The identifier of the cache, can be anything but empty
-	 * @param   string|array  Valid PHP callback
-	 * @param   array         Arguements for the above function/method
-	 * @param   int           Cache expiration in seconds
-	 * @param   array         Contains the identifiers of caches this one will depend on (not supported by all drivers!)
-	 * @return  mixed
-	 */
-	public static function call($identifier, $callback, $args = array(), $expiration = null, $dependencies = array())
-	{
-		$cache = static::forge($identifier);
-		return $cache->call($callback, $args, $expiration, $dependencies);
-	}
-
-	/**
-	 * Front for reading the cache, ensures interchangebility of storage drivers. Actual reading
-	 * is being done by the _get() method which needs to be extended.
-	 *
-	 * @param   mixed  The identifier of the cache, can be anything but empty
-	 * @param   bool
-	 * @return  mixed
-	 */
-	public static function get($identifier, $use_expiration = true)
-	{
-		$cache = static::forge($identifier);
-		return $cache->get($use_expiration);
-	}
-
-	/**
-	 * Frontend for deleting item from the cache, interchangable storage methods. Actual operation
-	 * handled by delete() call on storage driver class
-	 *
-	 * @param  mixed  The identifier of the cache, can be anything but empty
-	 */
-	public static function delete($identifier)
-	{
-		$cache = static::forge($identifier);
-		return $cache->delete();
-	}
-
-	/**
-	 * Flushes the whole cache for a specific storage driver or just a part of it when $section is set
-	 * (might not work with all storage drivers), defaults to the default storage driver
-	 *
-	 * @param   null|string
-	 * @param   null|string
-	 * @return  bool
-	 */
-	public static function delete_all($section = null, $driver = null)
-	{
-		$cache = static::forge('__NOT_USED__', $driver);
-		return $cache->delete_all($section);
-	}
-}
-

+ 0 - 36
frameworks/PHP/php-fuel/fuel/core/classes/cache/handler/driver.php

@@ -1,36 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-
-
-interface Cache_Handler_Driver {
-
-	/**
-	 * Should make the contents readable
-	 *
-	 * @param   mixed
-	 * @return  mixed
-	 */
-	public function readable($contents);
-
-	/**
-	 * Should make the contents writable
-	 *
-	 * @param   mixed
-	 * @return  mixed
-	 */
-	public function writable($contents);
-}
-
-

+ 0 - 44
frameworks/PHP/php-fuel/fuel/core/classes/cache/handler/json.php

@@ -1,44 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-
-
-class Cache_Handler_Json implements \Cache_Handler_Driver
-{
-
-	public function readable($contents)
-	{
-		$array = false;
-		if (substr($contents, 0, 1) == 'a')
-		{
-			$contents = substr($contents, 1);
-			$array = true;
-		}
-
-		return json_decode($contents, $array);
-	}
-
-	public function writable($contents)
-	{
-		$array = '';
-		if (is_array($contents))
-		{
-			$array = 'a';
-		}
-
-		return $array.json_encode($contents);
-	}
-}
-
-

+ 0 - 32
frameworks/PHP/php-fuel/fuel/core/classes/cache/handler/serialized.php

@@ -1,32 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-
-
-class Cache_Handler_Serialized implements \Cache_Handler_Driver
-{
-
-	public function readable($contents)
-	{
-		return unserialize($contents);
-	}
-
-	public function writable($contents)
-	{
-		return serialize($contents);
-	}
-
-}
-
-

+ 0 - 30
frameworks/PHP/php-fuel/fuel/core/classes/cache/handler/string.php

@@ -1,30 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-
-
-class Cache_Handler_String implements \Cache_Handler_Driver
-{
-
-	public function readable($contents)
-	{
-		return (string) $contents;
-	}
-
-	public function writable($contents)
-	{
-		return (string) $contents;
-	}
-}
-

+ 0 - 16
frameworks/PHP/php-fuel/fuel/core/classes/cache/notfound.php

@@ -1,16 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-// Exception thrown when the Cache wasn't found
-class CacheNotFoundException extends \OutOfBoundsException {}

+ 0 - 357
frameworks/PHP/php-fuel/fuel/core/classes/cache/storage/apc.php

@@ -1,357 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-
-
-class Cache_Storage_Apc extends \Cache_Storage_Driver
-{
-
-	/**
-	 * @const  string  Tag used for opening & closing cache properties
-	 */
-	const PROPS_TAG = 'Fuel_Cache_Properties';
-
-	/**
-	 * @var  array  driver specific configuration
-	 */
-	protected $config = array();
-
-	public function __construct($identifier, $config)
-	{
-		parent::__construct($identifier, $config);
-
-		$this->config = isset($config['apc']) ? $config['apc'] : array();
-
-		// make sure we have an id
-		$this->config['cache_id'] = $this->_validate_config('cache_id', isset($this->config['cache_id'])
-			? $this->config['cache_id'] : 'fuel');
-
-		// check for an expiration override
-		$this->expiration = $this->_validate_config('expiration', isset($this->config['expiration'])
-			? $this->config['expiration'] : $this->expiration);
-
-		// do we have the PHP APC extension available
-		if ( ! function_exists('apc_store') )
-		{
-			throw new \FuelException('Your PHP installation doesn\'t have APC loaded.');
-		}
-	}
-
-	/**
-	 * Prepend the cache properties
-	 *
-	 * @return  string
-	 */
-	protected function prep_contents()
-	{
-		$properties = array(
-			'created'          => $this->created,
-			'expiration'       => $this->expiration,
-			'dependencies'     => $this->dependencies,
-			'content_handler'  => $this->content_handler
-		);
-		$properties = '{{'.static::PROPS_TAG.'}}'.json_encode($properties).'{{/'.static::PROPS_TAG.'}}';
-
-		return $properties.$this->contents;
-	}
-
-	/**
-	 * Remove the prepended cache properties and save them in class properties
-	 *
-	 * @param   string
-	 * @throws  UnexpectedValueException
-	 */
-	protected function unprep_contents($payload)
-	{
-		$properties_end = strpos($payload, '{{/'.static::PROPS_TAG.'}}');
-		if ($properties_end === FALSE)
-		{
-			throw new \UnexpectedValueException('Cache has bad formatting');
-		}
-
-		$this->contents = substr($payload, $properties_end + strlen('{{/'.static::PROPS_TAG.'}}'));
-		$props = substr(substr($payload, 0, $properties_end), strlen('{{'.static::PROPS_TAG.'}}'));
-		$props = json_decode($props, true);
-		if ($props === NULL)
-		{
-			throw new \UnexpectedValueException('Cache properties retrieval failed');
-		}
-
-		$this->created          = $props['created'];
-		$this->expiration       = is_null($props['expiration']) ? null : (int) ($props['expiration'] - time());
-		$this->dependencies     = $props['dependencies'];
-		$this->content_handler  = $props['content_handler'];
-	}
-
-	/**
-	 * Check if other caches or files have been changed since cache creation
-	 *
-	 * @param   array
-	 * @return  bool
-	 */
-	public function check_dependencies(array $dependencies)
-	{
-		foreach($dependencies as $dep)
-		{
-			// get the section name and identifier
-			$sections = explode('.', $dep);
-			if (count($sections) > 1)
-			{
-				$identifier = array_pop($sections);
-				$sections = '.'.implode('.', $sections);
-
-			}
-			else
-			{
-				$identifier = $dep;
-				$sections = '';
-			}
-
-			// get the cache index
-			$index = apc_fetch($this->config['cache_id'].$sections);
-
-			// get the key from the index
-			$key = isset($index[$identifier][0]) ? $index[$identifier] : false;
-
-			// key found and newer?
-			if ($key === false or $key[1] > $this->created)
-			{
-				return false;
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Delete Cache
-	 */
-	public function delete()
-	{
-		// get the APC key for the cache identifier
-		$key = $this->_get_key(true);
-
-		// delete the key from the apc store
-		$key and apc_delete($key);
-
-		$this->reset();
-	}
-
-	/**
-	 * Purge all caches
-	 *
-	 * @param   limit purge to subsection
-	 * @return  bool
-	 */
-	public function delete_all($section)
-	{
-		// determine the section index name
-		$section = $this->config['cache_id'].(empty($section)?'':'.'.$section);
-
-		// get the directory index
-		$index = apc_fetch($this->config['cache_id'].'__DIR__');
-
-		if (is_array($index))
-		{
-			// limit the delete if we have a valid section
-			if ( ! empty($section))
-			{
-				$dirs = in_array($section, $index) ? array($section) : array();
-			}
-			else
-			{
-				$dirs = $index;
-			}
-
-			// loop through the indexes, delete all stored keys, then delete the indexes
-			foreach ($dirs as $dir)
-			{
-				$list = apc_fetch($dir);
-				foreach ($list as $item)
-				{
-					apc_delete($item[0]);
-				}
-				apc_delete($dir);
-			}
-
-			// update the directory index
-			$index = array_diff($index, $dirs);
-			apc_store($this->config['cache_id'].'__DIR__', $index);
-		}
-	}
-
-	/**
-	 * Save a cache, this does the generic pre-processing
-	 *
-	 * @return  bool  success
-	 */
-	protected function _set()
-	{
-		// get the apc key for the cache identifier
-		$key = $this->_get_key();
-
-		$payload = $this->prep_contents();
-
-		// adjust the expiration, apc uses a TTL instead of a timestamp
-		$expiration = is_null($this->expiration) ? 0 : (int) ($this->expiration - $this->created);
-
-		// write it to the apc store
-		if (apc_store($key, $payload, $expiration) === false)
-		{
-			throw new \RuntimeException('APC returned failed to write. Check your configuration.');
-		}
-
-		return true;
-	}
-
-	/**
-	 * Load a cache, this does the generic post-processing
-	 *
-	 * @return  bool  success
-	 */
-	protected function _get()
-	{
-		// get the apc key for the cache identifier
-		$key = $this->_get_key();
-
-		// fetch the cached data from the apc store
-		$payload = apc_fetch($key);
-
-		try
-		{
-			$this->unprep_contents($payload);
-		}
-		catch (\UnexpectedValueException $e)
-		{
-			return false;
-		}
-
-		return true;
-	}
-
-	/**
-	 * validate a driver config value
-	 *
-	 * @param   string  name of the config variable to validate
-	 * @param   mixed   value
-	 * @return  mixed
-	 */
-	private function _validate_config($name, $value)
-	{
-		switch ($name)
-		{
-			case 'cache_id':
-				if (empty($value) or ! is_string($value))
-				{
-					$value = 'fuel';
-				}
-			break;
-
-			case 'expiration':
-				if (empty($value) or ! is_numeric($value))
-				{
-					$value = null;
-				}
-			break;
-
-			default:
-			break;
-		}
-
-		return $value;
-	}
-
-	/**
-	 * Get's the apc key belonging to the cache identifier
-	 *
-	 * @param   bool  if true, remove the key retrieved from the index
-	 * @return  string
-	 */
-	private function _get_key($remove = false)
-	{
-		// get the section name and identifier
-		$sections = explode('.', $this->identifier);
-		if (count($sections) > 1)
-		{
-			$identifier = array_pop($sections);
-			$sections = '.'.implode('.', $sections);
-
-		}
-		else
-		{
-			$identifier = $this->identifier;
-			$sections = '';
-		}
-
-		// get the cache index
-		$index = apc_fetch($this->config['cache_id'].$sections);
-
-		// get the key from the index
-		$key = isset($index[$identifier][0]) ? $index[$identifier][0] : false;
-
-		if ($remove === true)
-		{
-			if ( $key !== false )
-			{
-				unset($index[$identifier]);
-				apc_store($this->config['cache_id'].$sections, $index);
-			}
-		}
-		else
-		{
-			if ( $key === false )
-			{
-				// create a new key
-				$key = $this->_new_key();
-
-				// create a new index and store the key
-				is_array($index) || $index = array();
-				apc_store($this->config['cache_id'].$sections, array_merge($index, array($identifier => array($key,$this->created))), 0);
-
-				// get the directory index
-				$index = apc_fetch($this->config['cache_id'].'__DIR__');
-
-				if (is_array($index))
-				{
-					if (!in_array($this->config['cache_id'].$sections, $index))
-					{
-						$index[] = $this->config['cache_id'].$sections;
-					}
-				}
-				else
-				{
-					$index = array($this->config['cache_id'].$sections);
-				}
-
-				// update the directory index
-				apc_store($this->config['cache_id'].'__DIR__', $index, 0);
-			}
-		}
-		return $key;
-	}
-
-	/**
-	 * Generate a new unique key for the current identifier
-	 *
-	 * @return  string
-	 */
-	private function _new_key()
-	{
-		$key = '';
-		while (strlen($key) < 32)
-		{
-			$key .= mt_rand(0, mt_getrandmax());
-		}
-		return md5($this->config['cache_id'].'_'.uniqid($key, TRUE));
-	}
-}

+ 0 - 420
frameworks/PHP/php-fuel/fuel/core/classes/cache/storage/driver.php

@@ -1,420 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-
-abstract class Cache_Storage_Driver
-{
-
-	/**
-	 * @var  array  defines which class properties are gettable with get_... in the __call() method
-	 */
-	protected static $_gettable = array('created', 'expiration', 'dependencies', 'identifier');
-
-	/**
-	 * @var  array  defines which class properties are settable with set_... in the __call() method
-	 */
-	protected static $_settable = array('expiration', 'dependencies', 'identifier');
-
-	/**
-	 * @var  string  name of the content handler driver
-	 */
-	protected $content_handler = null;
-
-	/**
-	 * @var  Cache_Handler_Driver  handles and formats the cache's contents
-	 */
-	protected $handler_object = null;
-
-	/**
-	 * @var  string  the cache's name, either string or md5'd serialization of something else
-	 */
-	protected $identifier = null;
-
-	/**
-	 * @var  int  timestamp of creation of the cache
-	 */
-	protected $created = null;
-
-	/**
-	 * @var  int  timestamp when this cache will expire
-	 */
-	protected $expiration = null;
-
-	/**
-	 * @var  array  contains identifiers of other caches this one depends on
-	 */
-	protected $dependencies = array();
-
-	/**
-	 * @var  mixed  the contents of this
-	 */
-	protected $contents = null;
-
-	/**
-	 * @var  string  loaded driver
-	 */
-	protected $driver = null;
-
-	/**
-	 * Abstract method that should take care of the storage engine specific reading. Needs to set the object properties:
-	 * - created
-	 * - expiration
-	 * - dependencies
-	 * - contents
-	 * - content_handler
-	 *
-	 * @return  bool  success of the operation
-	 */
-	abstract protected function _get();
-
-	/**
-	 * Abstract method that should take care of the storage engine specific writing. Needs to write the object properties:
-	 * - created
-	 * - expiration
-	 * - dependencies
-	 * - contents
-	 * - content_handler
-	 */
-	abstract protected function _set();
-
-	/**
-	 * Should delete this cache instance, should also run reset() afterwards
-	 */
-	abstract public function delete();
-
-	/**
-	 * Flushes the whole cache for a specific storage type or just a part of it when $section is set
-	 * (might not work with all storage drivers), defaults to the default storage type
-	 *
-	 * @param  string
-	 */
-	abstract public function delete_all($section);
-
-	/**
-	 * Should check all dependencies against the creation timestamp.
-	 * This is static to make it possible in the future to check dependencies from other storages then the current one,
-	 * though I don't have a clue yet how to make that possible.
-	 *
-	 * @return  bool either true or false on any failure
-	 */
-	abstract public function check_dependencies(array $dependencies);
-
-	/**
-	 * Default constructor, any extension should either load this first or act similar
-	 *
-	 * @param  string  the identifier for this cache
-	 * @param  array   additional config values
-	 */
-	public function __construct($identifier, $config)
-	{
-		$this->identifier = $identifier;
-
-		// fetch options from config and set them
-		$this->expiration       = array_key_exists('expiration', $config) ? $config['expiration'] : \Config::get('cache.expiration', null);
-		$this->dependencies     = array_key_exists('dependencies', $config) ? $config['dependencies'] : array();
-		$this->content_handler  = array_key_exists('content_handler', $config) ? new $config['content_handler']() : null;
-		$this->driver           = array_key_exists('driver', $config) ? $config['driver'] : 'file';
-	}
-
-	/**
-	 * Allows for default getting and setting
-	 *
-	 * @param   string
-	 * @param   array
-	 * @return  void|mixed
-	 */
-	public function __call($method, $args = array())
-	{
-		// Allow getting any properties set in static::$_gettable
-		if (substr($method, 0, 3) == 'get')
-		{
-			$name = substr($method, 4);
-			if (in_array($name, static::$_gettable))
-			{
-				return $this->{$name};
-			}
-			else
-			{
-				throw new \BadMethodCallException('This property doesn\'t exist or can\'t be read.');
-			}
-		}
-		// Allow setting any properties set in static::$_settable
-		elseif (substr($method, 0, 3) == 'set')
-		{
-			$name = substr($method, 4);
-			if (in_array($name, static::$_settable))
-			{
-				$this->{$name} = @$args[0];
-			}
-			else
-			{
-				throw new \BadMethodCallException('This property doesn\'t exist or can\'t be set.');
-			}
-			return $this;
-		}
-		else
-		{
-			throw new \BadMethodCallException('Illegal method call: ' . $method);
-		}
-	}
-
-	/**
-	 * Converts the identifier to a string when necessary:
-	 * A int is just converted to a string, all others are serialized and then md5'd
-	 *
-	 * @param   mixed
-	 * @return  string
-	 */
-	public static function stringify_identifier($identifier)
-	{
-		// Identifier may not be empty, but can be false or 0
-		if ($identifier === '' || $identifier === null)
-		{
-			throw new \FuelException('The identifier cannot be empty, must contain a value of any kind other than null or an empty string.');
-		}
-
-		// In case of string or int just return it as a string
-		if (is_string($identifier) || is_int($identifier))
-		{
-			// cleanup to only allow alphanum chars, dashes, dots & underscores
-			if (preg_match('/^([a-z0-9_\.\-]*)$/iuD', $identifier) === 0)
-			{
-				throw new \FuelException('Cache identifier can only contain alphanumeric characters, underscores, dashes & dots.');
-			}
-
-			return (string) $identifier;
-		}
-		// In case of array, bool or object return the md5 of the $identifier's serialization
-		else
-		{
-			return '_hashes.'.md5(serialize($identifier));
-		}
-	}
-
-	/**
-	 * Resets all properties except for the identifier, should be run by default when a delete() is triggered
-	 */
-	public function reset()
-	{
-		$this->contents			= null;
-		$this->created			= null;
-		$this->expiration		= null;
-		$this->dependencies		= array();
-		$this->content_handler	= null;
-		$this->handler_object	= null;
-	}
-
-	/**
-	 * Front for writing the cache, ensures interchangeability of storage engines. Actual writing
-	 * is being done by the _set() method which needs to be extended.
-	 *
-	 * @param   mixed                 The content to be cached
-	 * @param   int                   The time in seconds until the cache will expire, =< 0 or null means no expiration
-	 * @param   array                 array of names on which this cache depends for
-	 * @return  Cache_Storage_Driver  The new request
-	 */
-	final public function set($contents = null, $expiration = false, $dependencies = array())
-	{
-		$contents = \Fuel::value($contents);
-		// save the current expiration
-		$current_expiration = $this->expiration;
-
-		// Use either the given value or the class property
-		if ( ! is_null($contents)) $this->set_contents($contents);
-		$this->expiration	= ($expiration !== false) ? $expiration : $this->expiration;
-		$this->dependencies	= ( ! empty($dependencies)) ? $dependencies : $this->dependencies;
-
-		$this->created = time();
-
-		// Create expiration timestamp when other then null
-		if ( ! is_null($this->expiration))
-		{
-			if ( ! is_numeric($this->expiration))
-			{
-				throw new \InvalidArgumentException('Expiration must be a valid number.');
-			}
-			$this->expiration = $this->created + intval($this->expiration);
-		}
-
-		// Convert dependency identifiers to string when set
-		$this->dependencies = ( ! is_array($this->dependencies)) ? array($this->dependencies) : $this->dependencies;
-		if ( ! empty( $this->dependencies ) )
-		{
-			foreach($this->dependencies as $key => $id)
-			{
-				$this->dependencies[$key] = $this->stringify_identifier($id);
-			}
-		}
-
-		// Turn everything over to the storage specific method
-		$this->_set();
-
-		// restore the expiration
-		$this->expiration = $current_expiration;
-	}
-
-	/**
-	 * Front for reading the cache, ensures interchangeability of storage engines. Actual reading
-	 * is being done by the _get() method which needs to be extended.
-	 *
-	 * @param   bool
-	 * @return  Cache_Storage_Driver
-	 */
-	final public function get($use_expiration = true)
-	{
-		if ( ! $this->_get())
-		{
-			throw new \CacheNotFoundException('not found');
-		}
-
-		if ($use_expiration)
-		{
-			if ( ! is_null($this->expiration) and $this->expiration < 0)
-			{
-				$this->delete();
-				throw new \CacheExpiredException('expired');
-			}
-
-			// Check dependencies and handle as expired on failure
-			if ( ! $this->check_dependencies($this->dependencies))
-			{
-				$this->delete();
-				throw new \CacheExpiredException('expired');
-			}
-		}
-
-		return $this->get_contents();
-	}
-
-	/**
-	 * Does get() & set() in one call that takes a callback and it's arguments to generate the contents
-	 *
-	 * @param   string|array  Valid PHP callback
-	 * @param   array         Arguments for the above function/method
-	 * @param   int|null      Cache expiration in seconds
-	 * @param   array         Contains the identifiers of caches this one will depend on
-	 * @return  mixed
-	 */
-	final public function call($callback, $args = array(), $expiration = null, $dependencies = array())
-	{
-		try
-		{
-			$this->get();
-		}
-		catch (\CacheNotFoundException $e)
-		{
-			// Create the contents
-			$contents = call_user_func_array($callback, $args);
-
-			$this->set($contents, $expiration, $dependencies);
-		}
-
-		return $this->get_contents();
-	}
-
-	/**
-	 * Set the contents with optional handler instead of the default
-	 *
-	 * @param   mixed
-	 * @param   string
-	 * @return  Cache_Storage_Driver
-	 */
-	public function set_contents($contents, $handler = NULL)
-	{
-		$this->contents = $contents;
-		$this->set_content_handler($handler);
-		$this->contents = $this->handle_writing($contents);
-		return $this;
-	}
-
-	/**
-	 * Fetches contents
-	 *
-	 * @return  mixed
-	 */
-	public function get_contents()
-	{
-		return $this->handle_reading($this->contents);
-	}
-
-	/**
-	 * Decides a content handler that makes it possible to write non-strings to a file
-	 *
-	 * @param   string
-	 * @return  Cache_Storage_Driver
-	 */
-	protected function set_content_handler($handler)
-	{
-		$this->handler_object = null;
-		$this->content_handler = (string) $handler;
-		return $this;
-	}
-
-	/**
-	 * Gets a specific content handler
-	 *
-	 * @param   string
-	 * @return  Cache_Handler_Driver
-	 */
-	public function get_content_handler($handler = null)
-	{
-		if ( ! empty($this->handler_object))
-		{
-			return $this->handler_object;
-		}
-
-		// When not yet set, use $handler or detect the preferred handler (string = string, otherwise serialize)
-		if (empty($this->content_handler) && empty($handler))
-		{
-			if ( ! empty($handler))
-			{
-				$this->content_handler = $handler;
-			}
-			if (is_string($this->contents))
-			{
-				$this->content_handler = \Config::get('cache.string_handler', 'string');
-			}
-			else
-			{
-				$type = is_object($this->contents) ? get_class($this->contents) : gettype($this->contents);
-				$this->content_handler = \Config::get('cache.'.$type.'_handler', 'serialized');
-			}
-		}
-
-		$class = '\\Cache_Handler_'.ucfirst($this->content_handler);
-		$this->handler_object = new $class();
-
-		return $this->handler_object;
-	}
-
-	/**
-	 * Converts the contents the cachable format
-	 *
-	 * @return  string
-	 */
-	protected function handle_writing($contents)
-	{
-		return $this->get_content_handler()->writable($contents);
-	}
-
-	/**
-	 * Converts the cachable format to the original value
-	 *
-	 * @return  mixed
-	 */
-	protected function handle_reading($contents)
-	{
-		return $this->get_content_handler()->readable($contents);
-	}
-}

+ 0 - 333
frameworks/PHP/php-fuel/fuel/core/classes/cache/storage/file.php

@@ -1,333 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-
-
-class Cache_Storage_File extends \Cache_Storage_Driver
-{
-
-	/**
-	 * @const  string  Tag used for opening & closing cache properties
-	 */
-	const PROPS_TAG = 'Fuel_Cache_Properties';
-
-	/**
-	 * @var  string  File caching basepath
-	 */
-	protected static $path = '';
-
-	/**
-	 * @var  array  driver specific configuration
-	 */
-	protected $config = array();
-
-	public function __construct($identifier, $config)
-	{
-		parent::__construct($identifier, $config);
-
-		$this->config = isset($config['file']) ? $config['file'] : array();
-
-		// check for an expiration override
-		$this->expiration = $this->_validate_config('expiration', isset($this->config['expiration'])
-			? $this->config['expiration'] : $this->expiration);
-
-		// determine the file cache path
-		static::$path = !empty($this->config['path'])
-			? $this->config['path'] : \Config::get('cache_dir', APPPATH.'cache'.DS);
-
-		if ( ! is_dir(static::$path) || ! is_writable(static::$path))
-		{
-			throw new \FuelException('Cache directory does not exist or is not writable.');
-		}
-	}
-
-	/**
-	 * Translates a given identifier to a valid path
-	 *
-	 * @param   string
-	 * @return  string
-	 */
-	protected function identifier_to_path($identifier)
-	{
-		// replace dots with dashes
-		$identifier = str_replace('.', DS, $identifier);
-
-		return $identifier;
-	}
-
-	/**
-	 * Prepend the cache properties
-	 *
-	 * @return  string
-	 */
-	protected function prep_contents()
-	{
-		$properties = array(
-			'created'          => $this->created,
-			'expiration'       => $this->expiration,
-			'dependencies'     => $this->dependencies,
-			'content_handler'  => $this->content_handler
-		);
-		$properties = '{{'.self::PROPS_TAG.'}}'.json_encode($properties).'{{/'.self::PROPS_TAG.'}}';
-
-		return $properties.$this->contents;
-	}
-
-	/**
-	 * Remove the prepended cache properties and save them in class properties
-	 *
-	 * @param   string
-	 * @throws  UnexpectedValueException
-	 */
-	protected function unprep_contents($payload)
-	{
-		$properties_end = strpos($payload, '{{/'.self::PROPS_TAG.'}}');
-		if ($properties_end === false)
-		{
-			throw new \UnexpectedValueException('Cache has bad formatting');
-		}
-
-		$this->contents = substr($payload, $properties_end + strlen('{{/'.self::PROPS_TAG.'}}'));
-		$props = substr(substr($payload, 0, $properties_end), strlen('{{'.self::PROPS_TAG.'}}'));
-		$props = json_decode($props, true);
-		if ($props === null)
-		{
-			throw new \UnexpectedValueException('Cache properties retrieval failed');
-		}
-
-		$this->created          = $props['created'];
-		$this->expiration       = is_null($props['expiration']) ? null : (int) ($props['expiration'] - time());
-		$this->dependencies     = $props['dependencies'];
-		$this->content_handler  = $props['content_handler'];
-	}
-
-	/**
-	 * Check if other caches or files have been changed since cache creation
-	 *
-	 * @param   array
-	 * @return  bool
-	 */
-	public function check_dependencies(array $dependencies)
-	{
-		foreach($dependencies as $dep)
-		{
-			if (file_exists($file = static::$path.str_replace('.', DS, $dep).'.cache'))
-			{
-				$filemtime = filemtime($file);
-				if ($filemtime === false || $filemtime > $this->created)
-				{
-					return false;
-				}
-			}
-			elseif (file_exists($dep))
-			{
-				$filemtime = filemtime($file);
-				if ($filemtime === false || $filemtime > $this->created)
-				{
-					return false;
-				}
-			}
-			else
-			{
-				return false;
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Delete Cache
-	 */
-	public function delete()
-	{
-		if (file_exists($file = static::$path.$this->identifier_to_path($this->identifier).'.cache'))
-		{
-			unlink($file);
-			$this->reset();
-		}
-	}
-
-	// ---------------------------------------------------------------------
-
-	/**
-	 * Purge all caches
-	 *
-	 * @param   limit purge to subsection
-	 * @return  bool
-	 */
-	public function delete_all($section)
-	{
-		$path = rtrim(static::$path, '\\/').DS;
-		$section = static::identifier_to_path($section);
-
-		$files = \File::read_dir($path.$section, -1, array('\.cache$' => 'file'));
-
-		$delete = function($path, $files) use(&$delete, &$section)
-		{
-			$path = rtrim($path, '\\/').DS;
-
-			foreach ($files as $dir => $file)
-			{
-				if (is_numeric($dir))
-				{
-					if ( ! $result = \File::delete($path.$file))
-					{
-						return $result;
-					}
-				}
-				else
-				{
-					if ( ! $result = ($delete($path.$dir, $file) and rmdir($path.$dir)))
-					{
-						return $result;
-					}
-				}
-			}
-
-			$section !== '' and rmdir($path);
-
-			return true;
-		};
-
-		return $delete($path.$section, $files);
-	}
-
-	/**
-	 * Save a cache, this does the generic pre-processing
-	 *
-	 * @return  bool  success
-	 */
-	protected function _set()
-	{
-		$payload = $this->prep_contents();
-		$id_path = $this->identifier_to_path($this->identifier);
-
-		// create directory if necessary
-		$subdirs = explode(DS, $id_path);
-		if (count($subdirs) > 1)
-		{
-			array_pop($subdirs);
-			$test_path = static::$path.implode(DS, $subdirs);
-
-			// check if specified subdir exists
-			if ( ! @is_dir($test_path))
-			{
-				// create non existing dir
-				if ( ! @mkdir($test_path, 0755, true))
-				{
-					return false;
-				}
-			}
-		}
-
-		// write the cache
-		$file = static::$path.$id_path.'.cache';
-		$handle = fopen($file, 'c');
-
-		if ( ! $handle)
-		{
-			return false;
-		}
-
-		// wait for a lock
-		while ( ! flock($handle, LOCK_EX));
-
-		// truncate the file
-		ftruncate($handle, 0);
-
-		// write the session data
-		fwrite($handle, $payload);
-
-		//release the lock
-		flock($handle, LOCK_UN);
-
-		// close the file
-		fclose($handle);
-
-		return true;
-	}
-
-	/**
-	 * Load a cache, this does the generic post-processing
-	 *
-	 * @return  bool  success
-	 */
-	protected function _get()
-	{
-		$id_path = $this->identifier_to_path( $this->identifier );
-		$file = static::$path.$id_path.'.cache';
-		if ( ! file_exists($file))
-		{
-			return false;
-		}
-
-		$handle = fopen($file, 'r');
-		if ( ! $handle)
-		{
-			return false;
-		}
-
-		// wait for a lock
-		while( ! flock($handle, LOCK_SH));
-
-		// read the session data
-		$payload = fread($handle, filesize($file));
-
-		//release the lock
-		flock($handle, LOCK_UN);
-
-		// close the file
-		fclose($handle);
-
-		try
-		{
-			$this->unprep_contents($payload);
-		}
-		catch (\UnexpectedValueException $e)
-		{
-			return false;
-		}
-
-		return true;
-	}
-
-	/**
-	 * validate a driver config value
-	 *
-	 * @param   string  name of the config variable to validate
-	 * @param   mixed   value
-	 * @return  mixed
-	 */
-	private function _validate_config($name, $value)
-	{
-		switch ($name)
-		{
-			case 'cache_id':
-				if (empty($value) or ! is_string($value))
-				{
-					$value = 'fuel';
-				}
-			break;
-
-			case 'expiration':
-				if (empty($value) or ! is_numeric($value))
-				{
-					$value = null;
-				}
-			break;
-		}
-
-		return $value;
-	}
-}

+ 0 - 412
frameworks/PHP/php-fuel/fuel/core/classes/cache/storage/memcached.php

@@ -1,412 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-
-
-class Cache_Storage_Memcached extends \Cache_Storage_Driver
-{
-
-	/**
-	 * @const  string  Tag used for opening & closing cache properties
-	 */
-	const PROPS_TAG = 'Fuel_Cache_Properties';
-
-	/**
-	 * @var  array  driver specific configuration
-	 */
-	protected $config = array();
-
-	/*
-	 * @var  Memcached  storage for the memcached object
-	 */
-	protected $memcached = false;
-
-	public function __construct($identifier, $config)
-	{
-		parent::__construct($identifier, $config);
-
-		$this->config = isset($config['memcached']) ? $config['memcached'] : array();
-
-		// make sure we have a memcache id
-		$this->config['cache_id'] = $this->_validate_config('cache_id', isset($this->config['cache_id'])
-			? $this->config['cache_id'] : 'fuel');
-
-		// check for an expiration override
-		$this->expiration = $this->_validate_config('expiration', isset($this->config['expiration'])
-			? $this->config['expiration'] : $this->expiration);
-
-		if ($this->memcached === false)
-		{
-			// make sure we have memcached servers configured
-			$this->config['servers'] = $this->_validate_config('servers', $this->config['servers']);
-
-			// do we have the PHP memcached extension available
-			if ( ! class_exists('Memcached') )
-			{
-				throw new \FuelException('Memcached cache are configured, but your PHP installation doesn\'t have the Memcached extension loaded.');
-			}
-
-			// instantiate the memcached object
-			$this->memcached = new \Memcached();
-
-			// add the configured servers
-			$this->memcached->addServers($this->config['servers']);
-
-			// check if we can connect to the server(s)
-			if ($this->memcached->getVersion() === false)
-			{
-				throw new \FuelException('Memcached cache are configured, but there is no connection possible. Check your configuration.');
-			}
-		}
-	}
-
-	/**
-	 * Prepend the cache properties
-	 *
-	 * @return  string
-	 */
-	protected function prep_contents()
-	{
-		$properties = array(
-			'created'          => $this->created,
-			'expiration'       => $this->expiration,
-			'dependencies'     => $this->dependencies,
-			'content_handler'  => $this->content_handler
-		);
-		$properties = '{{'.static::PROPS_TAG.'}}'.json_encode($properties).'{{/'.static::PROPS_TAG.'}}';
-
-		return $properties.$this->contents;
-	}
-
-	/**
-	 * Remove the prepended cache properties and save them in class properties
-	 *
-	 * @param   string
-	 * @throws  UnexpectedValueException
-	 */
-	protected function unprep_contents($payload)
-	{
-		$properties_end = strpos($payload, '{{/'.static::PROPS_TAG.'}}');
-		if ($properties_end === FALSE)
-		{
-			throw new \UnexpectedValueException('Cache has bad formatting');
-		}
-
-		$this->contents = substr($payload, $properties_end + strlen('{{/'.static::PROPS_TAG.'}}'));
-		$props = substr(substr($payload, 0, $properties_end), strlen('{{'.static::PROPS_TAG.'}}'));
-		$props = json_decode($props, true);
-		if ($props === NULL)
-		{
-			throw new \UnexpectedValueException('Cache properties retrieval failed');
-		}
-
-		$this->created          = $props['created'];
-		$this->expiration       = is_null($props['expiration']) ? null : (int) ($props['expiration'] - time());
-		$this->dependencies     = $props['dependencies'];
-		$this->content_handler  = $props['content_handler'];
-	}
-
-	/**
-	 * Check if other caches or files have been changed since cache creation
-	 *
-	 * @param   array
-	 * @return  bool
-	 */
-	public function check_dependencies(array $dependencies)
-	{
-		foreach($dependencies as $dep)
-		{
-			// get the section name and identifier
-			$sections = explode('.', $dep);
-			if (count($sections) > 1)
-			{
-				$identifier = array_pop($sections);
-				$sections = '.'.implode('.', $sections);
-
-			}
-			else
-			{
-				$identifier = $dep;
-				$sections = '';
-			}
-
-			// get the cache index
-			$index = $this->memcached->get($this->config['cache_id'].$sections);
-
-			// get the key from the index
-			$key = isset($index[$identifier][0]) ? $index[$identifier] : false;
-
-			// key found and newer?
-			if ($key === false or $key[1] > $this->created)
-			{
-				return false;
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Delete Cache
-	 */
-	public function delete()
-	{
-		// get the memcached key for the cache identifier
-		$key = $this->_get_key(true);
-
-		// delete the key from the memcached server
-		if ($key and $this->memcached->delete($key) === false)
-		{
-			if ($this->memcached->getResultCode() !== \Memcached::RES_NOTFOUND)
-			{
-				throw new \FuelException('Memcached returned error code "'.$this->memcached->getResultCode().'" on delete. Check your configuration.');
-			}
-		}
-
-		$this->reset();
-	}
-
-	/**
-	 * Purge all caches
-	 *
-	 * @param   limit purge to subsection
-	 * @return  bool
-	 */
-	public function delete_all($section)
-	{
-		// determine the section index name
-		$section = $this->config['cache_id'].(empty($section)?'':'.'.$section);
-
-		// get the directory index
-		$index = $this->memcached->get($this->config['cache_id'].'__DIR__');
-
-		if (is_array($index))
-		{
-			// limit the delete if we have a valid section
-			if ( ! empty($section))
-			{
-				$dirs = in_array($section, $index) ? array($section) : array();
-			}
-			else
-			{
-				$dirs = $index;
-			}
-
-			// loop through the indexes, delete all stored keys, then delete the indexes
-			foreach ($dirs as $dir)
-			{
-				$list = $this->memcached->get($dir);
-				foreach ($list as $item)
-				{
-					$this->memcached->delete($item[0]);
-				}
-				$this->memcached->delete($dir);
-			}
-
-			// update the directory index
-			$index = array_diff($index, $dirs);
-			$this->memcached->set($this->config['cache_id'].'__DIR__', $index);
-		}
-	}
-
-	/**
-	 * Save a cache, this does the generic pre-processing
-	 *
-	 * @return  bool  success
-	 */
-	protected function _set()
-	{
-		// get the memcached key for the cache identifier
-		$key = $this->_get_key();
-
-		$payload = $this->prep_contents();
-
-		// write it to the memcached server
-		if ($this->memcached->set($key, $payload, ! is_null($this->expiration) ? (int) $this->expiration : 0) === false)
-		{
-			throw new \FuelException('Memcached returned error code "'.$this->memcached->getResultCode().'" on write. Check your configuration.');
-		}
-
-		return true;
-	}
-
-	/**
-	 * Load a cache, this does the generic post-processing
-	 *
-	 * @return  bool  success
-	 */
-	protected function _get()
-	{
-		// get the memcached key for the cache identifier
-		$key = $this->_get_key();
-
-		// fetch the cached data from the Memcached server
-		$payload = $this->memcached->get($key);
-
-		try
-		{
-			$this->unprep_contents($payload);
-		}
-		catch (\UnexpectedValueException $e)
-		{
-			return false;
-		}
-
-		return true;
-	}
-
-	/**
-	 * validate a driver config value
-	 *
-	 * @param   string  name of the config variable to validate
-	 * @param   mixed   value
-	 * @return  mixed
-	 */
-	private function _validate_config($name, $value)
-	{
-		switch ($name)
-		{
-			case 'cache_id':
-				if (empty($value) or ! is_string($value))
-				{
-					$value = 'fuel';
-				}
-			break;
-
-			case 'expiration':
-				if (empty($value) or ! is_numeric($value))
-				{
-					$value = null;
-				}
-			break;
-
-			case 'servers':
-				// do we have a servers config
-				if ( empty($value) OR ! is_array($value))
-				{
-					$value = array('default' => array('host' => '127.0.0.1', 'port' => '11211'));
-				}
-
-				// validate the servers
-				foreach ($value as $key => $server)
-				{
-					// do we have a host?
-					if ( ! isset($server['host']) OR ! is_string($server['host']))
-					{
-						throw new \FuelException('Invalid Memcached server definition in the cache configuration.');
-					}
-					// do we have a port number?
-					if ( ! isset($server['port']) OR ! is_numeric($server['port']) OR $server['port'] < 1025 OR $server['port'] > 65535)
-					{
-						throw new \FuelException('Invalid Memcached server definition in the cache configuration.');
-					}
-					// do we have a relative server weight?
-					if ( ! isset($server['weight']) OR ! is_numeric($server['weight']) OR $server['weight'] < 0)
-					{
-						// set a default
-						$value[$key]['weight'] = 0;
-					}
-				}
-			break;
-
-			default:
-			break;
-		}
-
-		return $value;
-	}
-
-	/**
-	 * Get's the memcached key belonging to the cache identifier
-	 *
-	 * @param   bool  if true, remove the key retrieved from the index
-	 * @return  string
-	 */
-	private function _get_key($remove = false)
-	{
-		// get the section name and identifier
-		$sections = explode('.', $this->identifier);
-		if (count($sections) > 1)
-		{
-			$identifier = array_pop($sections);
-			$sections = '.'.implode('.', $sections);
-
-		}
-		else
-		{
-			$identifier = $this->identifier;
-			$sections = '';
-		}
-
-		// get the cache index
-		$index = $this->memcached->get($this->config['cache_id'].$sections);
-
-		// get the key from the index
-		$key = isset($index[$identifier][0]) ? $index[$identifier][0] : false;
-
-		if ($remove === true)
-		{
-			if ( $key !== false )
-			{
-				unset($index[$identifier]);
-				$this->memcached->set($this->config['cache_id'].$sections, $index);
-			}
-		}
-		else
-		{
-			if ( $key === false )
-			{
-				// create a new key
-				$key = $this->_new_key();
-
-				// create a new index and store the key
-				is_array($index) || $index = array();
-				$this->memcached->set($this->config['cache_id'].$sections, array_merge($index, array($identifier => array($key,$this->created))), 0);
-
-				// get the directory index
-				$index = $this->memcached->get($this->config['cache_id'].'__DIR__');
-
-				if (is_array($index))
-				{
-					if (!in_array($this->config['cache_id'].$sections, $index))
-					{
-						$index[] = $this->config['cache_id'].$sections;
-					}
-				}
-				else
-				{
-					$index = array($this->config['cache_id'].$sections);
-				}
-
-				// update the directory index
-				$this->memcached->set($this->config['cache_id'].'__DIR__', $index, 0);
-			}
-		}
-		return $key;
-	}
-
-	/**
-	 * Generate a new unique key for the current identifier
-	 *
-	 * @return  string
-	 */
-	private function _new_key()
-	{
-		$key = '';
-		while (strlen($key) < 32)
-		{
-			$key .= mt_rand(0, mt_getrandmax());
-		}
-		return md5($this->config['cache_id'].'_'.uniqid($key, TRUE));
-	}
-}

+ 0 - 490
frameworks/PHP/php-fuel/fuel/core/classes/cache/storage/redis.php

@@ -1,490 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-
-
-class Cache_Storage_Redis extends \Cache_Storage_Driver
-{
-
-	/**
-	 * @const  string  Tag used for opening & closing cache properties
-	 */
-	const PROPS_TAG = 'Fuel_Cache_Properties';
-
-	/**
-	 * @var  array  driver specific configuration
-	 */
-	protected $config = array();
-
-	/*
-	 * @var  Redis  storage for the redis object
-	 */
-	protected $redis = false;
-
-	public function __construct($identifier, $config)
-	{
-		parent::__construct($identifier, $config);
-
-		$this->config = isset($config['redis']) ? $config['redis'] : array();
-
-		// make sure we have a redis id
-		$this->config['cache_id'] = $this->_validate_config('cache_id', isset($this->config['cache_id'])
-			? $this->config['cache_id'] : 'fuel');
-
-		// check for an expiration override
-		$this->expiration = $this->_validate_config('expiration', isset($this->config['expiration'])
-			? $this->config['expiration'] : $this->expiration);
-
-		// make sure we have a redis database configured
-		$this->config['database'] = $this->_validate_config('database', isset($this->config['database'])
-			? $this->config['database'] : 'default');
-
-		if ($this->redis === false)
-		{
-			// get the redis database instance
-			try
-			{
-				$this->redis = \Redis::instance($this->config['database']);
-			}
-			catch (\Exception $e)
-			{
-				throw new \FuelException('Can not connect to the Redis engine. The error message says "'.$e->getMessage().'".');
-			}
-
-			// get the redis version
-			preg_match('/redis_version:(.*?)\n/', $this->redis->info(), $info);
-			if (version_compare(trim($info[1]), '1.2') < 0)
-			{
-				throw new \FuelException('Version 1.2 or higher of the Redis NoSQL engine is required to use the redis cache driver.');
-			}
-		}
-	}
-
-	/**
-	 * Translates a given identifier to a valid redis key
-	 *
-	 * @param   string
-	 * @return  string
-	 */
-	protected function identifier_to_key( $identifier )
-	{
-		return $this->config['cache_id'].':'.$identifier;
-	}
-
-	/**
-	 * Prepend the cache properties
-	 *
-	 * @return string
-	 */
-	protected function prep_contents()
-	{
-		$properties = array(
-			'created'          => $this->created,
-			'expiration'       => $this->expiration,
-			'dependencies'     => $this->dependencies,
-			'content_handler'  => $this->content_handler
-		);
-		$properties = '{{'.static::PROPS_TAG.'}}'.json_encode($properties).'{{/'.static::PROPS_TAG.'}}';
-
-		return $properties.$this->contents;
-	}
-
-	/**
-	 * Remove the prepended cache properties and save them in class properties
-	 *
-	 * @param   string
-	 * @throws  UnexpectedValueException
-	 */
-	protected function unprep_contents($payload)
-	{
-		$properties_end = strpos($payload, '{{/'.static::PROPS_TAG.'}}');
-		if ($properties_end === FALSE)
-		{
-			throw new \UnexpectedValueException('Cache has bad formatting');
-		}
-
-		$this->contents = substr($payload, $properties_end + strlen('{{/'.static::PROPS_TAG.'}}'));
-		$props = substr(substr($payload, 0, $properties_end), strlen('{{'.static::PROPS_TAG.'}}'));
-		$props = json_decode($props, true);
-		if ($props === NULL)
-		{
-			throw new \UnexpectedValueException('Cache properties retrieval failed');
-		}
-
-		$this->created          = $props['created'];
-		$this->expiration       = is_null($props['expiration']) ? null : (int) ($props['expiration'] - time());
-		$this->dependencies     = $props['dependencies'];
-		$this->content_handler  = $props['content_handler'];
-	}
-
-	/**
-	 * Check if other caches or files have been changed since cache creation
-	 *
-	 * @param   array
-	 * @return  bool
-	 */
-	public function check_dependencies(array $dependencies)
-	{
-		foreach($dependencies as $dep)
-		{
-			// get the section name and identifier
-			$sections = explode('.', $dep);
-			if (count($sections) > 1)
-			{
-				$identifier = array_pop($sections);
-				$sections = '.'.implode('.', $sections);
-
-			}
-			else
-			{
-				$identifier = $dep;
-				$sections = '';
-			}
-
-			// get the cache index
-			$index = $this->redis->get($this->config['cache_id'].':index:'.$sections);
-			is_null($index) or $index = $this->_unserialize($index);
-
-			// get the key from the index
-			$key = isset($index[$identifier][0]) ? $index[$identifier] : false;
-
-			// key found and newer?
-			if ($key === false or $key[1] > $this->created)
-			{
-				return false;
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Delete Cache
-	 */
-	public function delete()
-	{
-		// get the key for the cache identifier
-		$key = $this->_get_key(true);
-
-		// delete the key from the redis server
-		if ($key and $this->redis->del($key) === false)
-		{
-			// do something here?
-		}
-
-		$this->reset();
-	}
-
-	/**
-	 * Purge all caches
-	 *
-	 * @param   limit purge to subsection
-	 * @return  bool
-	 */
-	public function delete_all($section)
-	{
-		// determine the section index name
-		$section = empty($section) ? '' : '.'.$section;
-
-		// get the directory index
-		$index = $this->redis->get($this->config['cache_id'].':dir:');
-		is_null($index) or $index = $this->_unserialize($index);
-
-		if (is_array($index))
-		{
-			if (!empty($section))
-			{
-				// limit the delete if we have a valid section
-				$dirs = array();
-				foreach ($index as $entry)
-				{
-					if ($entry == $section or strpos($entry, $section.'.') === 0)
-					{
-						$dirs[] = $entry;
-					}
-				}
-			}
-			else
-			{
-				// else delete the entire contents of the cache
-				$dirs = $index;
-			}
-
-			// loop through the selected indexes
-			foreach ($dirs as $dir)
-			{
-				// get the stored cache entries for this index
-				$list = $this->redis->get($this->config['cache_id'].':index:'.$dir);
-				if (is_null($list))
-				{
-					$list = array();
-				}
-				else
-				{
-					$list = $this->_unserialize($list);
-				}
-
-				// delete all stored keys
-				foreach($list as $item)
-				{
-					$this->redis->del($item[0]);
-				}
-
-				// and delete the index itself
-				$this->redis->del($this->config['cache_id'].':index:'.$dir);
-			}
-
-			// update the directory index
-			$this->redis->set($this->config['cache_id'].':dir:', $this->_serialize(array_diff($index, $dirs)));
-		}
-	}
-
-	/**
-	 * Save a cache, this does the generic pre-processing
-	 *
-	 * @return  bool  success
-	 */
-	protected function _set()
-	{
-		// get the key for the cache identifier
-		$key = $this->_get_key();
-
-		// write the cache
-		$this->redis->set($key, $this->prep_contents());
-		if ( ! empty($this->expiration))
-		{
-			$this->redis->expireat($key, $this->expiration);
-		}
-
-		return true;
-	}
-
-	/**
-	 * Load a cache, this does the generic post-processing
-	 *
-	 * @return  bool  success
-	 */
-	protected function _get()
-	{
-		// get the key for the cache identifier
-		$key = $this->_get_key();
-
-		// fetch the session data from the redis server
-		$payload = $this->redis->get($key);
-		try
-		{
-			$this->unprep_contents($payload);
-		}
-		catch (\UnexpectedValueException $e)
-		{
-			return false;
-		}
-
-		return true;
-	}
-
-	/**
-	 * get's the memcached key belonging to the cache identifier
-	 *
-	 * @param   bool  if true, remove the key retrieved from the index
-	 * @return  string
-	 */
-	private function _get_key($remove = false)
-	{
-		// get the section name and identifier
-		$sections = explode('.', $this->identifier);
-		if (count($sections) > 1)
-		{
-			$identifier = array_pop($sections);
-			$sections = '.'.implode('.', $sections);
-		}
-		else
-		{
-			$identifier = $this->identifier;
-			$sections = '';
-		}
-
-		// get the cache index
-		$index = $this->redis->get($this->config['cache_id'].':index:'.$sections);
-		is_null($index) or $index = $this->_unserialize($index);
-
-		// get the key from the index
-		$key = isset($index[$identifier][0]) ? $index[$identifier][0] : false;
-
-		if ($remove === true)
-		{
-			if ( $key !== false )
-			{
-				unset($index[$identifier]);
-				$this->redis->set($this->config['cache_id'].':index:'.$sections, $this->_serialize($index));
-			}
-		}
-		else
-		{
-			if ( $key === false )
-			{
-				// create a new key
-				$key = $this->_new_key();
-
-				if ( ! is_array($index))
-				{
-					// create a new index and store the key
-					$this->redis->set($this->config['cache_id'].':index:'.$sections, $this->_serialize(array($identifier => array($key,$this->created))));
-				}
-				else
-				{
-					// add the key to the index
-					$index[$identifier] = array($key,$this->created);
-					$this->redis->set($this->config['cache_id'].':index:'.$sections, $this->_serialize($index));
-				}
-
-				// get the directory index
-				$index = $this->redis->get($this->config['cache_id'].':dir:');
-				is_null($index) or $index = $this->_unserialize($index);
-
-				if (is_array($index))
-				{
-					if ( ! in_array($sections, $index))
-					{
-						$index[] = $sections;
-					}
-				}
-				else
-				{
-					$index = array($sections);
-				}
-
-				// update the directory index
-				$this->redis->set($this->config['cache_id'].':dir:', $this->_serialize($index));
-			}
-		}
-
-		return $key;
-	}
-
-	/**
-	 * generate a new unique key for the current identifier
-	 *
-	 * @return  string
-	 */
-	private function _new_key()
-	{
-		$key = '';
-		while (strlen($key) < 32)
-		{
-			$key .= mt_rand(0, mt_getrandmax());
-		}
-		return $this->config['cache_id'].'_'.uniqid($key);
-	}
-
-	/**
-	 * validate a driver config value
-	 *
-	 * @param   string  name of the config variable to validate
-	 * @param   mixed   value
-	 * @return  mixed
-	 */
-	private function _validate_config($name, $value)
-	{
-		switch ($name)
-		{
-			case 'database':
-				// do we have a database config
-				if (empty($value) or ! is_array($value))
-				{
-					$value = 'default';
-				}
-			break;
-
-			case 'cache_id':
-				if (empty($value) or ! is_string($value))
-				{
-					$value = 'fuel';
-				}
-			break;
-
-			case 'expiration':
-				if (empty($value) or ! is_numeric($value))
-				{
-					$value = null;
-				}
-			break;
-
-			default:
-			break;
-		}
-
-		return $value;
-	}
-
-	/**
-	 * Serialize an array
-	 *
-	 * This function first converts any slashes found in the array to a temporary
-	 * marker, so when it gets unserialized the slashes will be preserved
-	 *
-	 * @param   array
-	 * @return  string
-	 */
-	protected function _serialize($data)
-	{
-		if (is_array($data))
-		{
-			foreach ($data as $key => $val)
-			{
-				if (is_string($val))
-				{
-					$data[$key] = str_replace('\\', '{{slash}}', $val);
-				}
-			}
-		}
-		else
-		{
-			if (is_string($data))
-			{
-				$data = str_replace('\\', '{{slash}}', $data);
-			}
-		}
-
-		return serialize($data);
-	}
-
-	/**
-	 * Unserialize
-	 *
-	 * This function unserializes a data string, then converts any
-	 * temporary slash markers back to actual slashes
-	 *
-	 * @param   array
-	 * @return  string
-	 */
-	protected function _unserialize($data)
-	{
-		$data = @unserialize(stripslashes($data));
-
-		if (is_array($data))
-		{
-			foreach ($data as $key => $val)
-			{
-				if (is_string($val))
-				{
-					$data[$key] = str_replace('{{slash}}', '\\', $val);
-				}
-			}
-
-			return $data;
-		}
-
-		return (is_string($data)) ? str_replace('{{slash}}', '\\', $data) : $data;
-	}
-}

+ 0 - 460
frameworks/PHP/php-fuel/fuel/core/classes/cli.php

@@ -1,460 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-/**
- * Cli class
- *
- * Interact with the command line by accepting input options, parameters and output text
- *
- * @package		Fuel
- * @category	Core
- * @author		Phil Sturgeon
- * @link		http://docs.fuelphp.com/classes/cli.html
- */
-class Cli
-{
-
-	public static $readline_support = false;
-
-	public static $wait_msg = 'Press any key to continue...';
-
-	protected static $args = array();
-
-	protected static $foreground_colors = array(
-		'black'			=> '0;30',
-		'dark_gray'		=> '1;30',
-		'blue'			=> '0;34',
-		'dark_blue'		=> '1;34',
-		'light_blue'	=> '1;34',
-		'green'			=> '0;32',
-		'light_green'	=> '1;32',
-		'cyan'			=> '0;36',
-		'light_cyan'	=> '1;36',
-		'red'			=> '0;31',
-		'light_red'		=> '1;31',
-		'purple'		=> '0;35',
-		'light_purple'	=> '1;35',
-		'light_yellow'	=> '0;33',
-		'yellow'		=> '1;33',
-		'light_gray'	=> '0;37',
-		'white'			=> '1;37',
-	);
-
-	protected static $background_colors = array(
-		'black'			=> '40',
-		'red'			=> '41',
-		'green'			=> '42',
-		'yellow'		=> '43',
-		'blue'			=> '44',
-		'magenta'		=> '45',
-		'cyan'			=> '46',
-		'light_gray'	=> '47',
-	);
-
-	/**
-	 * Static constructor.	Parses all the CLI params.
-	 */
-	public static function _init()
-	{
-		if ( ! \Fuel::$is_cli)
-		{
-			throw new \Exception('Cli class cannot be used outside of the command line.');
-		}
-		for ($i = 1; $i < $_SERVER['argc']; $i++)
-		{
-			$arg = explode('=', $_SERVER['argv'][$i]);
-
-			static::$args[$i] = $arg[0];
-
-			if (count($arg) > 1 || strncmp($arg[0], '-', 1) === 0)
-			{
-				static::$args[ltrim($arg[0], '-')] = isset($arg[1]) ? $arg[1] : true;
-			}
-		}
-
-		// Readline is an extension for PHP that makes interactive with PHP much more bash-like
-		// http://www.php.net/manual/en/readline.installation.php
-		static::$readline_support = extension_loaded('readline');
-	}
-
-	/**
-	 * Returns the option with the given name.	You can also give the option
-	 * number.
-	 *
-	 * Named options must be in the following formats:
-	 * php index.php user -v --v -name=John --name=John
-	 *
-	 * @param   string|int  $name     the name of the option (int if unnamed)
-	 * @param   mixed       $default  value to return if the option is not defined
-	 * @return  mixed
-	 */
-	public static function option($name, $default = null)
-	{
-		if ( ! isset(static::$args[$name]))
-		{
-			return \Fuel::value($default);
-		}
-		return static::$args[$name];
-	}
-
-	/**
-	 * Allows you to set a commandline option from code
-	 *
-	 * @param   string|int  $name   the name of the option (int if unnamed)
-	 * @param   mixed|null  $value  value to set, or null to delete the option
-	 * @return  mixed
-	 */
-	public static function set_option($name, $value = null)
-	{
-		if ($value === null)
-		{
-			if (isset(static::$args[$name]))
-			{
-				unset(static::$args[$name]);
-			}
-		}
-		else
-		{
-			static::$args[$name] = $value;
-		}
-	}
-
-	/**
-	 * Get input from the shell, using readline or the standard STDIN
-	 *
-	 * Named options must be in the following formats:
-	 * php index.php user -v --v -name=John --name=John
-	 *
-	 * @param	string|int	$name	the name of the option (int if unnamed)
-	 * @return	string
-	 */
-	public static function input($prefix = '')
-	{
-        if (static::$readline_support)
-		{
-			return readline($prefix);
-		}
-
-		echo $prefix;
-		return fgets(STDIN);
-	}
-
-
-	/**
-	 * Asks the user for input.  This can have either 1 or 2 arguments.
-	 *
-	 * Usage:
-	 *
-	 * // Waits for any key press
-	 * CLI::prompt();
-	 *
-	 * // Takes any input
-	 * $color = CLI::prompt('What is your favorite color?');
-	 *
-	 * // Takes any input, but offers default
-	 * $color = CLI::prompt('What is your favourite color?', 'white');
-	 *
-	 * // Will only accept the options in the array
-	 * $ready = CLI::prompt('Are you ready?', array('y','n'));
-	 *
-	 * @return	string	the user input
-	 */
-	public static function prompt()
-	{
-		$args = func_get_args();
-
-		$options = array();
-		$output = '';
-		$default = null;
-
-		// How many we got
-		$arg_count = count($args);
-
-		// Is the last argument a boolean? True means required
-		$required = end($args) === true;
-
-		// Reduce the argument count if required was passed, we don't care about that anymore
-		$required === true and --$arg_count;
-
-		// This method can take a few crazy combinations of arguments, so lets work it out
-		switch ($arg_count)
-		{
-			case 2:
-
-				// E.g: $ready = CLI::prompt('Are you ready?', array('y','n'));
-				if (is_array($args[1]))
-				{
-					list($output, $options)=$args;
-				}
-
-				// E.g: $color = CLI::prompt('What is your favourite color?', 'white');
-				elseif (is_string($args[1]))
-				{
-					list($output, $default)=$args;
-				}
-
-			break;
-
-			case 1:
-
-				// No question (probably been asked already) so just show options
-				// E.g: $ready = CLI::prompt(array('y','n'));
-				if (is_array($args[0]))
-				{
-					$options = $args[0];
-				}
-
-				// Question without options
-				// E.g: $ready = CLI::prompt('What did you do today?');
-				elseif (is_string($args[0]))
-				{
-					$output = $args[0];
-				}
-
-			break;
-		}
-
-		// If a question has been asked with the read
-		if ($output !== '')
-		{
-			$extra_output = '';
-
-			if ($default !== null)
-			{
-				$extra_output = ' [ Default: "'.$default.'" ]';
-			}
-
-			elseif ($options !== array())
-			{
-				$extra_output = ' [ '.implode(', ', $options).' ]';
-			}
-
-			fwrite(STDOUT, $output.$extra_output.': ');
-		}
-
-		// Read the input from keyboard.
-		$input = trim(static::input()) ?: $default;
-
-		// No input provided and we require one (default will stop this being called)
-		if (empty($input) and $required === true)
-		{
-			static::write('This is required.');
-			static::new_line();
-
-			$input = forward_static_call_array(array(__CLASS__, 'prompt'), $args);
-		}
-
-		// If options are provided and the choice is not in the array, tell them to try again
-		if ( ! empty($options) and ! in_array($input, $options))
-		{
-			static::write('This is not a valid option. Please try again.');
-			static::new_line();
-
-			$input = forward_static_call_array(array(__CLASS__, 'prompt'), $args);
-		}
-
-		return $input;
-	}
-
-	/**
-	 * Outputs a string to the cli.	 If you send an array it will implode them
-	 * with a line break.
-	 *
-	 * @param	string|array	$text	the text to output, or array of lines
-	 */
-	public static function write($text = '', $foreground = null, $background = null)
-	{
-		if (is_array($text))
-		{
-			$text = implode(PHP_EOL, $text);
-		}
-
-		if ($foreground or $background)
-		{
-			$text = static::color($text, $foreground, $background);
-		}
-
-		fwrite(STDOUT, $text.PHP_EOL);
-	}
-
-	/**
-	 * Outputs an error to the CLI using STDERR instead of STDOUT
-	 *
-	 * @param	string|array	$text	the text to output, or array of errors
-	 */
-	public static function error($text = '', $foreground = 'light_red', $background = null)
-	{
-		if (is_array($text))
-		{
-			$text = implode(PHP_EOL, $text);
-		}
-
-		if ($foreground OR $background)
-		{
-			$text = static::color($text, $foreground, $background);
-		}
-
-		fwrite(STDERR, $text.PHP_EOL);
-	}
-
-	/**
-	 * Beeps a certain number of times.
-	 *
-	 * @param	int $num	the number of times to beep
-	 */
-	public static function beep($num = 1)
-	{
-		echo str_repeat("\x07", $num);
-	}
-
-	/**
-	 * Waits a certain number of seconds, optionally showing a wait message and
-	 * waiting for a key press.
-	 *
-	 * @param	int		$seconds	number of seconds
-	 * @param	bool	$countdown	show a countdown or not
-	 */
-	public static function wait($seconds = 0, $countdown = false)
-	{
-		if ($countdown === true)
-		{
-			$time = $seconds;
-
-			while ($time > 0)
-			{
-				fwrite(STDOUT, $time.'... ');
-				sleep(1);
-				$time--;
-			}
-			static::write();
-		}
-
-		else
-		{
-			if ($seconds > 0)
-			{
-				sleep($seconds);
-			}
-			else
-			{
-				static::write(static::$wait_msg);
-				static::input();
-			}
-		}
-	}
-
-
-	/**
-	 * if operating system === windows
-	 */
- 	public static function is_windows()
- 	{
- 		return 'win' === strtolower(substr(php_uname("s"), 0, 3));
- 	}
-
-	/**
-	 * Enter a number of empty lines
-	 *
-	 * @param	integer	Number of lines to output
-	 * @return	void
-	 */
-	public static function new_line($num = 1)
-	{
-        // Do it once or more, write with empty string gives us a new line
-        for($i = 0; $i < $num; $i++)
-		{
-			static::write();
-		}
-    }
-
-	/**
-	 * Clears the screen of output
-	 *
-	 * @return	void
-	 */
-    public static function clear_screen()
-    {
-		static::is_windows()
-
-			// Windows is a bit crap at this, but their terminal is tiny so shove this in
-			? static::new_line(40)
-
-			// Anything with a flair of Unix will handle these magic characters
-			: fwrite(STDOUT, chr(27)."[H".chr(27)."[2J");
-	}
-
-	/**
-	 * Returns the given text with the correct color codes for a foreground and
-	 * optionally a background color.
-	 *
-	 * @param	string	$text		the text to color
-	 * @param	string	$foreground the foreground color
-	 * @param	string	$background the background color
-	 * @return	string	the color coded string
-	 */
-	public static function color($text, $foreground, $background = null)
-	{
-		if (static::is_windows() and ! \Input::server('ANSICON'))
-		{
-			return $text;
-		}
-
-		if ( ! array_key_exists($foreground, static::$foreground_colors))
-		{
-			throw new \FuelException('Invalid CLI foreground color: '.$foreground);
-		}
-
-		if ( $background !== null and ! array_key_exists($background, static::$background_colors))
-		{
-			throw new \FuelException('Invalid CLI background color: '.$background);
-		}
-
-		$string = "\033[".static::$foreground_colors[$foreground]."m";
-
-		if ($background !== null)
-		{
-			$string .= "\033[".static::$background_colors[$background]."m";
-		}
-
-		$string .= $text."\033[0m";
-
-		return $string;
-	}
-
-	/**
-	* Spawn Background Process
-	*
-	* Launches a background process (note, provides no security itself, $call must be sanitised prior to use)
-	* @param string $call the system call to make
-	* @return void
-	* @author raccettura
-	* @link http://robert.accettura.com/blog/2006/09/14/asynchronous-processing-with-php/
-	*/
-	public static function spawn($call, $output = '/dev/null')
-	{
-		// Windows
-		if(static::is_windows())
-		{
-			pclose(popen('start /b '.$call, 'r'));
-	    }
-
-		// Some sort of UNIX
-		else
-		{
-			pclose(popen($call.' > '.$output.' &', 'r'));
-	    }
-	}
-
-}
-

+ 0 - 231
frameworks/PHP/php-fuel/fuel/core/classes/config.php

@@ -1,231 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-class ConfigException extends \FuelException { }
-
-class Config
-{
-	/**
-	 * @var    array    $loaded_files    array of loaded files
-	 */
-	public static $loaded_files = array();
-
-	/**
-	 * @var    array    $items           the master config array
-	 */
-	public static $items = array();
-
-	/**
-	 * @var    string    $default_check_value          random value used as a not-found check in get()
-	 */
-	public static $default_check_value;
-
-	/**
-	 * @var    array    $itemcache       the dot-notated item cache
-	 */
-	protected static $itemcache = array();
-
-	/**
-	 * Loads a config file.
-	 *
-	 * @param    mixed    $file         string file | config array | Config_Interface instance
-	 * @param    mixed    $group        null for no group, true for group is filename, false for not storing in the master config
-	 * @param    bool     $reload       true to force a reload even if the file is already loaded
-	 * @param    bool     $overwrite    true for array_merge, false for \Arr::merge
-	 * @return   array                  the (loaded) config array
-	 */
-	public static function load($file, $group = null, $reload = false, $overwrite = false)
-	{
-		if ( ! $reload and
-		     ! is_array($file) and
-		     ! is_object($file) and
-		    array_key_exists($file, static::$loaded_files))
-		{
-			$group === true and $group = $file;
-			if ($group === null or $group === false or ! isset(static::$items[$group]))
-			{
-				return false;
-			}
-			return static::$items[$group];
-		}
-
-		$config = array();
-		if (is_array($file))
-		{
-			$config = $file;
-		}
-		elseif (is_string($file))
-		{
-			$info = pathinfo($file);
-			$type = 'php';
-			if (isset($info['extension']))
-			{
-				$type = $info['extension'];
-				// Keep extension when it's an absolute path, because the finder won't add it
-				if ($file[0] !== '/' and $file[1] !== ':')
-				{
-					$file = substr($file, 0, -(strlen($type) + 1));
-				}
-			}
-			$class = '\\Config_'.ucfirst($type);
-
-			if (class_exists($class))
-			{
-				static::$loaded_files[$file] = true;
-				$file = new $class($file);
-			}
-			else
-			{
-				throw new \FuelException(sprintf('Invalid config type "%s".', $type));
-			}
-		}
-
-		if ($file instanceof Config_Interface)
-		{
-			try
-			{
-				$config = $file->load($overwrite, ! $reload);
-			}
-			catch (\ConfigException $e)
-			{
-				$config = array();
-			}
-			$group = $group === true ? $file->group() : $group;
-		}
-
-		if ($group === null)
-		{
-			static::$items = $reload ? $config : ($overwrite ? array_merge(static::$items, $config) : \Arr::merge(static::$items, $config));
-			static::$itemcache = array();
-		}
-		else
-		{
-			$group = ($group === true) ? $file : $group;
-			if ( ! isset(static::$items[$group]) or $reload)
-			{
-				static::$items[$group] = array();
-			}
-			static::$items[$group] = $overwrite ? array_merge(static::$items[$group],$config) : \Arr::merge(static::$items[$group],$config);
-			$group .= '.';
-			foreach (static::$itemcache as $key => $value)
-			{
-				if (strpos($key, $group) === 0)
-				{
-					unset(static::$itemcache[$key]);
-				}
-			}
-		}
-
-		return $config;
-	}
-
-	/**
-	 * Save a config array to disc.
-	 *
-	 * @param   string          $file      desired file name
-	 * @param   string|array    $config    master config array key or config array
-	 * @return  bool                       false when config is empty or invalid else \File::update result
-	 */
-	public static function save($file, $config)
-	{
-		if ( ! is_array($config))
-		{
-			if ( ! isset(static::$items[$config]))
-			{
-				return false;
-			}
-			$config = static::$items[$config];
-		}
-
-		$info = pathinfo($file);
-		$type = 'php';
-		if (isset($info['extension']))
-		{
-			$type = $info['extension'];
-			// Keep extension when it's an absolute path, because the finder won't add it
-			if ($file[0] !== '/' and $file[1] !== ':')
-			{
-				$file = substr($file, 0, -(strlen($type) + 1));
-			}
-		}
-		$class = '\\Config_'.ucfirst($type);
-
-		if ( ! class_exists($class))
-		{
-			throw new \FuelException(sprintf('Invalid config type "%s".', $type));
-		}
-
-		$driver = new $class($file);
-
-		return $driver->save($config);
-	}
-
-	/**
-	 * Returns a (dot notated) config setting
-	 *
-	 * @param   string   $item      name of the config item, can be dot notated
-	 * @param   mixed    $default   the return value if the item isn't found
-	 * @return  mixed               the config setting or default if not found
-	 */
-	public static function get($item, $default = null)
-	{
-		is_null(static::$default_check_value) and static::$default_check_value = pack('H*', 'DEADBEEFCAFE');
-
-		if (isset(static::$items[$item]))
-		{
-			return static::$items[$item];
-		}
-		elseif ( ! isset(static::$itemcache[$item]))
-		{
-			$val = \Fuel::value(\Arr::get(static::$items, $item, static::$default_check_value));
-
-			if ($val === static::$default_check_value)
-			{
-				return $default;
-			}
-
-			static::$itemcache[$item] = $val;
-		}
-
-		return static::$itemcache[$item];
-	}
-
-	/**
-	 * Sets a (dot notated) config item
-	 *
-	 * @param    string    a (dot notated) config key
-	 * @param    mixed     the config value
-	 * @return   void      the \Arr::set result
-	 */
-	public static function set($item, $value)
-	{
-		strpos($item, '.') === false or static::$itemcache[$item] = $value;
-		return \Arr::set(static::$items, $item, \Fuel::value($value));
-	}
-
-	/**
-	 * Deletes a (dot notated) config item
-	 *
-	 * @param    string       a (dot notated) config key
-	 * @return   array|bool   the \Arr::delete result, success boolean or array of success booleans
-	 */
-	public static function delete($item)
-	{
-		if (isset(static::$itemcache[$item]))
-		{
-			unset(static::$itemcache[$item]);
-		}
-		return \Arr::delete(static::$items, $item);
-	}
-}

+ 0 - 207
frameworks/PHP/php-fuel/fuel/core/classes/config/file.php

@@ -1,207 +0,0 @@
-<?php
-
-namespace Fuel\Core;
-
-/**
- * A base Config File class for File based configs.
- */
-abstract class Config_File implements Config_Interface
-{
-	protected $file;
-
-	protected $vars = array();
-
-	/**
-	 * Sets up the file to be parsed and variables
-	 *
-	 * @param   string  $file  Config file name
-	 * @param   array   $vars  Variables to parse in the file
-	 * @return  void
-	 */
-	public function __construct($file = null, $vars = array())
-	{
-		$this->file = $file;
-
-		$this->vars = array(
-			'APPPATH' => APPPATH,
-			'COREPATH' => COREPATH,
-			'PKGPATH' => PKGPATH,
-			'DOCROOT' => DOCROOT,
-		) + $vars;
-	}
-
-	/**
-	 * Loads the config file(s).
-	 *
-	 * @param   bool  $overwrite  Whether to overwrite existing values
-	 * @return  array  the config array
-	 */
-	public function load($overwrite = false, $cache = true)
-	{
-		$paths = $this->find_file($cache);
-		$config = array();
-
-		foreach ($paths as $path)
-		{
-			$config = $overwrite ?
-				array_merge($config, $this->load_file($path)) :
-				\Arr::merge($config, $this->load_file($path));
-		}
-
-		return $config;
-	}
-
-	/**
-	 * Gets the default group name.
-	 *
-	 * @return  string
-	 */
-	public function group()
-	{
-		return $this->file;
-	}
-
-	/**
-	 * Parses a string using all of the previously set variables.  Allows you to
-	 * use something like %APPPATH% in non-PHP files.
-	 *
-	 * @param   string  $string  String to parse
-	 * @return  string
-	 */
-	protected function parse_vars($string)
-	{
-		foreach ($this->vars as $var => $val)
-		{
-			$string = str_replace("%$var%", $val, $string);
-		}
-
-		return $string;
-	}
-
-	/**
-	 * Replaces FuelPHP's path constants to their string counterparts.
-	 *
-	 * @param   array  $array  array to be prepped
-	 * @return  array  prepped array
-	 */
-	protected function prep_vars(&$array)
-	{
-		static $replacements = false;
-
-		if ($replacements === false)
-		{
-			foreach ($this->vars as $i => $v)
-			{
-				$replacements['#^('.preg_quote($v).'){1}(.*)?#'] = "%".$i."%$2";
-			}
-		}
-
-		foreach ($array as $i => $value)
-		{
-			if (is_string($value))
-			{
-				$array[$i] = preg_replace(array_keys($replacements), array_values($replacements), $value);
-			}
-			elseif(is_array($value))
-			{
-				$this->prep_vars($array[$i]);
-			}
-		}
-	}
-
-	/**
-	 * Finds the given config files
-	 *
-	 * @param   bool  $multiple  Whether to load multiple files or not
-	 * @return  array
-	 */
-	protected function find_file($cache = true)
-	{
-		if (($this->file[0] === '/' or (isset($this->file[1]) and $this->file[1] === ':')) and is_file($this->file))
-		{
-			$paths = array($this->file);
-		}
-		else
-		{
-			$paths = array_merge(
-				\Finder::search('config/'.\Fuel::$env, $this->file, $this->ext, true, $cache),
-				\Finder::search('config', $this->file, $this->ext, true, $cache)
-			);
-		}
-
-		if (empty($paths))
-		{
-			throw new \ConfigException(sprintf('File "%s" does not exist.', $this->file));
-		}
-
-		return array_reverse($paths);
-	}
-
-	/**
-	 * Formats the output and saved it to disc.
-	 *
-	 * @param   $contents  $contents    config array to save
-	 * @return  bool       \File::update result
-	 */
-	public function save($contents)
-	{
-		// get the formatted output
-		$output = $this->export_format($contents);
-
-		if ( ! $output)
-		{
-			return false;
-		}
-
-		if ( ! $path = \Finder::search('config', $this->file, $this->ext))
-		{
-			if ($pos = strripos($this->file, '::'))
-			{
-				// get the namespace path
-				if ($path = \Autoloader::namespace_path('\\'.ucfirst(substr($this->file, 0, $pos))))
-				{
-					// strip the namespace from the filename
-					$this->file = substr($this->file, $pos+2);
-
-					// strip the classes directory as we need the module root
-					$path = substr($path,0, -8).'config'.DS.$this->file;
-				}
-				else
-				{
-					// invalid namespace requested
-					return false;
-				}
-			}
-		}
-
-		// absolute path requested?
-		if ($this->file[0] === '/' or (isset($this->file[1]) and $this->file[1] === ':'))
-		{
-			$path = $this->file;
-		}
-
-		// make sure we have a fallback
-		$path or $path = APPPATH.'config'.DS.$this->file.$this->ext;
-
-		$path = pathinfo($path);
-		if ( ! is_dir($path['dirname']))
-		{
-			mkdir($path['dirname'], 0777, true);
-		}
-
-		return \File::update($path['dirname'], $path['basename'], $output);
-	}
-
-	/**
-	 * Must be implemented by child class. Gets called for each file to load.
-	 */
-	abstract protected function load_file($file);
-
-	/**
-	 * Must be impletmented by child class. Gets called when saving a config file.
-	 *
-	 * @param   array   $contents  config array to save
-	 * @return  string  formatted output
-	 */
-	abstract protected function export_format($contents);
-}

+ 0 - 34
frameworks/PHP/php-fuel/fuel/core/classes/config/ini.php

@@ -1,34 +0,0 @@
-<?php
-
-namespace Fuel\Core;
-
-/**
- * INI Config file parser
- */
-class Config_Ini extends \Config_File
-{
-	protected $ext = '.ini';
-
-	/**
-	 * Loads in the given file and parses it.
-	 *
-	 * @param   string  $file  File to load
-	 * @return  array
-	 */
-	protected function load_file($file)
-	{
-		$contents = $this->parse_vars(file_get_contents($file));
-		return parse_ini_string($contents, true);
-	}
-
-	/**
-	 * Returns the formatted config file contents.
-	 *
-	 * @param   array   $content  config array
-	 * @return  string  formatted config file contents
-	 */
-	protected function export_format($contents)
-	{
-		throw new \ConfigException('Saving config to ini is not supported at this time');
-	}
-}

+ 0 - 10
frameworks/PHP/php-fuel/fuel/core/classes/config/interface.php

@@ -1,10 +0,0 @@
-<?php
-
-namespace Fuel\Core;
-
-interface Config_Interface
-{
-	public function load($overwrite = false);
-	public function group();
-	public function save($contents);
-}

+ 0 - 35
frameworks/PHP/php-fuel/fuel/core/classes/config/json.php

@@ -1,35 +0,0 @@
-<?php
-
-namespace Fuel\Core;
-
-/**
- * JSON Config file parser
- */
-class Config_Json extends \Config_File
-{
-	protected $ext = '.json';
-
-	/**
-	 * Loads in the given file and parses it.
-	 *
-	 * @param   string  $file  File to load
-	 * @return  array
-	 */
-	protected function load_file($file)
-	{
-		$contents = $this->parse_vars(file_get_contents($file));
-		return json_decode($contents, true);
-	}
-
-	/**
-	 * Returns the formatted config file contents.
-	 *
-	 * @param   array   $content  config array
-	 * @return  string  formatted config file contents
-	 */
-	protected function export_format($contents)
-	{
-		$this->prep_vars($contents);
-		return \Format::forge()->to_json($contents, true);
-	}
-}

+ 0 - 38
frameworks/PHP/php-fuel/fuel/core/classes/config/php.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace Fuel\Core;
-
-/**
- * PHP Config file parser
- */
-class Config_Php extends \Config_File
-{
-	protected $ext = '.php';
-
-	/**
-	 * Loads in the given file and parses it.
-	 *
-	 * @param   string  $file  File to load
-	 * @return  array
-	 */
-	protected function load_file($file)
-	{
-		return \Fuel::load($file);
-	}
-
-	/**
-	 * Returns the formatted config file contents.
-	 *
-	 * @param   array   $content  config array
-	 * @return  string  formatted config file contents
-	 */
-	protected function export_format($contents)
-	{
-		$output = <<<CONF
-<?php
-
-CONF;
-		$output .= 'return '.str_replace(array('  ', 'array (', '\''.APPPATH, '\''.DOCROOT, '\''.COREPATH, '\''.PKGPATH), array("\t", 'array(', 'APPPATH.\'', 'DOCROOT.\'', 'COREPATH.\'', 'PKGPATH.\''), var_export($contents, true)).";\n";
-		return $output;
-	}
-}

+ 0 - 40
frameworks/PHP/php-fuel/fuel/core/classes/config/yml.php

@@ -1,40 +0,0 @@
-<?php
-
-namespace Fuel\Core;
-
-/**
- * Yaml Config file parser
- */
-class Config_Yml extends \Config_File
-{
-	protected $ext = '.yml';
-
-	/**
-	 * Loads in the given file and parses it.
-	 *
-	 * @param   string  $file  File to load
-	 * @return  array
-	 */
-	protected function load_file($file)
-	{
-		$contents = $this->parse_vars(file_get_contents($file));
-		return \Format::forge($contents, 'yaml')->to_array();
-	}
-
-	/**
-	 * Returns the formatted config file contents.
-	 *
-	 * @param   array   $content  config array
-	 * @return  string  formatted config file contents
-	 */
-	protected function export_format($contents)
-	{
-		if ( ! function_exists('spyc_load'))
-		{
-			import('spyc/spyc', 'vendor');
-		}
-
-		$this->prep_vars($contents);
-		return \Spyc::YAMLDump($contents);
-	}
-}

+ 0 - 75
frameworks/PHP/php-fuel/fuel/core/classes/controller.php

@@ -1,75 +0,0 @@
-<?php
-/**
- * Part of the Fuel framework.
- *
- * @package    Fuel
- * @version    1.5
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Fuel\Core;
-
-abstract class Controller
-{
-
-	/**
-	 * @var  Request  The current Request object
-	 */
-	public $request;
-
-	/**
-	 * Sets the controller request object.
-	 *
-	 * @param   Request   The current request object
-	 */
-	public function __construct(\Request $request)
-	{
-		$this->request = $request;
-	}
-
-	/**
-	 * This method gets called before the action is called
-	 */
-	public function before() {}
-
-	/**
-	 * This method gets called after the action is called
-	 */
-	public function after($response)
-	{
-		// Make sure the $response is a Response object
-		if ( ! $response instanceof Response)
-		{
-			$response = \Response::forge($response);
-		}
-
-		return $response;
-	}
-
-	/**
-	 * This method returns the named parameter requested, or all of them
-	 * if no parameter is given.
-	 *
-	 * @param   string  $param    The name of the parameter
-	 * @param   mixed   $default  Default value
-	 * @return  mixed
-	 */
-	public function param($param, $default = null)
-	{
-		return $this->request->param($param, $default);
-	}
-
-	/**
-	 * This method returns all of the named parameters.
-	 *
-	 * @return  array
-	 */
-	public function params()
-	{
-		return $this->request->params();
-	}
-}
-

+ 0 - 73
frameworks/PHP/php-fuel/fuel/core/classes/controller/bench.php

@@ -1,73 +0,0 @@
-<?php
-
-namespace Fuel\Core;
-
-
-abstract class Controller_Bench extends \Controller_Rest
-{
-
-    /**
-     * @var string page template
-     */
-    public $template = 'template';
-
-    /**
-     * Load the template and create the $this->template object if needed
-     */
-    public function before()
-    {
-        // setup the template if this isn't a RESTful call
-        if ( ! $this->is_restful())
-        {
-            if ( ! empty($this->template) and is_string($this->template))
-            {
-                // Load the template
-                $this->template = \View::forge($this->template);
-            }
-        }
-
-        return parent::before();
-    }
-
-    /**
-     * After controller method has run output the template
-     *
-     * @param  Response  $response
-     */
-    public function after($response)
-    {
-        // return the template if no response is present and this isn't a RESTful call
-        if ( ! $this->is_restful())
-        {
-            // do we have a response passed?
-            if(empty($response))
-            {
-                // maybe one in the rest body?
-                $response = $this->response->body;
-                if (empty($response))
-                {
-                    // fall back to the defined template
-                    $response = $this->template;
-                }
-            }
-
-            if ( ! $response instanceof Response)
-            {
-                $response = \Response::forge($response);
-            }
-        }
-
-        return parent::after($response);
-    }
-
-    /**
-     * Decide whether to return RESTful or templated response
-     * Override in subclass to introduce custom switching logic.
-     *
-     * @param  boolean
-     */
-    public function is_restful()
-    {
-        return \Input::is_ajax();
-    }
-}

Some files were not shown because too many files changed in this diff