WIP: WordPress Self-Installer

August 1st, 2010

I love WordPress. I use it almost everyday and for almost every web project that I am involved in. Whether designed, developing, or extending, WordPress has become so close to a default for me its not even funny.

With all these WordPress sites being rolled out, my local development server has become trodden with folders and folders of WordPress installs. I always begin a site locally in development and then migrate to a test server later on for previewing, so sometimes it gets rather time consuming to do manual WordPress installs once, or twice, or sometimes three times a day. That’s basically what spawned this idea.

Okay, I know this might not be a super break through script, judging by the fact that most shared hosts come pre-installed with Fantastico or have their own “1-Click” WordPress installers (a la MediaTemple), but that doesn’t help us developers who enjoy the speed and control of developing  locally. In addition, there aren’t any free development versions of Fantastico or anything of the like. lame.

As a disclaimer, this script is a work-in-progress. It currently runs great for me on my Mac running Snow Leopard 10.6.4. If your on a different OS, than be careful when running this, since it is writing and renaming files.

Requirements

  • PHP and MySQL (duh)
  • cURL PHP Extension
  • Tar command-line capabilities – comes pre-installed on Unix based systems (Windows users > try installing this)

What exactly this script does

  1. Uses MySQL connection to create new database for WordPress
  2. cURL then grabs latest wordpress tar.gz archive
  3. PHP then asks server to extract the Tar to a directory following the same name as the database
  4. Setups up core wp-config.php file with already-in-place MySQL connection info
  5. Redirects to WordPress settings setup page for you to add your blog name, initial user account, etc

Setup and Execution

  • Download ZIP and copy wordpress.php to local servers root directory
  • Configure the config class with your MySQL information (host, user, pass)
  • Run the wordpress.php file through your web browser (for me thats http://localhost/wordpress.php)
  • You’ll then see a list of active WordPress installations on the left, and a place to create your new WordPress Install on the right.
  • Enter your new desired installation name, and click submit

Source Code

Any comments, suggestions, or bug reports welcome :)

3 Comments

Deadlines

July 29th, 2010

“I love deadlines. I like the whooshing sound they make as they go by.”

Douglas Adams, March 11, 1952 – May 11, 2001 (via Jason Santa Maria)

No Comments

Preview: User Interface in the works

July 20th, 2010

Sometimes i can’t decide to post previews of work on either Tumblr, Twitpic, or Flickr … considering my blog always needs more attention, it gets the honor (or lack there of) this time around.

Well, here is the stab I took at UI design for a client project > a FTP/File Manager app that I will also be applying my custom PHP/MySQL knowledge to.

1 Comment

Job, Career, or Calling

July 7th, 2010

Most people approach their work in one of three ways: as a job, a career, or a calling.

  • If you see your work as a job, you do it only for the money, you look at the clock frequently while dreaming about the weekend ahead, and you probably pursue hobbies, which satisfy your effectance needs more thoroughly than does your work.
  • If you see your work as a career, you have larger goals of advancement, promotion, and prestige.
  • If you see your work as a calling, however, you find your work intrinsically fulfilling you are not doing it to achieve something else. You see your work as contributing to the greater good or as playing a role in some larger enterprise the worth of which seems obvious to you. You have frequent experiences of flow during the work day, and you neither look forward to “quitting time” nor feel the desire to shout, “Thank God it’s Friday!” You would continue to work, perhaps even without pay, if you suddenly became very wealthy.

(via ma.tt)

1 Comment

Some recent sites I’ve worked on

June 22nd, 2010

Since I’m really trying hard to blog and update things more around here, I thought I’d post a few links to some websites I’ve had the pleasure of working on lately. I’m super happy with this 3 sites…and thats not to say the other gajillion sites ive been working on suck. These few just really mean a lot to me, in kind of personal way :)

Jeff Johnson

Jeff Johnson Band Image

A simple one page WordPress site, designed and coded. This one was done via mi familia at Skorinc

American Revolution Recording

American Revolution Recording Image

This is a pretty standard 5 page blog and portfolio site with a minimal and clean approach for this local recording studio based out of Atlanta. Design and coded this one on WordPress.

Stand Twogether

Stand Twogether

This a pretty neat idea that i was able produce for my friend Bryan Noel. The idea behind this blog site is for married couples to write about their experiences and journey in their marriages as well as share with other couples in a web community setting. Stand Twogether is still in beta, but i finished up the design and build just a few hours ago. link to come.

2 Comments

Turn your PC into a WiFi Hotspot

May 30th, 2010

Recently I ran across a blog post on this sweet little 3rd party app that can take your PC and turn it into a WiFi hotspot, allowing you to connect multiple computers or mobile devices to the internet through it. Although one could only imagine the bandwidth clogging that could occur with this app, the overall idea and use of this application is pretty sweet and something i’ve looked for in the past.

The app goes by Connectify and is free. cheers

No Comments

5 Simple PHP functions for everyday use

May 6th, 2010

PHP seems to be one of those languages that has so many different ways of completing a single task or write a method.
I’ve personally found the processes and functions that complete the menial tasks, such as dumping array data or formatting a date, are the ones holding onto.

The following are 5 quick and easy functions that I hope to pass on to any developers who care to use them.
Feel free to comment, copy, and my favorite – paste, the following snippets however you like. Cheers

Dump var and exit function

This function has saved my butt so many times when I need to quickly view array or variable data.
A quick and easy way to see contents of an array or any other variable and kill the following script process afterward.
like I said, this has got to me favorite.

function dump( $str ){
    echo '<pre>'.print_r($str, false).'</pre>';
    exit();
}

MySQL datetime formatting via PHP

Formatting MySQL Datetime outside of a query is weird with PHP.
This script is pretty neat in how it takes in standard PHP date() formats and converts your MySQL datetime to any desired format.

function datetimeFormat( $date, $format ){
    $date = explode('-', $date);
    $day = explode(' ', $date[2]);
    $time = explode(':', $day[1]);
    $day = $day[0]; 

    $mktime = mktime($time[0] , $time[1], $time[2], $date[1], $day, $date[0]); 

    return date($format, $mktime);
}

Global site root function

This is a good one for custom PHP sites and applications usually when ModRewrite is on and hiding file extensions and so on.

global $siteroot;

function siteroot(){
    global $siteroot;
    $siteroot = explode('/',  $_SERVER['PHP_SELF']);
    $siteroot = 'http://' . $_SERVER['SERVER_NAME'] . '/' . $siteroot[1];

    return $siteroot;
}

Relative Time stamp

Pretty cool twitter-style script for converting any time stamp to relative time. Love this one.

function ago($time) {
    $time = strtotime($time);
    $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
    $lengths = array("60", "60", "24", "7", "4.35", "12", "10"); 

    $now = time(); 

    $difference = $now - $time;
    $tense = "ago"; 

    for ($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
        $difference /= $lengths[$i];
    } 

    $difference = round($difference); 

    if ($difference != 1) {
        $periods[$i] .= "s";
    } 

    return "$difference $periods[$i] ago ";
}

Simple Pagination with MySQL and PHP

This is relatively simplistic way of limiting a MySQL query and processing a pagination script for easy navigation.
Uses the browser GET for the page number passing. Also requires a little extra work for gathering and limiting the MySQL data…

function paginate( $total, $perpage ) {
    $current = $_GET['page'] != '' ? $_GET['page'] : 1;

    $paginate = '<div>';
    $paginate .= $current > 1 ? '<a href="?page='.($current-1).'"> &laquo; Older |</a>' : '';
    $paginate .= '<div>';

    for($i = 1; $i <= round($total/$perpage); $i++ ){
       $paginate .= '<a href="?page='.$i.'">'.$i."</a>";
    }

    $paginate .= '</div>';
    $paginate .= $current <= ($total/$perpage) ? '<a href="?page='.($current+1).'"> | Newer &raquo;</a>' : '';    
    $paginate .= '</div>';

    return $paginate;
}

…and heres how to setup the call for the paginate function with your MySQL query…

// this is the main setup for the function call and MySQL limiting
$start = $_GET['page'] == 1 || $_GET['page'] == '' ? 0 : $_GET['page'] * $perpage;
$perpage = 10;

$query = "SELECT * FROM table LIMIT $start, $perpage";
$query = mysql_query($query);

while($row = mysql_fetch_array($query)):
    echo '<p>'.$row['id'].' '.$row['data'].'</p>';
endwhile;

echo paginate( mysql_num_rows(mysql_query("SELECT * FROM data")), $perpage );
2 Comments

The Quick Brown Fox – Free Wallpaper Set

April 1st, 2010

I need to refresh my desktop wallpaper so i decided to design a few for you as well.
The idea started with the first Wallpaper and grew into a set of them, all featuring some photos i have taken with my iPhone.

enjoi

1680 x 1050
1440 x 900

1680 x 1050
1440 x 900

1680 x 1050
1440 x 900

1680 x 1050
1440 x 900

Download them all

1 Comment

CSS Element Rotation

January 15th, 2010

Recently…

I had the opportunity to work on a web site for building and construction company based out of the Atlanta area.
They had a great idea for a dynamic event viewer for their projects and they commissioned me to develop this application for them.
Its basically a large horizontal arrow the width of the site wrapper with events spanning length-wise in time.

As the site development went on, the event viewer turned out to be working great, and is chock full of jQuery gems.

Well long story short, I needed to add event titles and I was running out of vertical space with the site, thanks to the big arrow.
Thus entered the proposition for rotated, or slanted, text for the titles.

I knew this would be a cinch with Firefox and Safari, knowing firsthand that they have great advanced CSS tools such as webkit.
Internet Explorer on the other was a pretty big hassle to overcome with rotating a simple span element.
After much research I found some not-so-simple documentation on IE’s Filtering properties and was quickly pointed to the Matrix property by my friend Jordan Dobson.

On to the Code

Basically, here is the source on how to do  a simple 45 degree rotation in Safari and Firefox, respectively:

#element {
position:absolute;
-webkit-transform :rotate(-45deg);
-moz-transform: rotate(-45deg);
}

Now Internet Explorer is a bit more complicated to do a simple 45 degree rotation or angle for an element. It take a rather long list of  object-oriented looking CSS followed by a bunch of long decimals…all of which I could care less to know exactly what each matrix parameter is doing.

#element {
position:absolute;
-ms-filter: 'progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)';
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
}

The cool part is that this code seems to work fairly well. The first line starting with -ms-filter is for IE version 8. The code below that looks more familiar is for version lower than 8.
So I think that the M11, M12, M21, and M22 are some sort of array of blocks that are multiply each other. I really am not a math whiz…but i did find a useful script hidden in the Miscrosoft Documentation.

For the future, I implemented the script into a calculator so you and I dont have to learn mathematical formula for something a simple sounding as CSS element rotation. Please use the follow as much as you would like – IE Matrix Rotation Calculator

No Comments

Recently…

November 12th, 2009

I did a recent contribution blog post to the Blue Tide Productions Blog of which i discussed a few tips for MySpace Layout designers.
MySpace has definitely been a starting point for me as a markup coder and I have treaded many a deep sea of CSS and HTML headaches while designing layouts for bands and music artists.

Check out the post, and delve a little bit into the hectic world of MySpace templating (if you dare!).
Also check out my bud Zach Reed‘s web site over at Blue Tide Productions…he does some great stuff and definitely is making his mark in the Internet Cloud for sure!

2 Comments