This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple code for executing commands on a remote Linux server via SSH in PHP | |
* | |
* @author Phil Kershaw (In collaboration with Philip Mott) | |
* | |
* Note: ssh2_connect requires libssh2-php which is a non-standard PHP lib. | |
* Debian: apt-get install libssh2-php | |
* Redhat: yum install libssh2-php ???? I've no idea for redhat, sorry. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Zimo ACL Resources | |
* Complies an array of Modules/Controllers/Actions. | |
* | |
* @author Phil Kershaw | |
*/ | |
class Zimo_Acl_Resources | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* AppFogMongo Class | |
* Designed for AppFog Platform as a Service (PaaS). Obtains the connection details and esteblishes a connection to the Db. Extends PHPs Mongo Class. | |
* | |
* @author Phil Kershaw | |
*/ | |
class AppFogMongo extends Mongo | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var oauth = require('oauth'); | |
var app = express.createServer(); | |
var key = "[api-key]"; | |
var secret = "[api-secret]"; | |
var request = new oauth.OAuth(null, null, key, secret, '1.0', null, 'HMAC-SHA1'); | |
app.get('/api-request', function(req, res){ | |
request.get( | |
"http://127.0.0.1:8000/api/1.0/data.json", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* A demo function to compile a list of locations (WordPress Terms) based on a 'type' (also WordPress Terms: 'commercial', 'residential', 'land'). Requested and returned via AJAX. | |
* | |
* @author Phil Kershaw | |
*/ | |
add_action('wp_ajax_get_locations', 'get_locations'); | |
add_action('wp_ajax_nopriv_get_locations', 'get_locations'); | |
function get_locations() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
[ | |
{ | |
"button": "button1", | |
"count": 1, | |
"modifiers": ["super", "ctrl"], | |
"press_command": "drag_select", | |
"command": "goto_definition" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var formData = new FormData(); | |
var str_url = '/ajax'; | |
formData.append('id', int_id); | |
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', str_url, true); | |
xhr.onload = function(e) { | |
if (this.status == 200) { | |
if (/success/i.test(this.responseText)) { | |
alert('Category Box deleted successfully.'); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str_title = document.querySelector('#category_box_title').value; | |
var str_url = document.querySelector('#category_box_url').value; | |
var arr_image = document.querySelector('#category_box_image').files[0]; | |
var int_id = document.querySelector('#category_box_id').value; | |
var formData = new FormData(); | |
formData.append('title', str_title); | |
formData.append('url', str_url); | |
formData.append('image', arr_image); | |
formData.append('web_page_content_widget_id', int_selected_content_widget_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private static function _applyEntities(&$feed) | |
{ | |
if (null !== $feed) { | |
foreach($feed as &$item) { | |
if (null !== $item['entities']['urls']) { | |
$urls = array_reverse($item['entities']['urls']); | |
$content = &$item['text']; | |
foreach ($urls as $url) { | |
$content = substr_replace($content, '</a>', $url['indices'][1], 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$available_times = array( | |
"09:00:00" => '<option value="%s 09:00:00">%s 9.00am - 10.00am</option>', | |
"10:00:00" => '<option value="%s 10:00:00">%s 10.00am - 11.00am</option>', | |
"11:00:00" => '<option value="%s 11:00:00">%s 11.00am - 12.00pm</option>', | |
"12:00:00" => '<option value="%s 12:00:00">%s 12.00pm - 1.00pm</option>', | |
"13:00:00" => '<option value="%s 13:00:00">%s 1.00pm - 2.00pm</option>', | |
"14:00:00" => '<option value="%s 14:00:00">%s 2.00pm - 3.00pm</option>', | |
"15:00:00" => '<option value="%s 15:00:00">%s 3.00pm - 4.00pm</option>', | |
"16:00:00" => '<option value="%s 16:00:00">%s 4.00pm - 5.00pm</option>', |
OlderNewer