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 | |
function my_fopen ($url) { | |
$ch = curl_init ($url); | |
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); | |
$content = curl_exec ($ch); | |
$errno = curl_errno ($ch); | |
curl_close ($ch); | |
return (array ($errno, $content)); | |
} |
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 | |
class Decorator { | |
var $_obj; | |
function Decorator ($obj) { | |
$this->_obj = $obj; | |
} | |
} |
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 | |
if ( !defined( 'MY_VERSION' ) ) | |
define( 'MY_VERSION', 0.1 ); | |
function my_refresh_plugin() { | |
if ( MY_VERSION != get_option( 'my_version' ) ) { | |
update_option( 'my_version', MY_VERSION ); | |
flush_rewrite_rules( false ); | |
} |
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 | |
function mxs_flush_rules() { | |
global $wp_rewrite; | |
$wp_rewrite->flush_rules(); | |
} | |
register_activation_hook( __FILE__, 'mxs_flush_rules' ); | |
register_deactivation_hook( __FILE__, 'mxs_flush_rules' ); |
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 | |
function my_enqueue_script() { | |
wp_enqueue_script( | |
'requirejs', | |
plugins_url( '/js/require.js', __FILE__ ), | |
array( 'jquery' ) | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'my_enqueue_script' ); |
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 | |
add_filter( 'wp_setup_nav_menu_item', function ( $menu_item ) { | |
if ( ! is_user_logged_in() && | |
in_array( 'private', $menu_item->classes ) | |
) { | |
$menu_item->_invalid = true; | |
} | |
return $menu_item; |
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 | |
$name = 'scg_' . md5( $href ); | |
if ( false === ( $value = get_transient( $name ) ) ) { | |
$response = wp_remote_get( $href ); | |
if ( !is_wp_error( $response ) ) { | |
$value = trim( $response['body'] ); | |
if ( !empty( $value ) ) | |
set_transient( $name, $value, 86400 ); | |
} |