Skip to content

Instantly share code, notes, and snippets.

View tribulant's full-sized avatar

Tribulant tribulant

View GitHub Profile
//if the file doesn't exist, we'll try to copy it.
if (!file_exists($imagepath)) {
//Get the file
if ($content = file_get_contents($m[1])) {
if (!empty($content)) {
//Store in the filesystem.
$fp = fopen($imagepath, "w");
fwrite($fp, $content);
fclose($fp);
}
<?php $wpBanners = new wpBanners(); ?>
<?php $wpBanners -> ad($ad_id = 7, $output = true); ?>
<?php $wpBanners -> size($size_id = 4, $output = true); ?>
<?php $wpBanners -> zone($zone_id = 2, $output = true); ?>
<?php $wpBanners -> sizezone($size_id = 2, $zone_id = 3, $output = true); ?>
@tribulant
tribulant / currency_convert.php
Created October 20, 2014 20:03
CurrencyConvert CakePHP Component
<?php
class CurrencyConvertComponent extends Object {
function startup($controller = null) {
$this -> controller = $controller;
}
function get_rate($from = null, $to = null, $amount = 1) {
//make HttpSocket connection here to make a remote request and fetch an exchange rate
@tribulant
tribulant / app_controller.php
Created October 23, 2014 18:16
CurrencyConvert CakePHP Component
<?php
class AppController extends Controller {
var $components = array('CurrencyConvert');
}
?>
@tribulant
tribulant / model_controller.php
Created October 23, 2014 18:19
CurrencyConvert CakePHP Controller
<?php
class ModelController extends AppController {
function index() {
$rate = $this -> CurrencyConvert -> get_rate('USD', 'EUR', 1);
}
}
@tribulant
tribulant / gist:0927e04a2f3bf3cfce1e
Created October 29, 2014 14:05
Newsletter plugin: Filter - wpml_wpmlcontent_after_replace
<?php
function replace_content($body = null) {
// You can define your own $body content here
return $body;
}
add_filter('wpml_wpmlcontent_after_replace', 'replace_content', 10, 1);