schnitz81/rt-magnet — pull request #11 by atquick (2012-07-05 22:42:22+00:00)
Title: Changes the retrieval of directories.

Removes the iteration that removes the *.torrent (or similar) matching
patterns at the end of the paths extracted from the configuration path.

Rather than just applying trim to each line, the script will also call
PHP's dirname function, which extracts the directory path of the string
provided. This is a considerably easier, and safer option to implement
the path extraction, than what previously existed.

@>dirname("/my/path/*.ext");
"/my/path"

In a similar fashion, the category name function was changed to extract
the top (last) element through the use of PHP's basename function.

@>basename("/my/path");
"path"

Path related variable names were modified to better reflect what the
content of them are. Since they contain directories (paths), it was
renamed to directories. When you iterate over available directory,
you get a directory.

An argument can be had regarding the old array as singular or plural,
but I thought it would work quite well with the implementation of the
latter.

References:
http://php.net/manual/en/function.dirname.php
http://php.net/manual/en/function.basename.php