Warning: Invalid argument supplied for foreach() in /home/jared/jaredquinn.info/public_html/wordpress/wp-content/plugins/head-meta-desc.php on line 56
Jared Quinn :: PHP Code
Jared Quinn

IT Consulting :: Design :: Events Management

PHP Code


New WordPress Plugin - ATEM (Reverse Recurse Meta)


It’s crazy when the same thing pops up from two different sources within a day of each other, and in this case it was the need to be able to “inherit” Meta data from parent (and further ancestor) pages in WordPress.

I had already developed most of this plugin as part of another plugin specifically designed for a specific purpose, but this portion has been removed and genericised to form “ATEM” (pronounced ate-’em).

You can find download ATEM 0.1 here.

PHP Rapid Application Development Framework


I have decided to release a sneak preview of a PHP Rapid Application Development framework I have been working on, which is currently named fluidic. The name comes from the name of the application I was developing that spawned the framework, but seems more appropriate for the development framework.

Fluidic is designed to be used with PHP and MySQL and provides rapid List/Edit/View style interface which is extremely customisable. Filters/Search and custom buttons can be implemented easilly and with a little more coding subforms and sublists and other custom code components can be implemented.

It also currently supports pop-up calendar for date entry, customisable formatting and verification functions and an extenable framework for plugging into various interface events.

There is little documentation available for fluidic at the moment, but I intend to develop the documentation, including more working examples in the near future. It is currently aimed at experienced PHP developers who will be able to gain an understanding of how to implement systems utilising fluidic by reading the sample code.

If you are interested in contributing to the fluidic project, please contact me.

You can find information and the current code base at my fluidic page.

URL List example code published


I needed to generate a list of URLs to submit to Yahoo’s SiteMap upload feature, and couldn’t (quickly) find a WordPress plugin to generate this for me.

Instead of a full blown plugin, I quickly hacked together the relevant code to do the job as a standalone script and have published it. You can find it here.

If you have any questions/comments, ask here.

URL Function Enhancements


One of the most commonly code snippets i’ve needed in both Perl and PHP over the years has been a function to neatly split URLs. While PHP’s parse_url function does this nicely; I also wanted to be able to echo a single piece of that result and enhance it with some commonly used ones.

The first function is fairly straight forward, build a URL out of the $\_SERVER global bits. This can be used with the second function for returning more interesting things. The parameter for get\_myurl() is an indication of wether the result should be echo’d or returned (a-la WordPress functions).

function get_myurl($v = false) {
    $res = ( $_SERVER[‘HTTPS’] ? ‘https://’ : ‘http://’ ) .
                 $_SERVER[‘HTTP_HOST’] .
                 $_SERVER[‘REQUEST_URI’];
    if(!$v) { echo $res; } else { return $res; }
  }

The second function is split\_url which is my enhancement on PHP’s builtin parse\_url.

It may be called like:

<?php split_url(‘’, ‘relpath’, true); ?>

(Note: relpath is the relative path for the URL supplied (or from get\_myurl() if no URL is supplied), it is the path that any documents referenced in the current document would be relative to, unless a base href is supplied in the output.)

function split_url($url = ‘’, $component = ‘’, $v = false) {
    if($url == ‘’) { $url = get_myurl(true); }
    $res = parse_url($url);
    $res[‘fullpath’] = $res[‘path’];
    $paths = explode(‘/’, $res[‘fullpath’]);
    $res[‘file’]  = array_pop($paths);
    $res[‘path’]  = implode(‘/’, $paths);
    list($res[‘noquery’], $junk) = explode(‘/’, $res[’scheme’], 2);
    $res[‘relpath’] = $res[’scheme’] . ‘://’;
    if($res[‘username’]) { $res[‘relpath’] .= $res[‘user’] . ‘:’ . $res[‘pass’] . ‘@’; }
    $res[‘relpath’] .= $res[‘host’] . $res[‘path’] . ‘/’;
    if($component) {
      if($v) { echo $res[$component]; return } else { return $res[$component];   
    }
    return($res);
  }

split\_url() with no arguments would return a associate array of all parts of the current URL.