mirror of
https://github.com/getgrav/grav.git
synced 2026-03-04 03:21:33 +01:00
Merge branch 'release/0.9.2'
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,7 @@
|
||||
# Composer
|
||||
composer.lock
|
||||
.composer
|
||||
vendor
|
||||
|
||||
# Sass
|
||||
.sass-cache
|
||||
|
||||
BIN
bin/composer.phar
Executable file
BIN
bin/composer.phar
Executable file
Binary file not shown.
7
bin/grav
7
bin/grav
@@ -5,6 +5,13 @@ if (version_compare($ver = PHP_VERSION, $req = '5.4.0', '<')) {
|
||||
exit(sprintf("You are running PHP %s, but Grav needs at least PHP %s to run.\n", $ver, $req));
|
||||
}
|
||||
|
||||
if (!file_exists(__DIR__ . '/../vendor')){
|
||||
// Before we can even start, we need to run composer first
|
||||
echo "Preparing to install vendor dependencies...\n\n";
|
||||
echo system('php bin/composer.phar --working-dir="'.__DIR__.'/../" --no-interaction install -o');
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
require_once(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
@@ -13,16 +13,16 @@
|
||||
"symfony/console": "~2.5",
|
||||
"symfony/event-dispatcher": "~2.5",
|
||||
"doctrine/cache": "~1.3",
|
||||
"tracy/tracy": "~2.2",
|
||||
"gregwar/image": "~2.0",
|
||||
"tracy/tracy": "2.3.*@dev",
|
||||
"gregwar/image": "~2.0",
|
||||
"ircmaxell/password-compat": "1.0.*",
|
||||
"mrclay/minify": "dev-master",
|
||||
"donatj/phpuseragentparser": "dev-master",
|
||||
"pimple/pimple": "~3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Grav\\": "system/src/"
|
||||
"psr-4": {
|
||||
"Grav\\": "system/src/Grav"
|
||||
},
|
||||
"files": ["system/defines.php"]
|
||||
},
|
||||
|
||||
@@ -4,9 +4,10 @@ namespace Grav;
|
||||
if (version_compare($ver = PHP_VERSION, $req = '5.4.0', '<')) {
|
||||
exit(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
|
||||
}
|
||||
|
||||
$autoload = __DIR__ . '/vendor/autoload.php';
|
||||
if (!is_file($autoload)) {
|
||||
exit('Please run: <i>composer install -o</i>');
|
||||
exit('Please run: <i>bin/grav install</i>');
|
||||
}
|
||||
|
||||
use Grav\Common\Grav;
|
||||
@@ -20,10 +21,10 @@ if (!ini_get('date.timezone')) {
|
||||
}
|
||||
|
||||
$grav = Grav::instance(
|
||||
[
|
||||
array(
|
||||
'loader' => $loader,
|
||||
'debugger' => new Debugger(Debugger::PRODUCTION)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,42 +1,68 @@
|
||||
title: Site settings
|
||||
validation: strict
|
||||
|
||||
title: Site
|
||||
form:
|
||||
fields:
|
||||
title:
|
||||
type: text
|
||||
label: Site title
|
||||
fields:
|
||||
|
||||
description:
|
||||
type: textarea
|
||||
label: Description
|
||||
content:
|
||||
type: section
|
||||
title: Defaults
|
||||
|
||||
summary.size:
|
||||
type: text
|
||||
label: Summary size
|
||||
validate:
|
||||
type: int
|
||||
min: 0
|
||||
max: 65536
|
||||
fields:
|
||||
title:
|
||||
type: text
|
||||
label: Site Title
|
||||
size: large
|
||||
placeholder: "Site wide title"
|
||||
help: Default title for your site
|
||||
|
||||
author.name:
|
||||
type: text
|
||||
label: Default author
|
||||
author.name:
|
||||
type: text
|
||||
size: large
|
||||
label: Default Author
|
||||
|
||||
author.email:
|
||||
type: text
|
||||
label: Default email
|
||||
author.email:
|
||||
type: text
|
||||
size: large
|
||||
label: Default Email
|
||||
|
||||
taxonomies:
|
||||
type: text
|
||||
label: Taxonomy types
|
||||
validate:
|
||||
type: commalist
|
||||
taxonomies:
|
||||
type: text
|
||||
label: Taxonomy Types
|
||||
classes: fancy
|
||||
validate:
|
||||
type: commalist
|
||||
|
||||
blog.route:
|
||||
type: text
|
||||
label: Blog URL
|
||||
metadata:
|
||||
type: array
|
||||
label: Metadata
|
||||
placeholder_key: Name
|
||||
placeholder_value: Content
|
||||
|
||||
routes:
|
||||
type: array
|
||||
label: Custom routes
|
||||
blog:
|
||||
type: section
|
||||
title: Blog
|
||||
|
||||
fields:
|
||||
blog.route:
|
||||
type: text
|
||||
size: large
|
||||
label: Blog URL
|
||||
|
||||
summary.size:
|
||||
type: text
|
||||
size: x-small
|
||||
label: Summary Size
|
||||
validate:
|
||||
type: int
|
||||
min: 0
|
||||
max: 65536
|
||||
|
||||
routes:
|
||||
type: section
|
||||
title: Routes
|
||||
|
||||
fields:
|
||||
routes:
|
||||
type: array
|
||||
label: Custom
|
||||
placeholder_key: /your/alias
|
||||
placeholder_value: /your/route
|
||||
|
||||
@@ -1,275 +1,353 @@
|
||||
title: Configuration
|
||||
validation: strict
|
||||
title: System
|
||||
|
||||
form:
|
||||
fields:
|
||||
basics:
|
||||
type: section
|
||||
title: Basics
|
||||
underline: true
|
||||
fields:
|
||||
|
||||
fields:
|
||||
title:
|
||||
type: text
|
||||
label: Site Title
|
||||
placeholder: "Site wide title"
|
||||
help: Default title for your site
|
||||
content:
|
||||
type: section
|
||||
title: Content
|
||||
underline: true
|
||||
|
||||
base_url_absolute:
|
||||
type: text
|
||||
label: Absolute Base URL
|
||||
placeholder: "Override Absolute base URL (e.g. http://example.com)"
|
||||
help: You can provide a base URL to use rather than letting Grav guess what it is
|
||||
fields:
|
||||
home.alias:
|
||||
type: pages
|
||||
size: medium
|
||||
classes: fancy
|
||||
label: Home Page
|
||||
show_all: false
|
||||
show_modular: false
|
||||
show_root: false
|
||||
help: "The page that Grav will use as the default landing page"
|
||||
|
||||
base_url_relative:
|
||||
type: text
|
||||
label: Relative Base URL
|
||||
placeholder: "Override Relative base URL (e.g. /subdirectory/site)"
|
||||
help: You can provide a base URL to use rather than letting Grav guess what it is
|
||||
pages.theme:
|
||||
type: themeselect
|
||||
classes: fancy
|
||||
size: medium
|
||||
label: Default Theme
|
||||
help: "Set the theme (defaults to 'default')"
|
||||
|
||||
pages.dateformat.short:
|
||||
type: select
|
||||
label: PHP date format
|
||||
help: "Set the PHP date format"
|
||||
default: 'jS M Y'
|
||||
options:
|
||||
'F jS \\a\\t g:ia': "January 1st at 11:59pm"
|
||||
'l jS of F g:i A': "Monday 1st of January at 11:59 PM"
|
||||
'D, m M Y G:i:s': "Mon, 01 Jan 2014 23:59:00"
|
||||
'd-m-y G:i': "01-01-14 23:59"
|
||||
'jS M Y': "10th Feb 2014"
|
||||
pages.markdown_extra:
|
||||
type: toggle
|
||||
label: Markdown Extra
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
pages.dateformat.long:
|
||||
type: select
|
||||
label: Default date format
|
||||
help: "Set default date format rather than default for |date() filter"
|
||||
options:
|
||||
'F jS \a\t g:ia': "January 1st at 11:59pm"
|
||||
'l jS of F g:i A': "Monday 1st of January at 11:59 PM"
|
||||
'D, m M Y G:i:s': "Mon, 01 Jan 2014 23:59:00"
|
||||
'd-m-y G:i': "01-01-14 23:59"
|
||||
'jS M Y': "10th Feb 2014"
|
||||
pages.process:
|
||||
type: checkboxes
|
||||
label: Process
|
||||
default: [markdown: true, twig: true]
|
||||
options:
|
||||
markdown: Markdown
|
||||
twig: Twig
|
||||
use: keys
|
||||
|
||||
pages.theme:
|
||||
type: themeselect
|
||||
label: Default Theme
|
||||
help: "Set the theme (defaults to 'default')"
|
||||
pages.dateformat.short:
|
||||
type: select
|
||||
size: medium
|
||||
classes: fancy
|
||||
label: Short Date Format
|
||||
help: "Set the short date format"
|
||||
default: 'jS M Y'
|
||||
options:
|
||||
'F jS \\a\\t g:ia': "January 1st at 11:59pm"
|
||||
'l jS of F g:i A': "Monday 1st of January at 11:59 PM"
|
||||
'D, m M Y G:i:s': "Mon, 01 Jan 2014 23:59:00"
|
||||
'd-m-y G:i': "01-01-14 23:59"
|
||||
'jS M Y': "10th Feb 2014"
|
||||
|
||||
content:
|
||||
type: section
|
||||
title: Content
|
||||
underline: true
|
||||
pages.dateformat.long:
|
||||
type: select
|
||||
size: medium
|
||||
classes: fancy
|
||||
label: Long Date Format
|
||||
help: "Set the long date format"
|
||||
options:
|
||||
'F jS \a\t g:ia': "January 1st at 11:59pm"
|
||||
'l jS of F g:i A': "Monday 1st of January at 11:59 PM"
|
||||
'D, m M Y G:i:s': "Mon, 01 Jan 2014 23:59:00"
|
||||
'd-m-y G:i': "01-01-14 23:59"
|
||||
'jS M Y': "10th Feb 2014"
|
||||
|
||||
fields:
|
||||
home.alias:
|
||||
type: pages
|
||||
label: Home page
|
||||
show_all: false
|
||||
show_modular: false
|
||||
show_root: false
|
||||
help: "The page that Grav will use as the default landing page"
|
||||
pages.order.by:
|
||||
type: select
|
||||
size: medium
|
||||
classes: fancy
|
||||
label: Default Ordering
|
||||
options:
|
||||
default: Default - based on folder name
|
||||
folder: Folder - based on prefix-less folder name
|
||||
title: Title - based on title field in header
|
||||
date: Date - based on date field in header
|
||||
|
||||
pages.order.by:
|
||||
type: select
|
||||
label: Default ordering
|
||||
options:
|
||||
default: Default - based on folder name
|
||||
folder: Folder - based on prefix-less folder name
|
||||
title: Title - based on title field in header
|
||||
date: Date - based on date field in header
|
||||
pages.order.dir:
|
||||
type: toggle
|
||||
label: Default Order Direction
|
||||
highlight: asc
|
||||
default: desc
|
||||
options:
|
||||
asc: Ascending
|
||||
desc: Descending
|
||||
|
||||
pages.order.dir:
|
||||
type: toggle
|
||||
label: Ordering direction
|
||||
default: asc
|
||||
options:
|
||||
asc: Ascending
|
||||
desc: Descending
|
||||
pages.list.count:
|
||||
type: text
|
||||
size: x-small
|
||||
label: Default Item Count
|
||||
help: "Default max pages count"
|
||||
validate:
|
||||
type: number
|
||||
min: 1
|
||||
|
||||
pages.list.count:
|
||||
type: text
|
||||
label: Item count
|
||||
help: "Default max pages count"
|
||||
validate:
|
||||
type: number
|
||||
min: 1
|
||||
|
||||
pages.process:
|
||||
type: checkboxes
|
||||
label: Process
|
||||
default: [markdown: true, twig: true]
|
||||
options:
|
||||
markdown: Markdown
|
||||
twig: Twig
|
||||
use: keys
|
||||
|
||||
events:
|
||||
type: section
|
||||
title: Events
|
||||
underline: true
|
||||
events:
|
||||
type: section
|
||||
title: Events
|
||||
underline: true
|
||||
|
||||
fields:
|
||||
pages.events.page:
|
||||
type: toggle
|
||||
label: Page events
|
||||
highlight: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
fields:
|
||||
pages.events.page:
|
||||
type: toggle
|
||||
label: Page events
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
pages.events.twig:
|
||||
type: toggle
|
||||
label: Twig events
|
||||
highlight: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
pages.events.twig:
|
||||
type: toggle
|
||||
label: Twig events
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
caching:
|
||||
type: section
|
||||
title: Caching
|
||||
underline: true
|
||||
caching:
|
||||
type: section
|
||||
title: Caching
|
||||
underline: true
|
||||
|
||||
fields:
|
||||
cache.enabled:
|
||||
type: toggle
|
||||
label: Caching
|
||||
highlight: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
fields:
|
||||
cache.enabled:
|
||||
type: toggle
|
||||
label: Caching
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
cache.check.pages:
|
||||
type: toggle
|
||||
label: Detect changes in pages
|
||||
help: Be careful changing this setting. If you disable this setting, Grav no longer automatically updates the pages when the underlaying files are changed.
|
||||
highlight: 1
|
||||
default: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
cache.check.method:
|
||||
type: select
|
||||
size: small
|
||||
classes: fancy
|
||||
label: Cache Check Method
|
||||
options:
|
||||
file: File
|
||||
folder: Folder
|
||||
none: None
|
||||
|
||||
cache.prefix:
|
||||
type: text
|
||||
label: Cache prefix
|
||||
placeholder: "Derived from base URL (override by entering random string)"
|
||||
cache.driver:
|
||||
type: select
|
||||
size: small
|
||||
classes: fancy
|
||||
label: Cache driver
|
||||
options:
|
||||
auto: Auto detect
|
||||
file: File
|
||||
apc: APC
|
||||
xcache: XCache
|
||||
memcache: MemCache
|
||||
wincache: WinCache
|
||||
|
||||
cache.driver:
|
||||
type: select
|
||||
label: Cache driver
|
||||
options:
|
||||
auto: Auto detect
|
||||
file: File
|
||||
apc: APC
|
||||
xcache: XCache
|
||||
memcache: MemCache
|
||||
memcached: MemCached
|
||||
wincache: WinCache
|
||||
cache.prefix:
|
||||
type: text
|
||||
size: x-small
|
||||
label: Cache Prefix
|
||||
placeholder: "Derived from base URL (override by entering random string)"
|
||||
|
||||
twig:
|
||||
type: section
|
||||
title: Twig Templating
|
||||
underline: true
|
||||
twig:
|
||||
type: section
|
||||
title: Twig Templating
|
||||
underline: true
|
||||
|
||||
fields:
|
||||
twig.cache:
|
||||
type: toggle
|
||||
label: Twig caching
|
||||
highlight: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
fields:
|
||||
twig.cache:
|
||||
type: toggle
|
||||
label: Twig caching
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
twig.debug:
|
||||
type: toggle
|
||||
label: Twig debug
|
||||
highlight: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
twig.debug:
|
||||
type: toggle
|
||||
label: Twig debug
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
twig.auto_reload:
|
||||
type: toggle
|
||||
label: Detect changes
|
||||
highlight: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
twig.auto_reload:
|
||||
type: toggle
|
||||
label: Detect changes
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
twig.autoescape:
|
||||
type: toggle
|
||||
label: Autoescape variables
|
||||
highlight: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
twig.autoescape:
|
||||
type: toggle
|
||||
label: Autoescape variables
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
debugger:
|
||||
type: section
|
||||
title: Debugger
|
||||
underline: true
|
||||
assets:
|
||||
type: section
|
||||
title: Assets
|
||||
underline: true
|
||||
|
||||
fields:
|
||||
debugger.enabled:
|
||||
type: toggle
|
||||
label: Debugger
|
||||
highlight: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
fields:
|
||||
assets.css_pipeline:
|
||||
type: toggle
|
||||
label: CSS Pipeline
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
|
||||
debugger.max_depth:
|
||||
type: select
|
||||
label: Detail levels
|
||||
placeholder: "How many nested levels to display for objects or arrays"
|
||||
options:
|
||||
1: 1 level
|
||||
2: 2 levels
|
||||
3: 3 levels
|
||||
4: 4 levels
|
||||
5: 5 levels
|
||||
6: 6 levels
|
||||
7: 7 levels
|
||||
8: 8 levels
|
||||
9: 9 levels
|
||||
10: 10 levels
|
||||
validate:
|
||||
type: number
|
||||
assets.css_minify:
|
||||
type: toggle
|
||||
label: CSS Minify
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
|
||||
assets.css_minify_windows:
|
||||
type: toggle
|
||||
label: CSS Minify Windows Override
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
|
||||
assets.css_rewrite:
|
||||
type: toggle
|
||||
label: CSS Rewrite
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
|
||||
assets.js_pipeline:
|
||||
type: toggle
|
||||
label: JavaScript Pipeline
|
||||
highlight: 01
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
|
||||
assets.js_minify:
|
||||
type: toggle
|
||||
label: JavaScript Minify
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
|
||||
debugger:
|
||||
type: section
|
||||
title: Debugger
|
||||
underline: true
|
||||
|
||||
fields:
|
||||
debugger.enabled:
|
||||
type: toggle
|
||||
label: Debugger
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
debugger.mode:
|
||||
type: select
|
||||
size: small
|
||||
classes: fancy
|
||||
label: Mode
|
||||
options:
|
||||
detect: Auto-Detect
|
||||
development: Development
|
||||
production: Production
|
||||
|
||||
debugger.strict:
|
||||
type: toggle
|
||||
label: Strict
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
debugger.max_depth:
|
||||
type: select
|
||||
size: small
|
||||
classes: fancy
|
||||
label: Detail Level
|
||||
placeholder: "How many nested levels to display for objects or arrays"
|
||||
options:
|
||||
1: 1 level
|
||||
2: 2 levels
|
||||
3: 3 levels
|
||||
4: 4 levels
|
||||
5: 5 levels
|
||||
6: 6 levels
|
||||
7: 7 levels
|
||||
8: 8 levels
|
||||
9: 9 levels
|
||||
10: 10 levels
|
||||
validate:
|
||||
type: number
|
||||
|
||||
debugger.log.enabled:
|
||||
type: toggle
|
||||
label: Logging
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
debugger.shutdown.close_conection:
|
||||
type: toggle
|
||||
label: Shutdown Close Connection
|
||||
highlight: 1
|
||||
options:
|
||||
1: Yes
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
debugger.log.enabled:
|
||||
type: toggle
|
||||
label: Logging
|
||||
highlight: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
debugger.log.timing:
|
||||
type: toggle
|
||||
label: Log timings
|
||||
highlight: 1
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
title: Grav # Name of the site
|
||||
title: Grav # Name of the site
|
||||
author:
|
||||
name: John Appleseed # Default author name
|
||||
email: 'john@email.com' # Default author email
|
||||
taxonomies: [category,tag] # Arbitrary list of taxonomy types
|
||||
name: John Appleseed # Default author name
|
||||
email: 'john@email.com' # Default author email
|
||||
taxonomies: [category,tag] # Arbitrary list of taxonomy types
|
||||
blog:
|
||||
route: '/blog' # Route to blog
|
||||
description: 'Grav Site Description' # Site description
|
||||
route: '/blog' # Route to blog
|
||||
metadata:
|
||||
description: 'My Grav Site' # Site description
|
||||
summary:
|
||||
size: 300 # Maximum length of summary (characters)
|
||||
size: 300 # Maximum length of summary (characters)
|
||||
routes:
|
||||
/something/else: '/blog/sample-3' # Alias for /blog/sample-3
|
||||
/another/one/here: '/blog/sample-3' # Another alias for /blog/sample-3
|
||||
/something/else: '/blog/sample-3' # Alias for /blog/sample-3
|
||||
/another/one/here: '/blog/sample-3' # Another alias for /blog/sample-3
|
||||
|
||||
@@ -40,8 +40,7 @@ schemes:
|
||||
paths:
|
||||
- user/data
|
||||
|
||||
theme:
|
||||
themes:
|
||||
type: ReadOnlyStream
|
||||
prefixes:
|
||||
'/':
|
||||
- user/themes
|
||||
paths:
|
||||
- user/themes
|
||||
|
||||
@@ -23,7 +23,7 @@ cache:
|
||||
enabled: true # Set to true to enable caching
|
||||
check:
|
||||
method: file # Method to check for updates in pages: file|folder|none
|
||||
driver: auto # One of: auto|file|apc|xcache|memcache|memcached|wincache
|
||||
driver: auto # One of: auto|file|apc|xcache|memcache|wincache
|
||||
prefix: 'g' # Cache prefix string (prevents cache conflicts)
|
||||
|
||||
twig:
|
||||
@@ -35,6 +35,7 @@ twig:
|
||||
assets: # Configuration for Assets Manager (JS, CSS)
|
||||
css_pipeline: false # The CSS pipeline is the unification of multiple CSS resources into one file
|
||||
css_minify: true # Minify the CSS during pipelining
|
||||
css_minify_windows: false # Minify Override for Windows platforms. False by default due to ThreadStackSize
|
||||
css_rewrite: true # Rewrite any CSS relative URLs during pipelining
|
||||
js_pipeline: false # The JS pipeline is the unification of multiple JS resources into one file
|
||||
js_minify: true # Minify the JS during pipelining
|
||||
@@ -46,4 +47,5 @@ debugger:
|
||||
max_depth: 10 # How many nested levels to display for objects or arrays
|
||||
log:
|
||||
enabled: true # Enable logging
|
||||
timing: false # Enable timing logging
|
||||
shutdown:
|
||||
close_connection: true # Close the connection before calling onShutdown(). disable for debugging
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// Some standard defines
|
||||
define('GRAV', true);
|
||||
define('GRAV_VERSION', '0.9.1');
|
||||
define('GRAV_VERSION', '0.9.2');
|
||||
define('DS', '/');
|
||||
|
||||
// Directories and Paths
|
||||
|
||||
@@ -71,6 +71,7 @@ class Assets
|
||||
|
||||
// Default values for pipeline settings
|
||||
protected $css_minify = true;
|
||||
protected $css_minify_windows = false;
|
||||
protected $css_rewrite = true;
|
||||
protected $js_minify = true;
|
||||
|
||||
@@ -133,6 +134,9 @@ class Assets
|
||||
if(isset($config['css_minify']))
|
||||
$this->css_minify = $config['css_minify'];
|
||||
|
||||
if(isset($config['css_minify_windows']))
|
||||
$this->css_minify_windows = $config['css_minify_windows'];
|
||||
|
||||
if(isset($config['css_rewrite']))
|
||||
$this->css_rewrite = $config['css_rewrite'];
|
||||
|
||||
@@ -260,9 +264,10 @@ class Assets
|
||||
/**
|
||||
* Build the CSS link tags.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return string
|
||||
*/
|
||||
public function css()
|
||||
public function css($attributes = [])
|
||||
{
|
||||
if( ! $this->css)
|
||||
return null;
|
||||
@@ -271,21 +276,21 @@ class Assets
|
||||
usort($this->css, function ($a, $b) {return $a['priority'] - $b['priority'];});
|
||||
$this->css = array_reverse($this->css);
|
||||
|
||||
|
||||
$attributes = $this->attributes(array_merge([ 'type' => 'text/css', 'rel' => 'stylesheet' ], $attributes));
|
||||
|
||||
$output = '';
|
||||
if($this->css_pipeline) {
|
||||
$output .= '<link type="text/css" rel="stylesheet" href="'.$this->pipeline(CSS_ASSET).'" />'."\n";
|
||||
$output .= '<link href="'.$this->pipeline(CSS_ASSET).'"'.$attributes.' />'."\n";
|
||||
|
||||
foreach ($this->css_no_pipeline as $file) {
|
||||
$output .= '<link type="text/css" rel="stylesheet" href="'.$file['asset'].'" />'."\n";
|
||||
$output .= '<link href="'.$file['asset'].'"'.$attributes.' />'."\n";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
foreach($this->css as $file)
|
||||
$output .= '<link type="text/css" rel="stylesheet" href="'.$file['asset'].'" />'."\n";
|
||||
$output .= '<link href="'.$file['asset'].'"'.$attributes.' />'."\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -293,9 +298,10 @@ class Assets
|
||||
/**
|
||||
* Build the JavaScript script tags.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return string
|
||||
*/
|
||||
public function js()
|
||||
public function js($attributes = [])
|
||||
{
|
||||
if( ! $this->js)
|
||||
return null;
|
||||
@@ -304,22 +310,48 @@ class Assets
|
||||
usort($this->js, function ($a, $b) {return $a['priority'] - $b['priority'];});
|
||||
$this->js = array_reverse($this->js);
|
||||
|
||||
$attributes = $this->attributes(array_merge([ 'type' => 'text/javascript' ], $attributes));
|
||||
|
||||
$output = '';
|
||||
if($this->js_pipeline) {
|
||||
$output .= '<script type="text/javascript" src="'.$this->pipeline(JS_ASSET).'"></script>'."\n";
|
||||
$output .= '<script src="'.$this->pipeline(JS_ASSET).'"'.$attributes.' ></script>'."\n";
|
||||
foreach ($this->js_no_pipeline as $file) {
|
||||
$output .= '<script type="text/javascript" src="'.$file['asset'].'"></script>'."\n";
|
||||
$output .= '<script src="'.$file['asset'].'"'.$attributes.' ></script>'."\n";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
foreach($this->js as $file)
|
||||
$output .= '<script type="text/javascript" src="'.$file['asset'].'"></script>'."\n";
|
||||
$output .= '<script src="'.$file['asset'].'"'.$attributes.' ></script>'."\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an HTML attribute string from an array.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return string
|
||||
*/
|
||||
protected function attributes(array $attributes){
|
||||
$html = '';
|
||||
|
||||
foreach ( $attributes as $key => $value)
|
||||
{
|
||||
// For numeric keys we will assume that the key and the value are the same
|
||||
// as this will convert HTML attributes such as "required" to a correct
|
||||
// form like required="required" instead of using incorrect numerics.
|
||||
if (is_numeric($key)) $key = $value;
|
||||
if (is_array($value)) $value = implode(' ', $value);
|
||||
|
||||
$element = $key.'="'.htmlentities($value, ENT_QUOTES, 'UTF-8', false).'"';
|
||||
$html .= ' '.$element;
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add/replace collection.
|
||||
*
|
||||
@@ -404,10 +436,19 @@ class Assets
|
||||
if(file_exists($absolute_path))
|
||||
return $relative_path . $key;
|
||||
|
||||
$css_minify = $this->css_minify;
|
||||
|
||||
// If this is a Windows server, and minify_windows is false (default value) skip the
|
||||
// minification process because it will cause Apache to die/crash due to insufficient
|
||||
// ThreadStackSize in httpd.conf - See: https://bugs.php.net/bug.php?id=47689
|
||||
if (strtoupper(substr(php_uname('s'), 0, 3)) === 'WIN' && !$this->css_minify_windows) {
|
||||
$css_minify = false;
|
||||
}
|
||||
|
||||
// Concatenate files
|
||||
if ($css) {
|
||||
$buffer = $this->gatherLinks($this->css, CSS_ASSET);
|
||||
if ($this->css_minify) {
|
||||
if ($css_minify) {
|
||||
$min = new \CSSmin();
|
||||
$buffer = $min->run($buffer);
|
||||
}
|
||||
|
||||
@@ -90,8 +90,6 @@ class Cache extends Getters
|
||||
$driver_name = 'wincache';
|
||||
} elseif (extension_loaded('xcache')) {
|
||||
$driver_name = 'xcache';
|
||||
} elseif (extension_loaded('memcache')) {
|
||||
$driver_name = 'memcache';
|
||||
}
|
||||
} else {
|
||||
$driver_name = $setting;
|
||||
@@ -111,11 +109,11 @@ class Cache extends Getters
|
||||
break;
|
||||
|
||||
case 'memcache':
|
||||
$memcache = new \Memcache();
|
||||
$memcache->connect($this->config->get('system.cache.memcache.server','localhost'),
|
||||
$this->config->get('system.cache.memcache.port', 11211));
|
||||
$driver = new \Doctrine\Common\Cache\MemcacheCache();
|
||||
break;
|
||||
|
||||
case 'memcached':
|
||||
$driver = new \Doctrine\Common\Cache\MemcachedCache();
|
||||
$driver->setMemcache($memcache);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -55,7 +55,7 @@ class Config extends Data
|
||||
{
|
||||
// Build file map.
|
||||
$files = $this->build();
|
||||
$key = md5(serialize($files) . GRAV_VERSION);
|
||||
$key = md5(json_encode($files) . GRAV_VERSION);
|
||||
|
||||
if ($force || $key != $this->key) {
|
||||
// First take non-blocking lock to the file.
|
||||
@@ -231,12 +231,12 @@ class Config extends Data
|
||||
|
||||
/** @var \DirectoryIterator $plugin */
|
||||
foreach ($iterator as $plugin) {
|
||||
if ($iterator->isFile() || $iterator->isDot()) continue;
|
||||
|
||||
$name = $plugin->getBasename();
|
||||
$file = $plugin->getPathname() . DS . $name . YAML_EXT;
|
||||
|
||||
if (!is_file($file)) {
|
||||
continue;
|
||||
}
|
||||
if (!file_exists($file)) continue;
|
||||
|
||||
$modified = filemtime($file);
|
||||
$plugins["plugins/{$name}"] = $modified;
|
||||
|
||||
@@ -28,7 +28,6 @@ class Debugger
|
||||
/** @var Config $config */
|
||||
$config = $grav['config'];
|
||||
|
||||
$mode = $config->get('system.debugger.mode');
|
||||
TracyDebugger::$logDirectory = $config->get('system.debugger.log.enabled') ? LOG_DIR : null;
|
||||
TracyDebugger::$maxDepth = $config->get('system.debugger.max_depth');
|
||||
|
||||
@@ -38,19 +37,20 @@ class Debugger
|
||||
TracyDebugger::$strictMode = true;
|
||||
}
|
||||
|
||||
$mode = $config->get('system.debugger.mode');
|
||||
|
||||
if (function_exists('ini_set')) {
|
||||
ini_set('display_errors', true);
|
||||
ini_set('display_errors', !($mode === 'production'));
|
||||
}
|
||||
|
||||
if ($mode == strtolower('detect')) {
|
||||
if ($mode === 'detect') {
|
||||
TracyDebugger::$productionMode = self::DETECT;
|
||||
} elseif ($mode == strtolower('production')) {
|
||||
} elseif ($mode === 'production') {
|
||||
TracyDebugger::$productionMode = self::PRODUCTION;
|
||||
} else {
|
||||
TracyDebugger::$productionMode = self::DEVELOPMENT;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,4 +70,9 @@ class Debugger
|
||||
{
|
||||
TracyDebugger::dump($var);
|
||||
}
|
||||
|
||||
public static function barDump($var, $title = NULL, array $options = NULL)
|
||||
{
|
||||
TracyDebugger::barDump($var, $title, $options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,12 +54,17 @@ class Grav extends Container
|
||||
|
||||
$container['grav'] = $container;
|
||||
|
||||
$container['events'] = function ($c) {
|
||||
return new EventDispatcher;
|
||||
};
|
||||
$container['uri'] = function ($c) {
|
||||
return new Uri($c);
|
||||
};
|
||||
|
||||
$container['task'] = function ($c) {
|
||||
return !empty($_POST['task']) ? $_POST['task'] : $c['uri']->param('task');
|
||||
};
|
||||
|
||||
$container['events'] = function ($c) {
|
||||
return new EventDispatcher;
|
||||
};
|
||||
$container['config'] = function ($c) {
|
||||
return Config::instance($c);
|
||||
};
|
||||
@@ -122,6 +127,15 @@ class Grav extends Container
|
||||
|
||||
$this->fireEvent('onPluginsInitialized');
|
||||
|
||||
$this['themes']->init();
|
||||
|
||||
$this->fireEvent('onThemeInitialized');
|
||||
|
||||
$task = $this['task'];
|
||||
if ($task) {
|
||||
$this->fireEvent('onTask.' . $task);
|
||||
}
|
||||
|
||||
$this['assets']->init();
|
||||
|
||||
$this->fireEvent('onAssetsInitialized');
|
||||
@@ -143,10 +157,9 @@ class Grav extends Container
|
||||
|
||||
echo $this->output;
|
||||
|
||||
ob_end_flush();
|
||||
flush();
|
||||
|
||||
$this->fireEvent('onOutputRendered');
|
||||
|
||||
register_shutdown_function([$this, 'shutdown']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,4 +222,26 @@ class Grav extends Container
|
||||
$events = $this['events'];
|
||||
return $events->dispatch($eventName, $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the final content length for the page and flush the buffer
|
||||
*
|
||||
*/
|
||||
public function shutdown()
|
||||
{
|
||||
if($this['config']->get('system.debugger.shutdown.close_connection')) {
|
||||
set_time_limit(0);
|
||||
ignore_user_abort(true);
|
||||
session_write_close();
|
||||
|
||||
header('Content-length: ' . ob_get_length());
|
||||
header("Connection: close\r\n");
|
||||
|
||||
ob_end_flush();
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
|
||||
$this->fireEvent('onShutdown');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ trait MarkdownGravLinkTrait
|
||||
protected function convertUrl($markdown_url)
|
||||
{
|
||||
// if absolue and starts with a base_url move on
|
||||
if (strpos($markdown_url, $this->base_url) === 0) {
|
||||
if ($this->base_url == '' || strpos($markdown_url, $this->base_url) === 0) {
|
||||
$new_url = $markdown_url;
|
||||
// if its absolute with /
|
||||
} elseif (strpos($markdown_url, '/') === 0) {
|
||||
|
||||
@@ -58,6 +58,7 @@ class Page
|
||||
protected $raw_content;
|
||||
protected $pagination;
|
||||
protected $media;
|
||||
protected $metadata;
|
||||
protected $title;
|
||||
protected $max_count;
|
||||
protected $menu;
|
||||
@@ -109,6 +110,7 @@ class Page
|
||||
$this->modified($file->getMTime());
|
||||
$this->id($this->modified().md5($this->filePath()));
|
||||
$this->header();
|
||||
$this->metadata();
|
||||
$this->slug();
|
||||
$this->visible();
|
||||
$this->modularTwig($this->slug[0] == '_');
|
||||
@@ -187,9 +189,6 @@ class Page
|
||||
if (isset($this->header->visible)) {
|
||||
$this->visible = $this->header->visible;
|
||||
}
|
||||
if (isset($this->header->modular)) {
|
||||
$this->modular = $this->header->modular;
|
||||
}
|
||||
if (isset($this->header->order_dir)) {
|
||||
$this->order_dir = trim($this->header->order_dir);
|
||||
}
|
||||
@@ -204,7 +203,7 @@ class Page
|
||||
}
|
||||
if (isset($this->header->markdown_extra)) {
|
||||
$this->markdown_extra = (bool)$this->header->markdown_extra;
|
||||
}
|
||||
}
|
||||
if (isset($this->header->taxonomy)) {
|
||||
foreach ($this->header->taxonomy as $taxonomy => $taxitems) {
|
||||
$this->taxonomy[$taxonomy] = (array)$taxitems;
|
||||
@@ -218,7 +217,7 @@ class Page
|
||||
$this->process[$process] = $status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $this->header;
|
||||
@@ -704,6 +703,54 @@ class Page
|
||||
return $this->process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to merge page metadata tags and build an array of Metadata objects
|
||||
* that can then be rendered in the page.
|
||||
*/
|
||||
public function metadata()
|
||||
{
|
||||
// if not metadata yet, process it.
|
||||
if (null === $this->metadata) {
|
||||
|
||||
$header_tag_http_equivs = ['content-type', 'default-style', 'refresh'];
|
||||
$this->metadata = array();
|
||||
$page_header = $this->header;
|
||||
|
||||
|
||||
// Set the Generator tag
|
||||
$this->metadata['generator'] = array('name'=>'generator', 'content'=>'Grav ' . GRAV_VERSION);
|
||||
|
||||
// Merge any site.metadata settings in with page metadata
|
||||
$defaults = (array) self::$grav['config']->get('site.metadata');
|
||||
if (isset($page_header->metadata)) {
|
||||
$page_header->metadata = array_merge($defaults, $page_header->metadata);
|
||||
} else {
|
||||
$page_header->metadata = $defaults;
|
||||
}
|
||||
|
||||
// Build an array of meta objects..
|
||||
foreach((array)$page_header->metadata as $key => $value) {
|
||||
|
||||
// If this is a property type metadata: "og", "twitter", "facebook" etc
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $property => $prop_value) {
|
||||
$prop_key = $key.":".$property;
|
||||
$this->metadata[$prop_key] = array('property'=>$prop_key, 'content'=>$prop_value);
|
||||
}
|
||||
// If it this is a standard meta data type
|
||||
} else {
|
||||
if (in_array($key, $header_tag_http_equivs)) {
|
||||
$this->metadata[$key] = array('http_equiv'=>$key, 'content'=>$value);
|
||||
} else {
|
||||
$this->metadata[$key] = array('name'=>$key, 'content'=>$value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and Sets the slug for the Page. The slug is used in the URL routing. If not set it uses
|
||||
* the parent folder from the path
|
||||
@@ -999,10 +1046,7 @@ class Page
|
||||
*/
|
||||
public function modular($var = null)
|
||||
{
|
||||
if ($var !== null) {
|
||||
$this->modular = (bool) $var;
|
||||
}
|
||||
return $this->modular;
|
||||
return $this->modularTwig($var);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1233,7 +1277,8 @@ class Page
|
||||
public function activeChild()
|
||||
{
|
||||
$uri = self::$grav['uri'];
|
||||
if (!$this->home() && (strpos($uri->url(), $this->url()) !== false)) {
|
||||
|
||||
if (!$this->home() && (strpos($uri->url(), $this->url()) === 0)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1618,4 +1663,6 @@ class Page
|
||||
$this->_action = null;
|
||||
$this->_original = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ class Pages
|
||||
{
|
||||
$items = $collection->toArray();
|
||||
|
||||
$lookup = md5(serialize($items));
|
||||
$lookup = md5(json_encode($items));
|
||||
if (!isset($this->sort[$lookup][$orderBy])) {
|
||||
$this->buildSort($lookup, $items, $orderBy, $orderManual);
|
||||
}
|
||||
@@ -300,7 +300,7 @@ class Pages
|
||||
$list[$current->route()] = str_repeat(' ', ($level-1)*2) . $current->title();
|
||||
}
|
||||
|
||||
foreach ($current as $next) {
|
||||
foreach ($current->children() as $next) {
|
||||
$list = array_merge($list, $this->getList($next, $level + 1));
|
||||
}
|
||||
|
||||
@@ -426,17 +426,13 @@ class Pages
|
||||
throw new \RuntimeException('Fatal error when creating page instances.');
|
||||
}
|
||||
|
||||
$last_modified = 0;
|
||||
// set current modified of page
|
||||
$last_modified = $page->modified();
|
||||
|
||||
/** @var \DirectoryIterator $file */
|
||||
foreach ($iterator as $file) {
|
||||
$name = $file->getFilename();
|
||||
|
||||
$date = $file->getMTime();
|
||||
if ($date > $last_modified) {
|
||||
$last_modified = $date;
|
||||
}
|
||||
|
||||
if ($file->isFile() && Utils::endsWith($name, CONTENT_EXT)) {
|
||||
|
||||
$page->init($file);
|
||||
@@ -471,12 +467,16 @@ class Pages
|
||||
if ($config->get('system.pages.events.page')) {
|
||||
$this->grav->fireEvent('onFolderProcessed', new Event(['page' => $page]));
|
||||
}
|
||||
} else {
|
||||
$date = $file->getMTime();
|
||||
if ($date > $last_modified) {
|
||||
$last_modified = $date;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Override the modified and ID so that it takes the latest change
|
||||
// into account
|
||||
// Override the modified and ID so that it takes the latest change into account
|
||||
$page->modified($last_modified);
|
||||
$page->id($last_modified.md5($page->filePath()));
|
||||
|
||||
|
||||
@@ -60,14 +60,6 @@ class Plugins extends Iterator
|
||||
}
|
||||
}
|
||||
|
||||
/** @var Themes $themes */
|
||||
$themes = $this->grav['themes'];
|
||||
$themes->configure();
|
||||
$instance = $themes->load();
|
||||
if ($instance instanceof EventSubscriberInterface) {
|
||||
$events->addSubscriber($instance);
|
||||
}
|
||||
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
namespace Grav\Common;
|
||||
|
||||
use Grav\Common\Data\Data;
|
||||
use Grav\Common\Data\Blueprints;
|
||||
use Grav\Common\Filesystem\File\Yaml;
|
||||
use Grav\Common\Data\Data;
|
||||
use Grav\Common\Filesystem\File;
|
||||
use Grav\Component\EventDispatcher\EventDispatcher;
|
||||
use Grav\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Grav\Component\Filesystem\ResourceLocator;
|
||||
|
||||
/**
|
||||
@@ -12,27 +14,46 @@ use Grav\Component\Filesystem\ResourceLocator;
|
||||
* @author RocketTheme
|
||||
* @license MIT
|
||||
*/
|
||||
class Themes
|
||||
class Themes extends Iterator
|
||||
{
|
||||
/**
|
||||
* @var Grav
|
||||
*/
|
||||
/** @var Grav */
|
||||
protected $grav;
|
||||
|
||||
/** @var Config */
|
||||
protected $config;
|
||||
|
||||
public function __construct(Grav $grav)
|
||||
{
|
||||
$this->grav = $grav;
|
||||
$this->config = $grav['config'];
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
/** @var EventDispatcher $events */
|
||||
$events = $this->grav['events'];
|
||||
|
||||
/** @var Themes $themes */
|
||||
$themes = $this->grav['themes'];
|
||||
$themes->configure();
|
||||
$instance = $themes->load();
|
||||
|
||||
if ($instance instanceof EventSubscriberInterface) {
|
||||
$events->addSubscriber($instance);
|
||||
}
|
||||
|
||||
$this->grav['theme'] = $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of all theme data with their blueprints.
|
||||
*
|
||||
* @return array|Data[]
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
$list = array();
|
||||
$iterator = new \DirectoryIterator(THEMES_DIR);
|
||||
$iterator = new \DirectoryIterator('themes://');
|
||||
|
||||
/** @var \DirectoryIterator $directory */
|
||||
foreach ($iterator as $directory) {
|
||||
@@ -50,7 +71,7 @@ class Themes
|
||||
}
|
||||
|
||||
/**
|
||||
* Get theme or throw exception if it cannot be found.
|
||||
* Get theme configuration or throw exception if it cannot be found.
|
||||
*
|
||||
* @param string $name
|
||||
* @return Data
|
||||
@@ -62,25 +83,23 @@ class Themes
|
||||
throw new \RuntimeException('Theme name not provided.');
|
||||
}
|
||||
|
||||
$blueprints = new Blueprints("theme:///{$name}");
|
||||
$blueprints = new Blueprints("themes://{$name}");
|
||||
$blueprint = $blueprints->get('blueprints');
|
||||
$blueprint->name = $name;
|
||||
|
||||
/** @var Config $config */
|
||||
$config = $this->grav['config'];
|
||||
|
||||
// Find thumbnail.
|
||||
$thumb = "theme:///{$name}/thumbnail.jpg";
|
||||
$thumb = "themes://{$name}/thumbnail.jpg";
|
||||
|
||||
if (file_exists($thumb)) {
|
||||
$blueprint->set('thumbnail', $config->get('system.base_url_relative') . "/user/themes/{$name}/thumbnail.jpg");
|
||||
$blueprint->set('thumbnail', $this->config->get('system.base_url_relative') . "/user/themes/{$name}/thumbnail.jpg");
|
||||
}
|
||||
|
||||
// Load default configuration.
|
||||
$file = Yaml::instance("theme:///{$name}/{$name}.yaml");
|
||||
$file = File\Yaml::instance("themes://{$name}/{$name}" . YAML_EXT);
|
||||
$obj = new Data($file->content(), $blueprint);
|
||||
|
||||
// Override with user configuration.
|
||||
$file = Yaml::instance("user://config/themes/{$name}.yaml");
|
||||
$file = File\Yaml::instance("user://config/themes/{$name}" . YAML_EXT);
|
||||
$obj->merge($file->content());
|
||||
|
||||
// Save configuration always to user/config.
|
||||
@@ -89,32 +108,34 @@ class Themes
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function current($name = null)
|
||||
/**
|
||||
* Return name of the current theme.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
/** @var Config $config */
|
||||
$config = $this->grav['config'];
|
||||
|
||||
if (!$name) {
|
||||
$name = $config->get('system.pages.theme');
|
||||
}
|
||||
|
||||
return $name;
|
||||
return (string) $this->config->get('system.pages.theme');
|
||||
}
|
||||
|
||||
public function load($name = null)
|
||||
/**
|
||||
* Load current theme.
|
||||
*
|
||||
* @return Theme|object
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
$name = $this->current($name);
|
||||
// NOTE: ALL THE LOCAL VARIABLES ARE USED INSIDE INCLUDED FILE, DO NOT REMOVE THEM!
|
||||
$grav = $this->grav;
|
||||
|
||||
/** @var Config $config */
|
||||
$config = $grav['config'];
|
||||
$config = $this->config;
|
||||
$name = $this->current();
|
||||
|
||||
/** @var ResourceLocator $locator */
|
||||
$locator = $grav['locator'];
|
||||
$file = $locator('theme://theme.php') ?: $locator("theme://{$name}.php");
|
||||
|
||||
$file = $locator("theme://theme.php") ?: $locator("theme://{$name}.php");
|
||||
if ($file) {
|
||||
// Local variables available in the file: $grav, $config, $name, $path, $file
|
||||
// Local variables available in the file: $grav, $config, $name, $file
|
||||
$class = include $file;
|
||||
|
||||
if (!is_object($class)) {
|
||||
@@ -124,6 +145,8 @@ class Themes
|
||||
$class = new $className($grav, $config, $name);
|
||||
}
|
||||
}
|
||||
} elseif (!$locator('theme://')) {
|
||||
exit("Theme '$name' does not exist, unable to display page.");
|
||||
}
|
||||
|
||||
if (empty($class)) {
|
||||
@@ -133,13 +156,18 @@ class Themes
|
||||
return $class;
|
||||
}
|
||||
|
||||
public function configure($name = null) {
|
||||
$name = $this->current($name);
|
||||
/**
|
||||
* Configure and prepare streams for current template.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function configure() {
|
||||
$name = $this->current();
|
||||
|
||||
/** @var Config $config */
|
||||
$config = $this->grav['config'];
|
||||
$config = $this->config;
|
||||
|
||||
$themeConfig = Yaml::instance(THEMES_DIR . "{$name}/{$name}.yaml")->content();
|
||||
$themeConfig = File\Yaml::instance("themes://{$name}/{$name}" . YAML_EXT)->content();
|
||||
|
||||
$config->merge(['themes' => [$name => $themeConfig]]);
|
||||
|
||||
@@ -174,7 +202,6 @@ class Themes
|
||||
if (!stream_wrapper_register($scheme, $type)) {
|
||||
throw new \InvalidArgumentException("Stream '{$type}' could not be initialized.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class Twig
|
||||
|
||||
// Set some standard variables for twig
|
||||
$this->twig_vars = array(
|
||||
'grav_version' => GRAV_VERSION,
|
||||
'grav' => $this->grav,
|
||||
'config' => $config,
|
||||
'uri' => $this->grav['uri'],
|
||||
'base_dir' => rtrim(ROOT_DIR, '/'),
|
||||
@@ -196,10 +196,11 @@ class Twig
|
||||
{
|
||||
// set the page now its been processed
|
||||
$this->grav->fireEvent('onTwigSiteVariables');
|
||||
$twig_vars = $this->twig_vars;
|
||||
$pages = $this->grav['pages'];
|
||||
$page = $this->grav['page'];
|
||||
|
||||
$twig_vars = $this->twig_vars;
|
||||
|
||||
$twig_vars['pages'] = $pages->root();
|
||||
$twig_vars['page'] = $page;
|
||||
$twig_vars['header'] = $page->header();
|
||||
|
||||
@@ -126,7 +126,8 @@ class TwigExtension extends \Twig_Extension
|
||||
$random = array_slice($original, $offset);
|
||||
shuffle($random);
|
||||
|
||||
for ($x=0; $x < sizeof($original); $x++) {
|
||||
$sizeOf = sizeof($original);
|
||||
for ($x=0; $x < $sizeOf; $x++) {
|
||||
if ($x < $offset) {
|
||||
$sorted[] = $original[$x];
|
||||
} else {
|
||||
@@ -213,6 +214,6 @@ class TwigExtension extends \Twig_Extension
|
||||
/** @var Uri $uri */
|
||||
$uri = $grav['uri'];
|
||||
|
||||
return $uri->rootUrl($domain) . $locator->findResource($input, false);
|
||||
return $uri->rootUrl($domain) .'/'. $locator->findResource($input, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,4 +298,30 @@ class Uri
|
||||
// Return relative path.
|
||||
return substr($referrer, strlen($root));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrun the IP address of the current user
|
||||
*
|
||||
* @return string ip address
|
||||
*/
|
||||
public function ip()
|
||||
{
|
||||
$ipaddress = '';
|
||||
if (getenv('HTTP_CLIENT_IP'))
|
||||
$ipaddress = getenv('HTTP_CLIENT_IP');
|
||||
else if(getenv('HTTP_X_FORWARDED_FOR'))
|
||||
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
|
||||
else if(getenv('HTTP_X_FORWARDED'))
|
||||
$ipaddress = getenv('HTTP_X_FORWARDED');
|
||||
else if(getenv('HTTP_FORWARDED_FOR'))
|
||||
$ipaddress = getenv('HTTP_FORWARDED_FOR');
|
||||
else if(getenv('HTTP_FORWARDED'))
|
||||
$ipaddress = getenv('HTTP_FORWARDED');
|
||||
else if(getenv('REMOTE_ADDR'))
|
||||
$ipaddress = getenv('REMOTE_ADDR');
|
||||
else
|
||||
$ipaddress = 'UNKNOWN';
|
||||
return $ipaddress;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ use Grav\Common\Data\Data;
|
||||
*/
|
||||
class User extends Data
|
||||
{
|
||||
protected $password;
|
||||
|
||||
/**
|
||||
* Authenticate user.
|
||||
*
|
||||
|
||||
@@ -23,7 +23,12 @@ class ResourceLocator
|
||||
{
|
||||
$list = [];
|
||||
foreach((array) $paths as $path) {
|
||||
$list[] = trim($path, '/');
|
||||
$path = trim($path, '/');
|
||||
if (strstr($path, '://')) {
|
||||
$list = array_merge($list, $this->find($path, true, false));
|
||||
} else {
|
||||
$list[] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->schemes[$scheme][$prefix])) {
|
||||
|
||||
@@ -31,8 +31,7 @@ class SetupCommand extends Command
|
||||
protected $mappings = array('/index.php' => '/index.php',
|
||||
'/composer.json' => '/composer.json',
|
||||
'/bin' => '/bin',
|
||||
'/system' => '/system',
|
||||
'/vendor' => '/vendor'
|
||||
'/system' => '/system'
|
||||
);
|
||||
|
||||
protected $default_file = "---\ntitle: HomePage\n---\n# HomePage\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque porttitor eu felis sed ornare. Sed a mauris venenatis, pulvinar velit vel, dictum enim. Phasellus ac rutrum velit. Nunc lorem purus, hendrerit sit amet augue aliquet, iaculis ultricies nisl. Suspendisse tincidunt euismod risus, quis feugiat arcu tincidunt eget. Nulla eros mi, commodo vel ipsum vel, aliquet congue odio. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Pellentesque velit orci, laoreet at adipiscing eu, interdum quis nibh. Nunc a accumsan purus.";
|
||||
|
||||
@@ -2,5 +2,6 @@ title: Grav
|
||||
author:
|
||||
name: Joe Bloggs
|
||||
email: 'joe@test.com'
|
||||
description: 'Grav is an easy to use, yet powerful, open source flat-file CMS'
|
||||
metadata:
|
||||
description: 'Grav is an easy to use, yet powerful, open source flat-file CMS'
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ twig:
|
||||
autoescape: false
|
||||
|
||||
assets:
|
||||
css_pipeline: true
|
||||
css_pipeline: false
|
||||
css_minify: true
|
||||
css_rewrite: true
|
||||
js_pipeline: false
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Test
|
||||
---
|
||||
|
||||
# Testing
|
||||
7
vendor/autoload.php
vendored
7
vendor/autoload.php
vendored
@@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit836e000af2692cba78dada56c083fe42::getLoader();
|
||||
383
vendor/composer/ClassLoader.php
vendored
383
vendor/composer/ClassLoader.php
vendored
@@ -1,383 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0 class loader
|
||||
*
|
||||
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
// PSR-4
|
||||
private $prefixLengthsPsr4 = array();
|
||||
private $prefixDirsPsr4 = array();
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
private $prefixesPsr0 = array();
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
private $useIncludePath = false;
|
||||
private $classMap = array();
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
||||
}
|
||||
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classMap Class to filename map
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-0 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 base directories
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return bool|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
|
||||
if ('\\' == $class[0]) {
|
||||
$class = substr($class, 1);
|
||||
}
|
||||
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if ($file === null && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if ($file === null) {
|
||||
// Remember that this class does not exist.
|
||||
return $this->classMap[$class] = false;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
||||
415
vendor/composer/autoload_classmap.php
vendored
415
vendor/composer/autoload_classmap.php
vendored
@@ -1,415 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'CSSmin' => $vendorDir . '/mrclay/minify/min/lib/CSSmin.php',
|
||||
'Doctrine\\Common\\Cache\\ApcCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php',
|
||||
'Doctrine\\Common\\Cache\\ArrayCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php',
|
||||
'Doctrine\\Common\\Cache\\Cache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php',
|
||||
'Doctrine\\Common\\Cache\\CacheProvider' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php',
|
||||
'Doctrine\\Common\\Cache\\CouchbaseCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php',
|
||||
'Doctrine\\Common\\Cache\\FileCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php',
|
||||
'Doctrine\\Common\\Cache\\FilesystemCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php',
|
||||
'Doctrine\\Common\\Cache\\MemcacheCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php',
|
||||
'Doctrine\\Common\\Cache\\MemcachedCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php',
|
||||
'Doctrine\\Common\\Cache\\MongoDBCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php',
|
||||
'Doctrine\\Common\\Cache\\PhpFileCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php',
|
||||
'Doctrine\\Common\\Cache\\RedisCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php',
|
||||
'Doctrine\\Common\\Cache\\RiakCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php',
|
||||
'Doctrine\\Common\\Cache\\Version' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/Version.php',
|
||||
'Doctrine\\Common\\Cache\\WinCacheCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php',
|
||||
'Doctrine\\Common\\Cache\\XcacheCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php',
|
||||
'Doctrine\\Common\\Cache\\ZendDataCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php',
|
||||
'DooDigestAuth' => $vendorDir . '/mrclay/minify/min/lib/DooDigestAuth.php',
|
||||
'FirePHP' => $vendorDir . '/mrclay/minify/min/lib/FirePHP.php',
|
||||
'Grav\\Common\\Assets' => $baseDir . '/system/src/Grav/Common/Assets.php',
|
||||
'Grav\\Common\\Browser' => $baseDir . '/system/src/Grav/Common/Browser.php',
|
||||
'Grav\\Common\\Cache' => $baseDir . '/system/src/Grav/Common/Cache.php',
|
||||
'Grav\\Common\\Config' => $baseDir . '/system/src/Grav/Common/Config.php',
|
||||
'Grav\\Common\\Data\\Blueprint' => $baseDir . '/system/src/Grav/Common/Data/Blueprint.php',
|
||||
'Grav\\Common\\Data\\Blueprints' => $baseDir . '/system/src/Grav/Common/Data/Blueprints.php',
|
||||
'Grav\\Common\\Data\\Data' => $baseDir . '/system/src/Grav/Common/Data/Data.php',
|
||||
'Grav\\Common\\Data\\DataInterface' => $baseDir . '/system/src/Grav/Common/Data/DataInterface.php',
|
||||
'Grav\\Common\\Data\\Validation' => $baseDir . '/system/src/Grav/Common/Data/Validation.php',
|
||||
'Grav\\Common\\Debugger' => $baseDir . '/system/src/Grav/Common/Debugger.php',
|
||||
'Grav\\Common\\Filesystem\\FileInterface' => $baseDir . '/system/src/Grav/Common/Filesystem/FileInterface.php',
|
||||
'Grav\\Common\\Filesystem\\File\\Config' => $baseDir . '/system/src/Grav/Common/Filesystem/File/Config.php',
|
||||
'Grav\\Common\\Filesystem\\File\\General' => $baseDir . '/system/src/Grav/Common/Filesystem/File/General.php',
|
||||
'Grav\\Common\\Filesystem\\File\\Json' => $baseDir . '/system/src/Grav/Common/Filesystem/File/Json.php',
|
||||
'Grav\\Common\\Filesystem\\File\\Log' => $baseDir . '/system/src/Grav/Common/Filesystem/File/Log.php',
|
||||
'Grav\\Common\\Filesystem\\File\\Markdown' => $baseDir . '/system/src/Grav/Common/Filesystem/File/Markdown.php',
|
||||
'Grav\\Common\\Filesystem\\File\\Yaml' => $baseDir . '/system/src/Grav/Common/Filesystem/File/Yaml.php',
|
||||
'Grav\\Common\\Filesystem\\Folder' => $baseDir . '/system/src/Grav/Common/Filesystem/Folder.php',
|
||||
'Grav\\Common\\Filesystem\\GravRecursiveFilterIterator' => $baseDir . '/system/src/Grav/Common/Filesystem/Folder.php',
|
||||
'Grav\\Common\\Getters' => $baseDir . '/system/src/Grav/Common/Getters.php',
|
||||
'Grav\\Common\\Grav' => $baseDir . '/system/src/Grav/Common/Grav.php',
|
||||
'Grav\\Common\\GravTrait' => $baseDir . '/system/src/Grav/Common/GravTrait.php',
|
||||
'Grav\\Common\\Inflector' => $baseDir . '/system/src/Grav/Common/Inflector.php',
|
||||
'Grav\\Common\\Iterator' => $baseDir . '/system/src/Grav/Common/Iterator.php',
|
||||
'Grav\\Common\\Markdown\\Markdown' => $baseDir . '/system/src/Grav/Common/Markdown/Markdown.php',
|
||||
'Grav\\Common\\Markdown\\MarkdownExtra' => $baseDir . '/system/src/Grav/Common/Markdown/MarkdownExtra.php',
|
||||
'Grav\\Common\\Markdown\\MarkdownGravLinkTrait' => $baseDir . '/system/src/Grav/Common/Markdown/MarkdownGravLinkTrait.php',
|
||||
'Grav\\Common\\Page\\Collection' => $baseDir . '/system/src/Grav/Common/Page/Collection.php',
|
||||
'Grav\\Common\\Page\\Media' => $baseDir . '/system/src/Grav/Common/Page/Media.php',
|
||||
'Grav\\Common\\Page\\Medium' => $baseDir . '/system/src/Grav/Common/Page/Medium.php',
|
||||
'Grav\\Common\\Page\\Page' => $baseDir . '/system/src/Grav/Common/Page/Page.php',
|
||||
'Grav\\Common\\Page\\Pages' => $baseDir . '/system/src/Grav/Common/Page/Pages.php',
|
||||
'Grav\\Common\\Plugin' => $baseDir . '/system/src/Grav/Common/Plugin.php',
|
||||
'Grav\\Common\\Plugins' => $baseDir . '/system/src/Grav/Common/Plugins.php',
|
||||
'Grav\\Common\\Registry' => $baseDir . '/system/src/Grav/Common/Registry.php',
|
||||
'Grav\\Common\\Service\\StreamsServiceProvider' => $baseDir . '/system/src/Grav/Common/Service/StreamsServiceProvider.php',
|
||||
'Grav\\Common\\Session\\Message' => $baseDir . '/system/src/Grav/Common/Session/Message.php',
|
||||
'Grav\\Common\\Session\\Session' => $baseDir . '/system/src/Grav/Common/Session/Session.php',
|
||||
'Grav\\Common\\Taxonomy' => $baseDir . '/system/src/Grav/Common/Taxonomy.php',
|
||||
'Grav\\Common\\Theme' => $baseDir . '/system/src/Grav/Common/Theme.php',
|
||||
'Grav\\Common\\Themes' => $baseDir . '/system/src/Grav/Common/Themes.php',
|
||||
'Grav\\Common\\Twig' => $baseDir . '/system/src/Grav/Common/Twig.php',
|
||||
'Grav\\Common\\TwigExtension' => $baseDir . '/system/src/Grav/Common/TwigExtension.php',
|
||||
'Grav\\Common\\Uri' => $baseDir . '/system/src/Grav/Common/Uri.php',
|
||||
'Grav\\Common\\User\\Authentication' => $baseDir . '/system/src/Grav/Common/User/Authentication.php',
|
||||
'Grav\\Common\\User\\User' => $baseDir . '/system/src/Grav/Common/User/User.php',
|
||||
'Grav\\Common\\Utils' => $baseDir . '/system/src/Grav/Common/Utils.php',
|
||||
'Grav\\Component\\ArrayTraits\\ArrayAccess' => $baseDir . '/system/src/Grav/Component/ArrayTraits/ArrayAccess.php',
|
||||
'Grav\\Component\\ArrayTraits\\Constructor' => $baseDir . '/system/src/Grav/Component/ArrayTraits/Constructor.php',
|
||||
'Grav\\Component\\ArrayTraits\\Countable' => $baseDir . '/system/src/Grav/Component/ArrayTraits/Countable.php',
|
||||
'Grav\\Component\\ArrayTraits\\Getters' => $baseDir . '/system/src/Grav/Component/ArrayTraits/Getters.php',
|
||||
'Grav\\Component\\DI\\Container' => $baseDir . '/system/src/Grav/Component/DI/Container.php',
|
||||
'Grav\\Component\\DI\\ServiceProviderInterface' => $baseDir . '/system/src/Grav/Component/DI/ServiceProviderInterface.php',
|
||||
'Grav\\Component\\EventDispatcher\\Event' => $baseDir . '/system/src/Grav/Component/EventDispatcher/Event.php',
|
||||
'Grav\\Component\\EventDispatcher\\EventDispatcher' => $baseDir . '/system/src/Grav/Component/EventDispatcher/EventDispatcher.php',
|
||||
'Grav\\Component\\EventDispatcher\\EventSubscriberInterface' => $baseDir . '/system/src/Grav/Component/EventDispatcher/EventSubscriberInterface.php',
|
||||
'Grav\\Component\\Filesystem\\ResourceLocator' => $baseDir . '/system/src/Grav/Component/Filesystem/ResourceLocator.php',
|
||||
'Grav\\Component\\Filesystem\\StreamWrapper\\ReadOnlyStream' => $baseDir . '/system/src/Grav/Component/Filesystem/StreamWrapper/ReadOnlyStream.php',
|
||||
'Grav\\Component\\Filesystem\\StreamWrapper\\Stream' => $baseDir . '/system/src/Grav/Component/Filesystem/StreamWrapper/Stream.php',
|
||||
'Grav\\Component\\Filesystem\\StreamWrapper\\StreamInterface' => $baseDir . '/system/src/Grav/Component/Filesystem/StreamWrapper/StreamInterface.php',
|
||||
'Grav\\Console\\BackupCommand' => $baseDir . '/system/src/Grav/Console/BackupCommand.php',
|
||||
'Grav\\Console\\CleanCommand' => $baseDir . '/system/src/Grav/Console/CleanCommand.php',
|
||||
'Grav\\Console\\ClearCacheCommand' => $baseDir . '/system/src/Grav/Console/ClearCacheCommand.php',
|
||||
'Grav\\Console\\InstallCommand' => $baseDir . '/system/src/Grav/Console/InstallCommand.php',
|
||||
'Grav\\Console\\NewProjectCommand' => $baseDir . '/system/src/Grav/Console/NewProjectCommand.php',
|
||||
'Grav\\Console\\SetupCommand' => $baseDir . '/system/src/Grav/Console/SetupCommand.php',
|
||||
'Gregwar\\Cache\\Cache' => $vendorDir . '/gregwar/cache/Gregwar/Cache/Cache.php',
|
||||
'Gregwar\\Cache\\GarbageCollect' => $vendorDir . '/gregwar/cache/Gregwar/Cache/GarbageCollect.php',
|
||||
'Gregwar\\Image\\Adapter\\Adapter' => $vendorDir . '/gregwar/image/Gregwar/Image/Adapter/Adapter.php',
|
||||
'Gregwar\\Image\\Adapter\\AdapterInterface' => $vendorDir . '/gregwar/image/Gregwar/Image/Adapter/AdapterInterface.php',
|
||||
'Gregwar\\Image\\Adapter\\Common' => $vendorDir . '/gregwar/image/Gregwar/Image/Adapter/Common.php',
|
||||
'Gregwar\\Image\\Adapter\\GD' => $vendorDir . '/gregwar/image/Gregwar/Image/Adapter/GD.php',
|
||||
'Gregwar\\Image\\Adapter\\Imagick' => $vendorDir . '/gregwar/image/Gregwar/Image/Adapter/Imagick.php',
|
||||
'Gregwar\\Image\\Exceptions\\GenerationError' => $vendorDir . '/gregwar/image/Gregwar/Image/Exceptions/GenerationError.php',
|
||||
'Gregwar\\Image\\GarbageCollect' => $vendorDir . '/gregwar/image/Gregwar/Image/GarbageCollect.php',
|
||||
'Gregwar\\Image\\Image' => $vendorDir . '/gregwar/image/Gregwar/Image/Image.php',
|
||||
'Gregwar\\Image\\ImageColor' => $vendorDir . '/gregwar/image/Gregwar/Image/ImageColor.php',
|
||||
'Gregwar\\Image\\Source\\Create' => $vendorDir . '/gregwar/image/Gregwar/Image/Source/Create.php',
|
||||
'Gregwar\\Image\\Source\\Data' => $vendorDir . '/gregwar/image/Gregwar/Image/Source/Data.php',
|
||||
'Gregwar\\Image\\Source\\File' => $vendorDir . '/gregwar/image/Gregwar/Image/Source/File.php',
|
||||
'Gregwar\\Image\\Source\\Resource' => $vendorDir . '/gregwar/image/Gregwar/Image/Source/Resource.php',
|
||||
'Gregwar\\Image\\Source\\Source' => $vendorDir . '/gregwar/image/Gregwar/Image/Source/Source.php',
|
||||
'HTTP_ConditionalGet' => $vendorDir . '/mrclay/minify/min/lib/HTTP/ConditionalGet.php',
|
||||
'HTTP_Encoder' => $vendorDir . '/mrclay/minify/min/lib/HTTP/Encoder.php',
|
||||
'JSCompilerContext' => $vendorDir . '/mrclay/minify/min/lib/JSMinPlus.php',
|
||||
'JSMin' => $vendorDir . '/mrclay/minify/min/lib/JSMin.php',
|
||||
'JSMinPlus' => $vendorDir . '/mrclay/minify/min/lib/JSMinPlus.php',
|
||||
'JSMin_UnterminatedCommentException' => $vendorDir . '/mrclay/minify/min/lib/JSMin.php',
|
||||
'JSMin_UnterminatedRegExpException' => $vendorDir . '/mrclay/minify/min/lib/JSMin.php',
|
||||
'JSMin_UnterminatedStringException' => $vendorDir . '/mrclay/minify/min/lib/JSMin.php',
|
||||
'JSNode' => $vendorDir . '/mrclay/minify/min/lib/JSMinPlus.php',
|
||||
'JSParser' => $vendorDir . '/mrclay/minify/min/lib/JSMinPlus.php',
|
||||
'JSToken' => $vendorDir . '/mrclay/minify/min/lib/JSMinPlus.php',
|
||||
'JSTokenizer' => $vendorDir . '/mrclay/minify/min/lib/JSMinPlus.php',
|
||||
'Minify' => $vendorDir . '/mrclay/minify/min/lib/Minify.php',
|
||||
'Minify_Build' => $vendorDir . '/mrclay/minify/min/lib/Minify/Build.php',
|
||||
'Minify_CSS' => $vendorDir . '/mrclay/minify/min/lib/Minify/CSS.php',
|
||||
'Minify_CSS_Compressor' => $vendorDir . '/mrclay/minify/min/lib/Minify/CSS/Compressor.php',
|
||||
'Minify_CSS_UriRewriter' => $vendorDir . '/mrclay/minify/min/lib/Minify/CSS/UriRewriter.php',
|
||||
'Minify_CSSmin' => $vendorDir . '/mrclay/minify/min/lib/Minify/CSSmin.php',
|
||||
'Minify_Cache_APC' => $vendorDir . '/mrclay/minify/min/lib/Minify/Cache/APC.php',
|
||||
'Minify_Cache_File' => $vendorDir . '/mrclay/minify/min/lib/Minify/Cache/File.php',
|
||||
'Minify_Cache_Memcache' => $vendorDir . '/mrclay/minify/min/lib/Minify/Cache/Memcache.php',
|
||||
'Minify_Cache_XCache' => $vendorDir . '/mrclay/minify/min/lib/Minify/Cache/XCache.php',
|
||||
'Minify_Cache_ZendPlatform' => $vendorDir . '/mrclay/minify/min/lib/Minify/Cache/ZendPlatform.php',
|
||||
'Minify_ClosureCompiler' => $vendorDir . '/mrclay/minify/min/lib/Minify/ClosureCompiler.php',
|
||||
'Minify_ClosureCompiler_Exception' => $vendorDir . '/mrclay/minify/min/lib/Minify/ClosureCompiler.php',
|
||||
'Minify_CommentPreserver' => $vendorDir . '/mrclay/minify/min/lib/Minify/CommentPreserver.php',
|
||||
'Minify_Controller_Base' => $vendorDir . '/mrclay/minify/min/lib/Minify/Controller/Base.php',
|
||||
'Minify_Controller_Files' => $vendorDir . '/mrclay/minify/min/lib/Minify/Controller/Files.php',
|
||||
'Minify_Controller_Groups' => $vendorDir . '/mrclay/minify/min/lib/Minify/Controller/Groups.php',
|
||||
'Minify_Controller_MinApp' => $vendorDir . '/mrclay/minify/min/lib/Minify/Controller/MinApp.php',
|
||||
'Minify_Controller_Page' => $vendorDir . '/mrclay/minify/min/lib/Minify/Controller/Page.php',
|
||||
'Minify_Controller_Version1' => $vendorDir . '/mrclay/minify/min/lib/Minify/Controller/Version1.php',
|
||||
'Minify_DebugDetector' => $vendorDir . '/mrclay/minify/min/lib/Minify/DebugDetector.php',
|
||||
'Minify_HTML' => $vendorDir . '/mrclay/minify/min/lib/Minify/HTML.php',
|
||||
'Minify_HTML_Helper' => $vendorDir . '/mrclay/minify/min/lib/Minify/HTML/Helper.php',
|
||||
'Minify_ImportProcessor' => $vendorDir . '/mrclay/minify/min/lib/Minify/ImportProcessor.php',
|
||||
'Minify_JS_ClosureCompiler' => $vendorDir . '/mrclay/minify/min/lib/Minify/JS/ClosureCompiler.php',
|
||||
'Minify_JS_ClosureCompiler_Exception' => $vendorDir . '/mrclay/minify/min/lib/Minify/JS/ClosureCompiler.php',
|
||||
'Minify_Lines' => $vendorDir . '/mrclay/minify/min/lib/Minify/Lines.php',
|
||||
'Minify_Loader' => $vendorDir . '/mrclay/minify/min/lib/Minify/Loader.php',
|
||||
'Minify_Logger' => $vendorDir . '/mrclay/minify/min/lib/Minify/Logger.php',
|
||||
'Minify_Packer' => $vendorDir . '/mrclay/minify/min/lib/Minify/Packer.php',
|
||||
'Minify_Source' => $vendorDir . '/mrclay/minify/min/lib/Minify/Source.php',
|
||||
'Minify_YUICompressor' => $vendorDir . '/mrclay/minify/min/lib/Minify/YUICompressor.php',
|
||||
'Minify_YUI_CssCompressor' => $vendorDir . '/mrclay/minify/min/lib/Minify/YUI/CssCompressor.php',
|
||||
'MrClay\\Cli' => $vendorDir . '/mrclay/minify/min/lib/MrClay/Cli.php',
|
||||
'MrClay\\Cli\\Arg' => $vendorDir . '/mrclay/minify/min/lib/MrClay/Cli/Arg.php',
|
||||
'Parsedown' => $vendorDir . '/erusev/parsedown/Parsedown.php',
|
||||
'ParsedownExtra' => $vendorDir . '/erusev/parsedown-extra/ParsedownExtra.php',
|
||||
'Pimple\\Container' => $vendorDir . '/pimple/pimple/src/Pimple/Container.php',
|
||||
'Pimple\\ServiceProviderInterface' => $vendorDir . '/pimple/pimple/src/Pimple/ServiceProviderInterface.php',
|
||||
'Symfony\\Component\\Console\\Application' => $vendorDir . '/symfony/console/Symfony/Component/Console/Application.php',
|
||||
'Symfony\\Component\\Console\\Command\\Command' => $vendorDir . '/symfony/console/Symfony/Component/Console/Command/Command.php',
|
||||
'Symfony\\Component\\Console\\Command\\HelpCommand' => $vendorDir . '/symfony/console/Symfony/Component/Console/Command/HelpCommand.php',
|
||||
'Symfony\\Component\\Console\\Command\\ListCommand' => $vendorDir . '/symfony/console/Symfony/Component/Console/Command/ListCommand.php',
|
||||
'Symfony\\Component\\Console\\ConsoleEvents' => $vendorDir . '/symfony/console/Symfony/Component/Console/ConsoleEvents.php',
|
||||
'Symfony\\Component\\Console\\Descriptor\\ApplicationDescription' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/ApplicationDescription.php',
|
||||
'Symfony\\Component\\Console\\Descriptor\\Descriptor' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/Descriptor.php',
|
||||
'Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/DescriptorInterface.php',
|
||||
'Symfony\\Component\\Console\\Descriptor\\JsonDescriptor' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/JsonDescriptor.php',
|
||||
'Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php',
|
||||
'Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/TextDescriptor.php',
|
||||
'Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/XmlDescriptor.php',
|
||||
'Symfony\\Component\\Console\\Event\\ConsoleCommandEvent' => $vendorDir . '/symfony/console/Symfony/Component/Console/Event/ConsoleCommandEvent.php',
|
||||
'Symfony\\Component\\Console\\Event\\ConsoleEvent' => $vendorDir . '/symfony/console/Symfony/Component/Console/Event/ConsoleEvent.php',
|
||||
'Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent' => $vendorDir . '/symfony/console/Symfony/Component/Console/Event/ConsoleExceptionEvent.php',
|
||||
'Symfony\\Component\\Console\\Event\\ConsoleTerminateEvent' => $vendorDir . '/symfony/console/Symfony/Component/Console/Event/ConsoleTerminateEvent.php',
|
||||
'Symfony\\Component\\Console\\Formatter\\OutputFormatter' => $vendorDir . '/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php',
|
||||
'Symfony\\Component\\Console\\Formatter\\OutputFormatterInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterInterface.php',
|
||||
'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyle' => $vendorDir . '/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyle.php',
|
||||
'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php',
|
||||
'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleStack' => $vendorDir . '/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php',
|
||||
'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/DescriptorHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\DialogHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\FormatterHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/FormatterHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\Helper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/Helper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\HelperInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/HelperInterface.php',
|
||||
'Symfony\\Component\\Console\\Helper\\HelperSet' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/HelperSet.php',
|
||||
'Symfony\\Component\\Console\\Helper\\InputAwareHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/InputAwareHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\ProgressBar' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/ProgressBar.php',
|
||||
'Symfony\\Component\\Console\\Helper\\ProgressHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/ProgressHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\QuestionHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/QuestionHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\Table' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/Table.php',
|
||||
'Symfony\\Component\\Console\\Helper\\TableHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/TableHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\TableSeparator' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/TableSeparator.php',
|
||||
'Symfony\\Component\\Console\\Helper\\TableStyle' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/TableStyle.php',
|
||||
'Symfony\\Component\\Console\\Input\\ArgvInput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/ArgvInput.php',
|
||||
'Symfony\\Component\\Console\\Input\\ArrayInput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/ArrayInput.php',
|
||||
'Symfony\\Component\\Console\\Input\\Input' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/Input.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputArgument' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/InputArgument.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputAwareInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/InputAwareInterface.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputDefinition' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/InputDefinition.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/InputInterface.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputOption' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/InputOption.php',
|
||||
'Symfony\\Component\\Console\\Input\\StringInput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/StringInput.php',
|
||||
'Symfony\\Component\\Console\\Logger\\ConsoleLogger' => $vendorDir . '/symfony/console/Symfony/Component/Console/Logger/ConsoleLogger.php',
|
||||
'Symfony\\Component\\Console\\Output\\BufferedOutput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/BufferedOutput.php',
|
||||
'Symfony\\Component\\Console\\Output\\ConsoleOutput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/ConsoleOutput.php',
|
||||
'Symfony\\Component\\Console\\Output\\ConsoleOutputInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/ConsoleOutputInterface.php',
|
||||
'Symfony\\Component\\Console\\Output\\NullOutput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/NullOutput.php',
|
||||
'Symfony\\Component\\Console\\Output\\Output' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/Output.php',
|
||||
'Symfony\\Component\\Console\\Output\\OutputInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/OutputInterface.php',
|
||||
'Symfony\\Component\\Console\\Output\\StreamOutput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/StreamOutput.php',
|
||||
'Symfony\\Component\\Console\\Question\\ChoiceQuestion' => $vendorDir . '/symfony/console/Symfony/Component/Console/Question/ChoiceQuestion.php',
|
||||
'Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => $vendorDir . '/symfony/console/Symfony/Component/Console/Question/ConfirmationQuestion.php',
|
||||
'Symfony\\Component\\Console\\Question\\Question' => $vendorDir . '/symfony/console/Symfony/Component/Console/Question/Question.php',
|
||||
'Symfony\\Component\\Console\\Shell' => $vendorDir . '/symfony/console/Symfony/Component/Console/Shell.php',
|
||||
'Symfony\\Component\\Console\\Tester\\ApplicationTester' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tester/ApplicationTester.php',
|
||||
'Symfony\\Component\\Console\\Tester\\CommandTester' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tester/CommandTester.php',
|
||||
'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/WrappedListener.php',
|
||||
'Symfony\\Component\\EventDispatcher\\DependencyInjection\\RegisterListenersPass' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Event' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Event.php',
|
||||
'Symfony\\Component\\EventDispatcher\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php',
|
||||
'Symfony\\Component\\EventDispatcher\\EventDispatcherInterface' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php',
|
||||
'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php',
|
||||
'Symfony\\Component\\EventDispatcher\\GenericEvent' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/GenericEvent.php',
|
||||
'Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php',
|
||||
'Symfony\\Component\\Yaml\\Dumper' => $vendorDir . '/symfony/yaml/Symfony/Component/Yaml/Dumper.php',
|
||||
'Symfony\\Component\\Yaml\\Escaper' => $vendorDir . '/symfony/yaml/Symfony/Component/Yaml/Escaper.php',
|
||||
'Symfony\\Component\\Yaml\\Exception\\DumpException' => $vendorDir . '/symfony/yaml/Symfony/Component/Yaml/Exception/DumpException.php',
|
||||
'Symfony\\Component\\Yaml\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/yaml/Symfony/Component/Yaml/Exception/ExceptionInterface.php',
|
||||
'Symfony\\Component\\Yaml\\Exception\\ParseException' => $vendorDir . '/symfony/yaml/Symfony/Component/Yaml/Exception/ParseException.php',
|
||||
'Symfony\\Component\\Yaml\\Exception\\RuntimeException' => $vendorDir . '/symfony/yaml/Symfony/Component/Yaml/Exception/RuntimeException.php',
|
||||
'Symfony\\Component\\Yaml\\Inline' => $vendorDir . '/symfony/yaml/Symfony/Component/Yaml/Inline.php',
|
||||
'Symfony\\Component\\Yaml\\Parser' => $vendorDir . '/symfony/yaml/Symfony/Component/Yaml/Parser.php',
|
||||
'Symfony\\Component\\Yaml\\Unescaper' => $vendorDir . '/symfony/yaml/Symfony/Component/Yaml/Unescaper.php',
|
||||
'Symfony\\Component\\Yaml\\Yaml' => $vendorDir . '/symfony/yaml/Symfony/Component/Yaml/Yaml.php',
|
||||
'Tracy\\Bar' => $vendorDir . '/tracy/tracy/src/Tracy/Bar.php',
|
||||
'Tracy\\BlueScreen' => $vendorDir . '/tracy/tracy/src/Tracy/BlueScreen.php',
|
||||
'Tracy\\Debugger' => $vendorDir . '/tracy/tracy/src/Tracy/Debugger.php',
|
||||
'Tracy\\DefaultBarPanel' => $vendorDir . '/tracy/tracy/src/Tracy/DefaultBarPanel.php',
|
||||
'Tracy\\Dumper' => $vendorDir . '/tracy/tracy/src/Tracy/Dumper.php',
|
||||
'Tracy\\FireLogger' => $vendorDir . '/tracy/tracy/src/Tracy/FireLogger.php',
|
||||
'Tracy\\Helpers' => $vendorDir . '/tracy/tracy/src/Tracy/Helpers.php',
|
||||
'Tracy\\IBarPanel' => $vendorDir . '/tracy/tracy/src/Tracy/IBarPanel.php',
|
||||
'Tracy\\Logger' => $vendorDir . '/tracy/tracy/src/Tracy/Logger.php',
|
||||
'Tracy\\OutputDebugger' => $vendorDir . '/tracy/tracy/src/Tracy/OutputDebugger.php',
|
||||
'Twig_Autoloader' => $vendorDir . '/twig/twig/lib/Twig/Autoloader.php',
|
||||
'Twig_Compiler' => $vendorDir . '/twig/twig/lib/Twig/Compiler.php',
|
||||
'Twig_CompilerInterface' => $vendorDir . '/twig/twig/lib/Twig/CompilerInterface.php',
|
||||
'Twig_Environment' => $vendorDir . '/twig/twig/lib/Twig/Environment.php',
|
||||
'Twig_Error' => $vendorDir . '/twig/twig/lib/Twig/Error.php',
|
||||
'Twig_Error_Loader' => $vendorDir . '/twig/twig/lib/Twig/Error/Loader.php',
|
||||
'Twig_Error_Runtime' => $vendorDir . '/twig/twig/lib/Twig/Error/Runtime.php',
|
||||
'Twig_Error_Syntax' => $vendorDir . '/twig/twig/lib/Twig/Error/Syntax.php',
|
||||
'Twig_ExistsLoaderInterface' => $vendorDir . '/twig/twig/lib/Twig/ExistsLoaderInterface.php',
|
||||
'Twig_ExpressionParser' => $vendorDir . '/twig/twig/lib/Twig/ExpressionParser.php',
|
||||
'Twig_Extension' => $vendorDir . '/twig/twig/lib/Twig/Extension.php',
|
||||
'Twig_ExtensionInterface' => $vendorDir . '/twig/twig/lib/Twig/ExtensionInterface.php',
|
||||
'Twig_Extension_Core' => $vendorDir . '/twig/twig/lib/Twig/Extension/Core.php',
|
||||
'Twig_Extension_Debug' => $vendorDir . '/twig/twig/lib/Twig/Extension/Debug.php',
|
||||
'Twig_Extension_Escaper' => $vendorDir . '/twig/twig/lib/Twig/Extension/Escaper.php',
|
||||
'Twig_Extension_Optimizer' => $vendorDir . '/twig/twig/lib/Twig/Extension/Optimizer.php',
|
||||
'Twig_Extension_Sandbox' => $vendorDir . '/twig/twig/lib/Twig/Extension/Sandbox.php',
|
||||
'Twig_Extension_Staging' => $vendorDir . '/twig/twig/lib/Twig/Extension/Staging.php',
|
||||
'Twig_Extension_StringLoader' => $vendorDir . '/twig/twig/lib/Twig/Extension/StringLoader.php',
|
||||
'Twig_Filter' => $vendorDir . '/twig/twig/lib/Twig/Filter.php',
|
||||
'Twig_FilterCallableInterface' => $vendorDir . '/twig/twig/lib/Twig/FilterCallableInterface.php',
|
||||
'Twig_FilterInterface' => $vendorDir . '/twig/twig/lib/Twig/FilterInterface.php',
|
||||
'Twig_Filter_Function' => $vendorDir . '/twig/twig/lib/Twig/Filter/Function.php',
|
||||
'Twig_Filter_Method' => $vendorDir . '/twig/twig/lib/Twig/Filter/Method.php',
|
||||
'Twig_Filter_Node' => $vendorDir . '/twig/twig/lib/Twig/Filter/Node.php',
|
||||
'Twig_Function' => $vendorDir . '/twig/twig/lib/Twig/Function.php',
|
||||
'Twig_FunctionCallableInterface' => $vendorDir . '/twig/twig/lib/Twig/FunctionCallableInterface.php',
|
||||
'Twig_FunctionInterface' => $vendorDir . '/twig/twig/lib/Twig/FunctionInterface.php',
|
||||
'Twig_Function_Function' => $vendorDir . '/twig/twig/lib/Twig/Function/Function.php',
|
||||
'Twig_Function_Method' => $vendorDir . '/twig/twig/lib/Twig/Function/Method.php',
|
||||
'Twig_Function_Node' => $vendorDir . '/twig/twig/lib/Twig/Function/Node.php',
|
||||
'Twig_Lexer' => $vendorDir . '/twig/twig/lib/Twig/Lexer.php',
|
||||
'Twig_LexerInterface' => $vendorDir . '/twig/twig/lib/Twig/LexerInterface.php',
|
||||
'Twig_LoaderInterface' => $vendorDir . '/twig/twig/lib/Twig/LoaderInterface.php',
|
||||
'Twig_Loader_Array' => $vendorDir . '/twig/twig/lib/Twig/Loader/Array.php',
|
||||
'Twig_Loader_Chain' => $vendorDir . '/twig/twig/lib/Twig/Loader/Chain.php',
|
||||
'Twig_Loader_Filesystem' => $vendorDir . '/twig/twig/lib/Twig/Loader/Filesystem.php',
|
||||
'Twig_Loader_String' => $vendorDir . '/twig/twig/lib/Twig/Loader/String.php',
|
||||
'Twig_Markup' => $vendorDir . '/twig/twig/lib/Twig/Markup.php',
|
||||
'Twig_Node' => $vendorDir . '/twig/twig/lib/Twig/Node.php',
|
||||
'Twig_NodeInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeInterface.php',
|
||||
'Twig_NodeOutputInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeOutputInterface.php',
|
||||
'Twig_NodeTraverser' => $vendorDir . '/twig/twig/lib/Twig/NodeTraverser.php',
|
||||
'Twig_NodeVisitorInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitorInterface.php',
|
||||
'Twig_NodeVisitor_Escaper' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitor/Escaper.php',
|
||||
'Twig_NodeVisitor_Optimizer' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitor/Optimizer.php',
|
||||
'Twig_NodeVisitor_SafeAnalysis' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php',
|
||||
'Twig_NodeVisitor_Sandbox' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitor/Sandbox.php',
|
||||
'Twig_Node_AutoEscape' => $vendorDir . '/twig/twig/lib/Twig/Node/AutoEscape.php',
|
||||
'Twig_Node_Block' => $vendorDir . '/twig/twig/lib/Twig/Node/Block.php',
|
||||
'Twig_Node_BlockReference' => $vendorDir . '/twig/twig/lib/Twig/Node/BlockReference.php',
|
||||
'Twig_Node_Body' => $vendorDir . '/twig/twig/lib/Twig/Node/Body.php',
|
||||
'Twig_Node_Do' => $vendorDir . '/twig/twig/lib/Twig/Node/Do.php',
|
||||
'Twig_Node_Embed' => $vendorDir . '/twig/twig/lib/Twig/Node/Embed.php',
|
||||
'Twig_Node_Expression' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression.php',
|
||||
'Twig_Node_Expression_Array' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Array.php',
|
||||
'Twig_Node_Expression_AssignName' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/AssignName.php',
|
||||
'Twig_Node_Expression_Binary' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary.php',
|
||||
'Twig_Node_Expression_Binary_Add' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Add.php',
|
||||
'Twig_Node_Expression_Binary_And' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/And.php',
|
||||
'Twig_Node_Expression_Binary_BitwiseAnd' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php',
|
||||
'Twig_Node_Expression_Binary_BitwiseOr' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php',
|
||||
'Twig_Node_Expression_Binary_BitwiseXor' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php',
|
||||
'Twig_Node_Expression_Binary_Concat' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php',
|
||||
'Twig_Node_Expression_Binary_Div' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Div.php',
|
||||
'Twig_Node_Expression_Binary_EndsWith' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php',
|
||||
'Twig_Node_Expression_Binary_Equal' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php',
|
||||
'Twig_Node_Expression_Binary_FloorDiv' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php',
|
||||
'Twig_Node_Expression_Binary_Greater' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php',
|
||||
'Twig_Node_Expression_Binary_GreaterEqual' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php',
|
||||
'Twig_Node_Expression_Binary_In' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/In.php',
|
||||
'Twig_Node_Expression_Binary_Less' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Less.php',
|
||||
'Twig_Node_Expression_Binary_LessEqual' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php',
|
||||
'Twig_Node_Expression_Binary_Matches' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php',
|
||||
'Twig_Node_Expression_Binary_Mod' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php',
|
||||
'Twig_Node_Expression_Binary_Mul' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php',
|
||||
'Twig_Node_Expression_Binary_NotEqual' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php',
|
||||
'Twig_Node_Expression_Binary_NotIn' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php',
|
||||
'Twig_Node_Expression_Binary_Or' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Or.php',
|
||||
'Twig_Node_Expression_Binary_Power' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Power.php',
|
||||
'Twig_Node_Expression_Binary_Range' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Range.php',
|
||||
'Twig_Node_Expression_Binary_StartsWith' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php',
|
||||
'Twig_Node_Expression_Binary_Sub' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php',
|
||||
'Twig_Node_Expression_BlockReference' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/BlockReference.php',
|
||||
'Twig_Node_Expression_Call' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Call.php',
|
||||
'Twig_Node_Expression_Conditional' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Conditional.php',
|
||||
'Twig_Node_Expression_Constant' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Constant.php',
|
||||
'Twig_Node_Expression_ExtensionReference' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php',
|
||||
'Twig_Node_Expression_Filter' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Filter.php',
|
||||
'Twig_Node_Expression_Filter_Default' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Filter/Default.php',
|
||||
'Twig_Node_Expression_Function' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Function.php',
|
||||
'Twig_Node_Expression_GetAttr' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/GetAttr.php',
|
||||
'Twig_Node_Expression_MethodCall' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/MethodCall.php',
|
||||
'Twig_Node_Expression_Name' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Name.php',
|
||||
'Twig_Node_Expression_Parent' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Parent.php',
|
||||
'Twig_Node_Expression_TempName' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/TempName.php',
|
||||
'Twig_Node_Expression_Test' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Test.php',
|
||||
'Twig_Node_Expression_Test_Constant' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Test/Constant.php',
|
||||
'Twig_Node_Expression_Test_Defined' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Test/Defined.php',
|
||||
'Twig_Node_Expression_Test_Divisibleby' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php',
|
||||
'Twig_Node_Expression_Test_Even' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Test/Even.php',
|
||||
'Twig_Node_Expression_Test_Null' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Test/Null.php',
|
||||
'Twig_Node_Expression_Test_Odd' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Test/Odd.php',
|
||||
'Twig_Node_Expression_Test_Sameas' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php',
|
||||
'Twig_Node_Expression_Unary' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Unary.php',
|
||||
'Twig_Node_Expression_Unary_Neg' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php',
|
||||
'Twig_Node_Expression_Unary_Not' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Unary/Not.php',
|
||||
'Twig_Node_Expression_Unary_Pos' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php',
|
||||
'Twig_Node_Flush' => $vendorDir . '/twig/twig/lib/Twig/Node/Flush.php',
|
||||
'Twig_Node_For' => $vendorDir . '/twig/twig/lib/Twig/Node/For.php',
|
||||
'Twig_Node_ForLoop' => $vendorDir . '/twig/twig/lib/Twig/Node/ForLoop.php',
|
||||
'Twig_Node_If' => $vendorDir . '/twig/twig/lib/Twig/Node/If.php',
|
||||
'Twig_Node_Import' => $vendorDir . '/twig/twig/lib/Twig/Node/Import.php',
|
||||
'Twig_Node_Include' => $vendorDir . '/twig/twig/lib/Twig/Node/Include.php',
|
||||
'Twig_Node_Macro' => $vendorDir . '/twig/twig/lib/Twig/Node/Macro.php',
|
||||
'Twig_Node_Module' => $vendorDir . '/twig/twig/lib/Twig/Node/Module.php',
|
||||
'Twig_Node_Print' => $vendorDir . '/twig/twig/lib/Twig/Node/Print.php',
|
||||
'Twig_Node_Sandbox' => $vendorDir . '/twig/twig/lib/Twig/Node/Sandbox.php',
|
||||
'Twig_Node_SandboxedModule' => $vendorDir . '/twig/twig/lib/Twig/Node/SandboxedModule.php',
|
||||
'Twig_Node_SandboxedPrint' => $vendorDir . '/twig/twig/lib/Twig/Node/SandboxedPrint.php',
|
||||
'Twig_Node_Set' => $vendorDir . '/twig/twig/lib/Twig/Node/Set.php',
|
||||
'Twig_Node_SetTemp' => $vendorDir . '/twig/twig/lib/Twig/Node/SetTemp.php',
|
||||
'Twig_Node_Spaceless' => $vendorDir . '/twig/twig/lib/Twig/Node/Spaceless.php',
|
||||
'Twig_Node_Text' => $vendorDir . '/twig/twig/lib/Twig/Node/Text.php',
|
||||
'Twig_Parser' => $vendorDir . '/twig/twig/lib/Twig/Parser.php',
|
||||
'Twig_ParserInterface' => $vendorDir . '/twig/twig/lib/Twig/ParserInterface.php',
|
||||
'Twig_Sandbox_SecurityError' => $vendorDir . '/twig/twig/lib/Twig/Sandbox/SecurityError.php',
|
||||
'Twig_Sandbox_SecurityPolicy' => $vendorDir . '/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php',
|
||||
'Twig_Sandbox_SecurityPolicyInterface' => $vendorDir . '/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php',
|
||||
'Twig_SimpleFilter' => $vendorDir . '/twig/twig/lib/Twig/SimpleFilter.php',
|
||||
'Twig_SimpleFunction' => $vendorDir . '/twig/twig/lib/Twig/SimpleFunction.php',
|
||||
'Twig_Template' => $vendorDir . '/twig/twig/lib/Twig/Template.php',
|
||||
'Twig_TemplateInterface' => $vendorDir . '/twig/twig/lib/Twig/TemplateInterface.php',
|
||||
'Twig_Test' => $vendorDir . '/twig/twig/lib/Twig/Test.php',
|
||||
'Twig_TestCallableInterface' => $vendorDir . '/twig/twig/lib/Twig/TestCallableInterface.php',
|
||||
'Twig_TestInterface' => $vendorDir . '/twig/twig/lib/Twig/TestInterface.php',
|
||||
'Twig_Test_Function' => $vendorDir . '/twig/twig/lib/Twig/Test/Function.php',
|
||||
'Twig_Test_IntegrationTestCase' => $vendorDir . '/twig/twig/lib/Twig/Test/IntegrationTestCase.php',
|
||||
'Twig_Test_Method' => $vendorDir . '/twig/twig/lib/Twig/Test/Method.php',
|
||||
'Twig_Test_Node' => $vendorDir . '/twig/twig/lib/Twig/Test/Node.php',
|
||||
'Twig_Test_NodeTestCase' => $vendorDir . '/twig/twig/lib/Twig/Test/NodeTestCase.php',
|
||||
'Twig_Token' => $vendorDir . '/twig/twig/lib/Twig/Token.php',
|
||||
'Twig_TokenParser' => $vendorDir . '/twig/twig/lib/Twig/TokenParser.php',
|
||||
'Twig_TokenParserBroker' => $vendorDir . '/twig/twig/lib/Twig/TokenParserBroker.php',
|
||||
'Twig_TokenParserBrokerInterface' => $vendorDir . '/twig/twig/lib/Twig/TokenParserBrokerInterface.php',
|
||||
'Twig_TokenParserInterface' => $vendorDir . '/twig/twig/lib/Twig/TokenParserInterface.php',
|
||||
'Twig_TokenParser_AutoEscape' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/AutoEscape.php',
|
||||
'Twig_TokenParser_Block' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Block.php',
|
||||
'Twig_TokenParser_Do' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Do.php',
|
||||
'Twig_TokenParser_Embed' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Embed.php',
|
||||
'Twig_TokenParser_Extends' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Extends.php',
|
||||
'Twig_TokenParser_Filter' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Filter.php',
|
||||
'Twig_TokenParser_Flush' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Flush.php',
|
||||
'Twig_TokenParser_For' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/For.php',
|
||||
'Twig_TokenParser_From' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/From.php',
|
||||
'Twig_TokenParser_If' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/If.php',
|
||||
'Twig_TokenParser_Import' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Import.php',
|
||||
'Twig_TokenParser_Include' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Include.php',
|
||||
'Twig_TokenParser_Macro' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Macro.php',
|
||||
'Twig_TokenParser_Sandbox' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Sandbox.php',
|
||||
'Twig_TokenParser_Set' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Set.php',
|
||||
'Twig_TokenParser_Spaceless' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Spaceless.php',
|
||||
'Twig_TokenParser_Use' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Use.php',
|
||||
'Twig_TokenStream' => $vendorDir . '/twig/twig/lib/Twig/TokenStream.php',
|
||||
);
|
||||
13
vendor/composer/autoload_files.php
vendored
13
vendor/composer/autoload_files.php
vendored
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_files.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
$vendorDir . '/ircmaxell/password-compat/lib/password.php',
|
||||
$vendorDir . '/donatj/phpuseragentparser/Source/UserAgentParser.php',
|
||||
$vendorDir . '/tracy/tracy/src/shortcuts.php',
|
||||
$baseDir . '/system/defines.php',
|
||||
);
|
||||
19
vendor/composer/autoload_namespaces.php
vendored
19
vendor/composer/autoload_namespaces.php
vendored
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Twig_' => array($vendorDir . '/twig/twig/lib'),
|
||||
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
|
||||
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
|
||||
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
|
||||
'Pimple' => array($vendorDir . '/pimple/pimple/src'),
|
||||
'ParsedownExtra' => array($vendorDir . '/erusev/parsedown-extra'),
|
||||
'Parsedown' => array($vendorDir . '/erusev/parsedown'),
|
||||
'Gregwar\\Image' => array($vendorDir . '/gregwar/image'),
|
||||
'Gregwar\\Cache' => array($vendorDir . '/gregwar/cache'),
|
||||
'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib'),
|
||||
);
|
||||
10
vendor/composer/autoload_psr4.php
vendored
10
vendor/composer/autoload_psr4.php
vendored
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Grav\\' => array($baseDir . '/system/src'),
|
||||
);
|
||||
55
vendor/composer/autoload_real.php
vendored
55
vendor/composer/autoload_real.php
vendored
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit836e000af2692cba78dada56c083fe42
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit836e000af2692cba78dada56c083fe42', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit836e000af2692cba78dada56c083fe42', 'loadClassLoader'));
|
||||
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
foreach ($includeFiles as $file) {
|
||||
composerRequire836e000af2692cba78dada56c083fe42($file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire836e000af2692cba78dada56c083fe42($file)
|
||||
{
|
||||
require $file;
|
||||
}
|
||||
719
vendor/composer/installed.json
vendored
719
vendor/composer/installed.json
vendored
@@ -1,719 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "erusev/parsedown",
|
||||
"version": "1.0.1",
|
||||
"version_normalized": "1.0.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/erusev/parsedown.git",
|
||||
"reference": "d24439ada0704948deef0d3eda2ea20fd8db1747"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/erusev/parsedown/zipball/d24439ada0704948deef0d3eda2ea20fd8db1747",
|
||||
"reference": "d24439ada0704948deef0d3eda2ea20fd8db1747",
|
||||
"shasum": ""
|
||||
},
|
||||
"time": "2014-05-21 20:20:46",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Parsedown": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Emanuil Rusev",
|
||||
"email": "hello@erusev.com",
|
||||
"homepage": "http://erusev.com"
|
||||
}
|
||||
],
|
||||
"description": "Parser for Markdown.",
|
||||
"homepage": "http://parsedown.org",
|
||||
"keywords": [
|
||||
"markdown",
|
||||
"parser"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
"version": "v1.3.0",
|
||||
"version_normalized": "1.3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/cache.git",
|
||||
"reference": "e16d7adf45664a50fa86f515b6d5e7f670130449"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/cache/zipball/e16d7adf45664a50fa86f515b6d5e7f670130449",
|
||||
"reference": "e16d7adf45664a50fa86f515b6d5e7f670130449",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/common": ">2.2,<2.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": ">=3.7",
|
||||
"satooshi/php-coveralls": "~0.6"
|
||||
},
|
||||
"time": "2013-10-25 19:04:14",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\Common\\Cache\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com",
|
||||
"homepage": "http://www.jwage.com/",
|
||||
"role": "Creator"
|
||||
},
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com",
|
||||
"homepage": "http://www.instaclick.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com",
|
||||
"homepage": "https://github.com/schmittjoh",
|
||||
"role": "Developer of wrapped JMSSerializerBundle"
|
||||
}
|
||||
],
|
||||
"description": "Caching library offering an object-oriented API for many cache backends",
|
||||
"homepage": "http://www.doctrine-project.org",
|
||||
"keywords": [
|
||||
"cache",
|
||||
"caching"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pimple/pimple",
|
||||
"version": "v3.0.0",
|
||||
"version_normalized": "3.0.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fabpot/Pimple.git",
|
||||
"reference": "876bf0899d01feacd2a2e83f04641e51350099ef"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fabpot/Pimple/zipball/876bf0899d01feacd2a2e83f04641e51350099ef",
|
||||
"reference": "876bf0899d01feacd2a2e83f04641e51350099ef",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2014-07-24 09:48:15",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Pimple": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
|
||||
"homepage": "http://pimple.sensiolabs.org",
|
||||
"keywords": [
|
||||
"container",
|
||||
"dependency injection"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v2.5.3",
|
||||
"version_normalized": "2.5.3.0",
|
||||
"target-dir": "Symfony/Component/Yaml",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Yaml.git",
|
||||
"reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Yaml/zipball/5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f",
|
||||
"reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"time": "2014-08-05 09:00:40",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Yaml\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "http://symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v2.5.3",
|
||||
"version_normalized": "2.5.3.0",
|
||||
"target-dir": "Symfony/Component/Console",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Console.git",
|
||||
"reference": "cd2d1e4bac2206b337326b0140ff475fe9ad5f63"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Console/zipball/cd2d1e4bac2206b337326b0140ff475fe9ad5f63",
|
||||
"reference": "cd2d1e4bac2206b337326b0140ff475fe9ad5f63",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/event-dispatcher": "~2.1"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "For using the console logger",
|
||||
"symfony/event-dispatcher": ""
|
||||
},
|
||||
"time": "2014-08-05 09:00:40",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Console\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "http://symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v2.5.3",
|
||||
"version_normalized": "2.5.3.0",
|
||||
"target-dir": "Symfony/Component/EventDispatcher",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/EventDispatcher.git",
|
||||
"reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/8faf5cc7e80fde74a650a36e60d32ce3c3e0457b",
|
||||
"reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.0",
|
||||
"symfony/dependency-injection": "~2.0",
|
||||
"symfony/stopwatch": "~2.2"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/dependency-injection": "",
|
||||
"symfony/http-kernel": ""
|
||||
},
|
||||
"time": "2014-07-28 13:20:46",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\EventDispatcher\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "http://symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "gregwar/cache",
|
||||
"version": "v1.0.7",
|
||||
"version_normalized": "1.0.7.0",
|
||||
"target-dir": "Gregwar/Cache",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Gregwar/Cache.git",
|
||||
"reference": "b2d0197c07cc1ccf7436e1ae7bf64f9948e02052"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Gregwar/Cache/zipball/b2d0197c07cc1ccf7436e1ae7bf64f9948e02052",
|
||||
"reference": "b2d0197c07cc1ccf7436e1ae7bf64f9948e02052",
|
||||
"shasum": ""
|
||||
},
|
||||
"time": "2014-02-20 20:04:58",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Gregwar\\Cache": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Grégoire Passault",
|
||||
"email": "g.passault@gmail.com",
|
||||
"homepage": "http://www.gregwar.com/"
|
||||
}
|
||||
],
|
||||
"description": "A lightweight file-system cache system",
|
||||
"keywords": [
|
||||
"cache",
|
||||
"caching",
|
||||
"file-system",
|
||||
"system"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gregwar/image",
|
||||
"version": "v2.0.17",
|
||||
"version_normalized": "2.0.17.0",
|
||||
"target-dir": "Gregwar/Image",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Gregwar/Image.git",
|
||||
"reference": "a7bba10ed0e3004c098bb7fde3a3e5bcafca8a2c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Gregwar/Image/zipball/a7bba10ed0e3004c098bb7fde3a3e5bcafca8a2c",
|
||||
"reference": "a7bba10ed0e3004c098bb7fde3a3e5bcafca8a2c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-gd": "*",
|
||||
"gregwar/cache": "v1.0.7",
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2014-02-20 22:20:45",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Gregwar\\Image": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Grégoire Passault",
|
||||
"email": "g.passault@gmail.com",
|
||||
"homepage": "http://www.gregwar.com/"
|
||||
}
|
||||
],
|
||||
"description": "Image handling",
|
||||
"homepage": "https://github.com/Gregwar/Image",
|
||||
"keywords": [
|
||||
"gd",
|
||||
"image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ircmaxell/password-compat",
|
||||
"version": "1.0.3",
|
||||
"version_normalized": "1.0.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ircmaxell/password_compat.git",
|
||||
"reference": "1fc1521b5e9794ea77e4eca30717be9635f1d4f4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/1fc1521b5e9794ea77e4eca30717be9635f1d4f4",
|
||||
"reference": "1fc1521b5e9794ea77e4eca30717be9635f1d4f4",
|
||||
"shasum": ""
|
||||
},
|
||||
"time": "2013-04-30 19:58:08",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"lib/password.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Anthony Ferrara",
|
||||
"email": "ircmaxell@ircmaxell.com",
|
||||
"homepage": "http://blog.ircmaxell.com"
|
||||
}
|
||||
],
|
||||
"description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash",
|
||||
"homepage": "https://github.com/ircmaxell/password_compat",
|
||||
"keywords": [
|
||||
"hashing",
|
||||
"password"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v1.16.0",
|
||||
"version_normalized": "1.16.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fabpot/Twig.git",
|
||||
"reference": "8ce37115802e257a984a82d38254884085060024"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fabpot/Twig/zipball/8ce37115802e257a984a82d38254884085060024",
|
||||
"reference": "8ce37115802e257a984a82d38254884085060024",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.2.4"
|
||||
},
|
||||
"time": "2014-07-05 12:19:05",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.16-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Twig_": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "Armin Ronacher",
|
||||
"email": "armin.ronacher@active-4.com",
|
||||
"role": "Project Founder"
|
||||
},
|
||||
{
|
||||
"name": "Twig Team",
|
||||
"homepage": "https://github.com/fabpot/Twig/graphs/contributors",
|
||||
"role": "Contributors"
|
||||
}
|
||||
],
|
||||
"description": "Twig, the flexible, fast, and secure template language for PHP",
|
||||
"homepage": "http://twig.sensiolabs.org",
|
||||
"keywords": [
|
||||
"templating"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "donatj/phpuseragentparser",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/donatj/PhpUserAgent.git",
|
||||
"reference": "abbd69a119f067e4afc3c4baf28d04646114a668"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/donatj/PhpUserAgent/zipball/abbd69a119f067e4afc3c4baf28d04646114a668",
|
||||
"reference": "abbd69a119f067e4afc3c4baf28d04646114a668",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"camspiers/json-pretty": "0.1.*"
|
||||
},
|
||||
"time": "2014-08-06 03:39:39",
|
||||
"type": "library",
|
||||
"installation-source": "source",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"Source/UserAgentParser.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jesse G. Donat",
|
||||
"email": "donatj@gmail.com",
|
||||
"homepage": "http://donatstudios.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Simple, streamlined PHP user-agent parser",
|
||||
"homepage": "http://donatstudios.com/PHP-Parser-HTTP_USER_AGENT",
|
||||
"keywords": [
|
||||
"parser",
|
||||
"user agent",
|
||||
"useragent"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "tracy/tracy",
|
||||
"version": "v2.2.3",
|
||||
"version_normalized": "2.2.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nette/tracy.git",
|
||||
"reference": "97889d2b8cfb7607cc370ca0ddb97c6f5b43deb9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nette/tracy/zipball/97889d2b8cfb7607cc370ca0ddb97c6f5b43deb9",
|
||||
"reference": "97889d2b8cfb7607cc370ca0ddb97c6f5b43deb9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"nette/tester": "~1.0"
|
||||
},
|
||||
"time": "2014-08-24 23:36:30",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/Tracy"
|
||||
],
|
||||
"files": [
|
||||
"src/shortcuts.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause",
|
||||
"GPL-2.0",
|
||||
"GPL-3.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "David Grudl",
|
||||
"homepage": "http://davidgrudl.com"
|
||||
},
|
||||
{
|
||||
"name": "Nette Community",
|
||||
"homepage": "http://nette.org/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Tracy: useful PHP debugger",
|
||||
"homepage": "http://tracy.nette.org",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"debugger",
|
||||
"nette"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "erusev/parsedown-extra",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/erusev/parsedown-extra.git",
|
||||
"reference": "424e63fef5299f2a5a0464cd22a666b7a7b48657"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/424e63fef5299f2a5a0464cd22a666b7a7b48657",
|
||||
"reference": "424e63fef5299f2a5a0464cd22a666b7a7b48657",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"erusev/parsedown": "~1.0"
|
||||
},
|
||||
"time": "2014-08-25 10:49:57",
|
||||
"type": "library",
|
||||
"installation-source": "source",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"ParsedownExtra": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Emanuil Rusev",
|
||||
"email": "hello@erusev.com",
|
||||
"homepage": "http://erusev.com"
|
||||
}
|
||||
],
|
||||
"description": "An extension of Parsedown that adds support for Markdown Extra.",
|
||||
"homepage": "https://github.com/erusev/parsedown-extra",
|
||||
"keywords": [
|
||||
"markdown",
|
||||
"markdown extra",
|
||||
"parsedown",
|
||||
"parser"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mrclay/minify",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rhukster/minify.git",
|
||||
"reference": "fdf68abf30ccd86a65f66fa6eb98434eb29bef74"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/rhukster/minify/zipball/fdf68abf30ccd86a65f66fa6eb98434eb29bef74",
|
||||
"reference": "fdf68abf30ccd86a65f66fa6eb98434eb29bef74",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-pcre": "*",
|
||||
"php": ">=5.2.1"
|
||||
},
|
||||
"time": "2014-08-29 23:07:55",
|
||||
"type": "library",
|
||||
"installation-source": "source",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"min/lib/"
|
||||
]
|
||||
},
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Stephen Clay",
|
||||
"email": "steve@mrclay.org",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Minify is a PHP5 app that helps you follow several rules for client-side performance. It combines multiple CSS or Javascript files, removes unnecessary whitespace and comments, and serves them with gzip encoding and optimal client-side cache headers",
|
||||
"homepage": "http://code.google.com/p/minify/",
|
||||
"support": {
|
||||
"email": "minify@googlegroups.com",
|
||||
"issues": "http://code.google.com/p/minify/issues/list",
|
||||
"wiki": "http://code.google.com/p/minify/w/list",
|
||||
"source": "https://github.com/rhukster/minify/tree/master"
|
||||
}
|
||||
}
|
||||
]
|
||||
19
vendor/doctrine/cache/LICENSE
vendored
19
vendor/doctrine/cache/LICENSE
vendored
@@ -1,19 +0,0 @@
|
||||
Copyright (c) 2006-2012 Doctrine Project
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
14
vendor/doctrine/cache/README.md
vendored
14
vendor/doctrine/cache/README.md
vendored
@@ -1,14 +0,0 @@
|
||||
# Doctrine Cache
|
||||
|
||||
Master: [](http://travis-ci.org/doctrine/cache) [](https://coveralls.io/r/doctrine/cache?branch=master)
|
||||
|
||||
[](https://packagist.org/packages/doctrine/cache) [](https://packagist.org/packages/doctrine/cache)
|
||||
|
||||
Cache component extracted from the Doctrine Common project.
|
||||
|
||||
## Changelog
|
||||
|
||||
### v1.2
|
||||
|
||||
* Added support for MongoDB as Cache Provider
|
||||
* Fix namespace version reset
|
||||
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
/**
|
||||
* APC cache provider.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class ApcCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
return apc_fetch($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
return apc_exists($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
return (bool) apc_store($id, $data, (int) $lifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
return apc_delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
return apc_clear_cache() && apc_clear_cache('user');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
$info = apc_cache_info();
|
||||
$sma = apc_sma_info();
|
||||
|
||||
// @TODO - Temporary fix @see https://github.com/krakjoe/apcu/pull/42
|
||||
if (PHP_VERSION_ID >= 50500) {
|
||||
$info['num_hits'] = isset($info['num_hits']) ? $info['num_hits'] : $info['nhits'];
|
||||
$info['num_misses'] = isset($info['num_misses']) ? $info['num_misses'] : $info['nmisses'];
|
||||
$info['start_time'] = isset($info['start_time']) ? $info['start_time'] : $info['stime'];
|
||||
}
|
||||
|
||||
return array(
|
||||
Cache::STATS_HITS => $info['num_hits'],
|
||||
Cache::STATS_MISSES => $info['num_misses'],
|
||||
Cache::STATS_UPTIME => $info['start_time'],
|
||||
Cache::STATS_MEMORY_USAGE => $info['mem_size'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $sma['avail_mem'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
/**
|
||||
* Array cache driver.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class ArrayCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* @var array $data
|
||||
*/
|
||||
private $data = array();
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
return (isset($this->data[$id])) ? $this->data[$id] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
return isset($this->data[$id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
$this->data[$id] = $data;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
unset($this->data[$id]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
$this->data = array();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
/**
|
||||
* Interface for cache drivers.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
interface Cache
|
||||
{
|
||||
const STATS_HITS = 'hits';
|
||||
const STATS_MISSES = 'misses';
|
||||
const STATS_UPTIME = 'uptime';
|
||||
const STATS_MEMORY_USAGE = 'memory_usage';
|
||||
const STATS_MEMORY_AVAILABLE = 'memory_available';
|
||||
/**
|
||||
* Only for backward compatibility (may be removed in next major release)
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
const STATS_MEMORY_AVAILIABLE = 'memory_available';
|
||||
|
||||
/**
|
||||
* Fetches an entry from the cache.
|
||||
*
|
||||
* @param string $id The id of the cache entry to fetch.
|
||||
*
|
||||
* @return mixed The cached data or FALSE, if no cache entry exists for the given id.
|
||||
*/
|
||||
function fetch($id);
|
||||
|
||||
/**
|
||||
* Tests if an entry exists in the cache.
|
||||
*
|
||||
* @param string $id The cache id of the entry to check for.
|
||||
*
|
||||
* @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.
|
||||
*/
|
||||
function contains($id);
|
||||
|
||||
/**
|
||||
* Puts data into the cache.
|
||||
*
|
||||
* @param string $id The cache id.
|
||||
* @param mixed $data The cache entry/data.
|
||||
* @param int $lifeTime The cache lifetime.
|
||||
* If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).
|
||||
*
|
||||
* @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.
|
||||
*/
|
||||
function save($id, $data, $lifeTime = 0);
|
||||
|
||||
/**
|
||||
* Deletes a cache entry.
|
||||
*
|
||||
* @param string $id The cache id.
|
||||
*
|
||||
* @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.
|
||||
*/
|
||||
function delete($id);
|
||||
|
||||
/**
|
||||
* Retrieves cached information from the data store.
|
||||
*
|
||||
* The server's statistics array has the following values:
|
||||
*
|
||||
* - <b>hits</b>
|
||||
* Number of keys that have been requested and found present.
|
||||
*
|
||||
* - <b>misses</b>
|
||||
* Number of items that have been requested and not found.
|
||||
*
|
||||
* - <b>uptime</b>
|
||||
* Time that the server is running.
|
||||
*
|
||||
* - <b>memory_usage</b>
|
||||
* Memory used by this server to store items.
|
||||
*
|
||||
* - <b>memory_available</b>
|
||||
* Memory allowed to use for storage.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @return array|null An associative array with server's statistics if available, NULL otherwise.
|
||||
*/
|
||||
function getStats();
|
||||
}
|
||||
@@ -1,241 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
/**
|
||||
* Base class for cache provider implementations.
|
||||
*
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
abstract class CacheProvider implements Cache
|
||||
{
|
||||
const DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]';
|
||||
|
||||
/**
|
||||
* The namespace to prefix all cache ids with.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $namespace = '';
|
||||
|
||||
/**
|
||||
* The namespace version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $namespaceVersion;
|
||||
|
||||
/**
|
||||
* Sets the namespace to prefix all cache ids with.
|
||||
*
|
||||
* @param string $namespace
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNamespace($namespace)
|
||||
{
|
||||
$this->namespace = (string) $namespace;
|
||||
$this->namespaceVersion = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the namespace that prefixes all cache ids.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNamespace()
|
||||
{
|
||||
return $this->namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($id)
|
||||
{
|
||||
return $this->doFetch($this->getNamespacedId($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function contains($id)
|
||||
{
|
||||
return $this->doContains($this->getNamespacedId($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save($id, $data, $lifeTime = 0)
|
||||
{
|
||||
return $this->doSave($this->getNamespacedId($id), $data, $lifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
return $this->doDelete($this->getNamespacedId($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStats()
|
||||
{
|
||||
return $this->doGetStats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Flushes all cache entries.
|
||||
*
|
||||
* @return boolean TRUE if the cache entries were successfully flushed, FALSE otherwise.
|
||||
*/
|
||||
public function flushAll()
|
||||
{
|
||||
return $this->doFlush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all cache entries.
|
||||
*
|
||||
* @return boolean TRUE if the cache entries were successfully deleted, FALSE otherwise.
|
||||
*/
|
||||
public function deleteAll()
|
||||
{
|
||||
$namespaceCacheKey = $this->getNamespaceCacheKey();
|
||||
$namespaceVersion = $this->getNamespaceVersion() + 1;
|
||||
|
||||
$this->namespaceVersion = $namespaceVersion;
|
||||
|
||||
return $this->doSave($namespaceCacheKey, $namespaceVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefixes the passed id with the configured namespace value.
|
||||
*
|
||||
* @param string $id The id to namespace.
|
||||
*
|
||||
* @return string The namespaced id.
|
||||
*/
|
||||
private function getNamespacedId($id)
|
||||
{
|
||||
$namespaceVersion = $this->getNamespaceVersion();
|
||||
|
||||
return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the namespace cache key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getNamespaceCacheKey()
|
||||
{
|
||||
return sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the namespace version.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getNamespaceVersion()
|
||||
{
|
||||
if (null !== $this->namespaceVersion) {
|
||||
return $this->namespaceVersion;
|
||||
}
|
||||
|
||||
$namespaceCacheKey = $this->getNamespaceCacheKey();
|
||||
$namespaceVersion = $this->doFetch($namespaceCacheKey);
|
||||
|
||||
if (false === $namespaceVersion) {
|
||||
$namespaceVersion = 1;
|
||||
|
||||
$this->doSave($namespaceCacheKey, $namespaceVersion);
|
||||
}
|
||||
|
||||
$this->namespaceVersion = $namespaceVersion;
|
||||
|
||||
return $this->namespaceVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches an entry from the cache.
|
||||
*
|
||||
* @param string $id The id of the cache entry to fetch.
|
||||
*
|
||||
* @return string|bool The cached data or FALSE, if no cache entry exists for the given id.
|
||||
*/
|
||||
abstract protected function doFetch($id);
|
||||
|
||||
/**
|
||||
* Tests if an entry exists in the cache.
|
||||
*
|
||||
* @param string $id The cache id of the entry to check for.
|
||||
*
|
||||
* @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.
|
||||
*/
|
||||
abstract protected function doContains($id);
|
||||
|
||||
/**
|
||||
* Puts data into the cache.
|
||||
*
|
||||
* @param string $id The cache id.
|
||||
* @param string $data The cache entry/data.
|
||||
* @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this
|
||||
* cache entry (0 => infinite lifeTime).
|
||||
*
|
||||
* @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.
|
||||
*/
|
||||
abstract protected function doSave($id, $data, $lifeTime = 0);
|
||||
|
||||
/**
|
||||
* Deletes a cache entry.
|
||||
*
|
||||
* @param string $id The cache id.
|
||||
*
|
||||
* @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.
|
||||
*/
|
||||
abstract protected function doDelete($id);
|
||||
|
||||
/**
|
||||
* Flushes all cache entries.
|
||||
*
|
||||
* @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.
|
||||
*/
|
||||
abstract protected function doFlush();
|
||||
|
||||
/**
|
||||
* Retrieves cached information from the data store.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @return array|null An associative array with server's statistics if available, NULL otherwise.
|
||||
*/
|
||||
abstract protected function doGetStats();
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
use \Couchbase;
|
||||
|
||||
/**
|
||||
* Couchbase cache provider.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.4
|
||||
* @author Michael Nitschinger <michael@nitschinger.at>
|
||||
*/
|
||||
class CouchbaseCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* @var Couchbase|null
|
||||
*/
|
||||
private $couchbase;
|
||||
|
||||
/**
|
||||
* Sets the Couchbase instance to use.
|
||||
*
|
||||
* @param Couchbase $couchbase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCouchbase(Couchbase $couchbase)
|
||||
{
|
||||
$this->couchbase = $couchbase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Couchbase instance used by the cache.
|
||||
*
|
||||
* @return Couchbase|null
|
||||
*/
|
||||
public function getCouchbase()
|
||||
{
|
||||
return $this->couchbase;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
return $this->couchbase->get($id) ?: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
return (null !== $this->couchbase->get($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
if ($lifeTime > 30 * 24 * 3600) {
|
||||
$lifeTime = time() + $lifeTime;
|
||||
}
|
||||
return $this->couchbase->set($id, $data, (int) $lifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
return $this->couchbase->delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
return $this->couchbase->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
$stats = $this->couchbase->getStats();
|
||||
$servers = $this->couchbase->getServers();
|
||||
$server = explode(":", $servers[0]);
|
||||
$key = $server[0] . ":" . "11210";
|
||||
$stats = $stats[$key];
|
||||
return array(
|
||||
Cache::STATS_HITS => $stats['get_hits'],
|
||||
Cache::STATS_MISSES => $stats['get_misses'],
|
||||
Cache::STATS_UPTIME => $stats['uptime'],
|
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
/**
|
||||
* Base file cache driver.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
abstract class FileCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* The cache directory.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $directory;
|
||||
|
||||
/**
|
||||
* The cache file extension.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $extension;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $directory The cache directory.
|
||||
* @param string|null $extension The cache file extension.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($directory, $extension = null)
|
||||
{
|
||||
if ( ! is_dir($directory) && ! @mkdir($directory, 0777, true)) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'The directory "%s" does not exist and could not be created.',
|
||||
$directory
|
||||
));
|
||||
}
|
||||
|
||||
if ( ! is_writable($directory)) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'The directory "%s" is not writable.',
|
||||
$directory
|
||||
));
|
||||
}
|
||||
|
||||
$this->directory = realpath($directory);
|
||||
$this->extension = $extension ?: $this->extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cache directory.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDirectory()
|
||||
{
|
||||
return $this->directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cache file extension.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getExtension()
|
||||
{
|
||||
return $this->extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getFilename($id)
|
||||
{
|
||||
$hash = hash('sha256', $id);
|
||||
$path = implode(str_split($hash, 16), DIRECTORY_SEPARATOR);
|
||||
$path = $this->directory . DIRECTORY_SEPARATOR . $path;
|
||||
$id = preg_replace('@[\\\/:"*?<>|]+@', '', $id);
|
||||
|
||||
return $path . DIRECTORY_SEPARATOR . $id . $this->extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
return @unlink($this->getFilename($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
foreach ($this->getIterator() as $name => $file) {
|
||||
@unlink($name);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
$usage = 0;
|
||||
foreach ($this->getIterator() as $name => $file) {
|
||||
$usage += $file->getSize();
|
||||
}
|
||||
|
||||
$free = disk_free_space($this->directory);
|
||||
|
||||
return array(
|
||||
Cache::STATS_HITS => null,
|
||||
Cache::STATS_MISSES => null,
|
||||
Cache::STATS_UPTIME => null,
|
||||
Cache::STATS_MEMORY_USAGE => $usage,
|
||||
Cache::STATS_MEMORY_AVAILABLE => $free,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Iterator
|
||||
*/
|
||||
private function getIterator()
|
||||
{
|
||||
$pattern = '/^.+\\' . $this->extension . '$/i';
|
||||
$iterator = new \RecursiveDirectoryIterator($this->directory);
|
||||
$iterator = new \RecursiveIteratorIterator($iterator);
|
||||
return new \RegexIterator($iterator, $pattern);
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
/**
|
||||
* Filesystem cache driver.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class FilesystemCache extends FileCache
|
||||
{
|
||||
const EXTENSION = '.doctrinecache.data';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $extension = self::EXTENSION;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
$data = '';
|
||||
$lifetime = -1;
|
||||
$filename = $this->getFilename($id);
|
||||
|
||||
if ( ! is_file($filename)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$resource = fopen($filename, "r");
|
||||
|
||||
if (false !== ($line = fgets($resource))) {
|
||||
$lifetime = (integer) $line;
|
||||
}
|
||||
|
||||
if ($lifetime !== 0 && $lifetime < time()) {
|
||||
fclose($resource);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
while (false !== ($line = fgets($resource))) {
|
||||
$data .= $line;
|
||||
}
|
||||
|
||||
fclose($resource);
|
||||
|
||||
return unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
$lifetime = -1;
|
||||
$filename = $this->getFilename($id);
|
||||
|
||||
if ( ! is_file($filename)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$resource = fopen($filename, "r");
|
||||
|
||||
if (false !== ($line = fgets($resource))) {
|
||||
$lifetime = (integer) $line;
|
||||
}
|
||||
|
||||
fclose($resource);
|
||||
|
||||
return $lifetime === 0 || $lifetime > time();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
if ($lifeTime > 0) {
|
||||
$lifeTime = time() + $lifeTime;
|
||||
}
|
||||
|
||||
$data = serialize($data);
|
||||
$filename = $this->getFilename($id);
|
||||
$filepath = pathinfo($filename, PATHINFO_DIRNAME);
|
||||
|
||||
if ( ! is_dir($filepath)) {
|
||||
mkdir($filepath, 0777, true);
|
||||
}
|
||||
|
||||
return file_put_contents($filename, $lifeTime . PHP_EOL . $data) !== false;
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
use \Memcache;
|
||||
|
||||
/**
|
||||
* Memcache cache provider.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class MemcacheCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* @var Memcache|null
|
||||
*/
|
||||
private $memcache;
|
||||
|
||||
/**
|
||||
* Sets the memcache instance to use.
|
||||
*
|
||||
* @param Memcache $memcache
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMemcache(Memcache $memcache)
|
||||
{
|
||||
$this->memcache = $memcache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the memcache instance used by the cache.
|
||||
*
|
||||
* @return Memcache|null
|
||||
*/
|
||||
public function getMemcache()
|
||||
{
|
||||
return $this->memcache;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
return $this->memcache->get($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
return (bool) $this->memcache->get($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
if ($lifeTime > 30 * 24 * 3600) {
|
||||
$lifeTime = time() + $lifeTime;
|
||||
}
|
||||
return $this->memcache->set($id, $data, 0, (int) $lifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
return $this->memcache->delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
return $this->memcache->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
$stats = $this->memcache->getStats();
|
||||
return array(
|
||||
Cache::STATS_HITS => $stats['get_hits'],
|
||||
Cache::STATS_MISSES => $stats['get_misses'],
|
||||
Cache::STATS_UPTIME => $stats['uptime'],
|
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
use \Memcached;
|
||||
|
||||
/**
|
||||
* Memcached cache provider.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class MemcachedCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* @var Memcached|null
|
||||
*/
|
||||
private $memcached;
|
||||
|
||||
/**
|
||||
* Sets the memcache instance to use.
|
||||
*
|
||||
* @param Memcached $memcached
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMemcached(Memcached $memcached)
|
||||
{
|
||||
$this->memcached = $memcached;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the memcached instance used by the cache.
|
||||
*
|
||||
* @return Memcached|null
|
||||
*/
|
||||
public function getMemcached()
|
||||
{
|
||||
return $this->memcached;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
return $this->memcached->get($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
return (false !== $this->memcached->get($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
if ($lifeTime > 30 * 24 * 3600) {
|
||||
$lifeTime = time() + $lifeTime;
|
||||
}
|
||||
return $this->memcached->set($id, $data, (int) $lifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
return $this->memcached->delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
return $this->memcached->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
$stats = $this->memcached->getStats();
|
||||
$servers = $this->memcached->getServerList();
|
||||
$key = $servers[0]['host'] . ':' . $servers[0]['port'];
|
||||
$stats = $stats[$key];
|
||||
return array(
|
||||
Cache::STATS_HITS => $stats['get_hits'],
|
||||
Cache::STATS_MISSES => $stats['get_misses'],
|
||||
Cache::STATS_UPTIME => $stats['uptime'],
|
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,191 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
use MongoBinData;
|
||||
use MongoCollection;
|
||||
use MongoDate;
|
||||
|
||||
/**
|
||||
* MongoDB cache provider.
|
||||
*
|
||||
* @since 1.1
|
||||
* @author Jeremy Mikola <jmikola@gmail.com>
|
||||
*/
|
||||
class MongoDBCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* The data field will store the serialized PHP value.
|
||||
*/
|
||||
const DATA_FIELD = 'd';
|
||||
|
||||
/**
|
||||
* The expiration field will store a MongoDate value indicating when the
|
||||
* cache entry should expire.
|
||||
*
|
||||
* With MongoDB 2.2+, entries can be automatically deleted by MongoDB by
|
||||
* indexing this field wit the "expireAfterSeconds" option equal to zero.
|
||||
* This will direct MongoDB to regularly query for and delete any entries
|
||||
* whose date is older than the current time. Entries without a date value
|
||||
* in this field will be ignored.
|
||||
*
|
||||
* The cache provider will also check dates on its own, in case expired
|
||||
* entries are fetched before MongoDB's TTLMonitor pass can expire them.
|
||||
*
|
||||
* @see http://docs.mongodb.org/manual/tutorial/expire-data/
|
||||
*/
|
||||
const EXPIRATION_FIELD = 'e';
|
||||
|
||||
/**
|
||||
* @var MongoCollection
|
||||
*/
|
||||
private $collection;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* This provider will default to the write concern and read preference
|
||||
* options set on the MongoCollection instance (or inherited from MongoDB or
|
||||
* MongoClient). Using an unacknowledged write concern (< 1) may make the
|
||||
* return values of delete() and save() unreliable. Reading from secondaries
|
||||
* may make contain() and fetch() unreliable.
|
||||
*
|
||||
* @see http://www.php.net/manual/en/mongo.readpreferences.php
|
||||
* @see http://www.php.net/manual/en/mongo.writeconcerns.php
|
||||
* @param MongoCollection $collection
|
||||
*/
|
||||
public function __construct(MongoCollection $collection)
|
||||
{
|
||||
$this->collection = $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
$document = $this->collection->findOne(array('_id' => $id), array(self::DATA_FIELD, self::EXPIRATION_FIELD));
|
||||
|
||||
if ($document === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->isExpired($document)) {
|
||||
$this->doDelete($id);
|
||||
return false;
|
||||
}
|
||||
|
||||
return unserialize($document[self::DATA_FIELD]->bin);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
$document = $this->collection->findOne(array('_id' => $id), array(self::EXPIRATION_FIELD));
|
||||
|
||||
if ($document === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->isExpired($document)) {
|
||||
$this->doDelete($id);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
$result = $this->collection->update(
|
||||
array('_id' => $id),
|
||||
array('$set' => array(
|
||||
self::EXPIRATION_FIELD => ($lifeTime > 0 ? new MongoDate(time() + $lifeTime) : null),
|
||||
self::DATA_FIELD => new MongoBinData(serialize($data), MongoBinData::BYTE_ARRAY),
|
||||
)),
|
||||
array('upsert' => true, 'multiple' => false)
|
||||
);
|
||||
|
||||
return isset($result['ok']) ? $result['ok'] == 1 : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
$result = $this->collection->remove(array('_id' => $id));
|
||||
|
||||
return isset($result['n']) ? $result['n'] == 1 : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
// Use remove() in lieu of drop() to maintain any collection indexes
|
||||
$result = $this->collection->remove();
|
||||
|
||||
return isset($result['ok']) ? $result['ok'] == 1 : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
$serverStatus = $this->collection->db->command(array(
|
||||
'serverStatus' => 1,
|
||||
'locks' => 0,
|
||||
'metrics' => 0,
|
||||
'recordStats' => 0,
|
||||
'repl' => 0,
|
||||
));
|
||||
|
||||
$collStats = $this->collection->db->command(array('collStats' => 1));
|
||||
|
||||
return array(
|
||||
Cache::STATS_HITS => null,
|
||||
Cache::STATS_MISSES => null,
|
||||
Cache::STATS_UPTIME => (isset($serverStatus['uptime']) ? (integer) $serverStatus['uptime'] : null),
|
||||
Cache::STATS_MEMORY_USAGE => (isset($collStats['size']) ? (integer) $collStats['size'] : null),
|
||||
Cache::STATS_MEMORY_AVAILABLE => null,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the document is expired.
|
||||
*
|
||||
* @param array $document
|
||||
* @return boolean
|
||||
*/
|
||||
private function isExpired(array $document)
|
||||
{
|
||||
return isset($document[self::EXPIRATION_FIELD]) &&
|
||||
$document[self::EXPIRATION_FIELD] instanceof MongoDate &&
|
||||
$document[self::EXPIRATION_FIELD]->sec < time();
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
/**
|
||||
* Php file cache driver.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class PhpFileCache extends FileCache
|
||||
{
|
||||
const EXTENSION = '.doctrinecache.php';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $extension = self::EXTENSION;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
$filename = $this->getFilename($id);
|
||||
|
||||
if ( ! is_file($filename)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$value = include $filename;
|
||||
|
||||
if ($value['lifetime'] !== 0 && $value['lifetime'] < time()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $value['data'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
$filename = $this->getFilename($id);
|
||||
|
||||
if ( ! is_file($filename)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$value = include $filename;
|
||||
|
||||
return $value['lifetime'] === 0 || $value['lifetime'] > time();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
if ($lifeTime > 0) {
|
||||
$lifeTime = time() + $lifeTime;
|
||||
}
|
||||
|
||||
if (is_object($data) && ! method_exists($data, '__set_state')) {
|
||||
throw new \InvalidArgumentException(
|
||||
"Invalid argument given, PhpFileCache only allows objects that implement __set_state() " .
|
||||
"and fully support var_export(). You can use the FilesystemCache to save arbitrary object " .
|
||||
"graphs using serialize()/deserialize()."
|
||||
);
|
||||
}
|
||||
|
||||
$filename = $this->getFilename($id);
|
||||
$filepath = pathinfo($filename, PATHINFO_DIRNAME);
|
||||
|
||||
if ( ! is_dir($filepath)) {
|
||||
mkdir($filepath, 0777, true);
|
||||
}
|
||||
|
||||
$value = array(
|
||||
'lifetime' => $lifeTime,
|
||||
'data' => $data
|
||||
);
|
||||
|
||||
$value = var_export($value, true);
|
||||
$code = sprintf('<?php return %s;', $value);
|
||||
|
||||
return file_put_contents($filename, $code) !== false;
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
use Redis;
|
||||
|
||||
/**
|
||||
* Redis cache provider.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Osman Ungur <osmanungur@gmail.com>
|
||||
*/
|
||||
class RedisCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* @var Redis|null
|
||||
*/
|
||||
private $redis;
|
||||
|
||||
/**
|
||||
* Sets the redis instance to use.
|
||||
*
|
||||
* @param Redis $redis
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRedis(Redis $redis)
|
||||
{
|
||||
$redis->setOption(Redis::OPT_SERIALIZER, $this->getSerializerValue());
|
||||
$this->redis = $redis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the redis instance used by the cache.
|
||||
*
|
||||
* @return Redis|null
|
||||
*/
|
||||
public function getRedis()
|
||||
{
|
||||
return $this->redis;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
return $this->redis->get($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
return $this->redis->exists($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
if ($lifeTime > 0) {
|
||||
return $this->redis->setex($id, $lifeTime, $data);
|
||||
}
|
||||
|
||||
return $this->redis->set($id, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
return $this->redis->delete($id) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
return $this->redis->flushDB();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
$info = $this->redis->info();
|
||||
return array(
|
||||
Cache::STATS_HITS => false,
|
||||
Cache::STATS_MISSES => false,
|
||||
Cache::STATS_UPTIME => $info['uptime_in_seconds'],
|
||||
Cache::STATS_MEMORY_USAGE => $info['used_memory'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the serializer constant to use. If Redis is compiled with
|
||||
* igbinary support, that is used. Otherwise the default PHP serializer is
|
||||
* used.
|
||||
*
|
||||
* @return integer One of the Redis::SERIALIZER_* constants
|
||||
*/
|
||||
protected function getSerializerValue()
|
||||
{
|
||||
return defined('Redis::SERIALIZER_IGBINARY') ? Redis::SERIALIZER_IGBINARY : Redis::SERIALIZER_PHP;
|
||||
}
|
||||
}
|
||||
@@ -1,250 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
use Riak\Bucket;
|
||||
use Riak\Connection;
|
||||
use Riak\Input;
|
||||
use Riak\Exception;
|
||||
use Riak\Object;
|
||||
|
||||
/**
|
||||
* Riak cache provider.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 1.1
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
*/
|
||||
class RiakCache extends CacheProvider
|
||||
{
|
||||
const EXPIRES_HEADER = 'X-Riak-Meta-Expires';
|
||||
|
||||
/**
|
||||
* @var \Riak\Bucket
|
||||
*/
|
||||
private $bucket;
|
||||
|
||||
/**
|
||||
* Sets the riak bucket instance to use.
|
||||
*
|
||||
* @param \Riak\Bucket $bucket
|
||||
*/
|
||||
public function __construct(Bucket $bucket)
|
||||
{
|
||||
$this->bucket = $bucket;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
try {
|
||||
$response = $this->bucket->get($id);
|
||||
|
||||
// No objects found
|
||||
if ( ! $response->hasObject()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for attempted siblings
|
||||
$object = ($response->hasSiblings())
|
||||
? $this->resolveConflict($id, $response->getVClock(), $response->getObjectList())
|
||||
: $response->getFirstObject();
|
||||
|
||||
// Check for expired object
|
||||
if ($this->isExpired($object)) {
|
||||
$this->bucket->delete($object);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return unserialize($object->getContent());
|
||||
} catch (Exception\RiakException $e) {
|
||||
// Covers:
|
||||
// - Riak\ConnectionException
|
||||
// - Riak\CommunicationException
|
||||
// - Riak\UnexpectedResponseException
|
||||
// - Riak\NotFoundException
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
try {
|
||||
// We only need the HEAD, not the entire object
|
||||
$input = new Input\GetInput();
|
||||
|
||||
$input->setReturnHead(true);
|
||||
|
||||
$response = $this->bucket->get($id, $input);
|
||||
|
||||
// No objects found
|
||||
if ( ! $response->hasObject()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$object = $response->getFirstObject();
|
||||
|
||||
// Check for expired object
|
||||
if ($this->isExpired($object)) {
|
||||
$this->bucket->delete($object);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception\RiakException $e) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
try {
|
||||
$object = new Object($id);
|
||||
|
||||
$object->setContent(serialize($data));
|
||||
|
||||
if ($lifeTime > 0) {
|
||||
$object->addMetadata(self::EXPIRES_HEADER, (string) (time() + $lifeTime));
|
||||
}
|
||||
|
||||
$this->bucket->put($object);
|
||||
|
||||
return true;
|
||||
} catch (Exception\RiakException $e) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
try {
|
||||
$this->bucket->delete($id);
|
||||
|
||||
return true;
|
||||
} catch (Exception\BadArgumentsException $e) {
|
||||
// Key did not exist on cluster already
|
||||
} catch (Exception\RiakException $e) {
|
||||
// Covers:
|
||||
// - Riak\Exception\ConnectionException
|
||||
// - Riak\Exception\CommunicationException
|
||||
// - Riak\Exception\UnexpectedResponseException
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
try {
|
||||
$keyList = $this->bucket->getKeyList();
|
||||
|
||||
foreach ($keyList as $key) {
|
||||
$this->bucket->delete($key);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception\RiakException $e) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
// Only exposed through HTTP stats API, not Protocol Buffers API
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given Riak Object have expired.
|
||||
*
|
||||
* @param \Riak\Object $object
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function isExpired(Object $object)
|
||||
{
|
||||
$metadataMap = $object->getMetadataMap();
|
||||
|
||||
return isset($metadataMap[self::EXPIRES_HEADER])
|
||||
&& $metadataMap[self::EXPIRES_HEADER] < time();
|
||||
}
|
||||
|
||||
/**
|
||||
* On-read conflict resolution. Applied approach here is last write wins.
|
||||
* Specific needs may override this method to apply alternate conflict resolutions.
|
||||
*
|
||||
* {@internal Riak does not attempt to resolve a write conflict, and store
|
||||
* it as sibling of conflicted one. By following this approach, it is up to
|
||||
* the next read to resolve the conflict. When this happens, your fetched
|
||||
* object will have a list of siblings (read as a list of objects).
|
||||
* In our specific case, we do not care about the intermediate ones since
|
||||
* they are all the same read from storage, and we do apply a last sibling
|
||||
* (last write) wins logic.
|
||||
* If by any means our resolution generates another conflict, it'll up to
|
||||
* next read to properly solve it.}
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $vClock
|
||||
* @param array $objectList
|
||||
*
|
||||
* @return \Riak\Object
|
||||
*/
|
||||
protected function resolveConflict($id, $vClock, array $objectList)
|
||||
{
|
||||
// Our approach here is last-write wins
|
||||
$winner = $objectList[count($objectList)];
|
||||
|
||||
$putInput = new Input\PutInput();
|
||||
$putInput->setVClock($vClock);
|
||||
|
||||
$mergedObject = new Object($id);
|
||||
$mergedObject->setContent($winner->getContent());
|
||||
|
||||
$this->bucket->put($mergedObject, $putInput);
|
||||
|
||||
return $mergedObject;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
class Version
|
||||
{
|
||||
const VERSION = '1.3.0';
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
/**
|
||||
* WinCache cache provider.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class WinCacheCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
return wincache_ucache_get($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
return wincache_ucache_exists($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
return (bool) wincache_ucache_set($id, $data, (int) $lifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
return wincache_ucache_delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
return wincache_ucache_clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
$info = wincache_ucache_info();
|
||||
$meminfo = wincache_ucache_meminfo();
|
||||
|
||||
return array(
|
||||
Cache::STATS_HITS => $info['total_hit_count'],
|
||||
Cache::STATS_MISSES => $info['total_miss_count'],
|
||||
Cache::STATS_UPTIME => $info['total_cache_uptime'],
|
||||
Cache::STATS_MEMORY_USAGE => $meminfo['memory_total'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $meminfo['memory_free'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
/**
|
||||
* Xcache cache driver.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class XcacheCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
return $this->doContains($id) ? unserialize(xcache_get($id)) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
return xcache_isset($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
return xcache_set($id, serialize($data), (int) $lifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
return xcache_unset($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
$this->checkAuthorization();
|
||||
|
||||
xcache_clear_cache(XC_TYPE_VAR, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that xcache.admin.enable_auth is Off.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \BadMethodCallException When xcache.admin.enable_auth is On.
|
||||
*/
|
||||
protected function checkAuthorization()
|
||||
{
|
||||
if (ini_get('xcache.admin.enable_auth')) {
|
||||
throw new \BadMethodCallException('To use all features of \Doctrine\Common\Cache\XcacheCache, you must set "xcache.admin.enable_auth" to "Off" in your php.ini.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
$this->checkAuthorization();
|
||||
|
||||
$info = xcache_info(XC_TYPE_VAR, 0);
|
||||
return array(
|
||||
Cache::STATS_HITS => $info['hits'],
|
||||
Cache::STATS_MISSES => $info['misses'],
|
||||
Cache::STATS_UPTIME => null,
|
||||
Cache::STATS_MEMORY_USAGE => $info['size'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $info['avail'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
/**
|
||||
* Zend Data Cache cache driver.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Ralph Schindler <ralph.schindler@zend.com>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
*/
|
||||
class ZendDataCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
return zend_shm_cache_fetch($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
return (false !== zend_shm_cache_fetch($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
return zend_shm_cache_store($id, $data, $lifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
return zend_shm_cache_delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
$namespace = $this->getNamespace();
|
||||
if (empty($namespace)) {
|
||||
return zend_shm_cache_clear();
|
||||
}
|
||||
return zend_shm_cache_clear($namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
22
vendor/donatj/phpuseragentparser/LICENSE.md
vendored
22
vendor/donatj/phpuseragentparser/LICENSE.md
vendored
@@ -1,22 +0,0 @@
|
||||
The MIT License
|
||||
===============
|
||||
|
||||
Copyright (c) 2013 Jesse G. Donat
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
110
vendor/donatj/phpuseragentparser/README.md
vendored
110
vendor/donatj/phpuseragentparser/README.md
vendored
@@ -1,110 +0,0 @@
|
||||
# PHP User Agent Parser
|
||||
|
||||
[](https://packagist.org/packages/donatj/phpuseragentparser) [](https://packagist.org/packages/donatj/phpuseragentparser) [](https://packagist.org/packages/donatj/phpuseragentparser) [](https://packagist.org/packages/donatj/phpuseragentparser)
|
||||
[](https://travis-ci.org/donatj/PhpUserAgent)
|
||||
[](http://hhvm.h4cc.de/package/donatj/phpuseragentparser) [](https://scrutinizer-ci.com/g/donatj/PhpUserAgent/?branch=master)
|
||||
|
||||
## What It Is
|
||||
|
||||
A simple, streamlined PHP user-agent parser!
|
||||
|
||||
Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
|
||||
## Why Use This
|
||||
|
||||
You have your choice in user-agent parsers. This one detects **all modern browsers** in a very light, quick, understandable fashion.
|
||||
It is less than 150 lines of code, and consists of just two regular expressions!
|
||||
It can also correctly identify exotic versions of IE others fail on.
|
||||
|
||||
It offers 100% unit test coverage, is installable via Composer, and is very easy to use.
|
||||
|
||||
## What It Doesn't Do
|
||||
|
||||
### OS Versions
|
||||
|
||||
User-agent strings **are not** a reliable source of OS Version!
|
||||
|
||||
- Many agents simply don't send the information.
|
||||
- Others provide varying levels of accuracy.
|
||||
- Parsing Windows versions alone almost nearly doubles the size of the code.
|
||||
|
||||
I'm much more interested in keeping this thing *tiny* and accurate than adding niché features and would rather focus on things that can be **done well**.
|
||||
|
||||
All that said, there is the start of a [branch to do it](https://github.com/donatj/PhpUserAgent/tree/os_version_detection) I created for a client if you want to poke it, I update it from time to time, but frankly if you need to *reliably detect OS Version*, using user-agent isn't the way to do it. I'd go with JavaScript.
|
||||
|
||||
## Requirements
|
||||
|
||||
- PHP 5.3.0+
|
||||
|
||||
## Installing
|
||||
|
||||
PHP User Agent is available through Packagist via Composer.
|
||||
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
"donatj/phpuseragentparser": "*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Sample Usage
|
||||
|
||||
```php
|
||||
$ua_info = parse_user_agent();
|
||||
/*
|
||||
array(
|
||||
'platform' => '[Detected Platform]',
|
||||
'browser' => '[Detected Browser]',
|
||||
'version' => '[Detected Browser Version]',
|
||||
);
|
||||
*/
|
||||
```
|
||||
|
||||
## Currently Detected Platforms
|
||||
|
||||
- Desktop
|
||||
- Windows
|
||||
- Linux
|
||||
- Macintosh
|
||||
- Chrome OS
|
||||
- Mobile
|
||||
- Android
|
||||
- iPhone
|
||||
- iPad
|
||||
- Windows Phone OS
|
||||
- Kindle
|
||||
- Kindle Fire
|
||||
- BlackBerry
|
||||
- Playbook
|
||||
- Console
|
||||
- Nintendo 3DS
|
||||
- Nintendo Wii
|
||||
- Nintendo WiiU
|
||||
- PlayStation 3
|
||||
- PlayStation 4
|
||||
- PlayStation Vita
|
||||
- Xbox 360
|
||||
- Xbox One
|
||||
|
||||
## Currently Detected Browsers
|
||||
|
||||
- Android Browser
|
||||
- BlackBerry Browser
|
||||
- Camino
|
||||
- Kindle / Silk
|
||||
- Firefox / Iceweasel
|
||||
- Safari
|
||||
- Internet Explorer
|
||||
- IEMobile
|
||||
- Chrome
|
||||
- Opera
|
||||
- Midori
|
||||
- Lynx
|
||||
- Wget
|
||||
- Curl
|
||||
|
||||
|
||||
|
||||
More information is available at [Donat Studios](http://donatstudios.com/PHP-Parser-HTTP_USER_AGENT).
|
||||
@@ -1,144 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Parses a user agent string into its important parts
|
||||
*
|
||||
* @author Jesse G. Donat <donatj@gmail.com>
|
||||
* @link https://github.com/donatj/PhpUserAgent
|
||||
* @link http://donatstudios.com/PHP-Parser-HTTP_USER_AGENT
|
||||
* @param string|null $u_agent User agent string to parse or null. Uses $_SERVER['HTTP_USER_AGENT'] on NULL
|
||||
* @throws InvalidArgumentException on not having a proper user agent to parse.
|
||||
* @return array an array with browser, version and platform keys
|
||||
*/
|
||||
function parse_user_agent( $u_agent = null ) {
|
||||
if( is_null($u_agent) ) {
|
||||
if( isset($_SERVER['HTTP_USER_AGENT']) ) {
|
||||
$u_agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
} else {
|
||||
throw new \InvalidArgumentException('parse_user_agent requires a user agent');
|
||||
}
|
||||
}
|
||||
|
||||
$platform = null;
|
||||
$browser = null;
|
||||
$version = null;
|
||||
|
||||
$empty = array( 'platform' => $platform, 'browser' => $browser, 'version' => $version );
|
||||
|
||||
if( !$u_agent ) return $empty;
|
||||
|
||||
if( preg_match('/\((.*?)\)/im', $u_agent, $parent_matches) ) {
|
||||
|
||||
preg_match_all('/(?P<platform>BB\d+;|Android|CrOS|iPhone|iPad|Linux|Macintosh|Windows(\ Phone)?|Silk|linux-gnu|BlackBerry|PlayBook|Nintendo\ (WiiU?|3DS)|Xbox(\ One)?)
|
||||
(?:\ [^;]*)?
|
||||
(?:;|$)/imx', $parent_matches[1], $result, PREG_PATTERN_ORDER);
|
||||
|
||||
$priority = array( 'Android', 'Xbox One', 'Xbox' );
|
||||
$result['platform'] = array_unique($result['platform']);
|
||||
if( count($result['platform']) > 1 ) {
|
||||
if( $keys = array_intersect($priority, $result['platform']) ) {
|
||||
$platform = reset($keys);
|
||||
} else {
|
||||
$platform = $result['platform'][0];
|
||||
}
|
||||
} elseif( isset($result['platform'][0]) ) {
|
||||
$platform = $result['platform'][0];
|
||||
}
|
||||
}
|
||||
|
||||
if( $platform == 'linux-gnu' ) {
|
||||
$platform = 'Linux';
|
||||
} elseif( $platform == 'CrOS' ) {
|
||||
$platform = 'Chrome OS';
|
||||
}
|
||||
|
||||
preg_match_all('%(?P<browser>Camino|Kindle(\ Fire\ Build)?|Firefox|Iceweasel|Safari|MSIE|Trident/.*rv|AppleWebKit|Chrome|IEMobile|Opera|OPR|Silk|Lynx|Midori|Version|Wget|curl|NintendoBrowser|PLAYSTATION\ (\d|Vita)+)
|
||||
(?:\)?;?)
|
||||
(?:(?:[:/ ])(?P<version>[0-9A-Z.]+)|/(?:[A-Z]*))%ix',
|
||||
$u_agent, $result, PREG_PATTERN_ORDER);
|
||||
|
||||
|
||||
// If nothing matched, return null (to avoid undefined index errors)
|
||||
if( !isset($result['browser'][0]) || !isset($result['version'][0]) ) {
|
||||
return $empty;
|
||||
}
|
||||
|
||||
$browser = $result['browser'][0];
|
||||
$version = $result['version'][0];
|
||||
|
||||
$find = function ( $search, &$key ) use ( $result ) {
|
||||
$xkey = array_search(strtolower($search), array_map('strtolower', $result['browser']));
|
||||
if( $xkey !== false ) {
|
||||
$key = $xkey;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
$key = 0;
|
||||
if( $browser == 'Iceweasel' ) {
|
||||
$browser = 'Firefox';
|
||||
} elseif( $find('Playstation Vita', $key) ) {
|
||||
$platform = 'PlayStation Vita';
|
||||
$browser = 'Browser';
|
||||
} elseif( $find('Kindle Fire Build', $key) || $find('Silk', $key) ) {
|
||||
$browser = $result['browser'][$key] == 'Silk' ? 'Silk' : 'Kindle';
|
||||
$platform = 'Kindle Fire';
|
||||
if( !($version = $result['version'][$key]) || !is_numeric($version[0]) ) {
|
||||
$version = $result['version'][array_search('Version', $result['browser'])];
|
||||
}
|
||||
} elseif( $find('NintendoBrowser', $key) || $platform == 'Nintendo 3DS' ) {
|
||||
$browser = 'NintendoBrowser';
|
||||
$version = $result['version'][$key];
|
||||
} elseif( $find('Kindle', $key) ) {
|
||||
$browser = $result['browser'][$key];
|
||||
$platform = 'Kindle';
|
||||
$version = $result['version'][$key];
|
||||
} elseif( $find('OPR', $key) ) {
|
||||
$browser = 'Opera Next';
|
||||
$version = $result['version'][$key];
|
||||
} elseif( $find('Opera', $key) ) {
|
||||
$browser = 'Opera';
|
||||
$find('Version', $key);
|
||||
$version = $result['version'][$key];
|
||||
} elseif( $find('Midori', $key) ) {
|
||||
$browser = 'Midori';
|
||||
$version = $result['version'][$key];
|
||||
} elseif( $browser == 'MSIE' || strpos($browser, 'Trident') !== false ) {
|
||||
if( $find('IEMobile', $key) ) {
|
||||
$browser = 'IEMobile';
|
||||
} else {
|
||||
$browser = 'MSIE';
|
||||
$key = 0;
|
||||
}
|
||||
$version = $result['version'][$key];
|
||||
} elseif( $find('Chrome', $key) ) {
|
||||
$browser = 'Chrome';
|
||||
$version = $result['version'][$key];
|
||||
} elseif( $browser == 'AppleWebKit' ) {
|
||||
if( ($platform == 'Android' && !($key = 0)) ) {
|
||||
$browser = 'Android Browser';
|
||||
} elseif( strpos($platform, 'BB') === 0 ) {
|
||||
$browser = 'BlackBerry Browser';
|
||||
$platform = 'BlackBerry';
|
||||
} elseif( $platform == 'BlackBerry' || $platform == 'PlayBook' ) {
|
||||
$browser = 'BlackBerry Browser';
|
||||
} elseif( $find('Safari', $key) ) {
|
||||
$browser = 'Safari';
|
||||
}
|
||||
|
||||
$find('Version', $key);
|
||||
|
||||
$version = $result['version'][$key];
|
||||
} elseif( $key = preg_grep('/playstation \d/i', array_map('strtolower', $result['browser'])) ) {
|
||||
$key = reset($key);
|
||||
|
||||
$platform = 'PlayStation ' . preg_replace('/[^\d]/i', '', $key);
|
||||
$browser = 'NetFront';
|
||||
}
|
||||
|
||||
return array( 'platform' => $platform, 'browser' => $browser, 'version' => $version );
|
||||
|
||||
}
|
||||
20
vendor/erusev/parsedown-extra/LICENSE.txt
vendored
20
vendor/erusev/parsedown-extra/LICENSE.txt
vendored
@@ -1,20 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Emanuil Rusev, erusev.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
420
vendor/erusev/parsedown-extra/ParsedownExtra.php
vendored
420
vendor/erusev/parsedown-extra/ParsedownExtra.php
vendored
@@ -1,420 +0,0 @@
|
||||
<?php
|
||||
|
||||
#
|
||||
#
|
||||
# Parsedown Extra
|
||||
# https://github.com/erusev/parsedown-extra
|
||||
#
|
||||
# (c) Emanuil Rusev
|
||||
# http://erusev.com
|
||||
#
|
||||
# For the full license information, view the LICENSE file that was distributed
|
||||
# with this source code.
|
||||
#
|
||||
#
|
||||
|
||||
class ParsedownExtra extends Parsedown
|
||||
{
|
||||
#
|
||||
# ~
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->BlockTypes[':'] []= 'DefinitionList';
|
||||
|
||||
$this->DefinitionTypes['*'] []= 'Abbreviation';
|
||||
|
||||
# identify footnote definitions before reference definitions
|
||||
array_unshift($this->DefinitionTypes['['], 'Footnote');
|
||||
|
||||
# identify footnote markers before before links
|
||||
array_unshift($this->SpanTypes['['], 'FootnoteMarker');
|
||||
}
|
||||
|
||||
#
|
||||
# ~
|
||||
|
||||
function text($text)
|
||||
{
|
||||
$markup = parent::text($text);
|
||||
|
||||
# merge consecutive dl elements
|
||||
|
||||
$markup = preg_replace('/<\/dl>\s+<dl>\s+/', '', $markup);
|
||||
|
||||
# add footnotes
|
||||
|
||||
if (isset($this->Definitions['Footnote']))
|
||||
{
|
||||
$Element = $this->buildFootnoteElement();
|
||||
|
||||
$markup .= "\n" . $this->element($Element);
|
||||
}
|
||||
|
||||
return $markup;
|
||||
}
|
||||
|
||||
#
|
||||
# Blocks
|
||||
#
|
||||
|
||||
#
|
||||
# Atx
|
||||
|
||||
protected function identifyAtx($Line)
|
||||
{
|
||||
$Block = parent::identifyAtx($Line);
|
||||
|
||||
if (preg_match('/[ ]*'.$this->attributesPattern.'[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE))
|
||||
{
|
||||
$attributeString = $matches[1][0];
|
||||
|
||||
$Block['element']['attributes'] = $this->parseAttributes($attributeString);
|
||||
|
||||
$Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]);
|
||||
}
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
#
|
||||
# Definition List
|
||||
|
||||
protected function identifyDefinitionList($Line, $Block)
|
||||
{
|
||||
if (isset($Block['type']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$Element = array(
|
||||
'name' => 'dl',
|
||||
'handler' => 'elements',
|
||||
'text' => array(),
|
||||
);
|
||||
|
||||
$terms = explode("\n", $Block['element']['text']);
|
||||
|
||||
foreach ($terms as $term)
|
||||
{
|
||||
$Element['text'] []= array(
|
||||
'name' => 'dt',
|
||||
'handler' => 'line',
|
||||
'text' => $term,
|
||||
);
|
||||
}
|
||||
|
||||
$Element['text'] []= array(
|
||||
'name' => 'dd',
|
||||
'handler' => 'line',
|
||||
'text' => ltrim($Line['text'], ' :'),
|
||||
);
|
||||
|
||||
$Block['element'] = $Element;
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
protected function addToDefinitionList($Line, array $Block)
|
||||
{
|
||||
if ($Line['text'][0] === ':')
|
||||
{
|
||||
$Block['element']['text'] []= array(
|
||||
'name' => 'dd',
|
||||
'handler' => 'line',
|
||||
'text' => ltrim($Line['text'], ' :'),
|
||||
);
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
if ( ! isset($Block['interrupted']))
|
||||
{
|
||||
$Element = array_pop($Block['element']['text']);
|
||||
|
||||
$Element['text'] .= "\n" . chop($Line['text']);
|
||||
|
||||
$Block['element']['text'] []= $Element;
|
||||
|
||||
return $Block;
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Setext
|
||||
|
||||
protected function identifySetext($Line, array $Block = null)
|
||||
{
|
||||
$Block = parent::identifySetext($Line, $Block);
|
||||
|
||||
if (preg_match('/[ ]*'.$this->attributesPattern.'[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE))
|
||||
{
|
||||
$attributeString = $matches[1][0];
|
||||
|
||||
$Block['element']['attributes'] = $this->parseAttributes($attributeString);
|
||||
|
||||
$Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]);
|
||||
}
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
#
|
||||
# Markup
|
||||
|
||||
protected function completeMarkup($Block)
|
||||
{
|
||||
$DOMDocument = new DOMDocument;
|
||||
|
||||
$DOMDocument->loadXML($Block['element'], LIBXML_NOERROR | LIBXML_NOWARNING);
|
||||
|
||||
if ($DOMDocument->documentElement === null)
|
||||
{
|
||||
return $Block;
|
||||
}
|
||||
|
||||
$result = $DOMDocument->documentElement->getAttribute('markdown');
|
||||
|
||||
if ($result !== '1')
|
||||
{
|
||||
return $Block;
|
||||
}
|
||||
|
||||
$DOMDocument->documentElement->removeAttribute('markdown');
|
||||
|
||||
$index = 0;
|
||||
$texts = array();
|
||||
|
||||
foreach ($DOMDocument->documentElement->childNodes as $Node)
|
||||
{
|
||||
if ($Node instanceof DOMText)
|
||||
{
|
||||
$texts [] = $this->text($Node->nodeValue);
|
||||
|
||||
# replaces the text of the node with a placeholder
|
||||
$Node->nodeValue = '\x1A'.$index ++;
|
||||
}
|
||||
}
|
||||
|
||||
$markup = $DOMDocument->saveXML($DOMDocument->documentElement);
|
||||
|
||||
foreach ($texts as $index => $text)
|
||||
{
|
||||
$markup = str_replace('\x1A'.$index, $text, $markup);
|
||||
}
|
||||
|
||||
$Block['element'] = $markup;
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
#
|
||||
# Definitions
|
||||
#
|
||||
|
||||
#
|
||||
# Abbreviation
|
||||
|
||||
protected function identifyAbbreviation($Line)
|
||||
{
|
||||
if (preg_match('/^\*\[(.+?)\]:[ ]*(.+?)[ ]*$/', $Line['text'], $matches))
|
||||
{
|
||||
$Abbreviation = array(
|
||||
'id' => $matches[1],
|
||||
'data' => $matches[2],
|
||||
);
|
||||
|
||||
return $Abbreviation;
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Footnote
|
||||
|
||||
protected function identifyFootnote($Line)
|
||||
{
|
||||
if (preg_match('/^\[\^(.+?)\]:[ ]?(.+)$/', $Line['text'], $matches))
|
||||
{
|
||||
$Footnote = array(
|
||||
'id' => $matches[1],
|
||||
'data' => array(
|
||||
'text' => $matches[2],
|
||||
'count' => null,
|
||||
'number' => null,
|
||||
),
|
||||
);
|
||||
|
||||
return $Footnote;
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Spans
|
||||
#
|
||||
|
||||
#
|
||||
# Footnote Marker
|
||||
|
||||
protected function identifyFootnoteMarker($Excerpt)
|
||||
{
|
||||
if (preg_match('/^\[\^(.+?)\]/', $Excerpt['text'], $matches))
|
||||
{
|
||||
$name = $matches[1];
|
||||
|
||||
if ( ! isset($this->Definitions['Footnote'][$name]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->Definitions['Footnote'][$name]['count'] ++;
|
||||
|
||||
if ( ! isset($this->Definitions['Footnote'][$name]['number']))
|
||||
{
|
||||
$this->Definitions['Footnote'][$name]['number'] = ++ $this->footnoteCount; # » &
|
||||
}
|
||||
|
||||
$Element = array(
|
||||
'name' => 'sup',
|
||||
'attributes' => array('id' => 'fnref'.$this->Definitions['Footnote'][$name]['count'].':'.$name),
|
||||
'handler' => 'element',
|
||||
'text' => array(
|
||||
'name' => 'a',
|
||||
'attributes' => array('href' => '#fn:'.$name, 'class' => 'footnote-ref'),
|
||||
'text' => $this->Definitions['Footnote'][$name]['number'],
|
||||
),
|
||||
);
|
||||
|
||||
return array(
|
||||
'extent' => strlen($matches[0]),
|
||||
'element' => $Element,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private $footnoteCount = 0;
|
||||
|
||||
#
|
||||
# Link
|
||||
|
||||
protected function identifyLink($Excerpt)
|
||||
{
|
||||
$Span = parent::identifyLink($Excerpt);
|
||||
|
||||
$remainder = substr($Excerpt['text'], $Span['extent']);
|
||||
|
||||
if (preg_match('/^[ ]*'.$this->attributesPattern.'/', $remainder, $matches))
|
||||
{
|
||||
$Span['element']['attributes'] += $this->parseAttributes($matches[1]);
|
||||
|
||||
$Span['extent'] += strlen($matches[0]);
|
||||
}
|
||||
|
||||
return $Span;
|
||||
}
|
||||
|
||||
#
|
||||
# ~
|
||||
|
||||
protected function readPlainText($text)
|
||||
{
|
||||
$text = parent::readPlainText($text);
|
||||
|
||||
if (isset($this->Definitions['Abbreviation']))
|
||||
{
|
||||
foreach ($this->Definitions['Abbreviation'] as $abbreviation => $phrase)
|
||||
{
|
||||
$text = str_replace($abbreviation, '<abbr title="'.$phrase.'">'.$abbreviation.'</abbr>', $text);
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
#
|
||||
# ~
|
||||
#
|
||||
|
||||
protected function buildFootnoteElement()
|
||||
{
|
||||
$Element = array(
|
||||
'name' => 'div',
|
||||
'attributes' => array('class' => 'footnotes'),
|
||||
'handler' => 'elements',
|
||||
'text' => array(
|
||||
array(
|
||||
'name' => 'hr',
|
||||
),
|
||||
array(
|
||||
'name' => 'ol',
|
||||
'handler' => 'elements',
|
||||
'text' => array(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
usort($this->Definitions['Footnote'], function($A, $B) {
|
||||
return $A['number'] - $B['number'];
|
||||
});
|
||||
|
||||
foreach ($this->Definitions['Footnote'] as $name => $Data)
|
||||
{
|
||||
if ( ! isset($Data['number']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$text = $Data['text'];
|
||||
|
||||
foreach (range(1, $Data['count']) as $number)
|
||||
{
|
||||
$text .= ' <a href="#fnref'.$number.':'.$name.'" rev="footnote" class="footnote-backref">↩</a>';
|
||||
}
|
||||
|
||||
$Element['text'][1]['text'] []= array(
|
||||
'name' => 'li',
|
||||
'attributes' => array('id' => 'fn:'.$name),
|
||||
'handler' => 'elements',
|
||||
'text' => array(
|
||||
array(
|
||||
'name' => 'p',
|
||||
'text' => $text,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return $Element;
|
||||
}
|
||||
|
||||
#
|
||||
# Private
|
||||
#
|
||||
|
||||
private function parseAttributes($attributeString)
|
||||
{
|
||||
$Data = array();
|
||||
|
||||
$attributes = preg_split('/[ ]+/', $attributeString, - 1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach ($attributes as $attribute)
|
||||
{
|
||||
if ($attribute[0] === '#')
|
||||
{
|
||||
$Data['id'] = substr($attribute, 1);
|
||||
}
|
||||
else # "."
|
||||
{
|
||||
$classes []= substr($attribute, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($classes))
|
||||
{
|
||||
$Data['class'] = implode(' ', $classes);
|
||||
}
|
||||
|
||||
return $Data;
|
||||
}
|
||||
|
||||
private $attributesPattern = '{((?:[#.][-\w]+[ ]*)+)}';
|
||||
}
|
||||
17
vendor/erusev/parsedown-extra/README.md
vendored
17
vendor/erusev/parsedown-extra/README.md
vendored
@@ -1,17 +0,0 @@
|
||||
## Parsedown Extra
|
||||
|
||||
An extension of [Parsedown](http://parsedown.org) that adds support for [Markdown Extra](http://en.wikipedia.org/wiki/Markdown_Extra).
|
||||
|
||||
[[ demo ]](http://parsedown.org/demo?extra=1)
|
||||
|
||||
### Installation
|
||||
|
||||
Include both `Parsedown.php` and `ParsedownExtra.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown-extra).
|
||||
|
||||
### Example
|
||||
|
||||
``` php
|
||||
$Instance = new ParsedownExtra();
|
||||
|
||||
echo $Instance->text('Hello _Parsedown Extra_!'); # prints: <p>Hello <em>Parsedown Extra</em>!</p>
|
||||
```
|
||||
20
vendor/erusev/parsedown/LICENSE.txt
vendored
20
vendor/erusev/parsedown/LICENSE.txt
vendored
@@ -1,20 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Emanuil Rusev, erusev.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
1402
vendor/erusev/parsedown/Parsedown.php
vendored
1402
vendor/erusev/parsedown/Parsedown.php
vendored
File diff suppressed because it is too large
Load Diff
40
vendor/erusev/parsedown/README.md
vendored
40
vendor/erusev/parsedown/README.md
vendored
@@ -1,40 +0,0 @@
|
||||
## Parsedown
|
||||
|
||||
Better [Markdown](http://en.wikipedia.org/wiki/Markdown) parser for PHP.
|
||||
|
||||
* [Demo](http://parsedown.org/demo)
|
||||
* [Test Suite](http://parsedown.org/tests/)
|
||||
|
||||
### Features
|
||||
|
||||
* [Fast](http://parsedown.org/speed)
|
||||
* [Consistent](http://parsedown.org/consistency)
|
||||
* [GitHub Flavored](https://help.github.com/articles/github-flavored-markdown)
|
||||
* [Tested](https://travis-ci.org/erusev/parsedown) in PHP 5.2, 5.3, 5.4, 5.5, 5.6 and [hhvm](http://www.hhvm.com/)
|
||||
* Extensible
|
||||
* [Markdown Extra extension](https://github.com/erusev/parsedown-extra) <sup>new</sup>
|
||||
|
||||
### Installation
|
||||
|
||||
Include `Parsedown.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown).
|
||||
|
||||
### Example
|
||||
|
||||
``` php
|
||||
$Parsedown = new Parsedown();
|
||||
|
||||
echo $Parsedown->text('Hello _Parsedown_!'); # prints: <p>Hello <em>Parsedown</em>!</p>
|
||||
```
|
||||
|
||||
More examples in [the wiki](https://github.com/erusev/parsedown/wiki/Usage).
|
||||
|
||||
### Questions
|
||||
|
||||
**How does Parsedown work?**<br/>
|
||||
Parsedown recognises that the Markdown syntax is optimised for humans so it tries to read like one. It goes through text line by line. It looks at how lines start to identify blocks. It looks for special characters to identify inline elements.
|
||||
|
||||
**Why doesn’t Parsedown use namespaces?**<br/>
|
||||
Using namespaces would mean dropping support for PHP 5.2. Since Parsedown is a single class with an uncommon name, making this trade wouldn't make much sense.
|
||||
|
||||
**Who uses Parsedown?**<br/>
|
||||
[phpDocumentor](http://www.phpdoc.org/), [Bolt CMS](http://bolt.cm/), [RaspberryPi.org](http://www.raspberrypi.org/) and [more](https://www.versioneye.com/php/erusev:parsedown/references).
|
||||
291
vendor/gregwar/cache/Gregwar/Cache/Cache.php
vendored
291
vendor/gregwar/cache/Gregwar/Cache/Cache.php
vendored
@@ -1,291 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Cache;
|
||||
|
||||
/**
|
||||
* A cache system based on files
|
||||
*
|
||||
* @author Gregwar <g.passault@gmail.com>
|
||||
*/
|
||||
class Cache
|
||||
{
|
||||
/**
|
||||
* Cache directory
|
||||
*/
|
||||
protected $cacheDirectory;
|
||||
|
||||
/**
|
||||
* Use a different directory as actual cache
|
||||
*/
|
||||
protected $actualCacheDirectory = null;
|
||||
|
||||
/**
|
||||
* Prefix directories size
|
||||
*
|
||||
* For instance, if the file is helloworld.txt and the prefix size is
|
||||
* 5, the cache file will be: h/e/l/l/o/helloworld.txt
|
||||
*
|
||||
* This is useful to avoid reaching a too large number of files into the
|
||||
* cache system directories
|
||||
*/
|
||||
protected $prefixSize = 5;
|
||||
|
||||
/**
|
||||
* Constructs the cache system
|
||||
*/
|
||||
public function __construct($cacheDirectory = 'cache')
|
||||
{
|
||||
$this->cacheDirectory = $cacheDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cache directory
|
||||
*
|
||||
* @param $cacheDirectory the cache directory
|
||||
*/
|
||||
public function setCacheDirectory($cacheDirectory)
|
||||
{
|
||||
$this->cacheDirectory = $cacheDirectory;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cache directory
|
||||
*
|
||||
* @return string the cache directory
|
||||
*/
|
||||
public function getCacheDirectory()
|
||||
{
|
||||
return $this->cacheDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the actual cache directory
|
||||
*/
|
||||
public function setActualCacheDirectory($actualCacheDirectory = null)
|
||||
{
|
||||
$this->actualCacheDirectory = $actualCacheDirectory;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the actual cache directory
|
||||
*/
|
||||
public function getActualCacheDirectory()
|
||||
{
|
||||
return $this->actualCacheDirectory ?: $this->cacheDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the prefix size
|
||||
*
|
||||
* @param $prefixSize the size of the prefix directories
|
||||
*/
|
||||
public function setPrefixSize($prefixSize)
|
||||
{
|
||||
$this->prefixSize = $prefixSize;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a directory
|
||||
*
|
||||
* @param $directory, the target directory
|
||||
*/
|
||||
protected function mkdir($directory)
|
||||
{
|
||||
if (!is_dir($directory)) {
|
||||
@mkdir($directory, 0755, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cache file name
|
||||
*
|
||||
* @param $filename, the name of the cache file
|
||||
* @param $actual get the actual file or the public file
|
||||
* @param $mkdir, a boolean to enable/disable the construction of the
|
||||
* cache file directory
|
||||
*/
|
||||
public function getCacheFile($filename, $actual = false, $mkdir = false)
|
||||
{
|
||||
$path = array();
|
||||
|
||||
// Getting the length of the filename before the extension
|
||||
$parts = explode('.', $filename);
|
||||
$len = strlen($parts[0]);
|
||||
|
||||
for ($i=0; $i<min($len, $this->prefixSize); $i++) {
|
||||
$path[] = $filename[$i];
|
||||
|
||||
}
|
||||
$path = implode('/', $path);
|
||||
|
||||
$actualDir = $this->getActualCacheDirectory() . '/' . $path;
|
||||
if ($mkdir && !is_dir($actualDir)) {
|
||||
mkdir($actualDir, 0755, true);
|
||||
}
|
||||
|
||||
$path .= '/' . $filename;
|
||||
|
||||
if ($actual) {
|
||||
return $this->getActualCacheDirectory() . '/' . $path;
|
||||
} else {
|
||||
return $this->getCacheDirectory() . '/' . $path;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the cache conditions are respected
|
||||
*
|
||||
* @param $cacheFile the cache file
|
||||
* @param $conditions an array of conditions to check
|
||||
*/
|
||||
protected function checkConditions($cacheFile, array $conditions = array())
|
||||
{
|
||||
// Implicit condition: the cache file should exist
|
||||
if (!file_exists($cacheFile)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($conditions as $type => $value) {
|
||||
switch ($type) {
|
||||
case 'maxage':
|
||||
case 'max-age':
|
||||
// Return false if the file is older than $value
|
||||
$age = time() - filectime($cacheFile);
|
||||
if ($age > $value) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'younger-than':
|
||||
case 'youngerthan':
|
||||
// Return false if the file is older than the file $value, or the files $value
|
||||
$check = function($filename) use ($cacheFile) {
|
||||
return !file_exists($filename) || filectime($cacheFile) < filectime($filename);
|
||||
};
|
||||
|
||||
if (!is_array($value)) {
|
||||
if (!$this->isRemote($value) && $check($value)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
foreach ($value as $file) {
|
||||
if (!$this->isRemote($file) && $check($file)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('Cache condition '.$type.' not supported');
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the targt filename exists in the cache and if the conditions
|
||||
* are respected
|
||||
*
|
||||
* @param $filename the filename
|
||||
* @param $conditions the conditions to respect
|
||||
*/
|
||||
public function exists($filename, array $conditions = array())
|
||||
{
|
||||
$cacheFile = $this->getCacheFile($filename, true);
|
||||
|
||||
return $this->checkConditions($cacheFile, $conditions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for exists
|
||||
*/
|
||||
public function check($filename, array $conditions = array())
|
||||
{
|
||||
return $this->exists($filename, $conditions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write data in the cache
|
||||
*/
|
||||
public function set($filename, $contents = '')
|
||||
{
|
||||
$cacheFile = $this->getCacheFile($filename, true, true);
|
||||
|
||||
file_put_contents($cacheFile, $contents);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for set()
|
||||
*/
|
||||
public function write($filename, $contents = '')
|
||||
{
|
||||
return $this->set($filename, $contents);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data from the cache
|
||||
*/
|
||||
public function get($filename, array $conditions = array())
|
||||
{
|
||||
if ($this->exists($filename, $conditions)) {
|
||||
return file_get_contents($this->getCacheFile($filename, true));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this URL remote?
|
||||
*/
|
||||
protected function isRemote($file)
|
||||
{
|
||||
return preg_match('/^http(s{0,1}):\/\//', $file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or create the cache entry
|
||||
*
|
||||
* @param $filename the cache file name
|
||||
* @param $conditions an array of conditions about expiration
|
||||
* @param $function the closure to call if the file does not exists
|
||||
* @param $file returns the cache file or the file contents
|
||||
* @param $actual returns the actual cache file
|
||||
*/
|
||||
public function getOrCreate($filename, array $conditions = array(), \Closure $function, $file = false, $actual = false)
|
||||
{
|
||||
$cacheFile = $this->getCacheFile($filename, true, true);
|
||||
$data = null;
|
||||
|
||||
if ($this->check($filename, $conditions)) {
|
||||
$data = file_get_contents($cacheFile);
|
||||
} else {
|
||||
@unlink($cacheFile);
|
||||
$data = $function($cacheFile);
|
||||
|
||||
// Test if the closure wrote the file or if it returned the data
|
||||
if (!file_exists($cacheFile)) {
|
||||
$this->set($filename, $data);
|
||||
} else {
|
||||
$data = file_get_contents($cacheFile);
|
||||
}
|
||||
}
|
||||
|
||||
return $file ? $this->getCacheFile($filename, $actual) : $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias to getOrCreate with $file = true
|
||||
*/
|
||||
public function getOrCreateFile($filename, array $conditions = array(), \Closure $function, $actual = false)
|
||||
{
|
||||
return $this->getOrCreate($filename, $conditions, $function, true, $actual);
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Cache;
|
||||
|
||||
/**
|
||||
* Garbage collect a directory, this will crawl a directory, lookng
|
||||
* for files older than X days and destroy them
|
||||
*
|
||||
* @author Gregwar <g.passault@gmail.com>
|
||||
*/
|
||||
class GarbageCollect
|
||||
{
|
||||
/**
|
||||
* Drops old files of a directory
|
||||
*
|
||||
* @param string $directory the name of the target directory
|
||||
* @param int $days the number of days to consider a file old
|
||||
* @param bool $verbose enable verbose output
|
||||
*
|
||||
* @return true if all the files/directories of a directory was wiped
|
||||
*/
|
||||
public static function dropOldFiles($directory, $days = 30, $verbose = false)
|
||||
{
|
||||
$allDropped = true;
|
||||
$now = time();
|
||||
|
||||
$dir = opendir($directory);
|
||||
|
||||
if (!$dir) {
|
||||
if ($verbose) {
|
||||
echo "! Unable to open $directory\n";
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
while ($file = readdir($dir)) {
|
||||
if ($file == '.' || $file == '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullName = $directory.'/'.$file;
|
||||
|
||||
$old = $now-filemtime($fullName);
|
||||
|
||||
if (is_dir($fullName)) {
|
||||
// Directories are recursively crawled
|
||||
if (static::dropOldFiles($fullName, $days, $verbose)) {
|
||||
self::drop($fullName, $verbose);
|
||||
} else {
|
||||
$allDropped = false;
|
||||
}
|
||||
} else {
|
||||
if ($old > (24*60*60*$days)) {
|
||||
self::drop($fullName, $verbose);
|
||||
} else {
|
||||
$allDropped = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dir);
|
||||
|
||||
return $allDropped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops a file or an empty directory
|
||||
*
|
||||
* @param $file the file to be removed
|
||||
* @param $verbose the verbosity
|
||||
*/
|
||||
public static function drop($file, $verbose = false)
|
||||
{
|
||||
if (is_dir($file)) {
|
||||
@rmdir($file);
|
||||
} else {
|
||||
@unlink($file);
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
echo "> Dropping $file...\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
19
vendor/gregwar/cache/Gregwar/Cache/LICENSE
vendored
19
vendor/gregwar/cache/Gregwar/Cache/LICENSE
vendored
@@ -1,19 +0,0 @@
|
||||
Copyright (c) <2013> Grégoire Passault
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
162
vendor/gregwar/cache/Gregwar/Cache/README.md
vendored
162
vendor/gregwar/cache/Gregwar/Cache/README.md
vendored
@@ -1,162 +0,0 @@
|
||||
Cache
|
||||
=====
|
||||
|
||||
This is a lightweight cache system based on file and directories.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Step 1: Install it
|
||||
------------------
|
||||
|
||||
Via composer:
|
||||
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
"gregwar/cache": "1.0.*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Or with a clone of the repository:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Gregwar/Cache.git
|
||||
```
|
||||
|
||||
Or downloading it:
|
||||
|
||||
* [Download .zip](https://github.com/Gregwar/Cache/archive/master.zip)
|
||||
* [Download .tar.gz](https://github.com/Gregwar/Cache/archive/master.tar.gz)
|
||||
|
||||
Step 2: Setup the rights
|
||||
------------------------
|
||||
|
||||
You need your PHP script to have access to the cache directory, you can for instance
|
||||
create a `cache` directory with mode 777:
|
||||
|
||||
```
|
||||
mkdir cache
|
||||
chmod 777 cache
|
||||
```
|
||||
|
||||
Step 3: Access the cache
|
||||
------------------------
|
||||
|
||||
To access the cache, you can do like this:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
include('vendor/autoload.php'); // If using composer
|
||||
|
||||
use Gregwar\Cache\Cache;
|
||||
|
||||
$cache = new Cache;
|
||||
$cache->setCacheDirectory('cache'); // This is the default
|
||||
|
||||
// If the cache exists, this will return it, else, the closure will be called
|
||||
// to create this image
|
||||
$data = $cache->getOrCreate('red-square.png', array(), function($filename) {
|
||||
$i = imagecreatetruecolor(100, 100);
|
||||
imagefill($i, 0, 0, 0xff0000);
|
||||
imagepng($i, $filename);
|
||||
});
|
||||
|
||||
header('Content-type: image/png');
|
||||
echo $data;
|
||||
```
|
||||
|
||||
This will render a red square. If the cache file (which will look like `cache/r/e/d/-/s/red-square.png')
|
||||
exists, it will be read, else, the closure will be called in order to create the cache file.
|
||||
|
||||
API
|
||||
===
|
||||
|
||||
You can use the following methods:
|
||||
|
||||
* `setCacheDirectory($directory)`: sets the cache directory (see below).
|
||||
* `setActualCacheDirectory($directory)`: sets the actual cache directory (see below).
|
||||
* `exists($filename, $conditions = array())`: check that the $filename file exists in the cache, checking
|
||||
the conditions (see below).
|
||||
* `check($filename, $conditions = array())`: alias for `exists`.
|
||||
* `getCacheFile($filename, $actual = false, $mkdir = false)`: gets the cache file. If the `$actual` flag
|
||||
is true, the actual cache file name will be returned (see below), if the `$mkdir` flag is true, the
|
||||
cache file directories tree will be created.
|
||||
* `set($filename, $contents)`: write contents to `$filename` cache file.
|
||||
* `write($filename, $contents)`: alias for `set()`
|
||||
* `get($filename, $conditions = array())`: if the cache file for `$filename` exists, contents will be
|
||||
returned, else, `NULL` will be returned.
|
||||
* `setPrefixSize($prefixSize)`: sets the prefix size for directories, default is 5. For instance, the
|
||||
cache file for `helloworld.txt`, will be `'h/e/l/l/o/helloworld.txt`.
|
||||
* `getOrCreate($filename, $conditions = array(), $function, $file = false)`: this will check if the `$filename`
|
||||
cache file exists and verifies `$conditions` (see below). If the cache file is OK, it will return its
|
||||
contents. Else, it will call the `$function`, passing it the target file, this function can write the
|
||||
file given in parameter or just return data. Then, cache data will be returned. If `$file` flag is set,
|
||||
the cache file name will be returned instead of file data.
|
||||
|
||||
Note: consider using an hash for the `$filename` cache file, to avoid special characters.
|
||||
|
||||
Conditions
|
||||
==========
|
||||
|
||||
You can use conditions to manage file expirations on the cache, there is two way of expiring:
|
||||
|
||||
* Using `max-age`, in seconds, to set the maximum age of the file
|
||||
* Using `younger-than`, by passing another file, this will compare the modification date
|
||||
and regenerate the cache if the given file is younger.
|
||||
|
||||
For instance, if you want to uppercase a file:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use Gregwar\Cache\Cache;
|
||||
|
||||
$cache = new Cache;
|
||||
|
||||
$data = $cache->getOrCreate('uppercase.txt',
|
||||
array(
|
||||
'younger-than' => 'original.txt'
|
||||
),
|
||||
function() {
|
||||
echo "Generating file...\n";
|
||||
return strtoupper(file_get_contents('original.txt'));
|
||||
});
|
||||
|
||||
echo $data;
|
||||
```
|
||||
|
||||
This will be create the `uppercase.txt` cache file by uppercasing the `original.txt` if the cache file
|
||||
does not exists or if the `original.txt` file is more recent than the cache file.
|
||||
|
||||
For instance:
|
||||
|
||||
```
|
||||
php uppercase.php # Will generate the cache file
|
||||
php uppercase.php # Will not generate the cache file
|
||||
touch original.txt # Sets the last modification time to now
|
||||
php uppercase.php # Will re-generate the cache file
|
||||
```
|
||||
|
||||
Cache directory and actual cache directory
|
||||
==========================================
|
||||
|
||||
In some cases, you'll want to get the cache file name. For instance, if you're caching
|
||||
images, you'll want to give a string like `cache/s/o/m/e/i/someimage.png` to put it into
|
||||
an `<img>` tag. This can be done by passing the `$file` argument to the `getOrCreate` to true,
|
||||
or directly using `getCacheFile` method (see above).
|
||||
|
||||
However, the visible `cache` directory of your users is not the same as the absolute path
|
||||
you want to access. To do that, you can set both the cache directory and the actual cache directory.
|
||||
|
||||
The cache directory is the prefix visible by the users (for instance: `cache/s/o/m/e/i/someimage.png`),
|
||||
and the actual cache directory is the prefix to use to actually access to the image (for instance:
|
||||
`/var/www/somesite/cache/s/o/m/e/i/someimage.png`). This way, the file will be accessed using absolute
|
||||
path and the cache file returned will directly be usable for your user's browsers.
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
This repository is under the MIT license, have a look at the `LICENCE` file.
|
||||
16
vendor/gregwar/cache/Gregwar/Cache/autoload.php
vendored
16
vendor/gregwar/cache/Gregwar/Cache/autoload.php
vendored
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Registers an autoload for all the classes in Gregwar\Cache
|
||||
*/
|
||||
spl_autoload_register(function ($className) {
|
||||
$namespace = 'Gregwar\\Cache';
|
||||
|
||||
if (strpos($className, $namespace) === 0) {
|
||||
$className = str_replace($namespace, '', $className);
|
||||
$fileName = __DIR__ . '/' . str_replace('\\', '/', $className) . '.php';
|
||||
if (file_exists($fileName)) {
|
||||
require($fileName);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Adapter;
|
||||
|
||||
use Gregwar\Image\Source\Source;
|
||||
|
||||
/**
|
||||
* Base Adapter Implementation to handle Image information
|
||||
*/
|
||||
abstract class Adapter implements AdapterInterface
|
||||
{
|
||||
/**
|
||||
* @var Source
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
* The image resource handler
|
||||
*/
|
||||
protected $resource;
|
||||
|
||||
public function __construct(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function setSource(Source $source)
|
||||
{
|
||||
$this->source = $source;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this adapter supports the given type ?
|
||||
*/
|
||||
protected function supports($type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the image to true color
|
||||
*/
|
||||
protected function convertToTrueColor()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,378 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Adapter;
|
||||
|
||||
use Gregwar\Image\Image;
|
||||
use Gregwar\Image\Source\Source;
|
||||
|
||||
/**
|
||||
* all the functions / methods to work on images
|
||||
*
|
||||
* if changing anything please also add it to \Gregwar\Image\Image
|
||||
*
|
||||
* @author wodka <michael.schramm@gmail.com>
|
||||
*/
|
||||
interface AdapterInterface{
|
||||
/**
|
||||
* set the image source for the adapter
|
||||
*
|
||||
* @param Source $source
|
||||
* @return $this
|
||||
*/
|
||||
public function setSource(Source $source);
|
||||
|
||||
/**
|
||||
* get the raw resource
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
public function getResource();
|
||||
|
||||
/**
|
||||
* Gets the name of the adapter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* Image width
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function width();
|
||||
|
||||
/**
|
||||
* Image height
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function height();
|
||||
|
||||
/**
|
||||
* Init the resource
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function init();
|
||||
|
||||
/**
|
||||
* Save the image as a gif
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function saveGif($file);
|
||||
|
||||
/**
|
||||
* Save the image as a png
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function savePng($file);
|
||||
|
||||
/**
|
||||
* Save the image as a jpeg
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function saveJpeg($file, $quality);
|
||||
|
||||
/**
|
||||
* Works as resize() excepts that the layout will be cropped
|
||||
*
|
||||
* @param int $width the width
|
||||
* @param int $height the height
|
||||
* @param int $background the background
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function cropResize($width = null, $height = null, $background=0xffffff);
|
||||
|
||||
|
||||
/**
|
||||
* Resize the image preserving scale. Can enlarge it.
|
||||
*
|
||||
* @param int $width the width
|
||||
* @param int $height the height
|
||||
* @param int $background the background
|
||||
* @param boolean $crop
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function scaleResize($width = null, $height = null, $background=0xffffff, $crop = false);
|
||||
|
||||
/**
|
||||
* Resizes the image. It will never be enlarged.
|
||||
*
|
||||
* @param int $width the width
|
||||
* @param int $height the height
|
||||
* @param int $background the background
|
||||
* @param boolean $force
|
||||
* @param boolean $rescale
|
||||
* @param boolean $crop
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function resize($width = null, $height = null, $background = 0xffffff, $force = false, $rescale = false, $crop = false);
|
||||
|
||||
/**
|
||||
* Crops the image
|
||||
*
|
||||
* @param int $x the top-left x position of the crop box
|
||||
* @param int $y the top-left y position of the crop box
|
||||
* @param int $width the width of the crop box
|
||||
* @param int $height the height of the crop box
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function crop($x, $y, $width, $height);
|
||||
|
||||
/**
|
||||
* enable progressive image loading
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function enableProgressive();
|
||||
|
||||
/**
|
||||
* Resizes the image forcing the destination to have exactly the
|
||||
* given width and the height
|
||||
*
|
||||
* @param int $width the width
|
||||
* @param int $height the height
|
||||
* @param int $background the background
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function forceResize($width = null, $height = null, $background = 0xffffff);
|
||||
|
||||
/**
|
||||
* Perform a zoom crop of the image to desired width and height
|
||||
*
|
||||
* @param integer $width Desired width
|
||||
* @param integer $height Desired height
|
||||
* @param int $background
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function zoomCrop($width, $height, $background = 0xffffff);
|
||||
|
||||
|
||||
/**
|
||||
* Fills the image background to $bg if the image is transparent
|
||||
*
|
||||
* @param int $background background color
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function fillBackground($background = 0xffffff);
|
||||
|
||||
|
||||
/**
|
||||
* Negates the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function negate();
|
||||
|
||||
/**
|
||||
* Changes the brightness of the image
|
||||
*
|
||||
* @param int $brightness the brightness
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function brightness($brightness);
|
||||
|
||||
/**
|
||||
* Contrasts the image
|
||||
*
|
||||
* @param int $contrast the contrast [-100, 100]
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function contrast($contrast);
|
||||
|
||||
/**
|
||||
* Apply a grayscale level effect on the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function grayscale();
|
||||
|
||||
/**
|
||||
* Emboss the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function emboss();
|
||||
|
||||
/**
|
||||
* Smooth the image
|
||||
*
|
||||
* @param int $p value between [-10,10]
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function smooth($p);
|
||||
|
||||
/**
|
||||
* Sharps the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function sharp();
|
||||
|
||||
/**
|
||||
* Edges the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function edge();
|
||||
|
||||
/**
|
||||
* Colorize the image
|
||||
*
|
||||
* @param int $red value in range [-255, 255]
|
||||
* @param int $green value in range [-255, 255]
|
||||
* @param int $blue value in range [-255, 255]
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function colorize($red, $green, $blue);
|
||||
|
||||
/**
|
||||
* apply sepia to the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function sepia();
|
||||
|
||||
/**
|
||||
* Merge with another image
|
||||
*
|
||||
* @param Image $other
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function merge(Image $other, $x = 0, $y = 0, $width = null, $height = null);
|
||||
|
||||
/**
|
||||
* Rotate the image
|
||||
*
|
||||
* @param float $angle
|
||||
* @param int $background
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function rotate($angle, $background = 0xffffff);
|
||||
|
||||
/**
|
||||
* Fills the image
|
||||
*
|
||||
* @param int $color
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function fill($color = 0xffffff, $x = 0, $y = 0);
|
||||
|
||||
/**
|
||||
* write text to the image
|
||||
*
|
||||
* @param string $font
|
||||
* @param string $text
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $size
|
||||
* @param int $angle
|
||||
* @param int $color
|
||||
* @param string $align
|
||||
*/
|
||||
public function write($font, $text, $x = 0, $y = 0, $size = 12, $angle = 0, $color = 0x000000, $align = 'left');
|
||||
|
||||
/**
|
||||
* Draws a rectangle
|
||||
*
|
||||
* @param int $x1
|
||||
* @param int $y1
|
||||
* @param int $x2
|
||||
* @param int $y2
|
||||
* @param int $color
|
||||
* @param bool $filled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function rectangle($x1, $y1, $x2, $y2, $color, $filled = false);
|
||||
|
||||
/**
|
||||
* Draws a rounded rectangle
|
||||
*
|
||||
* @param int $x1
|
||||
* @param int $y1
|
||||
* @param int $x2
|
||||
* @param int $y2
|
||||
* @param int $radius
|
||||
* @param int $color
|
||||
* @param bool $filled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function roundedRectangle($x1, $y1, $x2, $y2, $radius, $color, $filled = false);
|
||||
|
||||
/**
|
||||
* Draws a line
|
||||
*
|
||||
* @param int $x1
|
||||
* @param int $y1
|
||||
* @param int $x2
|
||||
* @param int $y2
|
||||
* @param int $color
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function line($x1, $y1, $x2, $y2, $color = 0x000000);
|
||||
|
||||
/**
|
||||
* Draws an ellipse
|
||||
*
|
||||
* @param int $cx
|
||||
* @param int $cy
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @param int $color
|
||||
* @param bool $filled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function ellipse($cx, $cy, $width, $height, $color = 0x000000, $filled = false);
|
||||
|
||||
/**
|
||||
* Draws a circle
|
||||
*
|
||||
* @param int $cx
|
||||
* @param int $cy
|
||||
* @param int $r
|
||||
* @param int $color
|
||||
* @param bool $filled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function circle($cx, $cy, $r, $color = 0x000000, $filled = false);
|
||||
|
||||
/**
|
||||
* Draws a polygon
|
||||
*
|
||||
* @param array $points
|
||||
* @param int $color
|
||||
* @param bool $filled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function polygon(array $points, $color, $filled = false);
|
||||
}
|
||||
@@ -1,275 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Adapter;
|
||||
|
||||
abstract class Common extends Adapter
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function zoomCrop($width, $height, $background = 'transparent')
|
||||
{
|
||||
// Calculate the different ratios
|
||||
$originalRatio = $this->width() / $this->height();
|
||||
$newRatio = $width / $height;
|
||||
|
||||
// Compare ratios
|
||||
if ($originalRatio > $newRatio) {
|
||||
// Original image is wider
|
||||
$newHeight = $height;
|
||||
$newWidth = (int) $height * $originalRatio;
|
||||
} else {
|
||||
// Equal width or smaller
|
||||
$newHeight = (int) $width / $originalRatio;
|
||||
$newWidth = $width;
|
||||
}
|
||||
|
||||
// Perform resize
|
||||
$this->resize($newWidth, $newHeight, $background, true);
|
||||
|
||||
// Calculate cropping area
|
||||
$xPos = (int) ($newWidth - $width) / 2;
|
||||
$yPos = (int) ($newHeight - $height) / 2;
|
||||
|
||||
// Crop image to reach desired size
|
||||
$this->crop($xPos, $yPos, $width, $height);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the image forcing the destination to have exactly the
|
||||
* given width and the height
|
||||
*
|
||||
* @param int $w the width
|
||||
* @param int $h the height
|
||||
* @param int $bg the background
|
||||
*/
|
||||
public function forceResize($width = null, $height = null, $background = 'transparent')
|
||||
{
|
||||
return $this->resize($width, $height, $background, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function scaleResize($width = null, $height = null, $background='transparent', $crop = false)
|
||||
{
|
||||
return $this->resize($width, $height, $background, false, true, $crop);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function cropResize($width = null, $height = null, $background='transparent')
|
||||
{
|
||||
return $this->resize($width, $height, $background, false, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the image
|
||||
*/
|
||||
abstract protected function openGif($file);
|
||||
abstract protected function openJpeg($file);
|
||||
abstract protected function openPng($file);
|
||||
|
||||
/**
|
||||
* Creates an image
|
||||
*/
|
||||
abstract protected function createImage($width, $height);
|
||||
|
||||
/**
|
||||
* Creating an image using $data
|
||||
*/
|
||||
abstract protected function createImageFromData($data);
|
||||
|
||||
/**
|
||||
* Loading image from $resource
|
||||
*/
|
||||
protected function loadResource($resource)
|
||||
{
|
||||
$this->resource = $resource;
|
||||
}
|
||||
|
||||
protected function loadFile($file, $type)
|
||||
{
|
||||
if (!$this->supports($type)) {
|
||||
throw new \RuntimeException('Type '.$type.' is not supported by GD');
|
||||
}
|
||||
|
||||
if ($type == 'jpeg') {
|
||||
$this->openJpeg($file);
|
||||
}
|
||||
|
||||
if ($type == 'gif') {
|
||||
$this->openGif($file);
|
||||
}
|
||||
|
||||
if ($type == 'png') {
|
||||
$this->openPng($file);
|
||||
}
|
||||
|
||||
if (false === $this->resource) {
|
||||
throw new \UnexpectedValueException('Unable to open file ('.$file.')');
|
||||
} else {
|
||||
$this->convertToTrueColor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$source = $this->source;
|
||||
|
||||
if ($source instanceof \Gregwar\Image\Source\File) {
|
||||
$this->loadFile($source->getFile(), $source->guessType());
|
||||
} else if ($source instanceof \Gregwar\Image\Source\Create) {
|
||||
$this->createImage($source->getWidth(), $source->getHeight());
|
||||
} else if ($source instanceof \Gregwar\Image\Source\Data) {
|
||||
$this->createImageFromData($source->getData());
|
||||
} else if ($source instanceof \Gregwar\Image\Source\Resource) {
|
||||
$this->loadResource($source->getResource());
|
||||
} else {
|
||||
throw new \Exception('Unsupported image source type '.get_class($source));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function resize($width = null, $height = null, $background = 'transparent', $force = false, $rescale = false, $crop = false)
|
||||
{
|
||||
$current_width = $this->width();
|
||||
$current_height = $this->height();
|
||||
$new_width = 0;
|
||||
$new_height = 0;
|
||||
$scale = 1.0;
|
||||
|
||||
if ($height === null && preg_match('#^(.+)%$#mUsi', $width, $matches)) {
|
||||
$width = round($current_width * ((float)$matches[1]/100.0));
|
||||
$height = round($current_height * ((float)$matches[1]/100.0));
|
||||
}
|
||||
|
||||
if (!$rescale && (!$force || $crop)) {
|
||||
if ($width!=null && $current_width>$width) {
|
||||
$scale = $current_width/$width;
|
||||
}
|
||||
|
||||
if ($height!=null && $current_height>$height) {
|
||||
if ($current_height/$height > $scale)
|
||||
$scale = $current_height/$height;
|
||||
}
|
||||
} else {
|
||||
if ($width!=null) {
|
||||
$scale = $current_width/$width;
|
||||
$new_width = $width;
|
||||
}
|
||||
|
||||
if ($height!=null) {
|
||||
if ($width!=null && $rescale) {
|
||||
$scale = max($scale,$current_height/$height);
|
||||
} else {
|
||||
$scale = $current_height/$height;
|
||||
}
|
||||
$new_height = $height;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$force || $width==null || $rescale) {
|
||||
$new_width = round($current_width/$scale);
|
||||
}
|
||||
|
||||
if (!$force || $height==null || $rescale) {
|
||||
$new_height = round($current_height/$scale);
|
||||
}
|
||||
|
||||
if ($width == null || $crop) {
|
||||
$width = $new_width;
|
||||
}
|
||||
|
||||
if ($height == null || $crop) {
|
||||
$height = $new_height;
|
||||
}
|
||||
|
||||
$this->doResize($background, $width, $height, $new_width, $new_height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim background color arround the image
|
||||
*
|
||||
* @param int $bg the background
|
||||
*/
|
||||
protected function _trimColor($background='transparent')
|
||||
{
|
||||
$width = $this->width();
|
||||
$height = $this->height();
|
||||
|
||||
$b_top = 0;
|
||||
$b_lft = 0;
|
||||
$b_btm = $height - 1;
|
||||
$b_rt = $width - 1;
|
||||
|
||||
//top
|
||||
for(; $b_top < $height; ++$b_top) {
|
||||
for($x = 0; $x < $width; ++$x) {
|
||||
if ($this->getColor($x, $b_top) != $background) {
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bottom
|
||||
for(; $b_btm >= 0; --$b_btm) {
|
||||
for($x = 0; $x < $width; ++$x) {
|
||||
if ($this->getColor($x, $b_btm) != $background) {
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// left
|
||||
for(; $b_lft < $width; ++$b_lft) {
|
||||
for($y = $b_top; $y <= $b_btm; ++$y) {
|
||||
if ($this->getColor($b_lft, $y) != $background) {
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// right
|
||||
for(; $b_rt >= 0; --$b_rt) {
|
||||
for($y = $b_top; $y <= $b_btm; ++$y) {
|
||||
if ($this->getColor($b_rt, $y) != $background) {
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$b_btm++;
|
||||
$b_rt++;
|
||||
|
||||
$this->crop($b_lft, $b_top, $b_rt - $b_lft, $b_btm - $b_top);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the image to an image having size of $target_width, $target_height, using
|
||||
* $new_width and $new_height and padding with $bg color
|
||||
*/
|
||||
abstract protected function doResize($bg, $target_width, $target_height, $new_width, $new_height);
|
||||
|
||||
/**
|
||||
* Gets the color of the $x, $y pixel
|
||||
*/
|
||||
abstract protected function getColor($x, $y);
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function enableProgressive(){
|
||||
throw new \Exception('The Adapter '.$this->getName().' does not support Progressive Image loading');
|
||||
}
|
||||
}
|
||||
516
vendor/gregwar/image/Gregwar/Image/Adapter/GD.php
vendored
516
vendor/gregwar/image/Gregwar/Image/Adapter/GD.php
vendored
@@ -1,516 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Adapter;
|
||||
|
||||
use Gregwar\Image\ImageColor;
|
||||
use Gregwar\Image\Image;
|
||||
|
||||
class GD extends Common
|
||||
{
|
||||
public static $gdTypes = array(
|
||||
'jpeg' => \IMG_JPG,
|
||||
'gif' => \IMG_GIF,
|
||||
'png' => \IMG_PNG,
|
||||
);
|
||||
|
||||
protected function loadResource($resource)
|
||||
{
|
||||
parent::loadResource($resource);
|
||||
imagesavealpha($this->resource, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width and the height for writing some text
|
||||
*/
|
||||
public static function TTFBox($font, $text, $size, $angle = 0)
|
||||
{
|
||||
$box = imagettfbbox($size, $angle, $font, $text);
|
||||
|
||||
return array(
|
||||
'width' => abs($box[2] - $box[0]),
|
||||
'height' => abs($box[3] - $box[5])
|
||||
);
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if (!(extension_loaded('gd') && function_exists('gd_info'))) {
|
||||
throw new \RuntimeException('You need to install GD PHP Extension to use this library');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'GD';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function fillBackground($background = 0xffffff)
|
||||
{
|
||||
$w = $this->width();
|
||||
$h = $this->height();
|
||||
$n = imagecreatetruecolor($w, $h);
|
||||
imagefill($n, 0, 0, ImageColor::gdAllocate($this->resource, $background));
|
||||
imagecopyresampled($n, $this->resource, 0, 0, 0, 0, $w, $h, $w, $h);
|
||||
imagedestroy($this->resource);
|
||||
$this->resource = $n;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the image resize
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function doResize($bg, $target_width, $target_height, $new_width, $new_height)
|
||||
{
|
||||
$width = $this->width();
|
||||
$height = $this->height();
|
||||
$n = imagecreatetruecolor($target_width, $target_height);
|
||||
|
||||
if ($bg != 'transparent') {
|
||||
imagefill($n, 0, 0, ImageColor::gdAllocate($this->resource, $bg));
|
||||
} else {
|
||||
imagealphablending($n, false);
|
||||
$color = ImageColor::gdAllocate($this->resource, 'transparent');
|
||||
|
||||
imagefill($n, 0, 0, $color);
|
||||
imagesavealpha($n, true);
|
||||
}
|
||||
|
||||
imagecopyresampled($n, $this->resource, ($target_width-$new_width)/2, ($target_height-$new_height)/2, 0, 0, $new_width, $new_height, $width, $height);
|
||||
imagedestroy($this->resource);
|
||||
|
||||
$this->resource = $n;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function crop($x, $y, $width, $height)
|
||||
{
|
||||
$destination = imagecreatetruecolor($width, $height);
|
||||
imagealphablending($destination, false);
|
||||
imagesavealpha($destination, true);
|
||||
imagecopy($destination, $this->resource, 0, 0, $x, $y, $this->width(), $this->height());
|
||||
imagedestroy($this->resource);
|
||||
$this->resource = $destination;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function negate()
|
||||
{
|
||||
imagefilter($this->resource, IMG_FILTER_NEGATE);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function brightness($brightness)
|
||||
{
|
||||
imagefilter($this->resource, IMG_FILTER_BRIGHTNESS, $brightness);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function contrast($contrast)
|
||||
{
|
||||
imagefilter($this->resource, IMG_FILTER_CONTRAST, $contrast);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function grayscale()
|
||||
{
|
||||
imagefilter($this->resource, IMG_FILTER_GRAYSCALE);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function emboss()
|
||||
{
|
||||
imagefilter($this->resource, IMG_FILTER_EMBOSS);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function smooth($p)
|
||||
{
|
||||
imagefilter($this->resource, IMG_FILTER_SMOOTH, $p);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function sharp()
|
||||
{
|
||||
imagefilter($this->resource, IMG_FILTER_MEAN_REMOVAL);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function edge()
|
||||
{
|
||||
imagefilter($this->resource, IMG_FILTER_EDGEDETECT);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function colorize($red, $green, $blue)
|
||||
{
|
||||
imagefilter($this->resource, IMG_FILTER_COLORIZE, $red, $green, $blue);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function sepia()
|
||||
{
|
||||
imagefilter($this->resource, IMG_FILTER_GRAYSCALE);
|
||||
imagefilter($this->resource, IMG_FILTER_COLORIZE, 100, 50, 0);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function merge(Image $other, $x = 0, $y = 0, $width = null, $height = null)
|
||||
{
|
||||
$other = clone $other;
|
||||
$other->init();
|
||||
$other->applyOperations();
|
||||
|
||||
imagealphablending($this->resource, true);
|
||||
|
||||
if (null == $width) {
|
||||
$width = $other->width();
|
||||
}
|
||||
|
||||
if (null == $height) {
|
||||
$height = $other->height();
|
||||
}
|
||||
|
||||
imagecopyresampled($this->resource, $other->getAdapter()->getResource(), $x, $y, 0, 0, $width, $height, $width, $height);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rotate($angle, $background = 0xffffff)
|
||||
{
|
||||
$this->resource = imagerotate($this->resource, $angle, ImageColor::gdAllocate($this->resource, $background));
|
||||
imagealphablending($this->resource, true);
|
||||
imagesavealpha($this->resource, true);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function fill($color = 0xffffff, $x = 0, $y = 0)
|
||||
{
|
||||
imagealphablending($this->resource, false);
|
||||
imagefill($this->resource, $x, $y, ImageColor::gdAllocate($this->resource, $color));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function write($font, $text, $x = 0, $y = 0, $size = 12, $angle = 0, $color = 0x000000, $align = 'left')
|
||||
{
|
||||
imagealphablending($this->resource, true);
|
||||
|
||||
if ($align != 'left') {
|
||||
$sim_size = self::TTFBox($font, $text, $size, $angle);
|
||||
|
||||
if ($align == 'center') {
|
||||
$x -= $sim_size['width'] / 2;
|
||||
}
|
||||
|
||||
if ($align == 'right') {
|
||||
$x -= $sim_size['width'];
|
||||
}
|
||||
}
|
||||
|
||||
imagettftext($this->resource, $size, $angle, $x, $y, ImageColor::gdAllocate($this->resource, $color), $font, $text);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rectangle($x1, $y1, $x2, $y2, $color, $filled = false)
|
||||
{
|
||||
if ($filled) {
|
||||
imagefilledrectangle($this->resource, $x1, $y1, $x2, $y2, ImageColor::gdAllocate($this->resource, $color));
|
||||
} else {
|
||||
imagerectangle($this->resource, $x1, $y1, $x2, $y2, ImageColor::gdAllocate($this->resource, $color));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function roundedRectangle($x1, $y1, $x2, $y2, $radius, $color, $filled = false) {
|
||||
if ($color) {
|
||||
$color = ImageColor::gdAllocate($this->resource, $color);
|
||||
}
|
||||
|
||||
if ($filled == true) {
|
||||
imagefilledrectangle($this->resource, $x1+$radius, $y1, $x2-$radius, $y2, $color);
|
||||
imagefilledrectangle($this->resource, $x1, $y1+$radius, $x1+$radius-1, $y2-$radius, $color);
|
||||
imagefilledrectangle($this->resource, $x2-$radius+1, $y1+$radius, $x2, $y2-$radius, $color);
|
||||
|
||||
imagefilledarc($this->resource,$x1+$radius, $y1+$radius, $radius*2, $radius*2, 180 , 270, $color, IMG_ARC_PIE);
|
||||
imagefilledarc($this->resource,$x2-$radius, $y1+$radius, $radius*2, $radius*2, 270 , 360, $color, IMG_ARC_PIE);
|
||||
imagefilledarc($this->resource,$x1+$radius, $y2-$radius, $radius*2, $radius*2, 90 , 180, $color, IMG_ARC_PIE);
|
||||
imagefilledarc($this->resource,$x2-$radius, $y2-$radius, $radius*2, $radius*2, 360 , 90, $color, IMG_ARC_PIE);
|
||||
} else {
|
||||
imageline($this->resource, $x1+$radius, $y1, $x2-$radius, $y1, $color);
|
||||
imageline($this->resource, $x1+$radius, $y2, $x2-$radius, $y2, $color);
|
||||
imageline($this->resource, $x1, $y1+$radius, $x1, $y2-$radius, $color);
|
||||
imageline($this->resource, $x2, $y1+$radius, $x2, $y2-$radius, $color);
|
||||
|
||||
imagearc($this->resource,$x1+$radius, $y1+$radius, $radius*2, $radius*2, 180 , 270, $color);
|
||||
imagearc($this->resource,$x2-$radius, $y1+$radius, $radius*2, $radius*2, 270 , 360, $color);
|
||||
imagearc($this->resource,$x1+$radius, $y2-$radius, $radius*2, $radius*2, 90 , 180, $color);
|
||||
imagearc($this->resource,$x2-$radius, $y2-$radius, $radius*2, $radius*2, 360 , 90, $color);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function line($x1, $y1, $x2, $y2, $color = 0x000000)
|
||||
{
|
||||
imageline($this->resource, $x1, $y1, $x2, $y2, ImageColor::gdAllocate($this->resource, $color));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function ellipse($cx, $cy, $width, $height, $color = 0x000000, $filled = false)
|
||||
{
|
||||
if ($filled) {
|
||||
imagefilledellipse($this->resource, $cx, $cy, $width, $height, ImageColor::gdAllocate($this->resource, $color));
|
||||
} else {
|
||||
imageellipse($this->resource, $cx, $cy, $width, $height, ImageColor::gdAllocate($this->resource, $color));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function circle($cx, $cy, $r, $color = 0x000000, $filled = false)
|
||||
{
|
||||
return $this->ellipse($cx, $cy, $r, $r, ImageColor::gdAllocate($this->resource, $color), $filled);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function polygon(array $points, $color, $filled = false)
|
||||
{
|
||||
if ($filled) {
|
||||
imagefilledpolygon($this->resource, $points, count($points)/2, ImageColor::gdAllocate($this->resource, $color));
|
||||
} else {
|
||||
imagepolygon($this->resource, $points, count($points)/2, ImageColor::gdAllocate($this->resource, $color));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function width()
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
$this->init();
|
||||
}
|
||||
|
||||
return imagesx($this->resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function height()
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
$this->init();
|
||||
}
|
||||
|
||||
return imagesy($this->resource);
|
||||
}
|
||||
|
||||
protected function createImage($width, $height)
|
||||
{
|
||||
$this->resource = imagecreatetruecolor($width, $height);
|
||||
}
|
||||
|
||||
protected function createImageFromData($data)
|
||||
{
|
||||
$this->resource = @imagecreatefromstring($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the image to true color
|
||||
*/
|
||||
protected function convertToTrueColor()
|
||||
{
|
||||
if (!imageistruecolor($this->resource)) {
|
||||
if (function_exists('imagepalettetotruecolor')) {
|
||||
// Available in PHP 5.5
|
||||
imagepalettetotruecolor($this->resource);
|
||||
} else {
|
||||
$transparentIndex = imagecolortransparent($this->resource);
|
||||
|
||||
$w = $this->width();
|
||||
$h = $this->height();
|
||||
|
||||
$img = imagecreatetruecolor($w, $h);
|
||||
imagecopy($img, $this->resource, 0, 0, 0, 0, $w, $h);
|
||||
|
||||
if ($transparentIndex != -1) {
|
||||
$width = $this->width();
|
||||
$height = $this->height();
|
||||
|
||||
imagealphablending($img, false);
|
||||
imagesavealpha($img, true);
|
||||
|
||||
for ($x=0; $x<$width; $x++) {
|
||||
for ($y=0; $y<$height; $y++) {
|
||||
if (imagecolorat($this->resource, $x, $y) == $transparentIndex) {
|
||||
imagesetpixel($img, $x, $y, 127 << 24);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->resource = $img;
|
||||
}
|
||||
}
|
||||
|
||||
imagesavealpha($this->resource, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function saveGif($file)
|
||||
{
|
||||
$transColor = imagecolorallocatealpha($this->resource, 255, 255, 255, 127);
|
||||
imagecolortransparent($this->resource, $transColor);
|
||||
imagegif($this->resource, $file);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function savePng($file)
|
||||
{
|
||||
imagepng($this->resource, $file);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function saveJpeg($file, $quality)
|
||||
{
|
||||
imagejpeg($this->resource, $file, $quality);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to open the file using jpeg
|
||||
*
|
||||
*/
|
||||
protected function openJpeg($file)
|
||||
{
|
||||
$this->resource = @imagecreatefromjpeg($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to open the file using gif
|
||||
*/
|
||||
protected function openGif($file)
|
||||
{
|
||||
$this->resource = @imagecreatefromgif($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to open the file using PNG
|
||||
*/
|
||||
protected function openPng($file)
|
||||
{
|
||||
$this->resource = @imagecreatefrompng($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this adapter supports type ?
|
||||
*/
|
||||
protected function supports($type)
|
||||
{
|
||||
return (imagetypes() & self::$gdTypes[$type]);
|
||||
}
|
||||
|
||||
protected function getColor($x, $y)
|
||||
{
|
||||
return imagecolorat($this->resource, $x, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function enableProgressive(){
|
||||
imageinterlace($this->resource, 1);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -1,382 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Adapter;
|
||||
|
||||
use Gregwar\Image\Image;
|
||||
|
||||
class Imagick extends Common{
|
||||
public function __construct(){
|
||||
throw new \Exception('Imagick is not supported right now');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the adapter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(){
|
||||
return 'ImageMagick';
|
||||
}
|
||||
|
||||
/**
|
||||
* Image width
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function width(){
|
||||
// TODO: Implement width() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Image height
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function height(){
|
||||
// TODO: Implement height() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the image as a gif
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function saveGif($file){
|
||||
// TODO: Implement saveGif() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the image as a png
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function savePng($file){
|
||||
// TODO: Implement savePng() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the image as a jpeg
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function saveJpeg($file, $quality){
|
||||
// TODO: Implement saveJpeg() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Crops the image
|
||||
*
|
||||
* @param int $x the top-left x position of the crop box
|
||||
* @param int $y the top-left y position of the crop box
|
||||
* @param int $width the width of the crop box
|
||||
* @param int $height the height of the crop box
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function crop($x, $y, $width, $height){
|
||||
// TODO: Implement crop() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills the image background to $bg if the image is transparent
|
||||
*
|
||||
* @param int $background background color
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function fillBackground($background = 0xffffff){
|
||||
// TODO: Implement fillBackground() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Negates the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function negate(){
|
||||
// TODO: Implement negate() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the brightness of the image
|
||||
*
|
||||
* @param int $brightness the brightness
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function brightness($brightness){
|
||||
// TODO: Implement brightness() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Contrasts the image
|
||||
*
|
||||
* @param int $contrast the contrast [-100, 100]
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function contrast($contrast){
|
||||
// TODO: Implement contrast() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a grayscale level effect on the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function grayscale(){
|
||||
// TODO: Implement grayscale() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Emboss the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function emboss(){
|
||||
// TODO: Implement emboss() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Smooth the image
|
||||
*
|
||||
* @param int $p value between [-10,10]
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function smooth($p){
|
||||
// TODO: Implement smooth() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Sharps the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function sharp(){
|
||||
// TODO: Implement sharp() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Edges the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function edge(){
|
||||
// TODO: Implement edge() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Colorize the image
|
||||
*
|
||||
* @param int $red value in range [-255, 255]
|
||||
* @param int $green value in range [-255, 255]
|
||||
* @param int $blue value in range [-255, 255]
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function colorize($red, $green, $blue){
|
||||
// TODO: Implement colorize() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* apply sepia to the image
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function sepia(){
|
||||
// TODO: Implement sepia() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge with another image
|
||||
*
|
||||
* @param Image $other
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function merge(Image $other, $x = 0, $y = 0, $width = null, $height = null){
|
||||
// TODO: Implement merge() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate the image
|
||||
*
|
||||
* @param float $angle
|
||||
* @param int $background
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function rotate($angle, $background = 0xffffff){
|
||||
// TODO: Implement rotate() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills the image
|
||||
*
|
||||
* @param int $color
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function fill($color = 0xffffff, $x = 0, $y = 0){
|
||||
// TODO: Implement fill() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* write text to the image
|
||||
*
|
||||
* @param string $font
|
||||
* @param string $text
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $size
|
||||
* @param int $angle
|
||||
* @param int $color
|
||||
* @param string $align
|
||||
*/
|
||||
public function write($font, $text, $x = 0, $y = 0, $size = 12, $angle = 0, $color = 0x000000, $align = 'left'){
|
||||
// TODO: Implement write() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a rectangle
|
||||
*
|
||||
* @param int $x1
|
||||
* @param int $y1
|
||||
* @param int $x2
|
||||
* @param int $y2
|
||||
* @param int $color
|
||||
* @param bool $filled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function rectangle($x1, $y1, $x2, $y2, $color, $filled = false){
|
||||
// TODO: Implement rectangle() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a rounded rectangle
|
||||
*
|
||||
* @param int $x1
|
||||
* @param int $y1
|
||||
* @param int $x2
|
||||
* @param int $y2
|
||||
* @param int $radius
|
||||
* @param int $color
|
||||
* @param bool $filled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function roundedRectangle($x1, $y1, $x2, $y2, $radius, $color, $filled = false){
|
||||
// TODO: Implement roundedRectangle() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a line
|
||||
*
|
||||
* @param int $x1
|
||||
* @param int $y1
|
||||
* @param int $x2
|
||||
* @param int $y2
|
||||
* @param int $color
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function line($x1, $y1, $x2, $y2, $color = 0x000000){
|
||||
// TODO: Implement line() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws an ellipse
|
||||
*
|
||||
* @param int $cx
|
||||
* @param int $cy
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @param int $color
|
||||
* @param bool $filled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function ellipse($cx, $cy, $width, $height, $color = 0x000000, $filled = false){
|
||||
// TODO: Implement ellipse() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a circle
|
||||
*
|
||||
* @param int $cx
|
||||
* @param int $cy
|
||||
* @param int $r
|
||||
* @param int $color
|
||||
* @param bool $filled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function circle($cx, $cy, $r, $color = 0x000000, $filled = false){
|
||||
// TODO: Implement circle() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a polygon
|
||||
*
|
||||
* @param array $points
|
||||
* @param int $color
|
||||
* @param bool $filled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function polygon(array $points, $color, $filled = false){
|
||||
// TODO: Implement polygon() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the image
|
||||
*/
|
||||
protected function openGif($file){
|
||||
// TODO: Implement openGif() method.
|
||||
}
|
||||
|
||||
protected function openJpeg($file){
|
||||
// TODO: Implement openJpeg() method.
|
||||
}
|
||||
|
||||
protected function openPng($file){
|
||||
// TODO: Implement openPng() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an image
|
||||
*/
|
||||
protected function createImage($width, $height){
|
||||
// TODO: Implement createImage() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Creating an image using $data
|
||||
*/
|
||||
protected function createImageFromData($data){
|
||||
// TODO: Implement createImageFromData() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the image to an image having size of $target_width, $target_height, using
|
||||
* $new_width and $new_height and padding with $bg color
|
||||
*/
|
||||
protected function doResize($bg, $target_width, $target_height, $new_width, $new_height){
|
||||
// TODO: Implement doResize() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the color of the $x, $y pixel
|
||||
*/
|
||||
protected function getColor($x, $y){
|
||||
// TODO: Implement getColor() method.
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Exceptions;
|
||||
|
||||
class GenerationError extends \Exception
|
||||
{
|
||||
public function __construct($newNewFile)
|
||||
{
|
||||
$this->newNewFile = $newNewFile;
|
||||
}
|
||||
|
||||
public function getNewFile()
|
||||
{
|
||||
return $this->newNewFile;
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image;
|
||||
|
||||
/**
|
||||
* Garbage collect a directory, this will crawl a directory, lookng
|
||||
* for files older than X days and destroy them
|
||||
*
|
||||
* @author Gregwar <g.passault@gmail.com>
|
||||
*/
|
||||
class GarbageCollect
|
||||
{
|
||||
/**
|
||||
* Drops old files of a directory
|
||||
*
|
||||
* @param string $directory the name of the target directory
|
||||
* @param int $days the number of days to consider a file old
|
||||
* @param bool $verbose enable verbose output
|
||||
*
|
||||
* @return true if all the files/directories of a directory was wiped
|
||||
*/
|
||||
public static function dropOldFiles($directory, $days = 30, $verbose = false)
|
||||
{
|
||||
$allDropped = true;
|
||||
$now = time();
|
||||
|
||||
$dir = opendir($directory);
|
||||
|
||||
if (!$dir) {
|
||||
if ($verbose) {
|
||||
echo "! Unable to open $directory\n";
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
while ($file = readdir($dir)) {
|
||||
if ($file == '.' || $file == '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullName = $directory.'/'.$file;
|
||||
|
||||
$old = $now-filemtime($fullName);
|
||||
|
||||
if (is_dir($fullName)) {
|
||||
// Directories are recursively crawled
|
||||
if (static::dropOldFiles($fullName, $days, $verbose)) {
|
||||
self::drop($fullName, $verbose);
|
||||
} else {
|
||||
$allDropped = false;
|
||||
}
|
||||
} else {
|
||||
if ($old > (24*60*60*$days)) {
|
||||
self::drop($fullName, $verbose);
|
||||
} else {
|
||||
$allDropped = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dir);
|
||||
|
||||
return $allDropped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops a file or an empty directory
|
||||
*/
|
||||
public static function drop($file, $verbose = false)
|
||||
{
|
||||
if (is_dir($file)) {
|
||||
@rmdir($file);
|
||||
} else {
|
||||
@unlink($file);
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
echo "> Dropping $file...\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
717
vendor/gregwar/image/Gregwar/Image/Image.php
vendored
717
vendor/gregwar/image/Gregwar/Image/Image.php
vendored
@@ -1,717 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image;
|
||||
|
||||
use Gregwar\Image\Adapter\AdapterInterface;
|
||||
use Gregwar\Image\Exceptions\GenerationError;
|
||||
|
||||
/**
|
||||
* Images handling class
|
||||
*
|
||||
* @author Gregwar <g.passault@gmail.com>
|
||||
*
|
||||
* @method Image saveGif($file)
|
||||
* @method Image savePng($file)
|
||||
* @method Image saveJpeg($file, $quality)
|
||||
* @method Image cropResize($width = null, $height = null, $background=0xffffff)
|
||||
* @method Image scale($width = null, $height = null, $background=0xffffff, $crop = false)
|
||||
* @method Image ($width = null, $height = null, $background = 0xffffff, $force = false, $rescale = false, $crop = false)
|
||||
* @method Image crop($x, $y, $width, $height)
|
||||
* @method Image enableProgressive()
|
||||
* @method Image force($width = null, $height = null, $background = 0xffffff)
|
||||
* @method Image zoomCrop($width, $height, $background = 0xffffff)
|
||||
* @method Image fillBackground($background = 0xffffff)
|
||||
* @method Image negate()
|
||||
* @method Image brightness($brightness)
|
||||
* @method Image contrast($contrast)
|
||||
* @method Image grayscale()
|
||||
* @method Image emboss()
|
||||
* @method Image smooth($p)
|
||||
* @method Image sharp()
|
||||
* @method Image edge()
|
||||
* @method Image colorize($red, $green, $blue)
|
||||
* @method Image sepia()
|
||||
* @method Image merge(Image $other, $x = 0, $y = 0, $width = null, $height = null)
|
||||
* @method Image rotate($angle, $background = 0xffffff)
|
||||
* @method Image fill($color = 0xffffff, $x = 0, $y = 0)
|
||||
* @method Image write($font, $text, $x = 0, $y = 0, $size = 12, $angle = 0, $color = 0x000000, $align = 'left')
|
||||
* @method Image rectangle($x1, $y1, $x2, $y2, $color, $filled = false)
|
||||
* @method Image roundedRectangle($x1, $y1, $x2, $y2, $radius, $color, $filled = false)
|
||||
* @method Image line($x1, $y1, $x2, $y2, $color = 0x000000)
|
||||
* @method Image ellipse($cx, $cy, $width, $height, $color = 0x000000, $filled = false)
|
||||
* @method Image circle($cx, $cy, $r, $color = 0x000000, $filled = false)
|
||||
* @method Image polygon(array $points, $color, $filled = false)
|
||||
*/
|
||||
class Image
|
||||
{
|
||||
/**
|
||||
* Direcory to use for file caching
|
||||
*/
|
||||
protected $cacheDir = 'cache/images';
|
||||
|
||||
/**
|
||||
* Internal adapter
|
||||
*
|
||||
* @var AdapterInterface
|
||||
*/
|
||||
protected $adapter = null;
|
||||
|
||||
/**
|
||||
* Pretty name for the image
|
||||
*/
|
||||
protected $prettyName = '';
|
||||
protected $prettyPrefix;
|
||||
|
||||
/**
|
||||
* Transformations hash
|
||||
*/
|
||||
protected $hash = null;
|
||||
|
||||
/**
|
||||
* The image source
|
||||
*/
|
||||
protected $source = null;
|
||||
|
||||
/**
|
||||
* Force image caching, even if there is no operation applied
|
||||
*/
|
||||
protected $forceCache = true;
|
||||
|
||||
/**
|
||||
* Supported types
|
||||
*/
|
||||
public static $types = array(
|
||||
'jpg' => 'jpeg',
|
||||
'jpeg' => 'jpeg',
|
||||
'png' => 'png',
|
||||
'gif' => 'gif',
|
||||
);
|
||||
|
||||
/**
|
||||
* Fallback image
|
||||
*/
|
||||
protected $fallback;
|
||||
|
||||
/**
|
||||
* Use fallback image
|
||||
*/
|
||||
protected $useFallbackImage = true;
|
||||
|
||||
/**
|
||||
* Cache system
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* Change the caching directory
|
||||
*/
|
||||
public function setCacheDir($cacheDir)
|
||||
{
|
||||
$this->cache->setCacheDirectory($cacheDir);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable to force cache even if the file is unchanged
|
||||
*/
|
||||
public function setForceCache($forceCache = true)
|
||||
{
|
||||
$this->forceCache = $forceCache;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual cache dir
|
||||
*/
|
||||
public function setActualCacheDir($actualCacheDir)
|
||||
{
|
||||
$this->cache->setActualCacheDirectory($actualCacheDir);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pretty name of the image
|
||||
*/
|
||||
public function setPrettyName($name, $prefix = true)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
$name = str_replace(' ', '-', $name);
|
||||
$this->prettyName = preg_replace('/([^a-z0-9\-]+)/m', '', $name);
|
||||
$this->prettyPrefix = $prefix;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operations array
|
||||
*/
|
||||
protected $operations = array();
|
||||
|
||||
public function __construct($originalFile = null, $width = null, $height = null)
|
||||
{
|
||||
$this->cache = new \Gregwar\Cache\Cache;
|
||||
$this->cache->setCacheDirectory($this->cacheDir);
|
||||
|
||||
$this->setFallback(null);
|
||||
|
||||
if ($originalFile) {
|
||||
$this->source = new Source\File($originalFile);
|
||||
} else {
|
||||
$this->source = new Source\Create($width, $height);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the image data
|
||||
*/
|
||||
public function setData($data)
|
||||
{
|
||||
$this->source = new Source\Data($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the resource
|
||||
*/
|
||||
public function setResource($resource)
|
||||
{
|
||||
$this->source = new Source\Resource($resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the fallback image or not
|
||||
*/
|
||||
public function useFallback($useFallbackImage = true)
|
||||
{
|
||||
$this->useFallbackImage = $useFallbackImage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the fallback image to use
|
||||
*/
|
||||
public function setFallback($fallback = null)
|
||||
{
|
||||
if ($fallback === null) {
|
||||
$this->fallback = __DIR__ . '/images/error.jpg';
|
||||
} else {
|
||||
$this->fallback = $fallback;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fallack image path
|
||||
*/
|
||||
public function getFallback()
|
||||
{
|
||||
return $this->fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fallback into the cache dir
|
||||
*/
|
||||
public function getCacheFallback()
|
||||
{
|
||||
$fallback = $this->fallback;
|
||||
|
||||
return $this->cache->getOrCreateFile('fallback.jpg', array(), function($target) use ($fallback) {
|
||||
copy($fallback, $target);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AdapterInterface
|
||||
*/
|
||||
public function getAdapter()
|
||||
{
|
||||
if (null === $this->adapter) {
|
||||
// Defaults to GD
|
||||
$this->setAdapter('gd');
|
||||
}
|
||||
|
||||
return $this->adapter;
|
||||
}
|
||||
|
||||
public function setAdapter($adapter)
|
||||
{
|
||||
if ($adapter instanceof Adapter\Adapter) {
|
||||
$this->adapter = $adapter;
|
||||
} else {
|
||||
if (is_string($adapter)) {
|
||||
$adapter = strtolower($adapter);
|
||||
|
||||
switch ($adapter) {
|
||||
case 'gd':
|
||||
$this->adapter = new Adapter\GD();
|
||||
break;
|
||||
case 'imagemagick':
|
||||
case 'imagick':
|
||||
$this->adapter = new Adapter\Imagick();
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('Unknown adapter: '.$adapter);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
throw new \Exception('Unable to load the given adapter (not string or Adapter)');
|
||||
}
|
||||
}
|
||||
|
||||
$this->adapter->setSource($this->source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file path
|
||||
*
|
||||
* @return mixed a string with the filen name, null if the image
|
||||
* does not depends on a file
|
||||
*/
|
||||
public function getFilePath()
|
||||
{
|
||||
if ($this->source instanceof Source\File) {
|
||||
return $this->source->getFile();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the file only after instantiation
|
||||
*
|
||||
* @param string $originalFile the file path
|
||||
*/
|
||||
public function fromFile($originalFile)
|
||||
{
|
||||
$this->source = new Source\File($originalFile);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if the image is correct
|
||||
*/
|
||||
public function correct()
|
||||
{
|
||||
return $this->source->correct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Guess the file type
|
||||
*/
|
||||
public function guessType()
|
||||
{
|
||||
return $this->source->guessType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an operation
|
||||
*/
|
||||
protected function addOperation($method, $args)
|
||||
{
|
||||
$this->operations[] = array($method, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic function
|
||||
*/
|
||||
public function __call($methodName, $args)
|
||||
{
|
||||
$adapter = $this->getAdapter();
|
||||
$reflection = new \ReflectionClass(get_class($adapter));
|
||||
|
||||
if ($reflection->hasMethod($methodName)) {
|
||||
$method = $reflection->getMethod($methodName);
|
||||
|
||||
if ($method->getNumberOfRequiredParameters() > count($args)) {
|
||||
throw new \InvalidArgumentException('Not enough arguments given for '.$methodName);
|
||||
}
|
||||
|
||||
$this->addOperation($methodName, $args);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
throw new \BadFunctionCallException('Invalid method: '.$methodName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialization of operations
|
||||
*/
|
||||
public function serializeOperations()
|
||||
{
|
||||
$datas = array();
|
||||
|
||||
foreach ($this->operations as $operation) {
|
||||
$method = $operation[0];
|
||||
$args = $operation[1];
|
||||
|
||||
foreach ($args as &$arg) {
|
||||
if ($arg instanceof self) {
|
||||
$arg = $arg->getHash();
|
||||
}
|
||||
}
|
||||
|
||||
$datas[] = array($method, $args);
|
||||
}
|
||||
|
||||
return serialize($datas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the hash
|
||||
*/
|
||||
public function generateHash($type = 'guess', $quality = 80)
|
||||
{
|
||||
$inputInfos = $this->source->getInfos();
|
||||
|
||||
$datas = array(
|
||||
$inputInfos,
|
||||
$this->serializeOperations(),
|
||||
$type,
|
||||
$quality
|
||||
);
|
||||
|
||||
$this->hash = sha1(serialize($datas));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hash
|
||||
*/
|
||||
public function getHash($type = 'guess', $quality = 80)
|
||||
{
|
||||
if (null === $this->hash) {
|
||||
$this->generateHash($type, $quality);
|
||||
}
|
||||
|
||||
return $this->hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cache file name and generate it if it does not exists.
|
||||
* Note that if it exists, all the image computation process will
|
||||
* not be done.
|
||||
*
|
||||
* @param string $type the image type
|
||||
* @param int $quality the quality (for JPEG)
|
||||
*/
|
||||
public function cacheFile($type = 'jpg', $quality = 80, $actual = false)
|
||||
{
|
||||
if ($type == 'guess') {
|
||||
$type = $this->guessType();
|
||||
}
|
||||
|
||||
if (!count($this->operations) && $type == $this->guessType() && !$this->forceCache) {
|
||||
return $this->getFilename($this->getFilePath());
|
||||
}
|
||||
|
||||
// Computes the hash
|
||||
$this->hash = $this->getHash($type, $quality);
|
||||
|
||||
// Generates the cache file
|
||||
$cacheFile = '';
|
||||
|
||||
if (!$this->prettyName || $this->prettyPrefix) {
|
||||
$cacheFile .= $this->hash;
|
||||
}
|
||||
|
||||
if ($this->prettyPrefix) {
|
||||
$cacheFile .= '-';
|
||||
}
|
||||
|
||||
if ($this->prettyName) {
|
||||
$cacheFile .= $this->prettyName;
|
||||
}
|
||||
|
||||
$cacheFile .= '.'.$type;
|
||||
|
||||
// If the files does not exists, save it
|
||||
$image = $this;
|
||||
|
||||
// Target file should be younger than all the current image
|
||||
// dependencies
|
||||
$conditions = array(
|
||||
'younger-than' => $this->getDependencies()
|
||||
);
|
||||
|
||||
// The generating function
|
||||
$generate = function($target) use ($image, $type, $quality) {
|
||||
$result = $image->save($target, $type, $quality);
|
||||
|
||||
if ($result != $target) {
|
||||
throw new GenerationError($result);
|
||||
}
|
||||
};
|
||||
|
||||
// Asking the cache for the cacheFile
|
||||
try {
|
||||
$file = $this->cache->getOrCreateFile($cacheFile, $conditions, $generate, $actual);
|
||||
} catch (GenerationError $e) {
|
||||
$file = $e->getNewFile();
|
||||
}
|
||||
|
||||
if ($actual) {
|
||||
return $file;
|
||||
} else {
|
||||
return $this->getFilename($file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cache data (to render the image)
|
||||
*
|
||||
* @param string $type the image type
|
||||
* @param int $quality the quality (for JPEG)
|
||||
*/
|
||||
public function cacheData($type = 'jpg', $quality = 80)
|
||||
{
|
||||
return file_get_contents($this->cacheFile($type, $quality));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to helps to extends and enhance this class
|
||||
*/
|
||||
protected function getFilename($filename)
|
||||
{
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates and output a jpeg cached file
|
||||
*/
|
||||
public function jpeg($quality = 80)
|
||||
{
|
||||
return $this->cacheFile('jpg', $quality);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates and output a gif cached file
|
||||
*/
|
||||
public function gif()
|
||||
{
|
||||
return $this->cacheFile('gif');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates and output a png cached file
|
||||
*/
|
||||
public function png()
|
||||
{
|
||||
return $this->cacheFile('png');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates and output an image using the same type as input
|
||||
*/
|
||||
public function guess($quality = 80)
|
||||
{
|
||||
return $this->cacheFile('guess', $quality);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the files that this image depends on
|
||||
*
|
||||
* @return string[] this is an array of strings containing all the files that the
|
||||
* current Image depends on
|
||||
*/
|
||||
public function getDependencies()
|
||||
{
|
||||
$dependencies = array();
|
||||
|
||||
$file = $this->getFilePath();
|
||||
if ($file) {
|
||||
$dependencies[] = $file;
|
||||
}
|
||||
|
||||
foreach ($this->operations as $operation) {
|
||||
foreach ($operation[1] as $argument) {
|
||||
if ($argument instanceof self) {
|
||||
$dependencies = array_merge($dependencies, $argument->getDependencies());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $dependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the operations
|
||||
*/
|
||||
public function applyOperations()
|
||||
{
|
||||
// Renders the effects
|
||||
foreach ($this->operations as $operation) {
|
||||
call_user_func_array(array($this->adapter, $operation[0]), $operation[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the adapter
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->getAdapter()->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the file to a given output
|
||||
*/
|
||||
public function save($file, $type = 'guess', $quality = 80)
|
||||
{
|
||||
if ($file) {
|
||||
$directory = dirname($file);
|
||||
|
||||
if (!is_dir($directory)) {
|
||||
@mkdir($directory, 0777, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_int($type)) {
|
||||
$quality = $type;
|
||||
$type = 'jpeg';
|
||||
}
|
||||
|
||||
if ($type == 'guess') {
|
||||
$type = $this->guessType();
|
||||
}
|
||||
|
||||
if (!isset(self::$types[$type])) {
|
||||
throw new \InvalidArgumentException('Given type ('.$type.') is not valid');
|
||||
}
|
||||
|
||||
$type = self::$types[$type];
|
||||
|
||||
try {
|
||||
$this->init();
|
||||
$this->applyOperations();
|
||||
|
||||
$success = false;
|
||||
|
||||
if (null == $file) {
|
||||
ob_start();
|
||||
}
|
||||
|
||||
if ($type == 'jpeg') {
|
||||
$success = $this->getAdapter()->saveJpeg($file, $quality);
|
||||
}
|
||||
|
||||
if ($type == 'gif') {
|
||||
$success = $this->getAdapter()->saveGif($file);
|
||||
}
|
||||
|
||||
if ($type == 'png') {
|
||||
$success = $this->getAdapter()->savePng($file);
|
||||
}
|
||||
|
||||
if (!$success) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (null === $file ? ob_get_clean() : $file);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
if ($this->useFallbackImage) {
|
||||
return (null === $file ? file_get_contents($this->fallback) : $this->getCacheFallback());
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of the image
|
||||
*/
|
||||
public function get($type = 'guess', $quality = 80)
|
||||
{
|
||||
return $this->save(null, $type, $quality);
|
||||
}
|
||||
|
||||
/* Image API */
|
||||
|
||||
/**
|
||||
* Image width
|
||||
*/
|
||||
public function width()
|
||||
{
|
||||
return $this->getAdapter()->width();
|
||||
}
|
||||
|
||||
/**
|
||||
* Image height
|
||||
*/
|
||||
public function height()
|
||||
{
|
||||
return $this->getAdapter()->height();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tostring defaults to jpeg
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->guess();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returning basic html code for this image
|
||||
*/
|
||||
public function html($title = '', $type = 'jpg', $quality = 80)
|
||||
{
|
||||
return '<img title="' . $title . '" src="' . $this->cacheFile($type, $quality) . '" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Base64 inlinable representation
|
||||
*/
|
||||
public function inline($type = 'jpg', $quality = 80)
|
||||
{
|
||||
$mime = $type;
|
||||
if ($mime == 'jpg') {
|
||||
$mime = 'jpeg';
|
||||
}
|
||||
|
||||
return 'data:image/'.$mime.';base64,'.base64_encode(file_get_contents($this->cacheFile($type, $quality, true)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance, usefull for one-line chaining
|
||||
*/
|
||||
public static function open($file = '')
|
||||
{
|
||||
return new self($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of a new resource
|
||||
*/
|
||||
public static function create($width, $height)
|
||||
{
|
||||
return new self(null, $width, $height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of image from its data
|
||||
*/
|
||||
public static function fromData($data)
|
||||
{
|
||||
$image = new self();
|
||||
$image->setData($data);
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of image from resource
|
||||
*/
|
||||
public static function fromResource($resource)
|
||||
{
|
||||
$image = new self();
|
||||
$image->setResource($resource);
|
||||
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image;
|
||||
|
||||
/**
|
||||
* Color manipulation class
|
||||
*/
|
||||
class ImageColor
|
||||
{
|
||||
private static $colors = array(
|
||||
'black' => 0x000000,
|
||||
'silver' => 0xc0c0c0,
|
||||
'gray' => 0x808080,
|
||||
'teal' => 0x008080,
|
||||
'aqua' => 0x00ffff,
|
||||
'blue' => 0x0000ff,
|
||||
'navy' => 0x000080,
|
||||
'green' => 0x008000,
|
||||
'lime' => 0x00ff00,
|
||||
'white' => 0xffffff,
|
||||
'fuschia' => 0xff00ff,
|
||||
'purple' => 0x800080,
|
||||
'olive' => 0x808000,
|
||||
'yellow' => 0xffff00,
|
||||
'orange' => 0xffA500,
|
||||
'red' => 0xff0000,
|
||||
'maroon' => 0x800000,
|
||||
'transparent' => 0x7fffffff
|
||||
);
|
||||
|
||||
public static function gdAllocate($image, $color)
|
||||
{
|
||||
$colorRGBA = self::parse($color);
|
||||
|
||||
$b = ($colorRGBA)&0xff;
|
||||
$colorRGBA >>= 8;
|
||||
$g = ($colorRGBA)&0xff;
|
||||
$colorRGBA >>= 8;
|
||||
$r = ($colorRGBA)&0xff;
|
||||
$colorRGBA >>= 8;
|
||||
$a = ($colorRGBA)&0xff;
|
||||
|
||||
$c = imagecolorallocatealpha($image, $r, $g, $b, $a);
|
||||
|
||||
if ($color == 'transparent') {
|
||||
imagecolortransparent($image, $c);
|
||||
}
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
||||
public static function parse($color)
|
||||
{
|
||||
// Direct color representation (ex: 0xff0000)
|
||||
if (!is_string($color) && is_numeric($color))
|
||||
return $color;
|
||||
|
||||
// Color name (ex: "red")
|
||||
if (isset(self::$colors[$color]))
|
||||
return self::$colors[$color];
|
||||
|
||||
if (is_string($color)) {
|
||||
$color_string = str_replace(' ', '', $color);
|
||||
|
||||
// Color string (ex: "ff0000", "#ff0000" or "0xfff")
|
||||
if (preg_match('/^(#|0x|)([0-9a-f]{3,6})/i', $color_string, $matches)) {
|
||||
$col = $matches[2];
|
||||
|
||||
if (strlen($col) == 6)
|
||||
return hexdec($col);
|
||||
|
||||
if (strlen($col) == 3) {
|
||||
$r = '';
|
||||
for ($i=0; $i<3; $i++)
|
||||
$r.= $col[$i].$col[$i];
|
||||
return hexdec($r);
|
||||
}
|
||||
}
|
||||
|
||||
// Colors like "rgb(255, 0, 0)"
|
||||
if (preg_match('/^rgb\(([0-9]+),([0-9]+),([0-9]+)\)/i', $color_string, $matches)) {
|
||||
$r = $matches[1];
|
||||
$g = $matches[2];
|
||||
$b = $matches[3];
|
||||
if ($r>=0 && $r<=0xff && $g>=0 && $g<=0xff && $b>=0 && $b<=0xff) {
|
||||
return ($r << 16) | ($g << 8) | ($b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException('Invalid color: '.$color);
|
||||
}
|
||||
}
|
||||
19
vendor/gregwar/image/Gregwar/Image/LICENSE
vendored
19
vendor/gregwar/image/Gregwar/Image/LICENSE
vendored
@@ -1,19 +0,0 @@
|
||||
Copyright (c) <2012-2013> Grégoire Passault
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
271
vendor/gregwar/image/Gregwar/Image/README.md
vendored
271
vendor/gregwar/image/Gregwar/Image/README.md
vendored
@@ -1,271 +0,0 @@
|
||||
Gregwar's Image class
|
||||
=====================
|
||||
|
||||
The `Gregwar\Image` class purpose is to provide a simple object-oriented images handling and caching API.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Basic handling
|
||||
--------------
|
||||
|
||||
Using methods chaining, you can open, transform and save a file in a single line:
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once('lib/Gregwar/Image.php');
|
||||
|
||||
use Gregwar\Image\Image;
|
||||
|
||||
Image::open('in.png')
|
||||
->resize(100, 100)
|
||||
->negate()
|
||||
->save('out.jpg');
|
||||
```
|
||||
|
||||
The methods available are:
|
||||
|
||||
* `resize($width, $height, $background)`: resizes the image, will preserve scale and never
|
||||
enlarge it
|
||||
|
||||
* `scaleResize($width, $height, $background)`: resizes the image, will preserve scale
|
||||
|
||||
* `forceResize($width, $height, $background)`: resizes the image, will force the image to
|
||||
be exactly $width by $height
|
||||
|
||||
* `cropResize($width, $height, $background)`: resizes the image preserving scale and croping
|
||||
the whitespaces
|
||||
|
||||
* `crop($x, $y, $w, $h)`: crops the image to a box located on coordinates $x,y and
|
||||
which size is $w by $h
|
||||
|
||||
* `negate()`: negates the image colors
|
||||
|
||||
* `brighness($b)`: applies a brightness effect to the image (from -255 to +255)
|
||||
|
||||
* `contrast($c)`: applies a contrast effect to the image (from -100 to +100)
|
||||
|
||||
* `grayscale()`: converts the image to grayscale
|
||||
|
||||
* `emboss()`: emboss the image
|
||||
|
||||
* `smooth($p)`: smooth the image
|
||||
|
||||
* `sharp()`: applies a mean removal filter on the image
|
||||
|
||||
* `edge()`: applies an edge effect on the image
|
||||
|
||||
* `colorize($red, $green, $blue)`: colorize the image (from -255 to +255 for each color)
|
||||
|
||||
* `sepia()`: applies a sepia effect
|
||||
|
||||
* `merge($image, $x, $y, $width, $height)`: merges two images
|
||||
|
||||
* `fill($color, $x, $y)`: fills the image with the given color
|
||||
|
||||
* `write($font, $text, $x, $y, $size, $angle, $color, $position)`: writes text over image, $position can be any of 'left', 'right', or 'center'
|
||||
|
||||
* `rectangle($x1, $y1, $x2, $y2, $color, $filled=false)`: draws a rectangle
|
||||
|
||||
* `rotate($angle, $background = 0xffffff)` : rotate the image to given angle
|
||||
|
||||
* `roundedRectangle($x1, $y1, $x2, $y2, $radius, $color, $filled=false)`: draws a rounded rectangle ($radius can be anything from 0)
|
||||
|
||||
* `line($x1, $y1, $x2, $y2, $color)`: draws a line
|
||||
|
||||
* `ellipse($cx, $cy, $width, $height, $color, $filled=false)`: draws an ellipse
|
||||
|
||||
* `circle($cx, $cy, $r, $color, $filled=false)`: draws a circle
|
||||
|
||||
* `zoomCrop($width, $height, $background)`: resize and crop the image to fit to given dimensions
|
||||
|
||||
* `fillBackground($bg=0xffffff)`: fills the background of a transparent image to the 'bg' color
|
||||
|
||||
* `html($title = '', $type = 'jpg')`: return the `<img ... />` tag with the cache image
|
||||
|
||||
* `inline($type = 'jpg')`: returns the HTML inlinable base64 string (see `demo/inline.php`)
|
||||
|
||||
You can also create image from scratch using:
|
||||
|
||||
```php
|
||||
<?php
|
||||
Image::create(200, 100);
|
||||
```
|
||||
|
||||
Where 200 is the width and 100 the height
|
||||
|
||||
Saving the image
|
||||
----------------
|
||||
|
||||
You can save the image to an explicit file using `save($file, $type = 'jpg', $quality = 80)`:
|
||||
|
||||
```php
|
||||
<?php
|
||||
// ...
|
||||
$image->save('output.jpg', 'jpg', 85);
|
||||
```
|
||||
|
||||
You can also get the contents of the image using `get($type = 'jpg', $quality = 80)`, which will return the binary contents of the image
|
||||
|
||||
Using cache
|
||||
-----------
|
||||
|
||||
Each operation above is not actually applied on the opened image, but added in an operations
|
||||
array. This operation array, the name, type and modification time of file are hashed using
|
||||
`sha1()` and the hash is used to look up for a cache file.
|
||||
|
||||
Once the cache directory configured, you can call the following methods:
|
||||
|
||||
* `jpeg($quality = 80)`: lookup or create a jpeg cache file on-the-fly
|
||||
|
||||
* `gif()`: lookup or create a gif cache file on-the-fly
|
||||
|
||||
* `png()`: lookup or create a png cache file on-the-fly
|
||||
|
||||
* `guess($quality = 80)`: guesses the type (use the same as input) and lookup or create a
|
||||
cache file on-the-fly
|
||||
|
||||
* `setPrettyName($prettyName, $prefix = true)`: sets a "pretty" name suffix for the file, if you want it to be more SEO-friendly.
|
||||
for instance, if you call it "Fancy Image", the cache will look like something/something-fancy-image.jpg.
|
||||
If `$prefix` is passed to `false` (default `true`), the pretty name won't have any hash prefix.
|
||||
|
||||
For instance:
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once('lib/Gregwar/Image.php');
|
||||
|
||||
use Gregwar\Image\Image;
|
||||
|
||||
echo Image::open('test.png')
|
||||
->sepia()
|
||||
->jpeg();
|
||||
|
||||
//Outputs: cache/images/1/8/6/9/c/86e4532dbd9c073075ef08e9751fc9bc0f4.jpg
|
||||
```
|
||||
|
||||
If the original file and operations do not change, the hashed value will be the same and the
|
||||
cache will not be generated again.
|
||||
|
||||
You can use this directly in an HTML document:
|
||||
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once('lib/Gregwar/Image.php');
|
||||
|
||||
use Gregwar\Image\Image;
|
||||
|
||||
// ...
|
||||
<img src="<?php echo Image::open('image.jpg')->resize(150, 150)->jpeg(); ?>" />
|
||||
// ...
|
||||
```
|
||||
|
||||
This is powerful since if you change the original image or any of your code the cached hash
|
||||
will change and the file will be regenerated.
|
||||
|
||||
Writing image
|
||||
-------------
|
||||
|
||||
You can also create your own image on-the-fly using drawing functions:
|
||||
|
||||
|
||||
```php
|
||||
<img src="<?php echo Image::create(300, 300)
|
||||
->fill(0xffaaaa) // Filling with a light red
|
||||
->rectangle(0xff3333, 0, 100, 300, 200, true) // Drawing a red rectangle
|
||||
// Writing "Hello $username !" on the picture using a custom TTF font file
|
||||
->write('./fonts/CaviarDreams.ttf', 'Hello '.$username.'!', 150, 150, 20, 0, 'white', 'center')
|
||||
->jpeg(); ?>" />
|
||||
```
|
||||
|
||||
Using fallback image
|
||||
--------------------
|
||||
|
||||
If the image file doesn't exists, you can configurate a fallback image that will be used
|
||||
by the class (note that this require the cache directory to be available).
|
||||
|
||||
A default "error" image which is used is in `images/error.jpg`, you can change it with:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$img->setFallback('/path/to/my/fallback.jpg');
|
||||
```
|
||||
|
||||
Garbage Collect
|
||||
===============
|
||||
|
||||
To prevent the cache from growing forever, you can use the provided GarbageCollect class as below:
|
||||
|
||||
```php
|
||||
<?php
|
||||
// This could be a cron called each day @3:00AM for instance
|
||||
use Gregwar\Image\GarbageCollect;
|
||||
|
||||
// Removes all the files from ../cache that are more than 30 days
|
||||
// old. A verbose output will explain which files are deleted
|
||||
GarbageCollect::dropOldFiles(__DIR__.'/../cache', 30, true);
|
||||
|
||||
```
|
||||
|
||||
Using with composer
|
||||
===================
|
||||
|
||||
This repository is available with composer under the name `gregwar/image`, so simply add this to
|
||||
your requires :
|
||||
|
||||
```
|
||||
"requires": {
|
||||
...
|
||||
"gregwar/image": "dev-master"
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
And update your dependencies, you'll be able to use the composer autoloader to load the class
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
`Gregwar\Image` is under MIT License
|
||||
|
||||
Development
|
||||
===========
|
||||
|
||||
`Gregwar\Image` is using PHP metaprogramming paradigms so it make it easy to enhance.
|
||||
|
||||
Each function that handle the image is implemented in an *Adapter*, this is where
|
||||
all the specific actions take places.
|
||||
|
||||
The `Common` adapter is design to contain common abstract actions, while the
|
||||
specific adatpers (like `GD`) are designed to contain actions specific to the low
|
||||
level layer.
|
||||
|
||||
You can add your own methods by adding it in the corresponding adapter.
|
||||
|
||||
```php
|
||||
<?php
|
||||
// In the adapter
|
||||
private function myFilter()
|
||||
{
|
||||
$this->negate();
|
||||
$this->sepia();
|
||||
}
|
||||
```
|
||||
|
||||
Which could be usable on the Image
|
||||
|
||||
```php
|
||||
<?php
|
||||
$image->myFilter();
|
||||
```
|
||||
|
||||
You can also write your own adapter in your application, which could extend one of this repository,
|
||||
and uses it calling `setAdapter()`:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$image->setAdapter(new MyCustomAdapter);
|
||||
```
|
||||
|
||||
Do not hesitate to fork this repository and customize it !
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Source;
|
||||
|
||||
/**
|
||||
* Creates a new image from scratch
|
||||
*/
|
||||
class Create extends Source
|
||||
{
|
||||
protected $width;
|
||||
protected $height;
|
||||
|
||||
public function __construct($width, $height)
|
||||
{
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
public function getInfos()
|
||||
{
|
||||
return array($this->width, $this->height);
|
||||
}
|
||||
|
||||
public function correct()
|
||||
{
|
||||
return $this->width > 0 && $this->height > 0;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Source;
|
||||
|
||||
/**
|
||||
* Having image in some string
|
||||
*/
|
||||
class Data extends Source
|
||||
{
|
||||
protected $data;
|
||||
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function getInfos()
|
||||
{
|
||||
return sha1($this->data);
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Source;
|
||||
|
||||
use Gregwar\Image\Image;
|
||||
|
||||
/**
|
||||
* Open an image from a file
|
||||
*/
|
||||
class File extends Source
|
||||
{
|
||||
protected $file;
|
||||
|
||||
public function __construct($file)
|
||||
{
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
public function getFile()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
|
||||
public function correct()
|
||||
{
|
||||
return false !== @exif_imagetype($this->file);
|
||||
}
|
||||
|
||||
public function guessType()
|
||||
{
|
||||
if (function_exists('exif_imagetype')) {
|
||||
$type = @exif_imagetype($this->file);
|
||||
|
||||
if (false !== $type) {
|
||||
if ($type == IMAGETYPE_JPEG) {
|
||||
return 'jpeg';
|
||||
}
|
||||
|
||||
if ($type == IMAGETYPE_GIF) {
|
||||
return 'gif';
|
||||
}
|
||||
|
||||
if ($type == IMAGETYPE_PNG) {
|
||||
return 'png';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$parts = explode('.', $this->file);
|
||||
$ext = strtolower($parts[count($parts)-1]);
|
||||
|
||||
if (isset(Image::$types[$ext])) {
|
||||
return Image::$types[$ext];
|
||||
}
|
||||
|
||||
return 'jpeg';
|
||||
}
|
||||
|
||||
public function getInfos()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Source;
|
||||
|
||||
/**
|
||||
* Have the image directly in a specific resource
|
||||
*/
|
||||
class Resource extends Source
|
||||
{
|
||||
protected $resource;
|
||||
|
||||
public function __construct($resource)
|
||||
{
|
||||
$this->resource = $resource;
|
||||
}
|
||||
|
||||
public function getResource()
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Gregwar\Image\Source;
|
||||
|
||||
/**
|
||||
* An Image source
|
||||
*/
|
||||
class Source
|
||||
{
|
||||
/**
|
||||
* Guess the type of the image
|
||||
*/
|
||||
public function guessType()
|
||||
{
|
||||
return 'jpeg';
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this image correct ?
|
||||
*/
|
||||
public function correct()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information about images, these informations should
|
||||
* change only if the original image changed
|
||||
*/
|
||||
public function getInfos()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
21
vendor/gregwar/image/Gregwar/Image/autoload.php
vendored
21
vendor/gregwar/image/Gregwar/Image/autoload.php
vendored
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
$vendors = __DIR__.'/vendor/autoload.php';
|
||||
if (file_exists($vendors)) {
|
||||
require($vendors);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an autoload for all the classes in Gregwar\Image
|
||||
*/
|
||||
spl_autoload_register(function ($className) {
|
||||
$namespace = 'Gregwar\\Image';
|
||||
|
||||
if (strpos($className, $namespace) === 0) {
|
||||
$className = str_replace($namespace, '', $className);
|
||||
$fileName = __DIR__ . '/' . str_replace('\\', '/', $className) . '.php';
|
||||
if (file_exists($fileName)) {
|
||||
require($fileName);
|
||||
}
|
||||
}
|
||||
});
|
||||
BIN
vendor/gregwar/image/Gregwar/Image/images/error.jpg
vendored
BIN
vendor/gregwar/image/Gregwar/Image/images/error.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
7
vendor/ircmaxell/password-compat/LICENSE.md
vendored
7
vendor/ircmaxell/password-compat/LICENSE.md
vendored
@@ -1,7 +0,0 @@
|
||||
Copyright (c) 2012 Anthony Ferrara
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
75
vendor/ircmaxell/password-compat/README.md
vendored
75
vendor/ircmaxell/password-compat/README.md
vendored
@@ -1,75 +0,0 @@
|
||||
password_compat
|
||||
===============
|
||||
|
||||
[](https://travis-ci.org/ircmaxell/password_compat)
|
||||
|
||||
This library is intended to provide forward compatibility with the password_* functions being worked on for PHP 5.5.
|
||||
|
||||
See [the RFC](https://wiki.php.net/rfc/password_hash) for more detailed information.
|
||||
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
This library requires `PHP >= 5.3.7` OR a version that has the `$2y` fix backported into it (such as Debian provides).
|
||||
|
||||
The runtime checks have been removed due to this version issue. To see if password_compat is available for your system, run the included `version-test.php`. If it outputs "Pass", you can safely use the library. If not, you cannot.
|
||||
|
||||
If you attempt to use password-compat on an unsupported version, attempts to create or verify hashes will return `false`. You have been warned!
|
||||
|
||||
The reason for this is that PHP prior to 5.3.7 contains a security issue with its BCRYPT implementation. Therefore, it's highly recommended that you upgrade to a newer version of PHP prior to using this layer.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
To install, simply `require` the `password.php` file under `lib`.
|
||||
|
||||
You can also install it via `Composer` by using the [Packagist archive](http://packagist.org/packages/ircmaxell/password-compat).
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
**Creating Password Hashes**
|
||||
|
||||
To create a password hash from a password, simply use the `password_hash` function.
|
||||
|
||||
$hash = password_hash($password, PASSWORD_BCRYPT);
|
||||
|
||||
Note that the algorithm that we chose is `PASSWORD_BCRYPT`. That's the current strongest algorithm supported. This is the `BCRYPT` crypt algorithm. It produces a 60 character hash as the result.
|
||||
|
||||
`BCRYPT` also allows for you to define a `cost` parameter in the options array. This allows for you to change the CPU cost of the algorithm:
|
||||
|
||||
$hash = password_hash($password, PASSWORD_BCRYPT, ["cost" => 10]);
|
||||
|
||||
That's the same as the default. The cost can range from `4` to `31`. I would suggest that you use the highest cost that you can, while keeping response time reasonable (I target between 0.1 and 0.5 seconds for a hash, depending on use-case).
|
||||
|
||||
Another algorithm name is supported:
|
||||
|
||||
PASSWORD_DEFAULT
|
||||
|
||||
This will use the strongest algorithm available to PHP at the current time. Presently, this is the same as specifying `PASSWORD_BCRYPT`. But in future versions of PHP, it may be updated to use a stronger algorithm if one is introduced. It can also be changed if a problem is identified with the BCRYPT algorithm. Note that if you use this option, you are **strongly** encouraged to store it in a `VARCHAR(255)` column to avoid truncation issues if a future algorithm increases the length of the generated hash.
|
||||
|
||||
It is very important that you should check the return value of `password_hash` prior to storing it, because a `false` may be returned if it encountered an error.
|
||||
|
||||
**Verifying Password Hashes**
|
||||
|
||||
To verify a hash created by `password_hash`, simply call:
|
||||
|
||||
if (password_verify($password, $hash)) {
|
||||
/* Valid */
|
||||
} else {
|
||||
/* Invalid */
|
||||
}
|
||||
|
||||
That's all there is to it.
|
||||
|
||||
**Rehashing Passwords**
|
||||
|
||||
From time to time you may update your hashing parameters (algorithm, cost, etc). So a function to determine if rehashing is necessary is available:
|
||||
|
||||
if (password_verify($password, $hash)) {
|
||||
if (password_needs_rehash($hash, $algorithm, $options)) {
|
||||
$hash = password_hash($password, $algorithm, $options);
|
||||
/* Store new hash in db */
|
||||
}
|
||||
}
|
||||
222
vendor/ircmaxell/password-compat/lib/password.php
vendored
222
vendor/ircmaxell/password-compat/lib/password.php
vendored
@@ -1,222 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* A Compatibility library with PHP 5.5's simplified password hashing API.
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@php.net>
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
* @copyright 2012 The Authors
|
||||
*/
|
||||
|
||||
if (!defined('PASSWORD_BCRYPT')) {
|
||||
|
||||
define('PASSWORD_BCRYPT', 1);
|
||||
define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
|
||||
|
||||
/**
|
||||
* Hash the password using the specified algorithm
|
||||
*
|
||||
* @param string $password The password to hash
|
||||
* @param int $algo The algorithm to use (Defined by PASSWORD_* constants)
|
||||
* @param array $options The options for the algorithm to use
|
||||
*
|
||||
* @return string|false The hashed password, or false on error.
|
||||
*/
|
||||
function password_hash($password, $algo, array $options = array()) {
|
||||
if (!function_exists('crypt')) {
|
||||
trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
if (!is_string($password)) {
|
||||
trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
if (!is_int($algo)) {
|
||||
trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
switch ($algo) {
|
||||
case PASSWORD_BCRYPT:
|
||||
// Note that this is a C constant, but not exposed to PHP, so we don't define it here.
|
||||
$cost = 10;
|
||||
if (isset($options['cost'])) {
|
||||
$cost = $options['cost'];
|
||||
if ($cost < 4 || $cost > 31) {
|
||||
trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// The length of salt to generate
|
||||
$raw_salt_len = 16;
|
||||
// The length required in the final serialization
|
||||
$required_salt_len = 22;
|
||||
$hash_format = sprintf("$2y$%02d$", $cost);
|
||||
break;
|
||||
default:
|
||||
trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
if (isset($options['salt'])) {
|
||||
switch (gettype($options['salt'])) {
|
||||
case 'NULL':
|
||||
case 'boolean':
|
||||
case 'integer':
|
||||
case 'double':
|
||||
case 'string':
|
||||
$salt = (string) $options['salt'];
|
||||
break;
|
||||
case 'object':
|
||||
if (method_exists($options['salt'], '__tostring')) {
|
||||
$salt = (string) $options['salt'];
|
||||
break;
|
||||
}
|
||||
case 'array':
|
||||
case 'resource':
|
||||
default:
|
||||
trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
if (strlen($salt) < $required_salt_len) {
|
||||
trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", strlen($salt), $required_salt_len), E_USER_WARNING);
|
||||
return null;
|
||||
} elseif (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $salt)) {
|
||||
$salt = str_replace('+', '.', base64_encode($salt));
|
||||
}
|
||||
} else {
|
||||
$buffer = '';
|
||||
$buffer_valid = false;
|
||||
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
|
||||
$buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM);
|
||||
if ($buffer) {
|
||||
$buffer_valid = true;
|
||||
}
|
||||
}
|
||||
if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) {
|
||||
$buffer = openssl_random_pseudo_bytes($raw_salt_len);
|
||||
if ($buffer) {
|
||||
$buffer_valid = true;
|
||||
}
|
||||
}
|
||||
if (!$buffer_valid && is_readable('/dev/urandom')) {
|
||||
$f = fopen('/dev/urandom', 'r');
|
||||
$read = strlen($buffer);
|
||||
while ($read < $raw_salt_len) {
|
||||
$buffer .= fread($f, $raw_salt_len - $read);
|
||||
$read = strlen($buffer);
|
||||
}
|
||||
fclose($f);
|
||||
if ($read >= $raw_salt_len) {
|
||||
$buffer_valid = true;
|
||||
}
|
||||
}
|
||||
if (!$buffer_valid || strlen($buffer) < $raw_salt_len) {
|
||||
$bl = strlen($buffer);
|
||||
for ($i = 0; $i < $raw_salt_len; $i++) {
|
||||
if ($i < $bl) {
|
||||
$buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255));
|
||||
} else {
|
||||
$buffer .= chr(mt_rand(0, 255));
|
||||
}
|
||||
}
|
||||
}
|
||||
$salt = str_replace('+', '.', base64_encode($buffer));
|
||||
}
|
||||
$salt = substr($salt, 0, $required_salt_len);
|
||||
|
||||
$hash = $hash_format . $salt;
|
||||
|
||||
$ret = crypt($password, $hash);
|
||||
|
||||
if (!is_string($ret) || strlen($ret) <= 13) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about the password hash. Returns an array of the information
|
||||
* that was used to generate the password hash.
|
||||
*
|
||||
* array(
|
||||
* 'algo' => 1,
|
||||
* 'algoName' => 'bcrypt',
|
||||
* 'options' => array(
|
||||
* 'cost' => 10,
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @param string $hash The password hash to extract info from
|
||||
*
|
||||
* @return array The array of information about the hash.
|
||||
*/
|
||||
function password_get_info($hash) {
|
||||
$return = array(
|
||||
'algo' => 0,
|
||||
'algoName' => 'unknown',
|
||||
'options' => array(),
|
||||
);
|
||||
if (substr($hash, 0, 4) == '$2y$' && strlen($hash) == 60) {
|
||||
$return['algo'] = PASSWORD_BCRYPT;
|
||||
$return['algoName'] = 'bcrypt';
|
||||
list($cost) = sscanf($hash, "$2y$%d$");
|
||||
$return['options']['cost'] = $cost;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the password hash needs to be rehashed according to the options provided
|
||||
*
|
||||
* If the answer is true, after validating the password using password_verify, rehash it.
|
||||
*
|
||||
* @param string $hash The hash to test
|
||||
* @param int $algo The algorithm used for new password hashes
|
||||
* @param array $options The options array passed to password_hash
|
||||
*
|
||||
* @return boolean True if the password needs to be rehashed.
|
||||
*/
|
||||
function password_needs_rehash($hash, $algo, array $options = array()) {
|
||||
$info = password_get_info($hash);
|
||||
if ($info['algo'] != $algo) {
|
||||
return true;
|
||||
}
|
||||
switch ($algo) {
|
||||
case PASSWORD_BCRYPT:
|
||||
$cost = isset($options['cost']) ? $options['cost'] : 10;
|
||||
if ($cost != $info['options']['cost']) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify a password against a hash using a timing attack resistant approach
|
||||
*
|
||||
* @param string $password The password to verify
|
||||
* @param string $hash The hash to verify against
|
||||
*
|
||||
* @return boolean If the password matches the hash
|
||||
*/
|
||||
function password_verify($password, $hash) {
|
||||
if (!function_exists('crypt')) {
|
||||
trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
$ret = crypt($password, $hash);
|
||||
if (!is_string($ret) || strlen($ret) != strlen($hash) || strlen($ret) <= 13) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$status = 0;
|
||||
for ($i = 0; $i < strlen($ret); $i++) {
|
||||
$status |= (ord($ret[$i]) ^ ord($hash[$i]));
|
||||
}
|
||||
|
||||
return $status === 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
141
vendor/mrclay/minify/HISTORY.txt
vendored
141
vendor/mrclay/minify/HISTORY.txt
vendored
@@ -1,141 +0,0 @@
|
||||
Minify Release History
|
||||
|
||||
(master)
|
||||
* Builder styled with Bootstrap (thanks to help from acidvertigo)
|
||||
|
||||
Version 2.2.0
|
||||
* Fix handling of RegEx in certain situations in JSMin
|
||||
* Thanks to Vovan-VE for reporting this
|
||||
* Update composer.json with support info
|
||||
* Add ability to set ClosureCompiler URL
|
||||
* Thanks Elan Ruusamäe for the pull request
|
||||
* Better report of temp directory errors
|
||||
* Also thanks to Elan Ruusamäe for anatoher pull request
|
||||
* Updated CSSmin and added Minify_CSSmin wrapper
|
||||
* Fix windows issue associated with long cache filenames
|
||||
* Fix issue with web-based tool
|
||||
* Fix bug in JSMin exceptions
|
||||
* Fix "about:blank" bug in CSS_UriRewriter
|
||||
* Cite is no longer a block element in HTML minification
|
||||
* Allow for definition of custom config locations outside of the min directory
|
||||
* Thanks Sam Bauers for the pull request
|
||||
* Allow option for overriding the maximum byte size POST limit for ClosureCompiler and other additions
|
||||
* Thanks Joscha Feth for the code
|
||||
* Fixes to file-relative URL identification in UriRewriter
|
||||
* Allow far-future expiration and file versioning with the "v" querystirng parameter in addition to existing method
|
||||
* Lots of general code tidy ups
|
||||
|
||||
Version 2.1.7
|
||||
* Fixes arbitrary file inclusion vulnerability on some systems
|
||||
* Thanks to Matt Mecham for reporting this
|
||||
|
||||
Version 2.1.6
|
||||
* JSMin fixes
|
||||
* Prevents some Closure Compiler API failures
|
||||
* Uses autoloading for all class loading
|
||||
* Multiple group support in HTML Helper
|
||||
* Cache adaptor for XCache
|
||||
* Allow setting stack-size in YUI Compressor wrapper
|
||||
* Adds jsCleanComments option to HTML minifier
|
||||
* Upgrades CSSmin
|
||||
* CLI script more portable
|
||||
* Adds composer.json
|
||||
|
||||
Version 2.1.5
|
||||
* Removed XSS vulnerability
|
||||
* Disabled builder bby default
|
||||
* command line tools to minify and rewrite URIs in CSS
|
||||
* upgrade (optional) JSMin+ library
|
||||
* more efficient JS minification when using CC/YUIC
|
||||
* Closure Compiler uses cURL when allow_url_fopen is off
|
||||
* Missing file notices when using groups
|
||||
|
||||
Version 2.1.4
|
||||
* Option to minify JS with Closure Compiler API w/ JSMin failover
|
||||
* Cookie/bookmarklet-based debug mode. No HTML editing!
|
||||
* Allows 1 file to be missing w/o complete failure
|
||||
* Combine multiple groups and files in single URI
|
||||
* More useful HTML helpers for writing versioned URIs
|
||||
* More detailed error logging, including minifier exceptions
|
||||
* Builder offers more helpful messages/PHP environment warnings
|
||||
* Bypass minification based on filename pattern. e.g. foo.min.js / foo-min.css
|
||||
* JSMin won't choke on common Closure compiler syntaxes (i+ ++j)
|
||||
* Better caching in IE6
|
||||
* Cache ids are influenced by group/file names
|
||||
* Debug mode for Javascript doesn't break on common XPath strings (Prototype 1.6)
|
||||
* Removed annoying maxFiles limit
|
||||
* mbstring.func_overload usage is safer
|
||||
|
||||
Version 2.1.3
|
||||
* HTTP fixes
|
||||
* ETag generation now valid (different when gzipped)
|
||||
* Vary header always sent when Accept-Encoding is sniffed
|
||||
* Cache-Control no longer has "must-revalidate" due to webkit bug
|
||||
See: http://mrclay.org/index.php/2009/02/24/safari-4-beta-cache-controlmust-revalidate-bug/
|
||||
* Dropped deflate encoding. Browser and proxy support could be buggy.
|
||||
See: http://stackoverflow.com/questions/883841/
|
||||
* File cache now works w/o setting $min_cachePath
|
||||
* Allow setting contentType in Minify_Source objects
|
||||
* No more 5.3 deprecation warnings: split() removed
|
||||
|
||||
Version 2.1.2
|
||||
* Javascript fixes
|
||||
* Debug mode no longer confused by "*/*" in strings/RegExps (jQuery)
|
||||
* quote characters inside RegExp literals no longer cause exception
|
||||
* files ending in single-line comments no longer cause code loss
|
||||
* CSS: data: URLs no longer mangled
|
||||
* Optional error logging to Firefox's FirePHP extension
|
||||
* Unit tests to check for common DOCUMENT_ROOT problems
|
||||
* DOCUMENT_ROOT no longer overwritten on IIS servers
|
||||
* Builder app doesn't fail on systems without gzdeflate()
|
||||
* APC caching class included
|
||||
|
||||
Version 2.1.1
|
||||
* Bug fix release
|
||||
* Detection and workarounds for zlib.output_compression and non-PHP encoding modules
|
||||
* Zlib not required (mod_rewrite, et.al., can still be used for encoding)
|
||||
* HTML : More IE conditional comments preserved
|
||||
* Minify_groupUri() utility fixed
|
||||
|
||||
Version 2.1.0
|
||||
* "min" default application for quick deployment
|
||||
* Minify URI Builder app & bookmarklet for quickly creating minify URIs
|
||||
* Relative URIs in CSS file are fixed automatically by default
|
||||
* "debug" mode for revealing original line #s in combined files
|
||||
* Better IIS support
|
||||
* Improved minifier classes:
|
||||
* JS: preserves IE conditional comments
|
||||
* CSS: smaller output, preserves more hacks and valid CSS syntax,
|
||||
shorter line lengths, other bug fixes
|
||||
* HTML: smaller output, shorter line lengths, other bug fixes
|
||||
* Default Cache-Control: max-age of 30 minutes
|
||||
* Conditional GETs supported even when max-age sent
|
||||
* Experimental memcache cache class (default is files)
|
||||
* Minify_Cache_File has flock()s (by default)
|
||||
* Workaround for Windows mtime reporting bug
|
||||
|
||||
Version 2.0.2 beta (2008-06-24)
|
||||
* Fast new cache system. Cached files served almost 3x as fast.
|
||||
* Dropped support of compress encoding (though HTTP_Encoder still supports it)
|
||||
|
||||
Version 2.0.1 (2008-05-31)
|
||||
* E_STRICT compliance (Cache_Lite_File).
|
||||
|
||||
Version 2.0.0 (2008-05-22)
|
||||
* Complete code overhaul. Minify is now a PEAR-style class and toolkit
|
||||
for building customized minifying file servers.
|
||||
* Content-Encoding: deflate/gzip/compress, based on request headers
|
||||
* Expanded CSS and HTML minifiers with test cases
|
||||
* Easily plug-in 3rd-party minifiers (like Packer)
|
||||
* Plug-able front end controller allows changing the way files are chosen
|
||||
* Compression & encoding modules lazy-loaded as needed (304 responses use
|
||||
use minimal code)
|
||||
* Separate utility classes for HTTP encoding and cache control
|
||||
|
||||
Version 1.0.1 (2007-05-05)
|
||||
* Fixed various problems resolving pathnames when hosted on an NFS mount.
|
||||
* Fixed 'undefined constant' notice.
|
||||
* Replaced old JSMin library with a much faster custom implementation.
|
||||
|
||||
Version 1.0.0 (2007-05-02)
|
||||
* First release.
|
||||
26
vendor/mrclay/minify/LICENSE.txt
vendored
26
vendor/mrclay/minify/LICENSE.txt
vendored
@@ -1,26 +0,0 @@
|
||||
Copyright (c) 2008 Ryan Grove <ryan@wonko.com>
|
||||
Copyright (c) 2008 Steve Clay <steve@mrclay.org>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of this project nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
181
vendor/mrclay/minify/MIN.txt
vendored
181
vendor/mrclay/minify/MIN.txt
vendored
@@ -1,181 +0,0 @@
|
||||
The files in the /min/ directory represent the default Minify setup designed to ease
|
||||
integration with your site. This app will combine and minify your Javascript or
|
||||
CSS files and serve them with HTTP compression and cache headers.
|
||||
|
||||
|
||||
RECOMMENDED
|
||||
|
||||
It's recommended to edit /min/config.php to set $min_cachePath to a writeable
|
||||
(by PHP) directory on your system. This will improve performance.
|
||||
|
||||
|
||||
GETTING STARTED
|
||||
|
||||
The quickest way to get started is to use the Minify URI Builder application
|
||||
on your website: http://example.com/min/builder/
|
||||
|
||||
|
||||
MINIFYING A SINGLE FILE
|
||||
|
||||
Let's say you want to serve this file:
|
||||
http://example.com/wp-content/themes/default/default.css
|
||||
|
||||
Here's the "Minify URL" for this file:
|
||||
http://example.com/min/?f=wp-content/themes/default/default.css
|
||||
|
||||
In other words, the "f" argument is set to the file path from root without the
|
||||
initial "/". As CSS files may contain relative URIs, Minify will automatically
|
||||
"fix" these by rewriting them as root relative.
|
||||
|
||||
|
||||
COMBINING MULTIPLE FILES IN ONE DOWNLOAD
|
||||
|
||||
Separate the paths given to "f" with commas.
|
||||
|
||||
Let's say you have CSS files at these URLs:
|
||||
http://example.com/scripts/jquery-1.2.6.js
|
||||
http://example.com/scripts/site.js
|
||||
|
||||
You can combine these files through Minify by requesting this URL:
|
||||
http://example.com/min/?f=scripts/jquery-1.2.6.js,scripts/site.js
|
||||
|
||||
|
||||
SIMPLIFYING URLS WITH A BASE PATH
|
||||
|
||||
If you're combining files that share the same ancestor directory, you can use
|
||||
the "b" argument to set the base directory for the "f" argument. Do not include
|
||||
the leading or trailing "/" characters.
|
||||
|
||||
E.g., the following URLs will serve the exact same content:
|
||||
http://example.com/min/?f=scripts/jquery-1.2.6.js,scripts/site.js,scripts/home.js
|
||||
http://example.com/min/?b=scripts&f=jquery-1.2.6.js,site.js,home.js
|
||||
|
||||
|
||||
MINIFY URLS IN HTML
|
||||
|
||||
In HTML files, don't forget to replace any "&" characters with "&".
|
||||
|
||||
|
||||
SPECIFYING ALLOWED DIRECTORIES
|
||||
|
||||
By default, Minify will serve any *.css/*.js files within the DOCUMENT_ROOT. If
|
||||
you'd prefer to limit Minify's access to certain directories, set the
|
||||
$min_serveOptions['minApp']['allowDirs'] array in config.php. E.g. to limit
|
||||
to the /js and /themes/default directories, use:
|
||||
|
||||
$min_serveOptions['minApp']['allowDirs'] = array('//js', '//themes/default');
|
||||
|
||||
|
||||
GROUPS: NICER URLS
|
||||
|
||||
For nicer URLs, edit groupsConfig.php to pre-specify groups of files
|
||||
to be combined under preset keys. E.g., here's an example configuration in
|
||||
groupsConfig.php:
|
||||
|
||||
return array(
|
||||
'js' => array('//js/Class.js', '//js/email.js')
|
||||
);
|
||||
|
||||
This pre-selects the following files to be combined under the key "js":
|
||||
http://example.com/js/Class.js
|
||||
http://example.com/js/email.js
|
||||
|
||||
You can now serve these files with this simple URL:
|
||||
http://example.com/min/?g=js
|
||||
|
||||
|
||||
GROUPS: SPECIFYING FILES OUTSIDE THE DOC_ROOT
|
||||
|
||||
In the groupsConfig.php array, the "//" in the file paths is a shortcut for
|
||||
the DOCUMENT_ROOT, but you can also specify paths from the root of the filesystem
|
||||
or relative to the DOC_ROOT:
|
||||
|
||||
return array(
|
||||
'js' => array(
|
||||
'//js/file.js' // file within DOC_ROOT
|
||||
,'//../file.js' // file in parent directory of DOC_ROOT
|
||||
,'C:/Users/Steve/file.js' // file anywhere on filesystem
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
COMBINE MULTIPLE GROUPS AND FILES IN ONE URL
|
||||
|
||||
E.g.: http://example.com/min/?g=js&f=more/scripts.js
|
||||
|
||||
Separate group keys with commas:
|
||||
http://example.com/min/?g=baseCss,css1&f=moreStyles.css
|
||||
|
||||
|
||||
FAR-FUTURE EXPIRES HEADERS
|
||||
|
||||
Minify can send far-future (one year) Expires headers. To enable this you must
|
||||
add a number or the parameter "v" to the querystring (e.g. /min/?g=js&1234 or
|
||||
/min/?g=js&v=1234) and alter it whenever a source file is changed. If you have a
|
||||
build process you can use a build/source control revision number.
|
||||
|
||||
You can alternately use the utility function Minify_getUri() to get a "versioned"
|
||||
Minify URI for use in your HTML. E.g.:
|
||||
|
||||
<?php
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/min/utils.php';
|
||||
|
||||
$jsUri = Minify_getUri('js'); // a key in groupsConfig.php
|
||||
echo "<script src='{$jsUri}'></script>";
|
||||
|
||||
$cssUri = Minify_getUri(array(
|
||||
'//css/styles1.css'
|
||||
,'//css/styles2.css'
|
||||
)); // a list of files
|
||||
echo "<link rel=stylesheet href='{$cssUri}'>";
|
||||
|
||||
|
||||
STORING CONFIG FILES OUTSIDE THE MINIFY DIRECTORY
|
||||
|
||||
It is possible to store config files (min/config.php, min/config-test.php,
|
||||
min/groupsConfig.php) in a custom directory outside the Minify directory. This is
|
||||
useful if you wish to include Minify as an external dependency inside another
|
||||
project via SVN external or Git submodule inclusion.
|
||||
|
||||
For example, let's assume you have a Minify directory "min" in your site root. Then
|
||||
you could create a new directory called "min-configs" in the site root. Copy any
|
||||
config files you wish to modify to "min-configs", and modify as desired.
|
||||
|
||||
Then create a new file, for example "min.php" in your site root. The contents of
|
||||
this file could look like this:
|
||||
|
||||
<?php
|
||||
$customConfigDirectory = dirname(__FILE__) . '/min-configs';
|
||||
$min_customConfigPaths = array(
|
||||
'base' => $customConfigDirectory . '/config.php',
|
||||
'test' => $customConfigDirectory . '/config-test.php',
|
||||
'groups' => $customConfigDirectory . '/groupsConfig.php'
|
||||
);
|
||||
|
||||
include_once 'min/index.php';
|
||||
|
||||
You would then reference min.php in your JS and CSS links instead of min/index.php.
|
||||
|
||||
This method will affect those using the Minify_getUri() function. You will need
|
||||
to add options to calls to that function, e.g.:
|
||||
|
||||
<?php
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/min/utils.php';
|
||||
|
||||
$jsUri = Minify_getUri('//js/file.js', array('minAppUri' => '/min.php'));
|
||||
echo "<script src='{$jsUri}'></script>";
|
||||
|
||||
|
||||
DEBUG MODE
|
||||
|
||||
In debug mode, instead of compressing files, Minify sends combined files with
|
||||
comments prepended to each line to show the line number in the original source
|
||||
file. To enable this, set $min_allowDebugFlag to true in config.php and append
|
||||
"&debug=1" to your URIs. E.g. /min/?f=script1.js,script2.js&debug=1
|
||||
|
||||
Known issue: files with comment-like strings/regexps can cause problems in this mode.
|
||||
|
||||
|
||||
QUESTIONS?
|
||||
|
||||
http://groups.google.com/group/minify
|
||||
68
vendor/mrclay/minify/README.txt
vendored
68
vendor/mrclay/minify/README.txt
vendored
@@ -1,68 +0,0 @@
|
||||
WELCOME TO MINIFY!
|
||||
|
||||
Minify is an HTTP content server. It compresses sources of content
|
||||
(usually files), combines the result and serves it with appropriate
|
||||
HTTP headers. These headers can allow clients to perform conditional
|
||||
GETs (serving content only when clients do not have a valid cache)
|
||||
and tell clients to cache the file for a period of time.
|
||||
More info: http://code.google.com/p/minify/
|
||||
|
||||
|
||||
WORDPRESS USER?
|
||||
|
||||
These WP plugins integrate Minify into WordPress's style and script hooks to
|
||||
get you set up faster.
|
||||
http://wordpress.org/extend/plugins/bwp-minify/
|
||||
http://wordpress.org/extend/plugins/w3-total-cache/
|
||||
|
||||
|
||||
INSTALLATION
|
||||
|
||||
Place the /min/ directory as a child of your DOCUMENT_ROOT
|
||||
directory: i.e. you will have: /home/example/www/min
|
||||
|
||||
You can see verify that it is working by visiting these two URLs:
|
||||
http://example.org/min/?f=min/quick-test.js
|
||||
http://example.org/min/?f=min/quick-test.css
|
||||
|
||||
If your server supports mod_rewrite, this URL should also work:
|
||||
http://example.org/min/f=min/quick-test.js
|
||||
|
||||
CONFIGURATION & USAGE
|
||||
|
||||
See the MIN.txt file and http://code.google.com/p/minify/wiki/UserGuide
|
||||
|
||||
Minify also comes with a URI Builder application that can help you write URLs
|
||||
for use with Minify or configure groups of files. See here for details:
|
||||
http://code.google.com/p/minify/wiki/BuilderApp
|
||||
|
||||
The cookbook also provides some more advanced options for minification:
|
||||
http://code.google.com/p/minify/wiki/CookBook
|
||||
|
||||
UPGRADING
|
||||
|
||||
See UPGRADING.txt for instructions.
|
||||
|
||||
|
||||
UNIT TESTING:
|
||||
|
||||
1. Place the /min_unit_tests/ directory as a child of your DOCUMENT_ROOT
|
||||
directory: i.e. you will have: /home/example/www/min_unit_tests
|
||||
|
||||
2. To run unit tests, access: http://example.org/min_unit_tests/test_all.php
|
||||
|
||||
(If you wish, the other test_*.php files can be run to test individual
|
||||
components with more verbose output.)
|
||||
|
||||
3. Remove /min_unit_tests/ from your DOCUMENT_ROOT when you are done.
|
||||
|
||||
|
||||
FILE ENCODINGS
|
||||
|
||||
Minify *should* work fine with files encoded in UTF-8 or other 8-bit
|
||||
encodings like ISO 8859/Windows-1252. By default Minify appends
|
||||
";charset=utf-8" to the Content-Type headers it sends.
|
||||
|
||||
Leading UTF-8 BOMs are stripped from all sources to prevent
|
||||
duplication in output files, and files are converted to Unix newlines.
|
||||
|
||||
28
vendor/mrclay/minify/UPGRADING.txt
vendored
28
vendor/mrclay/minify/UPGRADING.txt
vendored
@@ -1,28 +0,0 @@
|
||||
Minify Upgrade Guide
|
||||
|
||||
UPGRADING FROM 2.1.*
|
||||
|
||||
1. Rename the following files:
|
||||
|
||||
/min/config.php --> /min/old_config.php
|
||||
/min/groupsConfig.php --> /min/old_groupsConfig.php
|
||||
|
||||
2. Overwrite all files in /min (and /min_unit_tests) with those from this zip.
|
||||
|
||||
3. Delete /min/groupsConfig.php
|
||||
|
||||
4. Rename /min/old_groupsConfig.php --> /min/groupsConfig.php
|
||||
|
||||
5. Merge your settings in old_config.php into config.php.
|
||||
|
||||
6. (optional) Delete /min/old_config.php.
|
||||
|
||||
|
||||
INSTALLING FRESH
|
||||
|
||||
See README.txt for instructions on installing this app for the first time.
|
||||
|
||||
|
||||
SUPPORT
|
||||
|
||||
Send a message to http://groups.google.com/group/minify
|
||||
779
vendor/mrclay/minify/min/lib/CSSmin.php
vendored
779
vendor/mrclay/minify/min/lib/CSSmin.php
vendored
@@ -1,779 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* cssmin.php 2.4.8-2
|
||||
* Author: Tubal Martin - http://tubalmartin.me/
|
||||
* Repo: https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port
|
||||
*
|
||||
* This is a PHP port of the CSS minification tool distributed with YUICompressor,
|
||||
* itself a port of the cssmin utility by Isaac Schlueter - http://foohack.com/
|
||||
* Permission is hereby granted to use the PHP version under the same
|
||||
* conditions as the YUICompressor.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* YUI Compressor
|
||||
* http://developer.yahoo.com/yui/compressor/
|
||||
* Author: Julien Lecomte - http://www.julienlecomte.net/
|
||||
* Copyright (c) 2013 Yahoo! Inc. All rights reserved.
|
||||
* The copyrights embodied in the content of this file are licensed
|
||||
* by Yahoo! Inc. under the BSD (revised) open source license.
|
||||
*/
|
||||
|
||||
class CSSmin
|
||||
{
|
||||
const NL = '___YUICSSMIN_PRESERVED_NL___';
|
||||
const TOKEN = '___YUICSSMIN_PRESERVED_TOKEN_';
|
||||
const COMMENT = '___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_';
|
||||
const CLASSCOLON = '___YUICSSMIN_PSEUDOCLASSCOLON___';
|
||||
const QUERY_FRACTION = '___YUICSSMIN_QUERY_FRACTION___';
|
||||
|
||||
private $comments;
|
||||
private $preserved_tokens;
|
||||
private $memory_limit;
|
||||
private $max_execution_time;
|
||||
private $pcre_backtrack_limit;
|
||||
private $pcre_recursion_limit;
|
||||
private $raise_php_limits;
|
||||
|
||||
/**
|
||||
* @param bool|int $raise_php_limits
|
||||
* If true, PHP settings will be raised if needed
|
||||
*/
|
||||
public function __construct($raise_php_limits = TRUE)
|
||||
{
|
||||
// Set suggested PHP limits
|
||||
$this->memory_limit = 128 * 1048576; // 128MB in bytes
|
||||
$this->max_execution_time = 60; // 1 min
|
||||
$this->pcre_backtrack_limit = 1000 * 1000;
|
||||
$this->pcre_recursion_limit = 500 * 1000;
|
||||
|
||||
$this->raise_php_limits = (bool) $raise_php_limits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minify a string of CSS
|
||||
* @param string $css
|
||||
* @param int|bool $linebreak_pos
|
||||
* @return string
|
||||
*/
|
||||
public function run($css = '', $linebreak_pos = FALSE)
|
||||
{
|
||||
if (empty($css)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($this->raise_php_limits) {
|
||||
$this->do_raise_php_limits();
|
||||
}
|
||||
|
||||
$this->comments = array();
|
||||
$this->preserved_tokens = array();
|
||||
|
||||
$start_index = 0;
|
||||
$length = strlen($css);
|
||||
|
||||
$css = $this->extract_data_urls($css);
|
||||
|
||||
// collect all comment blocks...
|
||||
while (($start_index = $this->index_of($css, '/*', $start_index)) >= 0) {
|
||||
$end_index = $this->index_of($css, '*/', $start_index + 2);
|
||||
if ($end_index < 0) {
|
||||
$end_index = $length;
|
||||
}
|
||||
$comment_found = $this->str_slice($css, $start_index + 2, $end_index);
|
||||
$this->comments[] = $comment_found;
|
||||
$comment_preserve_string = self::COMMENT . (count($this->comments) - 1) . '___';
|
||||
$css = $this->str_slice($css, 0, $start_index + 2) . $comment_preserve_string . $this->str_slice($css, $end_index);
|
||||
// Set correct start_index: Fixes issue #2528130
|
||||
$start_index = $end_index + 2 + strlen($comment_preserve_string) - strlen($comment_found);
|
||||
}
|
||||
|
||||
// preserve strings so their content doesn't get accidentally minified
|
||||
$css = preg_replace_callback('/(?:"(?:[^\\\\"]|\\\\.|\\\\)*")|'."(?:'(?:[^\\\\']|\\\\.|\\\\)*')/S", array($this, 'replace_string'), $css);
|
||||
|
||||
// Let's divide css code in chunks of 5.000 chars aprox.
|
||||
// Reason: PHP's PCRE functions like preg_replace have a "backtrack limit"
|
||||
// of 100.000 chars by default (php < 5.3.7) so if we're dealing with really
|
||||
// long strings and a (sub)pattern matches a number of chars greater than
|
||||
// the backtrack limit number (i.e. /(.*)/s) PCRE functions may fail silently
|
||||
// returning NULL and $css would be empty.
|
||||
$charset = '';
|
||||
$charset_regexp = '/(@charset)( [^;]+;)/i';
|
||||
$css_chunks = array();
|
||||
$css_chunk_length = 5000; // aprox size, not exact
|
||||
$start_index = 0;
|
||||
$i = $css_chunk_length; // save initial iterations
|
||||
$l = strlen($css);
|
||||
|
||||
|
||||
// if the number of characters is 25000 or less, do not chunk
|
||||
if ($l <= $css_chunk_length) {
|
||||
$css_chunks[] = $css;
|
||||
} else {
|
||||
// chunk css code securely
|
||||
while ($i < $l) {
|
||||
$i += 50; // save iterations
|
||||
if ($l - $start_index <= $css_chunk_length || $i >= $l) {
|
||||
$css_chunks[] = $this->str_slice($css, $start_index);
|
||||
break;
|
||||
}
|
||||
if ($css[$i - 1] === '}' && $i - $start_index > $css_chunk_length) {
|
||||
// If there are two ending curly braces }} separated or not by spaces,
|
||||
// join them in the same chunk (i.e. @media blocks)
|
||||
$next_chunk = substr($css, $i);
|
||||
if (preg_match('/^\s*\}/', $next_chunk)) {
|
||||
$i = $i + $this->index_of($next_chunk, '}') + 1;
|
||||
}
|
||||
|
||||
$css_chunks[] = $this->str_slice($css, $start_index, $i);
|
||||
$start_index = $i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Minify each chunk
|
||||
for ($i = 0, $n = count($css_chunks); $i < $n; $i++) {
|
||||
$css_chunks[$i] = $this->minify($css_chunks[$i], $linebreak_pos);
|
||||
// Keep the first @charset at-rule found
|
||||
if (empty($charset) && preg_match($charset_regexp, $css_chunks[$i], $matches)) {
|
||||
$charset = strtolower($matches[1]) . $matches[2];
|
||||
}
|
||||
// Delete all @charset at-rules
|
||||
$css_chunks[$i] = preg_replace($charset_regexp, '', $css_chunks[$i]);
|
||||
}
|
||||
|
||||
// Update the first chunk and push the charset to the top of the file.
|
||||
$css_chunks[0] = $charset . $css_chunks[0];
|
||||
|
||||
return implode('', $css_chunks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the memory limit for this script
|
||||
* @param int|string $limit
|
||||
*/
|
||||
public function set_memory_limit($limit)
|
||||
{
|
||||
$this->memory_limit = $this->normalize_int($limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum execution time for this script
|
||||
* @param int|string $seconds
|
||||
*/
|
||||
public function set_max_execution_time($seconds)
|
||||
{
|
||||
$this->max_execution_time = (int) $seconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the PCRE backtrack limit for this script
|
||||
* @param int $limit
|
||||
*/
|
||||
public function set_pcre_backtrack_limit($limit)
|
||||
{
|
||||
$this->pcre_backtrack_limit = (int) $limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the PCRE recursion limit for this script
|
||||
* @param int $limit
|
||||
*/
|
||||
public function set_pcre_recursion_limit($limit)
|
||||
{
|
||||
$this->pcre_recursion_limit = (int) $limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to configure PHP to use at least the suggested minimum settings
|
||||
*/
|
||||
private function do_raise_php_limits()
|
||||
{
|
||||
$php_limits = array(
|
||||
'memory_limit' => $this->memory_limit,
|
||||
'max_execution_time' => $this->max_execution_time,
|
||||
'pcre.backtrack_limit' => $this->pcre_backtrack_limit,
|
||||
'pcre.recursion_limit' => $this->pcre_recursion_limit
|
||||
);
|
||||
|
||||
// If current settings are higher respect them.
|
||||
foreach ($php_limits as $name => $suggested) {
|
||||
$current = $this->normalize_int(ini_get($name));
|
||||
// memory_limit exception: allow -1 for "no memory limit".
|
||||
if ($current > -1 && ($suggested == -1 || $current < $suggested)) {
|
||||
ini_set($name, $suggested);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does bulk of the minification
|
||||
* @param string $css
|
||||
* @param int|bool $linebreak_pos
|
||||
* @return string
|
||||
*/
|
||||
private function minify($css, $linebreak_pos)
|
||||
{
|
||||
// strings are safe, now wrestle the comments
|
||||
for ($i = 0, $max = count($this->comments); $i < $max; $i++) {
|
||||
|
||||
$token = $this->comments[$i];
|
||||
$placeholder = '/' . self::COMMENT . $i . '___/';
|
||||
|
||||
// ! in the first position of the comment means preserve
|
||||
// so push to the preserved tokens keeping the !
|
||||
if (substr($token, 0, 1) === '!') {
|
||||
$this->preserved_tokens[] = $token;
|
||||
$token_tring = self::TOKEN . (count($this->preserved_tokens) - 1) . '___';
|
||||
$css = preg_replace($placeholder, $token_tring, $css, 1);
|
||||
// Preserve new lines for /*! important comments
|
||||
$css = preg_replace('/\s*[\n\r\f]+\s*(\/\*'. $token_tring .')/S', self::NL.'$1', $css);
|
||||
$css = preg_replace('/('. $token_tring .'\*\/)\s*[\n\r\f]+\s*/', '$1'.self::NL, $css);
|
||||
continue;
|
||||
}
|
||||
|
||||
// \ in the last position looks like hack for Mac/IE5
|
||||
// shorten that to /*\*/ and the next one to /**/
|
||||
if (substr($token, (strlen($token) - 1), 1) === '\\') {
|
||||
$this->preserved_tokens[] = '\\';
|
||||
$css = preg_replace($placeholder, self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1);
|
||||
$i = $i + 1; // attn: advancing the loop
|
||||
$this->preserved_tokens[] = '';
|
||||
$css = preg_replace('/' . self::COMMENT . $i . '___/', self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// keep empty comments after child selectors (IE7 hack)
|
||||
// e.g. html >/**/ body
|
||||
if (strlen($token) === 0) {
|
||||
$start_index = $this->index_of($css, $this->str_slice($placeholder, 1, -1));
|
||||
if ($start_index > 2) {
|
||||
if (substr($css, $start_index - 3, 1) === '>') {
|
||||
$this->preserved_tokens[] = '';
|
||||
$css = preg_replace($placeholder, self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// in all other cases kill the comment
|
||||
$css = preg_replace('/\/\*' . $this->str_slice($placeholder, 1, -1) . '\*\//', '', $css, 1);
|
||||
}
|
||||
|
||||
|
||||
// Normalize all whitespace strings to single spaces. Easier to work with that way.
|
||||
$css = preg_replace('/\s+/', ' ', $css);
|
||||
|
||||
// Fix IE7 issue on matrix filters which browser accept whitespaces between Matrix parameters
|
||||
$css = preg_replace_callback('/\s*filter\:\s*progid:DXImageTransform\.Microsoft\.Matrix\(([^\)]+)\)/', array($this, 'preserve_old_IE_specific_matrix_definition'), $css);
|
||||
|
||||
// Shorten & preserve calculations calc(...) since spaces are important
|
||||
$css = preg_replace_callback('/calc(\(((?:[^\(\)]+|(?1))*)\))/i', array($this, 'replace_calc'), $css);
|
||||
|
||||
// Replace positive sign from numbers preceded by : or a white-space before the leading space is removed
|
||||
// +1.2em to 1.2em, +.8px to .8px, +2% to 2%
|
||||
$css = preg_replace('/((?<!\\\\)\:|\s)\+(\.?\d+)/S', '$1$2', $css);
|
||||
|
||||
// Remove leading zeros from integer and float numbers preceded by : or a white-space
|
||||
// 000.6 to .6, -0.8 to -.8, 0050 to 50, -01.05 to -1.05
|
||||
$css = preg_replace('/((?<!\\\\)\:|\s)(\-?)0+(\.?\d+)/S', '$1$2$3', $css);
|
||||
|
||||
// Remove trailing zeros from float numbers preceded by : or a white-space
|
||||
// -6.0100em to -6.01em, .0100 to .01, 1.200px to 1.2px
|
||||
$css = preg_replace('/((?<!\\\\)\:|\s)(\-?)(\d?\.\d+?)0+([^\d])/S', '$1$2$3$4', $css);
|
||||
|
||||
// Remove trailing .0 -> -9.0 to -9
|
||||
$css = preg_replace('/((?<!\\\\)\:|\s)(\-?\d+)\.0([^\d])/S', '$1$2$3', $css);
|
||||
|
||||
// Replace 0 length numbers with 0
|
||||
$css = preg_replace('/((?<!\\\\)\:|\s)\-?\.?0+([^\d])/S', '${1}0$2', $css);
|
||||
|
||||
// Remove the spaces before the things that should not have spaces before them.
|
||||
// But, be careful not to turn "p :link {...}" into "p:link{...}"
|
||||
// Swap out any pseudo-class colons with the token, and then swap back.
|
||||
$css = preg_replace_callback('/(?:^|\})(?:(?:[^\{\:])+\:)+(?:[^\{]*\{)/', array($this, 'replace_colon'), $css);
|
||||
|
||||
// Remove spaces before the things that should not have spaces before them.
|
||||
$css = preg_replace('/\s+([\!\{\}\;\:\>\+\(\)\]\~\=,])/', '$1', $css);
|
||||
|
||||
// Restore spaces for !important
|
||||
$css = preg_replace('/\!important/i', ' !important', $css);
|
||||
|
||||
// bring back the colon
|
||||
$css = preg_replace('/' . self::CLASSCOLON . '/', ':', $css);
|
||||
|
||||
// retain space for special IE6 cases
|
||||
$css = preg_replace_callback('/\:first\-(line|letter)(\{|,)/i', array($this, 'lowercase_pseudo_first'), $css);
|
||||
|
||||
// no space after the end of a preserved comment
|
||||
$css = preg_replace('/\*\/ /', '*/', $css);
|
||||
|
||||
// lowercase some popular @directives
|
||||
$css = preg_replace_callback('/@(font-face|import|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?keyframe|media|page|namespace)/i', array($this, 'lowercase_directives'), $css);
|
||||
|
||||
// lowercase some more common pseudo-elements
|
||||
$css = preg_replace_callback('/:(active|after|before|checked|disabled|empty|enabled|first-(?:child|of-type)|focus|hover|last-(?:child|of-type)|link|only-(?:child|of-type)|root|:selection|target|visited)/i', array($this, 'lowercase_pseudo_elements'), $css);
|
||||
|
||||
// lowercase some more common functions
|
||||
$css = preg_replace_callback('/:(lang|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|(?:-(?:moz|webkit)-)?any)\(/i', array($this, 'lowercase_common_functions'), $css);
|
||||
|
||||
// lower case some common function that can be values
|
||||
// NOTE: rgb() isn't useful as we replace with #hex later, as well as and() is already done for us
|
||||
$css = preg_replace_callback('/([:,\( ]\s*)(attr|color-stop|from|rgba|to|url|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?(?:calc|max|min|(?:repeating-)?(?:linear|radial)-gradient)|-webkit-gradient)/iS', array($this, 'lowercase_common_functions_values'), $css);
|
||||
|
||||
// Put the space back in some cases, to support stuff like
|
||||
// @media screen and (-webkit-min-device-pixel-ratio:0){
|
||||
$css = preg_replace('/\band\(/i', 'and (', $css);
|
||||
|
||||
// Put the space back in for @support tag
|
||||
// @supports (display: flex) and @supports not (display: flex)
|
||||
$css = preg_replace('/\b(supports|not)\(/i', '$1 (', $css);
|
||||
|
||||
// Remove the spaces after the things that should not have spaces after them.
|
||||
$css = preg_replace('/([\!\{\}\:;\>\+\(\[\~\=,])\s+/S', '$1', $css);
|
||||
|
||||
// remove unnecessary semicolons
|
||||
$css = preg_replace('/;+\}/', '}', $css);
|
||||
|
||||
// Fix for issue: #2528146
|
||||
// Restore semicolon if the last property is prefixed with a `*` (lte IE7 hack)
|
||||
// to avoid issues on Symbian S60 3.x browsers.
|
||||
$css = preg_replace('/(\*[a-z0-9\-]+\s*\:[^;\}]+)(\})/', '$1;$2', $css);
|
||||
|
||||
// Replace 0 length units 0(px,em,%) with 0.
|
||||
$css = preg_replace('/(^|[^0-9])(?:0?\.)?0(?:em|ex|ch|rem|vw|vh|vm|vmin|cm|mm|in|px|pt|pc|%|deg|g?rad|m?s|k?hz)/iS', '${1}0', $css);
|
||||
|
||||
// 0% step in a keyframe? restore the % unit
|
||||
$css = preg_replace_callback('/(@[a-z\-]*?keyframes[^\{]*?\{)(.*?\}\s*\})/iS', array($this, 'replace_keyframe_zero'), $css);
|
||||
|
||||
// Replace 0 0; or 0 0 0; or 0 0 0 0; with 0.
|
||||
$css = preg_replace('/\:0(?: 0){1,3}(;|\}| \!)/', ':0$1', $css);
|
||||
|
||||
// Fix for issue: #2528142
|
||||
// Replace text-shadow:0; with text-shadow:0 0 0;
|
||||
$css = preg_replace('/(text-shadow\:0)(;|\}| \!)/i', '$1 0 0$2', $css);
|
||||
|
||||
// Replace background-position:0; with background-position:0 0;
|
||||
// same for transform-origin
|
||||
// Changing -webkit-mask-position: 0 0 to just a single 0 will result in the second parameter defaulting to 50% (center)
|
||||
$css = preg_replace('/(background\-position|webkit-mask-position|(?:webkit|moz|o|ms|)\-?transform\-origin)\:0(;|\}| \!)/iS', '$1:0 0$2', $css);
|
||||
|
||||
// Shorten colors from rgb(51,102,153) to #336699, rgb(100%,0%,0%) to #ff0000 (sRGB color space)
|
||||
// Shorten colors from hsl(0, 100%, 50%) to #ff0000 (sRGB color space)
|
||||
// This makes it more likely that it'll get further compressed in the next step.
|
||||
$css = preg_replace_callback('/rgb\s*\(\s*([0-9,\s\-\.\%]+)\s*\)(.{1})/i', array($this, 'rgb_to_hex'), $css);
|
||||
$css = preg_replace_callback('/hsl\s*\(\s*([0-9,\s\-\.\%]+)\s*\)(.{1})/i', array($this, 'hsl_to_hex'), $css);
|
||||
|
||||
// Shorten colors from #AABBCC to #ABC or short color name.
|
||||
$css = $this->compress_hex_colors($css);
|
||||
|
||||
// border: none to border:0, outline: none to outline:0
|
||||
$css = preg_replace('/(border\-?(?:top|right|bottom|left|)|outline)\:none(;|\}| \!)/iS', '$1:0$2', $css);
|
||||
|
||||
// shorter opacity IE filter
|
||||
$css = preg_replace('/progid\:DXImageTransform\.Microsoft\.Alpha\(Opacity\=/i', 'alpha(opacity=', $css);
|
||||
|
||||
// Find a fraction that is used for Opera's -o-device-pixel-ratio query
|
||||
// Add token to add the "\" back in later
|
||||
$css = preg_replace('/\(([a-z\-]+):([0-9]+)\/([0-9]+)\)/i', '($1:$2'. self::QUERY_FRACTION .'$3)', $css);
|
||||
|
||||
// Remove empty rules.
|
||||
$css = preg_replace('/[^\};\{\/]+\{\}/S', '', $css);
|
||||
|
||||
// Add "/" back to fix Opera -o-device-pixel-ratio query
|
||||
$css = preg_replace('/'. self::QUERY_FRACTION .'/', '/', $css);
|
||||
|
||||
// Replace multiple semi-colons in a row by a single one
|
||||
// See SF bug #1980989
|
||||
$css = preg_replace('/;;+/', ';', $css);
|
||||
|
||||
// Restore new lines for /*! important comments
|
||||
$css = preg_replace('/'. self::NL .'/', "\n", $css);
|
||||
|
||||
// Lowercase all uppercase properties
|
||||
$css = preg_replace_callback('/(\{|\;)([A-Z\-]+)(\:)/', array($this, 'lowercase_properties'), $css);
|
||||
|
||||
// Some source control tools don't like it when files containing lines longer
|
||||
// than, say 8000 characters, are checked in. The linebreak option is used in
|
||||
// that case to split long lines after a specific column.
|
||||
if ($linebreak_pos !== FALSE && (int) $linebreak_pos >= 0) {
|
||||
$linebreak_pos = (int) $linebreak_pos;
|
||||
$start_index = $i = 0;
|
||||
while ($i < strlen($css)) {
|
||||
$i++;
|
||||
if ($css[$i - 1] === '}' && $i - $start_index > $linebreak_pos) {
|
||||
$css = $this->str_slice($css, 0, $i) . "\n" . $this->str_slice($css, $i);
|
||||
$start_index = $i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// restore preserved comments and strings in reverse order
|
||||
for ($i = count($this->preserved_tokens) - 1; $i >= 0; $i--) {
|
||||
$css = preg_replace('/' . self::TOKEN . $i . '___/', $this->preserved_tokens[$i], $css, 1);
|
||||
}
|
||||
|
||||
// Trim the final string (for any leading or trailing white spaces)
|
||||
return trim($css);
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to replace all data urls with tokens before we start
|
||||
* compressing, to avoid performance issues running some of the subsequent
|
||||
* regexes against large strings chunks.
|
||||
*
|
||||
* @param string $css
|
||||
* @return string
|
||||
*/
|
||||
private function extract_data_urls($css)
|
||||
{
|
||||
// Leave data urls alone to increase parse performance.
|
||||
$max_index = strlen($css) - 1;
|
||||
$append_index = $index = $last_index = $offset = 0;
|
||||
$sb = array();
|
||||
$pattern = '/url\(\s*(["\']?)data\:/i';
|
||||
|
||||
// Since we need to account for non-base64 data urls, we need to handle
|
||||
// ' and ) being part of the data string. Hence switching to indexOf,
|
||||
// to determine whether or not we have matching string terminators and
|
||||
// handling sb appends directly, instead of using matcher.append* methods.
|
||||
|
||||
while (preg_match($pattern, $css, $m, 0, $offset)) {
|
||||
$index = $this->index_of($css, $m[0], $offset);
|
||||
$last_index = $index + strlen($m[0]);
|
||||
$start_index = $index + 4; // "url(".length()
|
||||
$end_index = $last_index - 1;
|
||||
$terminator = $m[1]; // ', " or empty (not quoted)
|
||||
$found_terminator = FALSE;
|
||||
|
||||
if (strlen($terminator) === 0) {
|
||||
$terminator = ')';
|
||||
}
|
||||
|
||||
while ($found_terminator === FALSE && $end_index+1 <= $max_index) {
|
||||
$end_index = $this->index_of($css, $terminator, $end_index + 1);
|
||||
|
||||
// endIndex == 0 doesn't really apply here
|
||||
if ($end_index > 0 && substr($css, $end_index - 1, 1) !== '\\') {
|
||||
$found_terminator = TRUE;
|
||||
if (')' != $terminator) {
|
||||
$end_index = $this->index_of($css, ')', $end_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Enough searching, start moving stuff over to the buffer
|
||||
$sb[] = $this->str_slice($css, $append_index, $index);
|
||||
|
||||
if ($found_terminator) {
|
||||
$token = $this->str_slice($css, $start_index, $end_index);
|
||||
$token = preg_replace('/\s+/', '', $token);
|
||||
$this->preserved_tokens[] = $token;
|
||||
|
||||
$preserver = 'url(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___)';
|
||||
$sb[] = $preserver;
|
||||
|
||||
$append_index = $end_index + 1;
|
||||
} else {
|
||||
// No end terminator found, re-add the whole match. Should we throw/warn here?
|
||||
$sb[] = $this->str_slice($css, $index, $last_index);
|
||||
$append_index = $last_index;
|
||||
}
|
||||
|
||||
$offset = $last_index;
|
||||
}
|
||||
|
||||
$sb[] = $this->str_slice($css, $append_index);
|
||||
|
||||
return implode('', $sb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to compress hex color values of the form #AABBCC to #ABC or short color name.
|
||||
*
|
||||
* DOES NOT compress CSS ID selectors which match the above pattern (which would break things).
|
||||
* e.g. #AddressForm { ... }
|
||||
*
|
||||
* DOES NOT compress IE filters, which have hex color values (which would break things).
|
||||
* e.g. filter: chroma(color="#FFFFFF");
|
||||
*
|
||||
* DOES NOT compress invalid hex values.
|
||||
* e.g. background-color: #aabbccdd
|
||||
*
|
||||
* @param string $css
|
||||
* @return string
|
||||
*/
|
||||
private function compress_hex_colors($css)
|
||||
{
|
||||
// Look for hex colors inside { ... } (to avoid IDs) and which don't have a =, or a " in front of them (to avoid filters)
|
||||
$pattern = '/(\=\s*?["\']?)?#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])(\}|[^0-9a-f{][^{]*?\})/iS';
|
||||
$_index = $index = $last_index = $offset = 0;
|
||||
$sb = array();
|
||||
// See: http://ajaxmin.codeplex.com/wikipage?title=CSS%20Colors
|
||||
$short_safe = array(
|
||||
'#808080' => 'gray',
|
||||
'#008000' => 'green',
|
||||
'#800000' => 'maroon',
|
||||
'#000080' => 'navy',
|
||||
'#808000' => 'olive',
|
||||
'#ffa500' => 'orange',
|
||||
'#800080' => 'purple',
|
||||
'#c0c0c0' => 'silver',
|
||||
'#008080' => 'teal',
|
||||
'#f00' => 'red'
|
||||
);
|
||||
|
||||
while (preg_match($pattern, $css, $m, 0, $offset)) {
|
||||
$index = $this->index_of($css, $m[0], $offset);
|
||||
$last_index = $index + strlen($m[0]);
|
||||
$is_filter = $m[1] !== null && $m[1] !== '';
|
||||
|
||||
$sb[] = $this->str_slice($css, $_index, $index);
|
||||
|
||||
if ($is_filter) {
|
||||
// Restore, maintain case, otherwise filter will break
|
||||
$sb[] = $m[1] . '#' . $m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7];
|
||||
} else {
|
||||
if (strtolower($m[2]) == strtolower($m[3]) &&
|
||||
strtolower($m[4]) == strtolower($m[5]) &&
|
||||
strtolower($m[6]) == strtolower($m[7])) {
|
||||
// Compress.
|
||||
$hex = '#' . strtolower($m[3] . $m[5] . $m[7]);
|
||||
} else {
|
||||
// Non compressible color, restore but lower case.
|
||||
$hex = '#' . strtolower($m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7]);
|
||||
}
|
||||
// replace Hex colors to short safe color names
|
||||
$sb[] = array_key_exists($hex, $short_safe) ? $short_safe[$hex] : $hex;
|
||||
}
|
||||
|
||||
$_index = $offset = $last_index - strlen($m[8]);
|
||||
}
|
||||
|
||||
$sb[] = $this->str_slice($css, $_index);
|
||||
|
||||
return implode('', $sb);
|
||||
}
|
||||
|
||||
/* CALLBACKS
|
||||
* ---------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private function replace_string($matches)
|
||||
{
|
||||
$match = $matches[0];
|
||||
$quote = substr($match, 0, 1);
|
||||
// Must use addcslashes in PHP to avoid parsing of backslashes
|
||||
$match = addcslashes($this->str_slice($match, 1, -1), '\\');
|
||||
|
||||
// maybe the string contains a comment-like substring?
|
||||
// one, maybe more? put'em back then
|
||||
if (($pos = $this->index_of($match, self::COMMENT)) >= 0) {
|
||||
for ($i = 0, $max = count($this->comments); $i < $max; $i++) {
|
||||
$match = preg_replace('/' . self::COMMENT . $i . '___/', $this->comments[$i], $match, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// minify alpha opacity in filter strings
|
||||
$match = preg_replace('/progid\:DXImageTransform\.Microsoft\.Alpha\(Opacity\=/i', 'alpha(opacity=', $match);
|
||||
|
||||
$this->preserved_tokens[] = $match;
|
||||
return $quote . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . $quote;
|
||||
}
|
||||
|
||||
private function replace_colon($matches)
|
||||
{
|
||||
return preg_replace('/\:/', self::CLASSCOLON, $matches[0]);
|
||||
}
|
||||
|
||||
private function replace_calc($matches)
|
||||
{
|
||||
$this->preserved_tokens[] = trim(preg_replace('/\s*([\*\/\(\),])\s*/', '$1', $matches[2]));
|
||||
return 'calc('. self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')';
|
||||
}
|
||||
|
||||
private function preserve_old_IE_specific_matrix_definition($matches)
|
||||
{
|
||||
$this->preserved_tokens[] = $matches[1];
|
||||
return 'filter:progid:DXImageTransform.Microsoft.Matrix(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')';
|
||||
}
|
||||
|
||||
private function replace_keyframe_zero($matches)
|
||||
{
|
||||
return $matches[1] . preg_replace('/0\s*,/', '0%,', preg_replace('/\s*0\s*\{/', '0%{', $matches[2]));
|
||||
}
|
||||
|
||||
private function rgb_to_hex($matches)
|
||||
{
|
||||
// Support for percentage values rgb(100%, 0%, 45%);
|
||||
if ($this->index_of($matches[1], '%') >= 0){
|
||||
$rgbcolors = explode(',', str_replace('%', '', $matches[1]));
|
||||
for ($i = 0; $i < count($rgbcolors); $i++) {
|
||||
$rgbcolors[$i] = $this->round_number(floatval($rgbcolors[$i]) * 2.55);
|
||||
}
|
||||
} else {
|
||||
$rgbcolors = explode(',', $matches[1]);
|
||||
}
|
||||
|
||||
// Values outside the sRGB color space should be clipped (0-255)
|
||||
for ($i = 0; $i < count($rgbcolors); $i++) {
|
||||
$rgbcolors[$i] = $this->clamp_number(intval($rgbcolors[$i], 10), 0, 255);
|
||||
$rgbcolors[$i] = sprintf("%02x", $rgbcolors[$i]);
|
||||
}
|
||||
|
||||
// Fix for issue #2528093
|
||||
if (!preg_match('/[\s\,\);\}]/', $matches[2])){
|
||||
$matches[2] = ' ' . $matches[2];
|
||||
}
|
||||
|
||||
return '#' . implode('', $rgbcolors) . $matches[2];
|
||||
}
|
||||
|
||||
private function hsl_to_hex($matches)
|
||||
{
|
||||
$values = explode(',', str_replace('%', '', $matches[1]));
|
||||
$h = floatval($values[0]);
|
||||
$s = floatval($values[1]);
|
||||
$l = floatval($values[2]);
|
||||
|
||||
// Wrap and clamp, then fraction!
|
||||
$h = ((($h % 360) + 360) % 360) / 360;
|
||||
$s = $this->clamp_number($s, 0, 100) / 100;
|
||||
$l = $this->clamp_number($l, 0, 100) / 100;
|
||||
|
||||
if ($s == 0) {
|
||||
$r = $g = $b = $this->round_number(255 * $l);
|
||||
} else {
|
||||
$v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l);
|
||||
$v1 = (2 * $l) - $v2;
|
||||
$r = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h + (1/3)));
|
||||
$g = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h));
|
||||
$b = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h - (1/3)));
|
||||
}
|
||||
|
||||
return $this->rgb_to_hex(array('', $r.','.$g.','.$b, $matches[2]));
|
||||
}
|
||||
|
||||
private function lowercase_pseudo_first($matches)
|
||||
{
|
||||
return ':first-'. strtolower($matches[1]) .' '. $matches[2];
|
||||
}
|
||||
|
||||
private function lowercase_directives($matches)
|
||||
{
|
||||
return '@'. strtolower($matches[1]);
|
||||
}
|
||||
|
||||
private function lowercase_pseudo_elements($matches)
|
||||
{
|
||||
return ':'. strtolower($matches[1]);
|
||||
}
|
||||
|
||||
private function lowercase_common_functions($matches)
|
||||
{
|
||||
return ':'. strtolower($matches[1]) .'(';
|
||||
}
|
||||
|
||||
private function lowercase_common_functions_values($matches)
|
||||
{
|
||||
return $matches[1] . strtolower($matches[2]);
|
||||
}
|
||||
|
||||
private function lowercase_properties($matches)
|
||||
{
|
||||
return $matches[1].strtolower($matches[2]).$matches[3];
|
||||
}
|
||||
|
||||
/* HELPERS
|
||||
* ---------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private function hue_to_rgb($v1, $v2, $vh)
|
||||
{
|
||||
$vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
|
||||
if ($vh * 6 < 1) return $v1 + ($v2 - $v1) * 6 * $vh;
|
||||
if ($vh * 2 < 1) return $v2;
|
||||
if ($vh * 3 < 2) return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6;
|
||||
return $v1;
|
||||
}
|
||||
|
||||
private function round_number($n)
|
||||
{
|
||||
return intval(floor(floatval($n) + 0.5), 10);
|
||||
}
|
||||
|
||||
private function clamp_number($n, $min, $max)
|
||||
{
|
||||
return min(max($n, $min), $max);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP port of Javascript's "indexOf" function for strings only
|
||||
* Author: Tubal Martin http://blog.margenn.com
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string $needle
|
||||
* @param int $offset index (optional)
|
||||
* @return int
|
||||
*/
|
||||
private function index_of($haystack, $needle, $offset = 0)
|
||||
{
|
||||
$index = strpos($haystack, $needle, $offset);
|
||||
|
||||
return ($index !== FALSE) ? $index : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP port of Javascript's "slice" function for strings only
|
||||
* Author: Tubal Martin http://blog.margenn.com
|
||||
* Tests: http://margenn.com/tubal/str_slice/
|
||||
*
|
||||
* @param string $str
|
||||
* @param int $start index
|
||||
* @param int|bool $end index (optional)
|
||||
* @return string
|
||||
*/
|
||||
private function str_slice($str, $start = 0, $end = FALSE)
|
||||
{
|
||||
if ($end !== FALSE && ($start < 0 || $end <= 0)) {
|
||||
$max = strlen($str);
|
||||
|
||||
if ($start < 0) {
|
||||
if (($start = $max + $start) < 0) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($end < 0) {
|
||||
if (($end = $max + $end) < 0) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($end <= $start) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
$slice = ($end === FALSE) ? substr($str, $start) : substr($str, $start, $end - $start);
|
||||
return ($slice === FALSE) ? '' : $slice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert strings like "64M" or "30" to int values
|
||||
* @param mixed $size
|
||||
* @return int
|
||||
*/
|
||||
private function normalize_int($size)
|
||||
{
|
||||
if (is_string($size)) {
|
||||
switch (substr($size, -1)) {
|
||||
case 'M': case 'm': return $size * 1048576;
|
||||
case 'K': case 'k': return $size * 1024;
|
||||
case 'G': case 'g': return $size * 1073741824;
|
||||
}
|
||||
}
|
||||
|
||||
return (int) $size;
|
||||
}
|
||||
}
|
||||
121
vendor/mrclay/minify/min/lib/DooDigestAuth.php
vendored
121
vendor/mrclay/minify/min/lib/DooDigestAuth.php
vendored
@@ -1,121 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* DooDigestAuth class file.
|
||||
*
|
||||
* @author Leng Sheng Hong <darkredz@gmail.com>
|
||||
* @link http://www.doophp.com/
|
||||
* @copyright Copyright © 2009 Leng Sheng Hong
|
||||
* @license http://www.doophp.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles HTTP digest authentication
|
||||
*
|
||||
* <p>HTTP digest authentication can be used with the URI router.
|
||||
* HTTP digest is much more recommended over the use of HTTP Basic auth which doesn't provide any encryption.
|
||||
* If you are running PHP on Apache in CGI/FastCGI mode, you would need to
|
||||
* add the following line to your .htaccess for digest auth to work correctly.</p>
|
||||
* <code>RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]</code>
|
||||
*
|
||||
* <p>This class is tested under Apache 2.2 and Cherokee web server. It should work in both mod_php and cgi mode.</p>
|
||||
*
|
||||
* @author Leng Sheng Hong <darkredz@gmail.com>
|
||||
* @version $Id: DooDigestAuth.php 1000 2009-07-7 18:27:22
|
||||
* @package doo.auth
|
||||
* @since 1.0
|
||||
*/
|
||||
class DooDigestAuth{
|
||||
|
||||
/**
|
||||
* Authenticate against a list of username and passwords.
|
||||
*
|
||||
* <p>HTTP Digest Authentication doesn't work with PHP in CGI mode,
|
||||
* you have to add this into your .htaccess <code>RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]</code></p>
|
||||
*
|
||||
* @param string $realm Name of the authentication session
|
||||
* @param array $users An assoc array of username and password: array('uname1'=>'pwd1', 'uname2'=>'pwd2')
|
||||
* @param string $fail_msg Message to be displayed if the User cancel the login
|
||||
* @param string $fail_url URL to be redirect if the User cancel the login
|
||||
* @return string The username if login success.
|
||||
*/
|
||||
public static function http_auth($realm, $users, $fail_msg=NULL, $fail_url=NULL){
|
||||
$realm = "Restricted area - $realm";
|
||||
|
||||
//user => password
|
||||
//$users = array('admin' => '1234', 'guest' => 'guest');
|
||||
if(!empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && strpos($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 'Digest')===0){
|
||||
$_SERVER['PHP_AUTH_DIGEST'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
|
||||
}
|
||||
|
||||
if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
|
||||
header('WWW-Authenticate: Digest realm="'.$realm.
|
||||
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
|
||||
header('HTTP/1.1 401 Unauthorized');
|
||||
if($fail_msg!=NULL)
|
||||
die($fail_msg);
|
||||
if($fail_url!=NULL)
|
||||
die("<script>window.location.href = '$fail_url'</script>");
|
||||
exit;
|
||||
}
|
||||
|
||||
// analyze the PHP_AUTH_DIGEST variable
|
||||
if (!($data = self::http_digest_parse($_SERVER['PHP_AUTH_DIGEST'])) || !isset($users[$data['username']])){
|
||||
header('WWW-Authenticate: Digest realm="'.$realm.
|
||||
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
|
||||
header('HTTP/1.1 401 Unauthorized');
|
||||
if($fail_msg!=NULL)
|
||||
die($fail_msg);
|
||||
if($fail_url!=NULL)
|
||||
die("<script>window.location.href = '$fail_url'</script>");
|
||||
exit;
|
||||
}
|
||||
|
||||
// generate the valid response
|
||||
$A1 = md5($data['username'] . ':' . $realm . ':' . $users[$data['username']]);
|
||||
$A2 = md5($_SERVER['REQUEST_METHOD'].':'.$data['uri']);
|
||||
$valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce'].':'.$data['qop'].':'.$A2);
|
||||
|
||||
if ($data['response'] != $valid_response){
|
||||
header('HTTP/1.1 401 Unauthorized');
|
||||
header('WWW-Authenticate: Digest realm="'.$realm.
|
||||
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
|
||||
if($fail_msg!=NULL)
|
||||
die($fail_msg);
|
||||
if($fail_url!=NULL)
|
||||
die("<script>window.location.href = '$fail_url'</script>");
|
||||
exit;
|
||||
}
|
||||
|
||||
// ok, valid username & password
|
||||
return $data['username'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to parse the http auth header, works with IE.
|
||||
*
|
||||
* Internet Explorer returns a qop="xxxxxxxxxxx" in the header instead of qop=xxxxxxxxxxx as most browsers do.
|
||||
*
|
||||
* @param string $txt header string to parse
|
||||
* @return array An assoc array of the digest auth session
|
||||
*/
|
||||
private static function http_digest_parse($txt)
|
||||
{
|
||||
$res = preg_match("/username=\"([^\"]+)\"/i", $txt, $match);
|
||||
$data['username'] = (isset($match[1]))?$match[1]:null;
|
||||
$res = preg_match('/nonce=\"([^\"]+)\"/i', $txt, $match);
|
||||
$data['nonce'] = $match[1];
|
||||
$res = preg_match('/nc=([0-9]+)/i', $txt, $match);
|
||||
$data['nc'] = $match[1];
|
||||
$res = preg_match('/cnonce=\"([^\"]+)\"/i', $txt, $match);
|
||||
$data['cnonce'] = $match[1];
|
||||
$res = preg_match('/qop=([^,]+)/i', $txt, $match);
|
||||
$data['qop'] = str_replace('"','',$match[1]);
|
||||
$res = preg_match('/uri=\"([^\"]+)\"/i', $txt, $match);
|
||||
$data['uri'] = $match[1];
|
||||
$res = preg_match('/response=\"([^\"]+)\"/i', $txt, $match);
|
||||
$data['response'] = $match[1];
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user