Changelogs: Decoda v5.1.0

A new version of Decoda has been released, version 5.1.0. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 5.1.0
Tested On: PHP 5.4, Composer
Requires: PHP 5.3, Composer
Commit Hash: b554ba63750bf2c32b0e22b757fed57d5adb981f
Changes:

  • Updated to use Multibyte extensively
  • Added Decoda::hasFilter() and Decoda::hasHook()
  • Added <code> tags within <pre> for CodeFilter and proper semantics
  • Added source tag that renders <code> tag for CodeFilter
  • Refactored Decoda::_buildTag() to be more efficient
  • Fixed bugs with custom brackets in tag parsing
  • Fixed bugs with auto-linking regex
  • Fixed bug with URLs that end in trailing slash
  • Changed <code> to <var> for var tag

Changelogs: Uploader v4.0.0

A new version of Uploader has been released, version 4.0.0. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 4.0.0
Tested On: PHP 5.4
Requires: PHP 5.3
Commit Hash: f4d115ff504abdb8b1c7e508ae530300ef53409c
Changes:

  • Updated to use Composer extensively
  • Updated to use Transit and AWS SDK internally
  • Uploader and S3 classes have been removed (uploading is done purely in the model layer)
  • Transformations can be applied to the original file or used to create new files
  • Transformations now support the following options: nameCallback, append, prepend, uploadDir, finalPath, overwrite and self
  • Added Model::deleteImages($id) to delete uploaded files and not the record
  • Added automatic file deletion when a record is deleted, or a path is being overwritten with a record update
  • Added built in support for file uploading and importing (local, remote or stream)
  • Added rollback file deletion if the upload process fails
  • Added Model::beforeTransport() callback
  • Added logging for critical errors
  • Added AWS S3 and Glacier transport support
  • Added type and mimeType validation rules
  • Improved the error handling
  • Improved file renaming and moving
  • Removed config and mime type mapping
  • Removed Test and Vendor files
  • Option name was renamed to nameCallback
  • Option importFrom was removed as importing is built in
  • Option s3 was replaced with transport
  • Option metaColumns had keys renamed
  • Options baseDir and uploadDir were replaced with tempDir, uploadDir and finalPath
  • Options maxNameLength and saveAsFilename were removed
  • View the updated documentation for help

Changelogs: Decoda v5.0.0

A new version of Decoda has been released, version 5.0.0. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 5.0.0
Tested On: PHP 5.3
Requires: PHP 5.3
Commit Hash: 29dfe2d792d65c0d2b81d470213e54e75a2db722
Changes:

  • Changed folder and namespace structure to make heavier use of Composer
  • Added attribute support for self closing tags
  • Moved interfaces to source root
  • Reversed naming of abstract classes
  • Removed Decoda's autoloader in place of Composer
  • Removed DECODA constant
  • Updated to use SPL exceptions

Using Composer in CakePHP

Composer, a magnificent dependency manager. CakePHP, a brilliant MVC framework. What's stopping you from using both in your application? Nothing at all! Personally, I have been using Composer exclusively in my applications to handle all my dependencies and even my CakePHP plugins. It's very easy to do.

The first thing you need to do is create a composer.json file within your application. It's best to place the file in app/composer.json as it would share the same directory structure with Vendor. Here's a quick example:

{
	"config": {
		"vendor-dir": "Vendor"
	},
	"require": {
		"mjohnson/uploader": "4.*",
		"mjohnson/decoda": "6.*"
	}
}

Since this is an application and not a dependency, all you need to define is the "require" property. We also set the vendor folder to use CakePHP's naming convention, because why not?

To benefit from Composer's autoloader, include the autoload.php file at the very top of Config/core.php.

require_once dirname(__DIR__) . '/Vendor/autoload.php';

Brilliant! Now we have full dependency and autoloading support. Can't get easier than that.

Importing a MySQL DB into WAMP

If you are like me and other Windows users, you most likely use WAMP or XAMPP as a PHP localhost environment stack. And in most cases, you use the MySQL service along with phpMyAdmin. For the most part phpMyAdmin handles all the database management tasks you need as well as a pretty great import and export feature. However, there are times when your DB dump is far too large for phpMyAdmin to handle, and twiddling with php.ini settings doesn't help fix it -- but there is a solution!

The MySQL services comes installed with a MySQL console which you can use to import the SQL file. After you turn WAMP on, click on the system tray icon, navigate to the MySQL folder and open the MySQL console. This should open a command prompt that asks for your password (usually empty if you use the default install settings). To import simply run the following commands (you can type \h to view more all the commands).

use databaseName;
\. C:\path\to\sql\dump.sql

And that's it! Be sure to have a raw SQL dump as the import won't work on gzipped files.

Changelogs: Decoda v4.1.0

A new version of Decoda has been released, version 4.1.0. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 4.1.0
Tested On: PHP 5.4
Requires: PHP 5.3
Commit Hash: 5da68b72a0ec4b774eb9e421fa930b9ff0d316c5
Changes:

Changelogs: Decoda v4.0.0-beta

A new version of Decoda has been released, version 4.0.0-beta. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 4.0.0-beta
Tested On: PHP 5.3
Requires: PHP 5.3
Commit Hash: f960a1b4f4064d48894f4f7438cce7eed3a9381c
Changes:

  • Refactored for PHP 5.3 namespaces and moved all classes to namespaced folders
  • Added unit tests for all classes
  • Added configuration paths to define custom lookup locations
  • Added a new option for Filters: childrenBlacklist and renamed children to childrenWhitelist
  • Added a new option for Filters: persistContent
  • Added a new config for QuoteFilters: dateFormat
  • Added a new config for BlockFilters: spoilerToggle
  • Added a new config for UrlFilter: protocols
  • Added a new config for CensorHook: suffix
  • Added a new configs for EmoticonHook: path, extension
  • Added support for self closing tags:
  • Added a global blacklist to Decoda using Decoda::blacklist()
  • Fixed incorrectly nested tags
  • Fixed child and parent hierarchies
  • Fixed CRLF conversion problems
  • Merged Filter options alias and map into mapAttributes
  • Moved all class constants to Decoda base
  • Refactored all Filter regex patterns
  • Refactored all the template HTML classes
  • Removed all global constants except for DECODA
  • Removed Decoda::nl2br()
  • Removed Filter option testNoDefault
  • Renamed Filter option key to tag
  • Renamed Filter option tag to htmlTag
  • Renamed Filter option type to displayType
  • Renamed Filter option allowed to allowedTypes
  • Renamed Decoda::disableFilters() to resetFilters()
  • Renamed Decoda::disableHooks() to resetHooks()
  • Updated doc blocks and examples
  • Updated EmailFilter and UrlFilter to use filter_var()
  • Updated Decoda to throw exceptions when necessary

Changelogs: Decoda v3.4

A new version of Decoda has been released, version 3.4. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 3.4
Tested On: PHP 5.3
Requires: PHP 5.2
Commit Hash: 6fb3cdb9a906d720687d87e4b6b3b4533cd5af7f
Changes:

  • Added Composer support
  • Added an alias property to filters allowing attribute alias names for tags

Changelogs: Uploader v3.6

A new version of Uploader has been released, version 3.6. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 3.6
Tested On: PHP 5.3, CakePHP 2.0.5
Requires: PHP 5.2, CakePHP 2.0
Commit Hash: d1f2f0c253d4c132836049dee6c84422155fb05e
Changes:

  • Fixed PHP 5.4 strict errors
  • Fixed a bug where empty file uploads will still trigger validation
  • Added an allowEmpty option for Uploader::uploadAll()
  • Added width and height validation rules to FileValidationBehavior
  • Refactored Uploader::uploadAll() to accept an array of options instead of arguments (backwards compatible)
  • Refactored so that on/allowEmpty rules can be passed to FileValidationBehavior like regular validation rules
  • Required validation rule is now by default, allowEmpty true and on create
  • Replaced errors with exceptions
  • Allow empty extension validation to use all mime types [Issue #56]
  • Allow empty file uploads to continue when multiple uploads are used [Issue #62]
  • Use uploadDir in AttachmentBehavior::beforeDelete() if saveAsFilename is true [Issue #63]
  • Use cURL to grab the ext/mimetype for Uploader::importRemote() [Issue #55]
  • Grab image dimensions at the end of Uploader::upload() to work for all upload formats [Issue #60]

Upgrading My Desktop: Transferring the OS to the SSD

After preparing my new SSD, the hard part (or rather easy part) was transferring the current Windows 7 operating system and all its contents (users, documents, etc) off the old HD and into the new SSD. What I wanted to achieve was to mirror the contents of my C: drive onto the SSD and simply swap out the drives and re-use the old SATA cables. To create the C: image I used Acronis True Image Home (free trial) -- which according to the internet, is one of the better products to do this with. The paid version of Acronis comes bundles within a "Clone disk" tool that would of made this process far easier (in case you want to do that).

1) Creating the backup

Before creating the image, I ran the disk cleanup utility on my C: drive to clear out any unneeded or temp files. This is also a great thing to do, as you can lower the filesize of your drive so that it will fit on the new SSD (since they are much smaller in size; this can be a problem). Once the disk cleanup was done, I simply ran the Disk and partition backup command under Backup and Recovery within Acronis. This created a backup file that I will later use in the SSD.

2) Restoring the backup to the SSD

With my shiny new backup, it was now time to restore it to the SSD. This was rather simple, actually it was extremely simple to do. Within Acronis next to each backup is a Recover button that can be used to restore the backup. All I had to do was set the destination for the SSD, and presto, I now have a mirrored drive. A few things to note however: the SSD must be large enough to house the backup and the SSD must not have a drive letter assigned to it so that swapping can easily be done.

3) Swapping out the drives

Now that the drives are mirrored, the easiest step is swapping them. This can be done by shutting down the computer, taking out the old C: drive, plugging its SATA cable into the SSD and inserting the SSD into the computer. When swapped, fire up the computer and let it boot. When it reached the desktop it recognized the SSD and installed new hardware. It then asked to restart the computer to apply the new changes. Once restarted, I noticed that everything was multitudes faster, and is just too beautiful for words to explain.

Since I now had an extra 300GB HD, I decided to plug it back in and re-format it. This drive is now used to store all my Windows backups and restore points. I felt it could still be useful, and in the event that something happens, I have a backup to fix the problem.