Skip to content

Instantly share code, notes, and snippets.

View w3guy's full-sized avatar
✍️
Typing...

Collins Agbonghama w3guy

✍️
Typing...
View GitHub Profile
@w3guy
w3guy / deaFilterClient.php
Created October 7, 2013 09:03
Protecting Your PHP Web App From Disposable Email Users via DEA-filter http://w3guy.com/protect-php-app-disposable-email/
<?php
function checkDEAfilter($deaEmailToCheck)
{
$apiKey = "5a8047b40e57750726618b8146066ef6"; // change to your API key
$curlPost = "mail=" . $deaEmailToCheck."&key=".$apiKey; //address to check
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.deafilter.com/classes/DeaFilter.php"); //must point to the DeaFilter.php class
@w3guy
w3guy / deaFilterClient.php
Created October 7, 2013 09:11
Protecting Your PHP Web App From Disposable Email Users via BDEA api http://w3guy.com/protect-php-app-disposable-email/
<?php
function checkDEAfilter($email)
{
$key = "d619f9ad24052ad785d1edf65bbd33b4"; //replace with your API key
$request = "http://check.block-disposable-email.com/easyapi/json/".$key."/" .$email;
$response = file_get_contents($request);
$dea = json_decode($response, true);
if ($dea['request_status'] == 'success') {
if ($dea['domain_status'] != "ok") {
@w3guy
w3guy / Creating WordPress Meta Box the OOP Way
Created April 7, 2014 12:25
A WordPress meta box plugin that add a custom message or notification before the actual post / page content http://w3guy.com/wordpress-meta-box-oop/
<?php
/*
Plugin Name: Custom Message Meta Box
Plugin URI: http://sitepoint.com
Description: Add custom message to each WordPress post
Author: Agbonghama Collins
Version: 1.0
Author URI: http://tech4sky.com/
*/
* Downloaded or downloading
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html
<?php
class ContactFormHandler
{
public function __construct(ContactFormTemplate $template, ContactFormValidator $validator, ContactFormMailer $mailer)
{
$this->template = $template;
$this->validator = $validator;
$this->mailer = $mailer;
}
<?php
/*Add this code to your functions.php file of current theme OR plugin file if you're making a plugin*/
//add the button to the tinymce editor
add_action('media_buttons_context','add_my_tinymce_media_button');
function add_my_tinymce_media_button($context){
return $context.=__("
<a href=\"#TB_inline?width=480&inlineId=my_shortcode_popup&width=640&height=513\" class=\"button thickbox\" id=\"my_shortcode_popup_button\" title=\"Add My Shortcode\">Add My Shortcode</a>");
}
<?php
/**
* Plugin Name: Multiple Roles per User
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful.
* Version: 1
* Author: nikolov.tmw
* Author URI: http://paiyakdev.com/
* License: GPL2
*/
/*
@w3guy
w3guy / backup.sh
Last active August 29, 2015 14:12 — forked from codeablehq/backup.sh
#!/bin/bash
# For this script to work, save it somewhere in the executable path, like /usr/local/sbin/backup.sh
# make it executable: chmod +x /usr/local/sbin/backup.sh
# then add it to cron: crontab -e
# and add the line below, which will run backup 3am each day, then upload to Dropbox
# 0 3 * * * /usr/local/sbin/backup.sh > /dev/null 2>&1
# You also need WP CLI installed: http://wp-cli.org/
/*
Plugin Name: Site specific plugin for ProfilePress
Plugin URI: http://w3guy.com
Description: Dummy / site specific plugin
Author: Agbonghama Collins
Version: 1.0
Author URI: http://w3guy.com
*/
<?php if(isset($pageoptions["tb_webpaint_sidebar"]) && $pageoptions["tb_webpaint_sidebar"]!="nosidebar"):?>
</section>
<aside class="sidebar">
<!-- Begin Sidebar -->
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar($pageoptions["tb_webpaint_sidebar"]) ) : ?>
<div class="sidebox">
<h3>Sidebar Widget</h3>
Please configure this Widget Area in the Admin Panel under Appearance -> Widgets
</div>