Update: please note that I have since switched to using a set of bash scripts instead of poluting the Git repository with git svn
.
Author: Kaspars Dambis
kaspars.net / @konstruktors
<?php | |
/** | |
* Convert a comma separated file into an associated array. | |
* The first row should contain the array keys. | |
* | |
* Example: | |
* | |
* @param string $filename Path to the CSV file | |
* @param string $delimiter The separator used in the file | |
* @return array |
#!/usr/bin/php | |
<?php | |
echo PHP_EOL; | |
// output a little introduction | |
echo '>> Starting unit tests' . PHP_EOL; | |
// get the name for this project; probably the topmost folder name | |
$projectName = basename(getcwd()); |
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
<?php | |
/** | |
* All of this code is in a big class that implements things like meta boxes and | |
* tons of other stuff but for now here's the relevant functions. | |
* | |
* Note the custom post types and custom taxonomies are just in placeholder form. | |
* I haven't gone through and properly set the labels, etc. for them like I will | |
* when I release the plugin. | |
*/ |
<?php | |
function ecpt_include_post_types_in_search($query) { | |
if(is_search()) { | |
$post_types = get_post_types(array('public' => true, 'exclude_from_search' => false), 'objects'); | |
$searchable_types = array(); | |
if($post_types) { | |
foreach( $post_types as $type) { | |
$searchable_types[] = $type->name; | |
} |
<?php | |
/* | |
Plugin Name: WP_Rewrite endpoints demo | |
Description: A plugin giving example usage of the WP_Rewrite endpoint API | |
Plugin URI: http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/ | |
Author: Jon Cave | |
Author URI: http://joncave.co.uk/ | |
*/ | |
function makeplugins_endpoints_add_endpoint() { |
#!/bin/bash | |
# | |
# This script configures WordPress file permissions based on recommendations | |
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
# | |
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org> | |
# | |
WP_OWNER=www-data # <-- wordpress owner | |
WP_GROUP=www-data # <-- wordpress group | |
WP_ROOT=$1 # <-- wordpress root directory |
Update: please note that I have since switched to using a set of bash scripts instead of poluting the Git repository with git svn
.
Author: Kaspars Dambis
kaspars.net / @konstruktors
<?php | |
echo nl2br(print_r(divide_money_evenly((float)(string) 78.23, 3), true)); | |
function divide_money_evenly($number, $divided_by, $numbers=array()) { | |
$total = 0; | |
for($i=1; $i<=$divided_by; $i++) { | |
if(abs($number - $total) != 0) { | |
$divided = $number / $divided_by; | |
if($divided < 1) { | |
$rounded = 0; | |
} |
<?php | |
/* | |
Plugin Name: Easy Digital Downloads - Variable Pricing License Activation Limits | |
Plugin URL: http://easydigitaldownloads.com/extension/ | |
Description: Limit the number of license activations permitted based on variable prices | |
Version: 1.0 | |
Author: Pippin Williamson | |
Author URI: http://pippinsplugins.com | |
Contributors: mordauk | |
*/ |