This post looks at the minimum PHP version requirements for SilverStripe. I will update this page as new versions are released and I upgrade the various SilverStripe websites I manage, noting any issues I experience. Please share also any experiences you have in the comments section at the end of the post. SilverStripe Server Requirements …
The Automator in OSX allows you to create processes, services, folder actions etc. Once you have created a service in Automator there doesn’t appear to be a way to delete it in the Automater app.
Delete an Automator Service
To delete an automator service, open up the finder and navigate your way to you own Library then Services folder. The files are there with the name you gave it in automater. If the file extension is visible it will be “.workflow”.
So for example, if you created a service to hide dot files and had called it “Hide dot files” then it would show as “Hide dot files.workflow”.
The traditional way of getting the directory the current file is in with PHP is to use dirname(__FILE__). From PHP 5.3 there is a new magic constant__DIR__ which is the equivilent of this function call.
__DIR__ magic constant
The __DIR__ magic constant is a “magic constant” which changes depending where it is used. It contains the directory of the file it is in. If the file is an include, it is the directory that include file is in. If it is the main script it is the directory that script is in.
__DIR__ is available from PHP 5.3 only. If prior versions a notice will be issued if it is used and the value will be __DIR__ and not the actual directory.
Example error if a version prior to PHP 5.3 is used:
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in ...
Unless your application requires the use of PHP 5.3 or greater, stick with the traditional use of:
PHP has heredoc syntax similar to other programming and scripting languages which allow multi line strings containing variables to be easily assigned to variables or echoed. This post looks at how to format a heredoc block in PHP and some of the rules.
A couple of weeks ago I posted how to read through a directory with PHP using the opendir() readdir() and closedir() functions and now look at the glob() function. glob() returns the filenames into an array and supports pattern matching so it can be very easy to find e.g. jpg images in a particular directory.