2
2013
I’m back!
After much much much delay, and hundreds of thousands of lines of code, I have returned! It’s not so much that I’d decided I had a blog that I didn’t care about anymore, but I felt as though if I were to carelessly throw garbage code on here for the sake of populating this site, I’d be a bit of an ass. Since my last post (whoaaa, apparently over a year ago), I have worked […]
13
2011
Using PHP to merge and minify CSS and Javascript
And yet another ‘bangin’ update! Don’t use this (I’m going to leave it here for reference), use the magicmin javascript and css minification/caching class instead for performance, better javascript minification, caching, gzip, base64_encoded images, and more! One MAJOR factor in the usability of your website is site load time. This is affected by a number of factors: the number of images, database queries, and the number of server requests to fetch your stylesheets and javascript […]
24
2011
Synchronous Input Population Using JavaScript
Working with code can often be tedious, and frequently requires programmers to continually reference functions or other sets of code that exists on different pages. For example: As a relative newbie to wordpress, when creating or modifying files I spend ~70% of my development time looking through files for correct/applicable function usage. If I wish to display an option to edit a post in a template, I must use “edit_post_link(‘edit’, ‘<p>’, ‘</p>’);”, however, the chance […]
25
2011
Using PHP to Replace Special Characters with their Equivalents
After having just completed an extensive text file parsing script, I discovered something very very very annoying. A small army of Microsoft Word inspired characters had invaded the imported plain text files (courtesy a number of citation management softwares and websites), causing text to have all sorts of ‘fun’ symbols sprucing things up. For example “Tâ��ms” => “Teams”, but with that extra something added in for visual highlight (or something). So what was a programmer […]
22
2011
How to Import an ExpressionEngine Blog into WordPress
I’m sure by now that most of you have seen my post on how I feel about ExpressionEngine (here), so this post is a natural follower! Today, we’re going to talk about migrating your content from ExpressionEngine to WordPress. I spent quite a bit of time working through EE’s poorly detailed instructions on how to export entries before I decided to just get my hands dirty. Mind you, this post is only applicable to you […]
11
2011
JavaScript Close Window AND Refresh Parent
Earlier today I was working with complex PHP function to update values in a database, within a popout window. The function worked flawlessly (naturally 😉 ), however I was looking for a way to have immediate display feedback on the parent page. Enter the JavaScript close window refresh parent script… <a id="actions" href="#" onClick="window.close();window.opener.location.reload();">Close Window</a> Looking for more? Sorry! That’s it for this crafty little function.
1
2011
Data Encryption Using AES_ENCRYPT
Having databases contain information on subscribers, customers, clients, and the like is similar to playing russian roulette. You’re never certain as to when the bullet comes! Same principles apply to having your customer’s sensitive information yanked from your precious databases! We all watch the news to see which company will have their customer details compromised next. Most recently, Sony has now had approximately 100 million accounts compromised, costing them upwards of $171 million dollars. And […]
21
2011
Simple (Advanced) Click Tracking Using PHP and MySQL
On a recent project, I was asked to record the pages that each user was navigating to in a secured special-purpose website. Initially it seemed daunting, however I recalled a script I’d written to track email open rates using PHP. I am generally disinterested in maintaining a database table of pages, along with a second table of clicked links as I find it to be very inefficient, so I opted to create a simple pass-through […]
18
2011
Exploding a String using Multiple Delimiters Using PHP
Updated February 12th, 2013 to reflect Dave’s comment function below- A++ for simplicity! function explodeX( $delimiters, $string ) { return explode( chr( 1 ), str_replace( $delimiters, chr( 1 ), $string ) ); } $list = ‘Thing 1&Thing 2,Thing 3|Thing 4’; $exploded = explodeX( array(‘&’, ‘,’, ‘|’ ), $list ); echo ‘<pre>’; print_r($exploded); echo ‘</pre>’; Earlier today, I was looking for a simple function to explode text that was contained in string format to be output […]
17
2011
ExpressionEngine Vs. WordPress
Update: detailed instructions and a full script for migrating from EE to WP may now be found here. For nine months now, I’ve been working with ExpressionEngine (EE) for one of my employers websites. Originally, I was very hesitant to make the dive into yet another content management system, and after 9 months- my hesitation was certainly merited! Expressionengine doesn’t specify that it lacks necessary functionality, it just makes it impossible to do whatever it […]
Recent Snippets
- htaccess : Only allow access to specific wordpress upload types if logged in
- MySQL : Query WordPress Database for Invalid Media Filenames
- PHP : Get Actual IP Address with PHP
- JavaScript : Allow Tab in Textarea
- PHP : Clean sanitized database contents on output
- htaccess : Force www. prefix in URIs
- PHP : Force File Download with Correct Content Type
- Wordpress : Disable upgrade notification