Skip to content

Instantly share code, notes, and snippets.

View davebonds's full-sized avatar

Dave Bonds davebonds

View GitHub Profile
@amcn84
amcn84 / addAgentIDallForms
Created August 11, 2017 01:20
addAgentID all forms
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(){
function addAgentID(id,formName,ord) {
var IDlocation = parseInt(ord);
var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "agentHeaderID");
input.setAttribute("value", id);
document.getElementsByClassName(formName)[IDlocation].appendChild(input);
}
@patpohler
patpohler / Big List of Real Estate APIs.md
Last active May 21, 2024 01:43
Evolving list of Real Estate APIs by Category

Big List of Real Estate APIs

Listings / Property Data

####Rets Rabbit http://www.retsrabbit.com

Rets Rabbit removes the nightmare of importing thousands of real estate listings and photos from RETS or ListHub and gives you an easy to use import and Web API server so you can focus on building your listing search powered website or app.

@tyxla
tyxla / insert-widget-in-sidebar.php
Created August 24, 2016 10:43
Insert a widget in a sidebar programmatically in WordPress
<?php
/**
* Insert a widget in a sidebar.
*
* @param string $widget_id ID of the widget (search, recent-posts, etc.)
* @param array $widget_data Widget settings.
* @param string $sidebar ID of the sidebar.
*/
function insert_widget_in_sidebar( $widget_id, $widget_data, $sidebar ) {
@davebonds
davebonds / managewp-update-mu-plugin-from-s3.php
Last active June 14, 2016 01:26
ManageWP: Update must use plugin from S3
<?php
function update_myplugin() {
// Get current version number
require_once ABSPATH . 'wp-admin/includes/plugin.php';
$version = get_plugin_data(WPMU_PLUGIN_DIR .'/myplugin.php');
// Check if current version is latest
if($version['Version'] < 1.0) {
// Use wp_remote_get to fetch the data and store it to a file
$response = wp_remote_get('https://s3.amazonaws.com/path/to/zipfile/myplugin.zip', array( 'stream' => true, 'filename' => WPMU_PLUGIN_DIR . '/myplugin.zip') );
@frosit
frosit / infectedFiles.md
Created May 5, 2016 22:40
Some commands for finding and clearing infected PHP files

Finding infected files with following bash commands

** Command to list all infected files:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot
  • grep -lr --include=*.php "eval" .
  • grep -lr --include=*.php "base64" .

Command to remove malicious code:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot | xargs sed -i.bak 's/<?php eval(base64_decode[^;]*;/<?php\n/g'
@chriscct7
chriscct7 / gist:d7d077afb01011b1839d
Last active January 24, 2024 04:20
Plugins that need to be updated to be ready for the move to PHP 5 constructors

Important Notice for WordPress Plugins Using PHP 4 Style Constructors

The ability to use PHP 4 style constructors is getting removed from PHP. Without an update, many plugins will eventually no longer work (this is PHP breaking this backwards compatibility, not WordPress)

One of the more common uses of the PHP 4 style constructor (as opposed to PHP 5 style __construct() ) are plugins with widgets calling WP_Widget::WP_Widget() and/or parent::WP_Widget() and/or {object}->WP_Widget()

Note: Starting in WordPress 4.3, regardless of the PHP version in use on a server, WordPress will throw a deprecated notice when one of the PHP 4 style constructors is called specifically for widgets.

Basically instead of doing these:

<?php
/**
* Default Category Title
*
* @author Bill Erickson
* @url http://www.billerickson.net/default-category-and-tag-titles
*
* @param string $headline
* @param object $term
<?php
/**
* Limit Primary Menu to Top Level Items
*
* @author Bill Erickson
* @link http://www.billerickson.net/customizing-menu-arguments/
*
* @param array @args
* @return array
@thenbrent
thenbrent / woocommerce-disable-paypal-for-subscriptions.md
Last active October 31, 2016 20:17
Using WooCommerce and want to disable PayPal for subscription purchases, but still offer it as an option for buying one-off products? Activate this plugin.

This gist has been migrated to a repo here.

@eduardozulian
eduardozulian / wp-customize-image-reloaded.php
Last active November 16, 2023 02:50
Extend WP_Customize_Image_Control class allowing access to files uploaded within the same context.
<?php
/**
* Customize Image Reloaded Class
*
* Extend WP_Customize_Image_Control allowing access to uploads made within
* the same context
*/
class My_Customize_Image_Reloaded_Control extends WP_Customize_Image_Control {
/**
* Constructor.