This file contains hidden or 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 | |
/* | |
* Plugin Name: EnvatoWP Bug Hunt One | |
* Plugin URI: https://gist.github.com/ | |
* Description: Bug Hunt One - Find all the bugs in this basic plugin | |
* Version: 0.1 | |
* Author: EnvatoWP | |
* Author URI: http://envatowp.github.com/ | |
* License: GPL2 | |
*/ |
This file contains hidden or 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 | |
if ( !function_exists( 'wp_print_r' ) ) { | |
/** | |
* Debugging function | |
* | |
* @param mixed $var the variable name | |
* @param string $title title of the variable | |
* @param bool $die if to die or not | |
*/ | |
function wp_print_r( $var, $title = '', $die = false ) { |
This file contains hidden or 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 | |
if ( !function_exists( 'wp_log' ) ) { | |
/** | |
* A file based logging utility. | |
* | |
* Made for WordPress, but can be used anywhere with a single change. | |
* | |
* @author Tareq Hasan <[email protected]> | |
* |
This file contains hidden or 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 | |
/** | |
* Entry Views - for counting single post views. | |
* | |
* Borrowed from Hybrid Core framework and adapted for weDevs Framework | |
* @package WeDevs Framework | |
*/ | |
class WeDevs_Entry_Views { | |
public function __construct() { |
This file contains hidden or 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 | |
require_once dirname( __FILE__ ) . '/class.settings-api.php'; | |
/** | |
* Theme Admin panel for Tareq's Planet | |
* | |
* @author Tareq Hasan | |
*/ | |
class Tareqs_Planet_Admin { |
This file contains hidden or 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 | |
function wpuf_show_custom_fields( $content ) { | |
global $post; | |
$form_id = get_post_meta( $post->ID, '_wpuf_form_id', true ); | |
if ( !$form_id ) { | |
return $content; | |
} |
This file contains hidden or 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 | |
/** | |
* Map display shortcode | |
* | |
* @param string $meta_key | |
* @param int $post_id | |
* @param array $args | |
*/ | |
function wpuf_shortcode_map( $location, $post_id = null, $args = array() ) { | |
This file contains hidden or 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 | |
if ( is_multisite() ) { | |
global $wpdb; | |
$all_sites = $wpdb->get_results( "SELECT * FROM $wpdb->blogs" ); | |
if ( $all_sites ) { | |
foreach ($all_sites as $site) { | |
$wpdb->set_blog_id( $site->blog_id ); |
This file contains hidden or 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 | |
add_action( 'save_post', function( $post_id ) { | |
if ( !wp_is_post_revision( $post_id ) ) { | |
$post_type = get_post_type( $post_id ); | |
// apply on specific post type and for specific user role | |
if ( $post_type == 'product' && current_user_can( 'subscriber' ) ) { | |
wp_update_post( array( |
OlderNewer