From 0810302e4f66022fc521fab73ea1d2ef3c795bbf Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Sun, 26 Jan 2014 15:09:16 -0500 Subject: [PATCH 01/14] Fixed issue with UTF-8 2-byte characters Characters were being split up and causing invalid sequences when using `substr()`. Went ahead and updated to use `mb_strcut()` and forcing the character encoding to UTF-8. I think the plan down the road will be to set the internal encoding to UTF-8 but I am not currently sure how that could effect the rest of the system (perhaps it won't). Closes #39 --- src/classes/String.php | 4 ++-- tests/classes/StringTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/classes/String.php b/src/classes/String.php index 08cf8f6..98fcae9 100644 --- a/src/classes/String.php +++ b/src/classes/String.php @@ -225,11 +225,11 @@ class String { if ($hover == true) { - $string = '' . substr($string, 0, $length) . '…'; + $string = '' . mb_strcut($string, 0, $length, 'UTF-8') . '…'; } else { - $string = substr($string, 0, $length) . '...'; + $string = mb_strcut($string, 0, $length, 'UTF-8') . '…'; } } diff --git a/tests/classes/StringTest.php b/tests/classes/StringTest.php index 6d60eac..0b93eb3 100644 --- a/tests/classes/StringTest.php +++ b/tests/classes/StringTest.php @@ -86,7 +86,7 @@ class StringTest extends PHPUnit_Framework_TestCase { return [ ['foo bar', 3, true, 'foo…'], - ['foo bar', 3, false, 'foo...'], + ['foo bar', 3, false, 'foo…'], ['foo bar', 7, true, 'foo bar'], ['foo bar', 8, true, 'foo bar'], ]; From ddf1719862b0cd4c42020fb7c70dd123d2d1c929 Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Sun, 26 Jan 2014 15:52:31 -0500 Subject: [PATCH 02/14] Reworked the README a bit --- README.md | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 1578593..635832e 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,47 @@ -# PHP Interface Collection of Killer Libraries to Enhance Stuff +# PICKLES [![Build Status](https://travis-ci.org/joshtronic/pickles.png?branch=master)](https://travis-ci.org/joshtronic/pickles) [![Coverage Status](https://coveralls.io/repos/joshtronic/pickles/badge.png)](https://coveralls.io/r/joshtronic/pickles) [![Dependency Status](https://www.versioneye.com/user/projects/52d1bc1eec13751bde00002a/badge.png)](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. +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. ## Requirements ### 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+ -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/v13.12.x) 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 -* MySQL with PDO and PDO_MYSQL drivers -* PostgreSQL with PDO and PDO_PGSQL drivers -* SQLite 3 with PDO and PDO_SQLITE drivers -* Memcached with the Memcache module -* composer if you want to compile LESS, SCSS or JS also necessary if you want - to run the unit tests +* MySQL server with the `PDO_MYSQL` driver +* PostgreSQL server with the `PDO_PGSQL` driver +* SQLite 3 with the `PDO_SQLITE` driver +* Memcached server with the `Memcache` module +* `composer` if you want to compile LESS, SCSS or JS also necessary if you want to use AYAH integration or 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 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) -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` -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. -4. At this point you should have a very rudimentary site up and running. -5. Run `composer update` +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[-vVERSION]` +3. Run `composer update` +4. A site already built in PICKLES can be found [here](https://github.com/gravityblvd/tools.gravityblvd.com) + +## TODO + +* Bring the project's Wiki up to date +* Build an actual boilerplate site that would be included in this project + +## Thanks + +Special thanks goes out to @deanproxy for helping to name this project and @geoffoliver for being a long time user and contributor of this project. From 25596722468ab7bac0248310187f3bfdfdea1826 Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Sun, 26 Jan 2014 15:56:22 -0500 Subject: [PATCH 03/14] Fixed user links --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 635832e..aa3e717 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,4 @@ -# PICKLES - -[![Build Status](https://travis-ci.org/joshtronic/pickles.png?branch=master)](https://travis-ci.org/joshtronic/pickles) -[![Coverage Status](https://coveralls.io/repos/joshtronic/pickles/badge.png)](https://coveralls.io/r/joshtronic/pickles) -[![Dependency Status](https://www.versioneye.com/user/projects/52d1bc1eec13751bde00002a/badge.png)](https://www.versioneye.com/user/projects/52d1bc1eec13751bde00002a) +# PICKLES [![Build Status](https://travis-ci.org/joshtronic/pickles.png?branch=master)](https://travis-ci.org/joshtronic/pickles) [![Coverage Status](https://coveralls.io/repos/joshtronic/pickles/badge.png)](https://coveralls.io/r/joshtronic/pickles) [![Dependency Status](https://www.versioneye.com/user/projects/52d1bc1eec13751bde00002a/badge.png)](https://www.versioneye.com/user/projects/52d1bc1eec13751bde00002a) 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. @@ -44,4 +40,4 @@ Installation is quite simple as there is no installer to run, and all server con ## Thanks -Special thanks goes out to @deanproxy for helping to name this project and @geoffoliver for being a long time user and contributor of this project. +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. From 4c59f7c55bb66cd9e0ced1423a238fe47ce69fb8 Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Sun, 2 Feb 2014 09:47:24 -0500 Subject: [PATCH 04/14] Added round up to Time::ago Some strings were resulting in returns of "24 hours" and "7 days" that needed to be rounded up to the next increment. Closes #28 --- src/classes/Time.php | 74 ++++++++++++++++++++++++++++--------- tests/classes/TimeTest.php | 76 +++++++++++++++++++++++++++++++------- 2 files changed, 119 insertions(+), 31 deletions(-) diff --git a/src/classes/Time.php b/src/classes/Time.php index e6604d5..94dc93b 100644 --- a/src/classes/Time.php +++ b/src/classes/Time.php @@ -176,40 +176,80 @@ class Time $time_ago = 'seconds'; } // Less than 1 hour ago (minutes ago) - elseif ($difference < 3600) + elseif ($difference < Time::HOUR) { - $minutes = round($difference / 60); - $time_ago = $minutes . ' minute' . ($minutes != 1 ? 's' : ''); + $minutes = round($difference / 60); + + 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) - elseif ($difference < 86400) + elseif ($difference < Time::DAY) { - $hours = round($difference / 3600); - $time_ago = $hours . ' hour' . ($hours != 1 ? 's' : ''); + $hours = round($difference / Time::HOUR); + + 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) - elseif ($difference < 604800) + elseif ($difference < Time::WEEK) { - $days = round($difference / 86400); - $time_ago = $days . ' day' . ($days != 1 ? 's' : ''); + $days = round($difference / Time::DAY); + + 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) - elseif ($difference < 2419200) + elseif ($difference < Time::MONTH) { - $weeks = round($difference / 604800); - $time_ago = $weeks . ' week' . ($weeks != 1 ? 's' : ''); + $weeks = round($difference / Time::WEEK); + + 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) - elseif ($difference < 31449600) + elseif ($difference < Time::YEAR) { - $months = round($difference / 2419200); - $time_ago = $months . ' month' . ($months != 1 ? 's' : ''); + $months = round($difference / Time::MONTH); + + if ($months == 12) + { + $time_ago = 'a year'; + } + else + { + $time_ago = ($months == 1 ? 'a' : $months) . ' month' . ($months != 1 ? 's' : ''); + } } // Over 1 year ago (years ago) else { - $years = round($difference / 31449600); - $time_ago = $years . ' year' . ($years != 1 ? 's' : ''); + $years = round($difference / Time::YEAR); + $time_ago = ($years == 1 ? 'a' : $years) . ' year' . ($years != 1 ? 's' : ''); } $time_ago .= $suffix; diff --git a/tests/classes/TimeTest.php b/tests/classes/TimeTest.php index 3dc2ce6..f4ff55b 100644 --- a/tests/classes/TimeTest.php +++ b/tests/classes/TimeTest.php @@ -32,41 +32,64 @@ class TimeTest extends PHPUnit_Framework_TestCase $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() { $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() { - $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() { - $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 testAgoPastTimeDays2() + public function testAgoPastTimeWeek() { - $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() { - $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() { - $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() { - $this->assertEquals('1 year ago', Time::ago(strtotime('-1 year'))); + $this->assertEquals('2 years ago', Time::ago(strtotime('-2 years'))); } public function testAgoFutureTimeSeconds() @@ -81,33 +104,58 @@ class TimeTest extends PHPUnit_Framework_TestCase 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() { - $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() { - $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() { - $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() { - $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() { $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'))); + } } ?> From 248c0ae4589bc5180163f40a74a259ffba8b0226 Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Sun, 2 Feb 2014 10:16:00 -0500 Subject: [PATCH 05/14] Updated dependencies I destroyed my old AYAH repo in favor of a fork of the official stuff that I updated. Had to add some vcs entry to get composer to pull from my fork and not the main package. --- composer.json | 6 +++++- composer.lock | 38 ++++++++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 46d338d..9cb74a0 100644 --- a/composer.json +++ b/composer.json @@ -12,13 +12,17 @@ "autoload": { "classmap": ["src/"] }, + "repositories": [{ + "type": "vcs", + "url": "https://github.com/joshtronic/php-ayah" + }], "require-dev": { "mikey179/vfsStream": "1.2.0", "satooshi/php-coveralls": "dev-master" }, "require": { "devize/closure-compiler": "@dev", - "joshtronic/php-ayah": "1.1.8", + "joshtronic/php-ayah": "@dev", "leafo/lessphp": "0.4.0", "leafo/scssphp": "0.0.9" } diff --git a/composer.lock b/composer.lock index eeae658..d4c2811 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "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" ], - "hash": "34fec617e973fcd94cae8d9158e5ce4b", + "hash": "02e47a40235974136fdc20e03dc179b3", "packages": [ { "name": "devize/closure-compiler", @@ -44,11 +44,17 @@ }, { "name": "joshtronic/php-ayah", - "version": "v1.1.8", + "version": "dev-master", "source": { "type": "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", "autoload": { @@ -61,7 +67,7 @@ ], "authors": [ { - "name": "Some awesome developer over at AreYouAHuman.com", + "name": "Elvis “Bear” Jakupovic", "email": "support@areyouahuman.com" }, { @@ -70,7 +76,10 @@ } ], "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", @@ -163,16 +172,16 @@ "packages-dev": [ { "name": "guzzle/guzzle", - "version": "v3.8.0", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "b4a3ce8c05e777fa18b802956d5d0e38ad338a69" + "reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b4a3ce8c05e777fa18b802956d5d0e38ad338a69", - "reference": "b4a3ce8c05e777fa18b802956d5d0e38ad338a69", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/4de0618a01b34aa1c8c33a3f13f396dcd3882eba", + "reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba", "shasum": "" }, "require": { @@ -210,8 +219,8 @@ "phpunit/phpunit": "3.7.*", "psr/log": "1.0.*", "symfony/class-loader": "*", - "zendframework/zend-cache": "2.0.*", - "zendframework/zend-log": "2.0.*" + "zendframework/zend-cache": "<2.3", + "zendframework/zend-log": "<2.3" }, "type": "library", "extra": { @@ -221,8 +230,8 @@ }, "autoload": { "psr-0": { - "Guzzle\\Tests": "tests/", - "Guzzle": "src/" + "Guzzle": "src/", + "Guzzle\\Tests": "tests/" } }, "notification-url": "https://packagist.org/downloads/", @@ -251,7 +260,7 @@ "rest", "web service" ], - "time": "2013-12-05 23:39:20" + "time": "2014-01-28 22:29:15" }, { "name": "mikey179/vfsStream", @@ -694,6 +703,7 @@ "minimum-stability": "stable", "stability-flags": { "devize/closure-compiler": 20, + "joshtronic/php-ayah": 20, "satooshi/php-coveralls": 20 }, "platform": [ From 048a118236eafb078a2495ccf8f068f206f8f786 Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Sun, 2 Feb 2014 10:36:10 -0500 Subject: [PATCH 06/14] Fixed link to branch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa3e717..185ea86 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ PICKLES (PHP Interface Collection of Killer Libraries to Enhance Stuff) is an op 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. -For anyone stuck using PHP 5.3 is welcome to use [PICKLES v13.12.x](https://github.com/joshtronic/pickles/tree/v13.12.x) which at this time is still receiving bug fixes but will not be seeing any new development by myself. Pull requests are welcome. +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. My rant about outdated server stacks can be found [on my blog](http://joshtronic.com/2014/01/13/your-stack-is-outdated/#.UuVzI3n0A18). From 86ef824455ec40f15659d216ce59ebc6dc8c57ef Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 20 Feb 2014 15:55:02 -0500 Subject: [PATCH 07/14] Only compile LESS or SASS if minify flag is true Probably need to rename the minify flag since it now also represents compiling the CSS. Better yet, probably better to eliminate it entirely and make it an assumption that you should only be compiling when on the "local" environment or when the minified file is completely missing. --- src/classes/Dynamic.php | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/classes/Dynamic.php b/src/classes/Dynamic.php index e10ea2d..5028336 100644 --- a/src/classes/Dynamic.php +++ b/src/classes/Dynamic.php @@ -150,31 +150,31 @@ class Dynamic extends Object { $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) { + // 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. $stylesheet = file_get_contents($original_filename); $stylesheet = str_replace( From 2a7555bf2b7e03323d5af586a93181f4917ee5f9 Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Wed, 16 Apr 2014 11:46:49 -0400 Subject: [PATCH 08/14] Updated dependencies --- composer.lock | 97 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 40 deletions(-) diff --git a/composer.lock b/composer.lock index d4c2811..14fdb53 100644 --- a/composer.lock +++ b/composer.lock @@ -336,12 +336,12 @@ "source": { "type": "git", "url": "https://github.com/satooshi/php-coveralls.git", - "reference": "c95c07e971e4b687718f54fc3447a260fb989e16" + "reference": "9fce7133a1d79b19f38a8fc975009703468172f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/c95c07e971e4b687718f54fc3447a260fb989e16", - "reference": "c95c07e971e4b687718f54fc3447a260fb989e16", + "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/9fce7133a1d79b19f38a8fc975009703468172f0", + "reference": "9fce7133a1d79b19f38a8fc975009703468172f0", "shasum": "" }, "require": { @@ -373,6 +373,11 @@ "composer/bin/coveralls" ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.7-dev" + } + }, "autoload": { "psr-0": { "Satooshi\\Component": "src/", @@ -398,21 +403,21 @@ "github", "test" ], - "time": "2013-07-25 11:22:39" + "time": "2014-03-27 16:05:26" }, { "name": "symfony/config", - "version": "v2.4.1", + "version": "v2.4.3", "target-dir": "Symfony/Component/Config", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "27d0b35879ebefcfee6d218512c32ab2d6cd6a6a" + "reference": "e98693981385224bd31667e56204f311d9e0f98e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/27d0b35879ebefcfee6d218512c32ab2d6cd6a6a", - "reference": "27d0b35879ebefcfee6d218512c32ab2d6cd6a6a", + "url": "https://api.github.com/repos/symfony/Config/zipball/e98693981385224bd31667e56204f311d9e0f98e", + "reference": "e98693981385224bd31667e56204f311d9e0f98e", "shasum": "" }, "require": { @@ -437,7 +442,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Symfony Community", @@ -446,21 +453,21 @@ ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2014-01-01 08:14:50" + "time": "2014-03-26 11:35:33" }, { "name": "symfony/console", - "version": "v2.4.1", + "version": "v2.4.3", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "4c1ed2ff514bd85ee186eebb010ccbdeeab05af7" + "reference": "ef20f1f58d7f693ee888353962bd2db336e3bbcb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/4c1ed2ff514bd85ee186eebb010ccbdeeab05af7", - "reference": "4c1ed2ff514bd85ee186eebb010ccbdeeab05af7", + "url": "https://api.github.com/repos/symfony/Console/zipball/ef20f1f58d7f693ee888353962bd2db336e3bbcb", + "reference": "ef20f1f58d7f693ee888353962bd2db336e3bbcb", "shasum": "" }, "require": { @@ -490,7 +497,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Symfony Community", @@ -499,21 +508,21 @@ ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2014-01-01 08:14:50" + "time": "2014-03-01 17:35:04" }, { "name": "symfony/event-dispatcher", - "version": "v2.4.1", + "version": "v2.4.3", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "e3ba42f6a70554ed05749e61b829550f6ac33601" + "reference": "4708b8cd41984a5ba29fe7dd40716f7f761ac501" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/e3ba42f6a70554ed05749e61b829550f6ac33601", - "reference": "e3ba42f6a70554ed05749e61b829550f6ac33601", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/4708b8cd41984a5ba29fe7dd40716f7f761ac501", + "reference": "4708b8cd41984a5ba29fe7dd40716f7f761ac501", "shasum": "" }, "require": { @@ -544,7 +553,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Symfony Community", @@ -553,21 +564,21 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", - "time": "2013-12-28 08:12:03" + "time": "2014-02-11 13:52:09" }, { "name": "symfony/filesystem", - "version": "v2.4.1", + "version": "v2.4.3", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "b3c3b5a8108b3e5d604dc23241b4ea84a067fc78" + "reference": "b717952487176a993e9b12a08b87beae25ae419c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/b3c3b5a8108b3e5d604dc23241b4ea84a067fc78", - "reference": "b3c3b5a8108b3e5d604dc23241b4ea84a067fc78", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/b717952487176a993e9b12a08b87beae25ae419c", + "reference": "b717952487176a993e9b12a08b87beae25ae419c", "shasum": "" }, "require": { @@ -591,7 +602,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Symfony Community", @@ -600,21 +613,21 @@ ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2013-12-31 13:43:26" + "time": "2014-03-26 11:55:03" }, { "name": "symfony/stopwatch", - "version": "v2.4.1", + "version": "v2.4.3", "target-dir": "Symfony/Component/Stopwatch", "source": { "type": "git", "url": "https://github.com/symfony/Stopwatch.git", - "reference": "c8e21e1380c7eef6197a8165620da8457b7c69a5" + "reference": "bffad325e36a3e71fba6d5dcce6e2f4b4637b91a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/c8e21e1380c7eef6197a8165620da8457b7c69a5", - "reference": "c8e21e1380c7eef6197a8165620da8457b7c69a5", + "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/bffad325e36a3e71fba6d5dcce6e2f4b4637b91a", + "reference": "bffad325e36a3e71fba6d5dcce6e2f4b4637b91a", "shasum": "" }, "require": { @@ -638,7 +651,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Symfony Community", @@ -647,21 +662,21 @@ ], "description": "Symfony Stopwatch Component", "homepage": "http://symfony.com", - "time": "2013-12-12 16:06:47" + "time": "2014-02-11 13:52:09" }, { "name": "symfony/yaml", - "version": "v2.4.1", + "version": "v2.4.3", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "4e1a237fc48145fae114b96458d799746ad89aa0" + "reference": "77a41c2835ab7cfe8bf6d15e25d3af8f3eb3bacd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/4e1a237fc48145fae114b96458d799746ad89aa0", - "reference": "4e1a237fc48145fae114b96458d799746ad89aa0", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/77a41c2835ab7cfe8bf6d15e25d3af8f3eb3bacd", + "reference": "77a41c2835ab7cfe8bf6d15e25d3af8f3eb3bacd", "shasum": "" }, "require": { @@ -685,7 +700,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Symfony Community", @@ -694,7 +711,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2013-12-28 08:12:03" + "time": "2014-03-12 18:29:58" } ], "aliases": [ From fa59eddae0e7dfb57b70880e61c58da9f4c44b4c Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Wed, 16 Apr 2014 11:50:18 -0400 Subject: [PATCH 09/14] Upgraded SCSS to latest --- composer.json | 2 +- composer.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 9cb74a0..299e3c4 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,6 @@ "devize/closure-compiler": "@dev", "joshtronic/php-ayah": "@dev", "leafo/lessphp": "0.4.0", - "leafo/scssphp": "0.0.9" + "leafo/scssphp": "0.0.10" } } diff --git a/composer.lock b/composer.lock index 14fdb53..89ee739 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "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" ], - "hash": "02e47a40235974136fdc20e03dc179b3", + "hash": "ea54b51744a27e84d6badff2b973acac", "packages": [ { "name": "devize/closure-compiler", @@ -124,16 +124,16 @@ }, { "name": "leafo/scssphp", - "version": "v0.0.9", + "version": "0.0.10", "source": { "type": "git", "url": "https://github.com/leafo/scssphp.git", - "reference": "a06d702ebf9fabb22542bbb27cc12a905813bb6d" + "reference": "558357feceb9b932a192966945904414dc372e4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/leafo/scssphp/zipball/a06d702ebf9fabb22542bbb27cc12a905813bb6d", - "reference": "a06d702ebf9fabb22542bbb27cc12a905813bb6d", + "url": "https://api.github.com/repos/leafo/scssphp/zipball/558357feceb9b932a192966945904414dc372e4d", + "reference": "558357feceb9b932a192966945904414dc372e4d", "shasum": "" }, "require": { @@ -166,7 +166,7 @@ ], "description": "scssphp is a compiler for SCSS written in PHP.", "homepage": "http://leafo.net/scssphp/", - "time": "2013-12-23 23:28:02" + "time": "2014-04-15 02:25:09" } ], "packages-dev": [ From 2763818e49dcbf96a127148a23dbfdac2e169efe Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Sun, 20 Apr 2014 18:41:01 -0400 Subject: [PATCH 10/14] Updated test RegEx for AYAH Seems the format being returned doesn't start with ip... updated RegEx to check for a 45 character alphanumeric instead of ip + 43 character alpha numeric --- tests/classes/API/AYAHTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/classes/API/AYAHTest.php b/tests/classes/API/AYAHTest.php index e36c29e..7c72c33 100644 --- a/tests/classes/API/AYAHTest.php +++ b/tests/classes/API/AYAHTest.php @@ -28,7 +28,7 @@ class API_AYAHTest extends PHPUnit_Framework_TestCase 'scoring_key' => '80cc3f9c6e1da29369c238d55bd8528a968473ad', ]; - $this->assertRegExp('/
<\/div>