Skip to content

Instantly share code, notes, and snippets.

@admataz
admataz / wp_plugin_boilerplate.php
Created February 14, 2013 15:13
WordPress Plugin Boilerplate
<?php
/*
Plugin Name: Plugin Boilerplate
Version: 0.1-alpha
Description: This is how I like to make sense of the WordPress plugin architecture
Author: Adam Davis
Author URI: http://admataz.com
Plugin URI: http://admataz.com
Text Domain: admataz-plugin-boilerplate
Domain Path: /languages
@admataz
admataz / articlesList.js
Created March 9, 2012 12:34
Jquery plugin to replace Drupal Views-based pagination with AJAX loading more button
/**
* -----------------------------
* Articles List (Home Page)
* -----------------------------
*/
;(function($){
$.fn.articlesList = function() {
var articleslist = this;
@admataz
admataz / is_xhr.php
Created June 7, 2011 11:41
Function to detect whether the current request is from XMLHTTPREQUEST
<?
/*
* Detect whether the current query is ajax
*
* TODO: check if this works across browsers and ajax libraries
*/
function is_xhr()
{
if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
@admataz
admataz / config override.php
Created October 6, 2010 22:25
override settings file with another inc
<?
/**
* override global config settings with local settings - add to the bottom of the global config file
* Server Specfic variables from unversion included file - if it exists
*/
$abspath = dirname(__FILE__);
if(file_exists($abspath.'/settings.local.php')){
include $abspath.'/settings.local.php';