Merge branch 'master' of github.com:joshtronic/pickles
This commit is contained in:
commit
5349159c51
39 changed files with 498 additions and 209 deletions
|
@ -3,10 +3,12 @@ language: php
|
||||||
php:
|
php:
|
||||||
- 5.4
|
- 5.4
|
||||||
- 5.5
|
- 5.5
|
||||||
|
- 5.6
|
||||||
- hhvm
|
- hhvm
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
allow_failures:
|
allow_failures:
|
||||||
|
- php: 5.6
|
||||||
- php: hhvm
|
- php: hhvm
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2007-2014 Joshua Sherman
|
Copyright (c) 2007-2014 Josh Sherman
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
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
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
55
README.md
55
README.md
|
@ -1,50 +1,43 @@
|
||||||
# PHP Interface Collection of Killer Libraries to Enhance Stuff
|
# PICKLES [](https://travis-ci.org/joshtronic/pickles) [](https://coveralls.io/r/joshtronic/pickles) [](https://www.versioneye.com/user/projects/52d1bc1eec13751bde00002a)
|
||||||
|
|
||||||
[](https://travis-ci.org/joshtronic/pickles)
|
PICKLES (PHP Interface Collection of Killer Libraries to Enhance Stuff) is an open source framework for rapid PHP development. PICKLES aims to be an “API First” system for building APIs as well as AJAX/AJAJ-centric web applications.
|
||||||
[](https://coveralls.io/r/joshtronic/pickles)
|
|
||||||
[](https://www.versioneye.com/user/projects/52d1bc1eec13751bde00002a)
|
|
||||||
|
|
||||||
## What is PICKLES?
|
|
||||||
|
|
||||||
PICKLES is an open source framework for the rapid development of web applications.
|
|
||||||
|
|
||||||
## Okay, but why?
|
|
||||||
|
|
||||||
I could have went with any number of existing frameworks, but I opted to build my own because I like to code. I’ve built quite a few sites from the ground up over the years, and I wanted to roll that experience into a single system that I could not only use for my sites, but share with the world.
|
|
||||||
|
|
||||||
## Wait, what, it’s not MVC?
|
|
||||||
|
|
||||||
PICKLES is in fact not a true MVC system and won’t be masquerading around as one (yeah, I know, I borrowed some naming conventions). PICKLES does have a main controller that handles incoming page views. The controller loads a module that contains all of the business logic (optionally interacting with data models) and then execution is passed off to the display layer. The display layer gives the user what they asked for (even if they didn’t say please). This is how web pages work, and there has never been a reason for me to force PICKLES into the MVC box just for the hell of it.
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
### Required Software
|
### Required Software
|
||||||
|
|
||||||
* Web server of your choice (nginx is highly recommended)
|
* Web server of your choice (nginx is highly recommended but Apache with `mod_rewrite` will suffice)
|
||||||
* PHP 5.4+
|
* PHP 5.4+
|
||||||
|
|
||||||
Please note that strides are being made to be compatible with bleeding edge technologies. PICKLES is currently developed against PHP 5.5 and does not pass build tests against prior versions. This effort will be with somewhat of a reckless abandon towards backwards compatibility to keep up with deprecations within PHP.
|
Please note that PICKLES development is focused on the most recent stable version of PHP (currently 5.5) but will maintain backwards compatibility with the previous stable version. It may not be immediate, but when PHP 5.6 is released compatibility for PHP 5.4 will be dropped in favor of modern niceties.
|
||||||
|
|
||||||
To help anyone that is “stuck” using PHP 5.3.x, the version distributed with Ubuntu 12.04 LTS, you can still use the 5.3 compatible branch [available here](https://github.com/joshtronic/pickles/archive/php53-compatible.zip) instead. This branch is a fork of the master branch just before we started to these efforts and is considered very stable. The branch will remain available for the foreseeable future but will be indefinitely frozen unless pull requests are submitted.
|
For anyone stuck using PHP 5.3 is welcome to use [PICKLES v13.12.x](https://github.com/joshtronic/pickles/tree/13.12) which at this time is still receiving bug fixes but will not be seeing any new development by myself. Pull requests are welcome.
|
||||||
|
|
||||||
As developers we make demands that our end users use modern day browsers while we’re just as guilty by running older server software, typically under the guise that it’s “stable”. I feel that we should be holding ourselves to the same standards when it comes to our server stacks. Stability is great, but at a certain point you’re sacrificing your own technology advancements as a developer as well as turning a blind eye to optimizations that can benefit your users.
|
My rant about outdated server stacks can be found [on my blog](http://joshtronic.com/2014/01/13/your-stack-is-outdated/#.UuVzI3n0A18).
|
||||||
|
|
||||||
### Optional Software
|
### Optional Software
|
||||||
|
|
||||||
* MySQL with PDO and PDO_MYSQL drivers
|
* MySQL server with the `PDO_MYSQL` driver
|
||||||
* PostgreSQL with PDO and PDO_PGSQL drivers
|
* PostgreSQL server with the `PDO_PGSQL` driver
|
||||||
* SQLite 3 with PDO and PDO_SQLITE drivers
|
* SQLite 3 with the `PDO_SQLITE` driver
|
||||||
* Memcached with the Memcache module
|
* Memcached server with the `Memcache` module
|
||||||
* composer if you want to compile LESS, SCSS or JS also necessary if you want
|
* `composer` if you want to compile LESS, SCSS or JS also necessary if you want to use AYAH integration or run the test suite
|
||||||
to run the unit tests
|
|
||||||
* [ext/test_helpers](https://github.com/php-test-helpers/php-test-helpers) if you want to be able to run the test suite
|
* [ext/test_helpers](https://github.com/php-test-helpers/php-test-helpers) if you want to be able to run the test suite
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Installation is quite simple as there is no installer to run, and all server configuration options can be set in your index.php for your site.
|
Installation is quite simple as there is no installer to run, and all server configuration options can be set in your index.php for your site.
|
||||||
|
|
||||||
1. [Download the PICKLES source code](https://github.com/joshtronic/pickles/archive/master.zip) (or clone the repository)
|
1. [Download the PICKLES source](https://github.com/joshtronic/pickles/archive/master.zip) (or clone the repository)
|
||||||
2. Place the code anywhere you’d like (that’s at least 2 directories up from the root of your website). I recommend using `/usr/share/pickles`
|
2. Place the code anywhere you’d like (that’s at least 2 directories up from the root of your website). I recommend using `/usr/share/pickles[-vVERSION]`
|
||||||
3. A starter site can be obtained from http://github.com/joshtronic/pickles-starter. It has everything you need to get a site up and running.
|
3. Run `composer update`
|
||||||
4. At this point you should have a very rudimentary site up and running.
|
4. A site already built in PICKLES can be found [here](https://github.com/gravityblvd/tools.gravityblvd.com)
|
||||||
5. Run `composer update`
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
* Bring the project's Wiki up to date
|
||||||
|
* Build an actual boilerplate site that would be included in this project
|
||||||
|
|
||||||
|
## Thanks
|
||||||
|
|
||||||
|
Special thanks to [Geoff Oliver](https://github.com/geoffoliver) for being a long time user and contributor of PICKLES and to [Dean Jones](https://github.com/deanproxy) for coming up with the PICKLES acronym.
|
||||||
|
|
|
@ -12,14 +12,18 @@
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": ["src/"]
|
"classmap": ["src/"]
|
||||||
},
|
},
|
||||||
|
"repositories": [{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/joshtronic/php-ayah"
|
||||||
|
}],
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mikey179/vfsStream": "1.2.0",
|
"mikey179/vfsStream": "1.2.0",
|
||||||
"satooshi/php-coveralls": "dev-master"
|
"satooshi/php-coveralls": "dev-master"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"devize/closure-compiler": "@dev",
|
"devize/closure-compiler": "@dev",
|
||||||
"joshtronic/php-ayah": "1.1.8",
|
"joshtronic/php-ayah": "@dev",
|
||||||
"leafo/lessphp": "0.4.0",
|
"leafo/lessphp": "0.4.0",
|
||||||
"leafo/scssphp": "0.0.9"
|
"leafo/scssphp": "0.0.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
145
composer.lock
generated
145
composer.lock
generated
|
@ -3,7 +3,7 @@
|
||||||
"This file locks the dependencies of your project to a known state",
|
"This file locks the dependencies of your project to a known state",
|
||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
||||||
],
|
],
|
||||||
"hash": "34fec617e973fcd94cae8d9158e5ce4b",
|
"hash": "ea54b51744a27e84d6badff2b973acac",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "devize/closure-compiler",
|
"name": "devize/closure-compiler",
|
||||||
|
@ -44,11 +44,17 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "joshtronic/php-ayah",
|
"name": "joshtronic/php-ayah",
|
||||||
"version": "v1.1.8",
|
"version": "dev-master",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/joshtronic/php-ayah.git",
|
"url": "https://github.com/joshtronic/php-ayah.git",
|
||||||
"reference": "cc0ebf289394f80a83372e36e097afe2d3355b45"
|
"reference": "98e39e2e16de9c77267a6dea4230f6387d5bd1aa"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/joshtronic/php-ayah/zipball/98e39e2e16de9c77267a6dea4230f6387d5bd1aa",
|
||||||
|
"reference": "98e39e2e16de9c77267a6dea4230f6387d5bd1aa",
|
||||||
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -61,7 +67,7 @@
|
||||||
],
|
],
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Some awesome developer over at AreYouAHuman.com",
|
"name": "Elvis “Bear” Jakupovic",
|
||||||
"email": "support@areyouahuman.com"
|
"email": "support@areyouahuman.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -70,7 +76,10 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Are You a Human PHP Bundle",
|
"description": "Are You a Human PHP Bundle",
|
||||||
"time": "2014-01-21 02:56:55"
|
"support": {
|
||||||
|
"source": "https://github.com/joshtronic/php-ayah/tree/master"
|
||||||
|
},
|
||||||
|
"time": "2014-02-02 14:58:38"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "leafo/lessphp",
|
"name": "leafo/lessphp",
|
||||||
|
@ -115,16 +124,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "leafo/scssphp",
|
"name": "leafo/scssphp",
|
||||||
"version": "v0.0.9",
|
"version": "0.0.10",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/leafo/scssphp.git",
|
"url": "https://github.com/leafo/scssphp.git",
|
||||||
"reference": "a06d702ebf9fabb22542bbb27cc12a905813bb6d"
|
"reference": "558357feceb9b932a192966945904414dc372e4d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/leafo/scssphp/zipball/a06d702ebf9fabb22542bbb27cc12a905813bb6d",
|
"url": "https://api.github.com/repos/leafo/scssphp/zipball/558357feceb9b932a192966945904414dc372e4d",
|
||||||
"reference": "a06d702ebf9fabb22542bbb27cc12a905813bb6d",
|
"reference": "558357feceb9b932a192966945904414dc372e4d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -157,22 +166,22 @@
|
||||||
],
|
],
|
||||||
"description": "scssphp is a compiler for SCSS written in PHP.",
|
"description": "scssphp is a compiler for SCSS written in PHP.",
|
||||||
"homepage": "http://leafo.net/scssphp/",
|
"homepage": "http://leafo.net/scssphp/",
|
||||||
"time": "2013-12-23 23:28:02"
|
"time": "2014-04-15 02:25:09"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
{
|
{
|
||||||
"name": "guzzle/guzzle",
|
"name": "guzzle/guzzle",
|
||||||
"version": "v3.8.0",
|
"version": "v3.8.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/guzzle.git",
|
"url": "https://github.com/guzzle/guzzle.git",
|
||||||
"reference": "b4a3ce8c05e777fa18b802956d5d0e38ad338a69"
|
"reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/b4a3ce8c05e777fa18b802956d5d0e38ad338a69",
|
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/4de0618a01b34aa1c8c33a3f13f396dcd3882eba",
|
||||||
"reference": "b4a3ce8c05e777fa18b802956d5d0e38ad338a69",
|
"reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -210,8 +219,8 @@
|
||||||
"phpunit/phpunit": "3.7.*",
|
"phpunit/phpunit": "3.7.*",
|
||||||
"psr/log": "1.0.*",
|
"psr/log": "1.0.*",
|
||||||
"symfony/class-loader": "*",
|
"symfony/class-loader": "*",
|
||||||
"zendframework/zend-cache": "2.0.*",
|
"zendframework/zend-cache": "<2.3",
|
||||||
"zendframework/zend-log": "2.0.*"
|
"zendframework/zend-log": "<2.3"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
|
@ -221,8 +230,8 @@
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
"Guzzle\\Tests": "tests/",
|
"Guzzle": "src/",
|
||||||
"Guzzle": "src/"
|
"Guzzle\\Tests": "tests/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
@ -251,7 +260,7 @@
|
||||||
"rest",
|
"rest",
|
||||||
"web service"
|
"web service"
|
||||||
],
|
],
|
||||||
"time": "2013-12-05 23:39:20"
|
"time": "2014-01-28 22:29:15"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mikey179/vfsStream",
|
"name": "mikey179/vfsStream",
|
||||||
|
@ -327,12 +336,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/satooshi/php-coveralls.git",
|
"url": "https://github.com/satooshi/php-coveralls.git",
|
||||||
"reference": "c95c07e971e4b687718f54fc3447a260fb989e16"
|
"reference": "9fce7133a1d79b19f38a8fc975009703468172f0"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/c95c07e971e4b687718f54fc3447a260fb989e16",
|
"url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/9fce7133a1d79b19f38a8fc975009703468172f0",
|
||||||
"reference": "c95c07e971e4b687718f54fc3447a260fb989e16",
|
"reference": "9fce7133a1d79b19f38a8fc975009703468172f0",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -364,6 +373,11 @@
|
||||||
"composer/bin/coveralls"
|
"composer/bin/coveralls"
|
||||||
],
|
],
|
||||||
"type": "library",
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "0.7-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
"Satooshi\\Component": "src/",
|
"Satooshi\\Component": "src/",
|
||||||
|
@ -389,21 +403,21 @@
|
||||||
"github",
|
"github",
|
||||||
"test"
|
"test"
|
||||||
],
|
],
|
||||||
"time": "2013-07-25 11:22:39"
|
"time": "2014-03-27 16:05:26"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/config",
|
"name": "symfony/config",
|
||||||
"version": "v2.4.1",
|
"version": "v2.4.3",
|
||||||
"target-dir": "Symfony/Component/Config",
|
"target-dir": "Symfony/Component/Config",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/Config.git",
|
"url": "https://github.com/symfony/Config.git",
|
||||||
"reference": "27d0b35879ebefcfee6d218512c32ab2d6cd6a6a"
|
"reference": "e98693981385224bd31667e56204f311d9e0f98e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/Config/zipball/27d0b35879ebefcfee6d218512c32ab2d6cd6a6a",
|
"url": "https://api.github.com/repos/symfony/Config/zipball/e98693981385224bd31667e56204f311d9e0f98e",
|
||||||
"reference": "27d0b35879ebefcfee6d218512c32ab2d6cd6a6a",
|
"reference": "e98693981385224bd31667e56204f311d9e0f98e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -428,7 +442,9 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Fabien Potencier",
|
"name": "Fabien Potencier",
|
||||||
"email": "fabien@symfony.com"
|
"email": "fabien@symfony.com",
|
||||||
|
"homepage": "http://fabien.potencier.org",
|
||||||
|
"role": "Lead Developer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Symfony Community",
|
"name": "Symfony Community",
|
||||||
|
@ -437,21 +453,21 @@
|
||||||
],
|
],
|
||||||
"description": "Symfony Config Component",
|
"description": "Symfony Config Component",
|
||||||
"homepage": "http://symfony.com",
|
"homepage": "http://symfony.com",
|
||||||
"time": "2014-01-01 08:14:50"
|
"time": "2014-03-26 11:35:33"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v2.4.1",
|
"version": "v2.4.3",
|
||||||
"target-dir": "Symfony/Component/Console",
|
"target-dir": "Symfony/Component/Console",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/Console.git",
|
"url": "https://github.com/symfony/Console.git",
|
||||||
"reference": "4c1ed2ff514bd85ee186eebb010ccbdeeab05af7"
|
"reference": "ef20f1f58d7f693ee888353962bd2db336e3bbcb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/Console/zipball/4c1ed2ff514bd85ee186eebb010ccbdeeab05af7",
|
"url": "https://api.github.com/repos/symfony/Console/zipball/ef20f1f58d7f693ee888353962bd2db336e3bbcb",
|
||||||
"reference": "4c1ed2ff514bd85ee186eebb010ccbdeeab05af7",
|
"reference": "ef20f1f58d7f693ee888353962bd2db336e3bbcb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -481,7 +497,9 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Fabien Potencier",
|
"name": "Fabien Potencier",
|
||||||
"email": "fabien@symfony.com"
|
"email": "fabien@symfony.com",
|
||||||
|
"homepage": "http://fabien.potencier.org",
|
||||||
|
"role": "Lead Developer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Symfony Community",
|
"name": "Symfony Community",
|
||||||
|
@ -490,21 +508,21 @@
|
||||||
],
|
],
|
||||||
"description": "Symfony Console Component",
|
"description": "Symfony Console Component",
|
||||||
"homepage": "http://symfony.com",
|
"homepage": "http://symfony.com",
|
||||||
"time": "2014-01-01 08:14:50"
|
"time": "2014-03-01 17:35:04"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/event-dispatcher",
|
"name": "symfony/event-dispatcher",
|
||||||
"version": "v2.4.1",
|
"version": "v2.4.3",
|
||||||
"target-dir": "Symfony/Component/EventDispatcher",
|
"target-dir": "Symfony/Component/EventDispatcher",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/EventDispatcher.git",
|
"url": "https://github.com/symfony/EventDispatcher.git",
|
||||||
"reference": "e3ba42f6a70554ed05749e61b829550f6ac33601"
|
"reference": "4708b8cd41984a5ba29fe7dd40716f7f761ac501"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/e3ba42f6a70554ed05749e61b829550f6ac33601",
|
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/4708b8cd41984a5ba29fe7dd40716f7f761ac501",
|
||||||
"reference": "e3ba42f6a70554ed05749e61b829550f6ac33601",
|
"reference": "4708b8cd41984a5ba29fe7dd40716f7f761ac501",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -535,7 +553,9 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Fabien Potencier",
|
"name": "Fabien Potencier",
|
||||||
"email": "fabien@symfony.com"
|
"email": "fabien@symfony.com",
|
||||||
|
"homepage": "http://fabien.potencier.org",
|
||||||
|
"role": "Lead Developer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Symfony Community",
|
"name": "Symfony Community",
|
||||||
|
@ -544,21 +564,21 @@
|
||||||
],
|
],
|
||||||
"description": "Symfony EventDispatcher Component",
|
"description": "Symfony EventDispatcher Component",
|
||||||
"homepage": "http://symfony.com",
|
"homepage": "http://symfony.com",
|
||||||
"time": "2013-12-28 08:12:03"
|
"time": "2014-02-11 13:52:09"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/filesystem",
|
"name": "symfony/filesystem",
|
||||||
"version": "v2.4.1",
|
"version": "v2.4.3",
|
||||||
"target-dir": "Symfony/Component/Filesystem",
|
"target-dir": "Symfony/Component/Filesystem",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/Filesystem.git",
|
"url": "https://github.com/symfony/Filesystem.git",
|
||||||
"reference": "b3c3b5a8108b3e5d604dc23241b4ea84a067fc78"
|
"reference": "b717952487176a993e9b12a08b87beae25ae419c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/Filesystem/zipball/b3c3b5a8108b3e5d604dc23241b4ea84a067fc78",
|
"url": "https://api.github.com/repos/symfony/Filesystem/zipball/b717952487176a993e9b12a08b87beae25ae419c",
|
||||||
"reference": "b3c3b5a8108b3e5d604dc23241b4ea84a067fc78",
|
"reference": "b717952487176a993e9b12a08b87beae25ae419c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -582,7 +602,9 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Fabien Potencier",
|
"name": "Fabien Potencier",
|
||||||
"email": "fabien@symfony.com"
|
"email": "fabien@symfony.com",
|
||||||
|
"homepage": "http://fabien.potencier.org",
|
||||||
|
"role": "Lead Developer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Symfony Community",
|
"name": "Symfony Community",
|
||||||
|
@ -591,21 +613,21 @@
|
||||||
],
|
],
|
||||||
"description": "Symfony Filesystem Component",
|
"description": "Symfony Filesystem Component",
|
||||||
"homepage": "http://symfony.com",
|
"homepage": "http://symfony.com",
|
||||||
"time": "2013-12-31 13:43:26"
|
"time": "2014-03-26 11:55:03"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/stopwatch",
|
"name": "symfony/stopwatch",
|
||||||
"version": "v2.4.1",
|
"version": "v2.4.3",
|
||||||
"target-dir": "Symfony/Component/Stopwatch",
|
"target-dir": "Symfony/Component/Stopwatch",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/Stopwatch.git",
|
"url": "https://github.com/symfony/Stopwatch.git",
|
||||||
"reference": "c8e21e1380c7eef6197a8165620da8457b7c69a5"
|
"reference": "bffad325e36a3e71fba6d5dcce6e2f4b4637b91a"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/Stopwatch/zipball/c8e21e1380c7eef6197a8165620da8457b7c69a5",
|
"url": "https://api.github.com/repos/symfony/Stopwatch/zipball/bffad325e36a3e71fba6d5dcce6e2f4b4637b91a",
|
||||||
"reference": "c8e21e1380c7eef6197a8165620da8457b7c69a5",
|
"reference": "bffad325e36a3e71fba6d5dcce6e2f4b4637b91a",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -629,7 +651,9 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Fabien Potencier",
|
"name": "Fabien Potencier",
|
||||||
"email": "fabien@symfony.com"
|
"email": "fabien@symfony.com",
|
||||||
|
"homepage": "http://fabien.potencier.org",
|
||||||
|
"role": "Lead Developer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Symfony Community",
|
"name": "Symfony Community",
|
||||||
|
@ -638,21 +662,21 @@
|
||||||
],
|
],
|
||||||
"description": "Symfony Stopwatch Component",
|
"description": "Symfony Stopwatch Component",
|
||||||
"homepage": "http://symfony.com",
|
"homepage": "http://symfony.com",
|
||||||
"time": "2013-12-12 16:06:47"
|
"time": "2014-02-11 13:52:09"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/yaml",
|
"name": "symfony/yaml",
|
||||||
"version": "v2.4.1",
|
"version": "v2.4.3",
|
||||||
"target-dir": "Symfony/Component/Yaml",
|
"target-dir": "Symfony/Component/Yaml",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/Yaml.git",
|
"url": "https://github.com/symfony/Yaml.git",
|
||||||
"reference": "4e1a237fc48145fae114b96458d799746ad89aa0"
|
"reference": "77a41c2835ab7cfe8bf6d15e25d3af8f3eb3bacd"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/Yaml/zipball/4e1a237fc48145fae114b96458d799746ad89aa0",
|
"url": "https://api.github.com/repos/symfony/Yaml/zipball/77a41c2835ab7cfe8bf6d15e25d3af8f3eb3bacd",
|
||||||
"reference": "4e1a237fc48145fae114b96458d799746ad89aa0",
|
"reference": "77a41c2835ab7cfe8bf6d15e25d3af8f3eb3bacd",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -676,7 +700,9 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Fabien Potencier",
|
"name": "Fabien Potencier",
|
||||||
"email": "fabien@symfony.com"
|
"email": "fabien@symfony.com",
|
||||||
|
"homepage": "http://fabien.potencier.org",
|
||||||
|
"role": "Lead Developer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Symfony Community",
|
"name": "Symfony Community",
|
||||||
|
@ -685,7 +711,7 @@
|
||||||
],
|
],
|
||||||
"description": "Symfony Yaml Component",
|
"description": "Symfony Yaml Component",
|
||||||
"homepage": "http://symfony.com",
|
"homepage": "http://symfony.com",
|
||||||
"time": "2013-12-28 08:12:03"
|
"time": "2014-03-12 18:29:58"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"aliases": [
|
"aliases": [
|
||||||
|
@ -694,6 +720,7 @@
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": {
|
"stability-flags": {
|
||||||
"devize/closure-compiler": 20,
|
"devize/closure-compiler": 20,
|
||||||
|
"joshtronic/php-ayah": 20,
|
||||||
"satooshi/php-coveralls": 20
|
"satooshi/php-coveralls": 20
|
||||||
},
|
},
|
||||||
"platform": [
|
"platform": [
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
107
src/classes/API/PlaceholdIt.php
Normal file
107
src/classes/API/PlaceholdIt.php
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Placehold.it Class File for PICKLES
|
||||||
|
*
|
||||||
|
* PHP version 5
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
|
* @package PICKLES
|
||||||
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Placehold.it API Interface
|
||||||
|
*
|
||||||
|
* @link http://placehold.it
|
||||||
|
*/
|
||||||
|
class API_PlaceholdIt extends Object
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* URL
|
||||||
|
*
|
||||||
|
* Generates a Placehold.it URL based on the passed parameters.
|
||||||
|
*
|
||||||
|
* @param integer $width width of the image
|
||||||
|
* @param integer $height optional height of the image
|
||||||
|
* @param string $format optional format of the image
|
||||||
|
* @param string $background optional background color of the image
|
||||||
|
* @param string $foreground optional foreground color of the image
|
||||||
|
* @param string $text optional text to display in the image
|
||||||
|
* @return string Placehold.it URL
|
||||||
|
*/
|
||||||
|
public function url($width, $height = null, $format = 'gif', $background = null, $foreground = null, $text = null)
|
||||||
|
{
|
||||||
|
// Checks if the format is valid
|
||||||
|
if (!in_array($format, ['gif', 'jpeg', 'jpg', 'png']))
|
||||||
|
{
|
||||||
|
throw new Exception('Invalid format. Valid formats: gif, jpeg, jpg and png.');
|
||||||
|
}
|
||||||
|
// Checks if foreground is present without background
|
||||||
|
elseif ($foreground && !$background)
|
||||||
|
{
|
||||||
|
throw new Exception('You must specify a background color if you wish to specify a foreground color.');
|
||||||
|
}
|
||||||
|
// Checks the background color's length
|
||||||
|
elseif ($background && strlen($background) < 6)
|
||||||
|
{
|
||||||
|
throw new Exception('The background color must be a 6 character hex code.');
|
||||||
|
}
|
||||||
|
// Checks the foreground color's length
|
||||||
|
elseif ($foreground && strlen($foreground) < 6)
|
||||||
|
{
|
||||||
|
throw new Exception('The foreground color must be a 6 character hex code.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = 'http://placehold.it/' . $width;
|
||||||
|
|
||||||
|
if ($height)
|
||||||
|
{
|
||||||
|
$url .= 'x' . $height;
|
||||||
|
}
|
||||||
|
|
||||||
|
$url .= '.' . $format;
|
||||||
|
|
||||||
|
if ($background)
|
||||||
|
{
|
||||||
|
$url .= '/' . $background;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($foreground)
|
||||||
|
{
|
||||||
|
$url .= '/' . $foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($text)
|
||||||
|
{
|
||||||
|
$url .= '&text=' . urlencode($text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL
|
||||||
|
*
|
||||||
|
* Generates a Placehold.it <img> tag based on the passed parameters.
|
||||||
|
*
|
||||||
|
* @param integer $width width of the image
|
||||||
|
* @param integer $height optional height of the image
|
||||||
|
* @param string $format optional format of the image
|
||||||
|
* @param string $background optional background color of the image
|
||||||
|
* @param string $foreground optional foreground color of the image
|
||||||
|
* @param string $text optional text to display in the image
|
||||||
|
* @return string <img> tag with the Placehold.it URL
|
||||||
|
*/
|
||||||
|
public function img($width, $height = null, $format = 'gif', $background = null, $foreground = null, $text = null)
|
||||||
|
{
|
||||||
|
return '<img src="' . $this->url($width, $height, $format, $background, $foreground, $text) . '">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
@ -150,31 +150,31 @@ class Dynamic extends Object
|
||||||
{
|
{
|
||||||
$reference = $original_reference;
|
$reference = $original_reference;
|
||||||
|
|
||||||
// Compiles LESS & SASS to CSS before minifying
|
|
||||||
if ($less || $sass)
|
|
||||||
{
|
|
||||||
$compiled_filename = str_replace('.min', '', $minified_filename);
|
|
||||||
|
|
||||||
if ($less)
|
|
||||||
{
|
|
||||||
$less = new lessc();
|
|
||||||
$less->compileFile($original_filename, $compiled_filename);
|
|
||||||
}
|
|
||||||
elseif ($sass)
|
|
||||||
{
|
|
||||||
$scss = new scssc();
|
|
||||||
|
|
||||||
file_put_contents(
|
|
||||||
$compiled_filename,
|
|
||||||
$scss->compile(file_get_contents($original_filename))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$original_filename = $compiled_filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->config->pickles['minify'] === true)
|
if ($this->config->pickles['minify'] === true)
|
||||||
{
|
{
|
||||||
|
// Compiles LESS & SASS to CSS before minifying
|
||||||
|
if ($less || $sass)
|
||||||
|
{
|
||||||
|
$compiled_filename = str_replace('.min', '', $minified_filename);
|
||||||
|
|
||||||
|
if ($less)
|
||||||
|
{
|
||||||
|
$less = new lessc();
|
||||||
|
$less->compileFile($original_filename, $compiled_filename);
|
||||||
|
}
|
||||||
|
elseif ($sass)
|
||||||
|
{
|
||||||
|
$scss = new scssc();
|
||||||
|
|
||||||
|
file_put_contents(
|
||||||
|
$compiled_filename,
|
||||||
|
$scss->compile(file_get_contents($original_filename))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$original_filename = $compiled_filename;
|
||||||
|
}
|
||||||
|
|
||||||
// Minifies CSS with a few basic character replacements.
|
// Minifies CSS with a few basic character replacements.
|
||||||
$stylesheet = file_get_contents($original_filename);
|
$stylesheet = file_get_contents($original_filename);
|
||||||
$stylesheet = str_replace(
|
$stylesheet = str_replace(
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
@ -225,11 +225,11 @@ class String
|
||||||
{
|
{
|
||||||
if ($hover == true)
|
if ($hover == true)
|
||||||
{
|
{
|
||||||
$string = '<span title="' . $string . '">' . substr($string, 0, $length) . '…</span>';
|
$string = '<span title="' . $string . '">' . mb_strcut($string, 0, $length, 'UTF-8') . '…</span>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$string = substr($string, 0, $length) . '...';
|
$string = mb_strcut($string, 0, $length, 'UTF-8') . '…';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
@ -176,40 +176,80 @@ class Time
|
||||||
$time_ago = 'seconds';
|
$time_ago = 'seconds';
|
||||||
}
|
}
|
||||||
// Less than 1 hour ago (minutes ago)
|
// Less than 1 hour ago (minutes ago)
|
||||||
elseif ($difference < 3600)
|
elseif ($difference < Time::HOUR)
|
||||||
{
|
{
|
||||||
$minutes = round($difference / 60);
|
$minutes = round($difference / 60);
|
||||||
$time_ago = $minutes . ' minute' . ($minutes != 1 ? 's' : '');
|
|
||||||
|
if ($minutes == 60)
|
||||||
|
{
|
||||||
|
$time_ago = 'an hour';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$time_ago = ($minutes == 1 ? 'a' : $minutes) . ' minute' . ($minutes != 1 ? 's' : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Less than 1 day ago (hours ago)
|
// Less than 1 day ago (hours ago)
|
||||||
elseif ($difference < 86400)
|
elseif ($difference < Time::DAY)
|
||||||
{
|
{
|
||||||
$hours = round($difference / 3600);
|
$hours = round($difference / Time::HOUR);
|
||||||
$time_ago = $hours . ' hour' . ($hours != 1 ? 's' : '');
|
|
||||||
|
if ($hours == 24)
|
||||||
|
{
|
||||||
|
$time_ago = 'a day';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$time_ago = ($hours == 1 ? 'an' : $hours) . ' hour' . ($hours != 1 ? 's' : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Less than 1 week ago (days ago)
|
// Less than 1 week ago (days ago)
|
||||||
elseif ($difference < 604800)
|
elseif ($difference < Time::WEEK)
|
||||||
{
|
{
|
||||||
$days = round($difference / 86400);
|
$days = round($difference / Time::DAY);
|
||||||
$time_ago = $days . ' day' . ($days != 1 ? 's' : '');
|
|
||||||
|
if ($days == 7)
|
||||||
|
{
|
||||||
|
$time_ago = 'a week';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$time_ago = ($days == 1 ? 'a' : $days) . ' day' . ($days != 1 ? 's' : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Less than 1 month ago (weeks ago)
|
// Less than 1 month ago (weeks ago)
|
||||||
elseif ($difference < 2419200)
|
elseif ($difference < Time::MONTH)
|
||||||
{
|
{
|
||||||
$weeks = round($difference / 604800);
|
$weeks = round($difference / Time::WEEK);
|
||||||
$time_ago = $weeks . ' week' . ($weeks != 1 ? 's' : '');
|
|
||||||
|
if ($weeks == 4)
|
||||||
|
{
|
||||||
|
$time_ago = 'a month';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$time_ago = ($weeks == 1 ? 'a' : $weeks) . ' week' . ($weeks != 1 ? 's' : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Less than 1 year ago (months ago)
|
// Less than 1 year ago (months ago)
|
||||||
elseif ($difference < 31449600)
|
elseif ($difference < Time::YEAR)
|
||||||
{
|
{
|
||||||
$months = round($difference / 2419200);
|
$months = round($difference / Time::MONTH);
|
||||||
$time_ago = $months . ' month' . ($months != 1 ? 's' : '');
|
|
||||||
|
if ($months == 12)
|
||||||
|
{
|
||||||
|
$time_ago = 'a year';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$time_ago = ($months == 1 ? 'a' : $months) . ' month' . ($months != 1 ? 's' : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Over 1 year ago (years ago)
|
// Over 1 year ago (years ago)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$years = round($difference / 31449600);
|
$years = round($difference / Time::YEAR);
|
||||||
$time_ago = $years . ' year' . ($years != 1 ? 's' : '');
|
$time_ago = ($years == 1 ? 'a' : $years) . ' year' . ($years != 1 ? 's' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$time_ago .= $suffix;
|
$time_ago .= $suffix;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistribution of these files must retain the above copyright notice.
|
* Redistribution of these files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @author Joshua Sherman <josh@gravityblvd.com>
|
* @author Josh Sherman <josh@gravityblvd.com>
|
||||||
* @copyright Copyright 2007-2014, Joshua Sherman
|
* @copyright Copyright 2007-2014, Josh Sherman
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html
|
* @license http://www.opensource.org/licenses/mit-license.html
|
||||||
* @package PICKLES
|
* @package PICKLES
|
||||||
* @link https://github.com/joshtronic/pickles
|
* @link https://github.com/joshtronic/pickles
|
||||||
|
|
|
@ -28,7 +28,7 @@ class API_AYAHTest extends PHPUnit_Framework_TestCase
|
||||||
'scoring_key' => '80cc3f9c6e1da29369c238d55bd8528a968473ad',
|
'scoring_key' => '80cc3f9c6e1da29369c238d55bd8528a968473ad',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->assertRegExp('/<div id=\'AYAH\'><\/div><script src=\'https:\/\/ws.areyouahuman.com\/ws\/script\/[a-z0-9]{40}\/ip[a-zA-Z0-9]{43}\' type=\'text\/javascript\' language=\'JavaScript\'><\/script>/', API_AYAH::getHTML());
|
$this->assertRegExp('/<div id=\'AYAH\'><\/div><script src=\'https:\/\/ws.areyouahuman.com\/ws\/script\/[a-z0-9]{40}\/[a-zA-Z0-9]{45}\' type=\'text\/javascript\' language=\'JavaScript\'><\/script>/', API_AYAH::getHTML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsNotHuman()
|
public function testIsNotHuman()
|
||||||
|
|
68
tests/classes/API/PlaceholdItTest.php
Normal file
68
tests/classes/API/PlaceholdItTest.php
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class API_PlaceholdIt_Test extends PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
private $placeholdit;
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
$this->placeholdit = new API_PlaceholdIt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testInstantiateObject()
|
||||||
|
{
|
||||||
|
$this->assertInstanceOf('API_PlaceholdIt', $this->placeholdit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testURL()
|
||||||
|
{
|
||||||
|
$expected = 'http://placehold.it/350x150.png/ffffff/000000&text=PICKLES+Rules%21';
|
||||||
|
$url = $this->placeholdit->url(350, 150, 'png', 'ffffff', '000000', 'PICKLES Rules!');
|
||||||
|
$this->assertEquals($expected, $url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException Exception
|
||||||
|
* @expectedExceptionMessage Invalid format. Valid formats: gif, jpeg, jpg and png.
|
||||||
|
*/
|
||||||
|
public function testInvalidFormat()
|
||||||
|
{
|
||||||
|
$this->placeholdit->url(350, 150, 'invalid');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException Exception
|
||||||
|
* @expectedExceptionMessage You must specify a background color if you wish to specify a foreground color.
|
||||||
|
*/
|
||||||
|
public function testForegroundNoBackground()
|
||||||
|
{
|
||||||
|
$this->placeholdit->url(350, 150, 'png', false, '000000');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException Exception
|
||||||
|
* @expectedExceptionMessage The background color must be a 6 character hex code.
|
||||||
|
*/
|
||||||
|
public function testInvalidBackground()
|
||||||
|
{
|
||||||
|
$this->placeholdit->url(350, 150, 'png', 'fff');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException Exception
|
||||||
|
* @expectedExceptionMessage The foreground color must be a 6 character hex code.
|
||||||
|
*/
|
||||||
|
public function testInvalidForeground()
|
||||||
|
{
|
||||||
|
$this->placeholdit->url(350, 150, 'png', 'ffffff', '000');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIMG()
|
||||||
|
{
|
||||||
|
$expected = '<img src="http://placehold.it/350x150.png/ffffff/000000&text=PICKLES+Rules%21">';
|
||||||
|
$url = $this->placeholdit->img(350, 150, 'png', 'ffffff', '000000', 'PICKLES Rules!');
|
||||||
|
$this->assertEquals($expected, $url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -86,7 +86,7 @@ class StringTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['foo bar', 3, true, '<span title="foo bar">foo…</span>'],
|
['foo bar', 3, true, '<span title="foo bar">foo…</span>'],
|
||||||
['foo bar', 3, false, 'foo...'],
|
['foo bar', 3, false, 'foo…'],
|
||||||
['foo bar', 7, true, 'foo bar'],
|
['foo bar', 7, true, 'foo bar'],
|
||||||
['foo bar', 8, true, 'foo bar'],
|
['foo bar', 8, true, 'foo bar'],
|
||||||
];
|
];
|
||||||
|
|
|
@ -32,41 +32,64 @@ class TimeTest extends PHPUnit_Framework_TestCase
|
||||||
$this->assertEquals('seconds ago', Time::ago(strtotime('-30 seconds')));
|
$this->assertEquals('seconds ago', Time::ago(strtotime('-30 seconds')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAgoPastTimeMinute()
|
||||||
|
{
|
||||||
|
$this->assertEquals('a minute ago', Time::ago(strtotime('-1 minutes')));
|
||||||
|
}
|
||||||
|
|
||||||
public function testAgoPastTimeMinutes()
|
public function testAgoPastTimeMinutes()
|
||||||
{
|
{
|
||||||
$this->assertEquals('5 minutes ago', Time::ago(strtotime('-5 minutes')));
|
$this->assertEquals('5 minutes ago', Time::ago(strtotime('-5 minutes')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAgoPastTimeHour()
|
||||||
|
{
|
||||||
|
$this->assertEquals('an hour ago', Time::ago(strtotime('-1 hours')));
|
||||||
|
}
|
||||||
|
|
||||||
public function testAgoPastTimeHours()
|
public function testAgoPastTimeHours()
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 hour ago', Time::ago(strtotime('-1 hour')));
|
$this->assertEquals('2 hours ago', Time::ago(strtotime('-2 hours')));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAgoPastTimeDay()
|
||||||
|
{
|
||||||
|
$this->assertEquals('a day ago', Time::ago(strtotime('-1 days')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAgoPastTimeDays()
|
public function testAgoPastTimeDays()
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 day ago', Time::ago(strtotime('-1 day')));
|
$this->assertEquals('2 days ago', Time::ago(strtotime('-2 days')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @todo Need to fix these results so it doesn't fail.
|
public function testAgoPastTimeWeek()
|
||||||
public function testAgoPastTimeDays2()
|
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 day ago', Time::ago(strtotime('-23 hours -55 minutes')));
|
$this->assertEquals('a week ago', Time::ago(strtotime('-1 weeks')));
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
public function testAgoPastTimeWeeks()
|
public function testAgoPastTimeWeeks()
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 week ago', Time::ago(strtotime('-1 week')));
|
$this->assertEquals('2 weeks ago', Time::ago(strtotime('-2 weeks')));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAgoPastTimeMonth()
|
||||||
|
{
|
||||||
|
$this->assertEquals('a month ago', Time::ago(strtotime('-1 months')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAgoPastTimeMonths()
|
public function testAgoPastTimeMonths()
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 month ago', Time::ago(strtotime('-1 month')));
|
$this->assertEquals('2 months ago', Time::ago(strtotime('-2 months')));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAgoPastTimeYear()
|
||||||
|
{
|
||||||
|
$this->assertEquals('a year ago', Time::ago(strtotime('-1 years')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAgoPastTimeYears()
|
public function testAgoPastTimeYears()
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 year ago', Time::ago(strtotime('-1 year')));
|
$this->assertEquals('2 years ago', Time::ago(strtotime('-2 years')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAgoFutureTimeSeconds()
|
public function testAgoFutureTimeSeconds()
|
||||||
|
@ -81,33 +104,58 @@ class TimeTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testAgoFutureTimeHours()
|
public function testAgoFutureTimeHours()
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 hour from now', Time::ago(strtotime('+1 hour')));
|
$this->assertEquals('an hour from now', Time::ago(strtotime('+1 hour')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAgoFutureTimeDays()
|
public function testAgoFutureTimeDays()
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 day from now', Time::ago(strtotime('+1 day')));
|
$this->assertEquals('a day from now', Time::ago(strtotime('+1 day')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAgoFutureTimeWeeks()
|
public function testAgoFutureTimeWeeks()
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 week from now', Time::ago(strtotime('+1 week')));
|
$this->assertEquals('a week from now', Time::ago(strtotime('+1 week')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAgoFutureTimeMonths()
|
public function testAgoFutureTimeMonths()
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 month from now', Time::ago(strtotime('+1 month')));
|
$this->assertEquals('a month from now', Time::ago(strtotime('+1 month')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAgoFutureTimeYears()
|
public function testAgoFutureTimeYears()
|
||||||
{
|
{
|
||||||
$this->assertEquals('1 year from now', Time::ago(strtotime('+1 year')));
|
$this->assertEquals('a year from now', Time::ago(strtotime('+1 year')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTimestamp()
|
public function testTimestamp()
|
||||||
{
|
{
|
||||||
$this->assertEquals(gmdate('Y-m-d H:i:s'), Time::timestamp());
|
$this->assertEquals(gmdate('Y-m-d H:i:s'), Time::timestamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRoundUpHour()
|
||||||
|
{
|
||||||
|
$this->assertEquals('an hour ago', Time::ago(strtotime('-59 minutes -55 seconds')));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRoundUpDay()
|
||||||
|
{
|
||||||
|
$this->assertEquals('a day ago', Time::ago(strtotime('-23 hours -55 minutes')));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRoundUpWeek()
|
||||||
|
{
|
||||||
|
$this->assertEquals('a week ago', Time::ago(strtotime('-6 days -23 hours')));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRoundUpMonth()
|
||||||
|
{
|
||||||
|
$this->assertEquals('a month ago', Time::ago(strtotime('-29 days')));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRoundUpYear()
|
||||||
|
{
|
||||||
|
$this->assertEquals('a year ago', Time::ago(strtotime('-364 days')));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue