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
add_filter( 'upgrader_post_install', 'autoactivate_plugin_after_install', 10, 3 ); | |
function autoactivate_plugin_after_install( $value, $hook_extra, $result ){ | |
$p_tmp = get_plugins('/' . $result['destination_name']); | |
$p_key = array_keys( $p_tmp ); | |
$pre = ! empty( $result['destination_name'] ) ? $result['destination_name'] . '/' : ''; | |
$plugin = $pre . $p_key[0]; | |
$plugins = get_option('active_plugins'); |
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 | |
/** | |
* Plugin Name: Show Comment Number | |
* Plugin URI: http://neun12.de | |
* Text Domain: | |
* Domain Path: | |
* Description: Dieses Plugin zeigt die laufende Kommentar-Nummer in einem Kommentar-Thread an. | |
* Author: Ralf Albert | |
* Version: 0.1 | |
* Author URI: http://neun12.de/ |
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
/* put this function in your functions.php. You can use it very often */ | |
function __return_null(){ | |
return NULL; | |
} | |
/* stop informing non-admins */ | |
global $current_user; | |
if( ! current_user_can( 'update_core' ) ){ | |
# 2.8 to 3.0: | |
remove_action( 'wp_version_check', 'wp_version_check' ); |
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 get_some_foo(){ | |
return array( 'foo_one', 'foo_two', 'foo_three' ); | |
} | |
function get_some_bar(){ | |
return array( 'bar_one', 'bar_two', 'bar_three' ); | |
} | |
function some_view( $the_array ){ |
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 | |
/* Plugin Name Some Code */ | |
class PluginInit | |
{ | |
/** | |
* mocking code | |
*/ | |
CONST WP_VERSION = '3.3'; | |
private function get_wp_version(){ return '3.3' ; } | |
private function get_wp_network() { return 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 | |
/* Plugin Name Some Code */ | |
namespace PluginInit | |
{ | |
/** | |
* mocking code | |
*/ | |
CONST WP_VERSION = '3.3'; | |
function get_wp_version(){ return '3.3' ; } |
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 | |
/* | |
Plugin Name: User Activity | |
Plugin URI: | |
Description: Provides means to query users by last login activity. | |
Version: 1.0 | |
Author: Eric Teubert, Ralf Albert | |
Author URI: ericteubert@googlemail.com, neun12@googlemail.com | |
License: MIT | |
*/ |
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 | |
/* | |
Plugin Name: Sortable post column | |
Description: Make posts column on users screen sortable | |
Version: 0.0.1 | |
Author: Ralf Albert | |
Author URI: http://yoda.neun12.de | |
*/ | |
// make posts-column sortable |
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 | |
require( dirname(__FILE__) . '/wp-load.php' ); | |
is_wp_error( | |
wp_signon( | |
array( | |
'user_login'=>'YourLoginName', | |
'user_password'=>'YoUrAw3s0M3P455W0rD' | |
) | |
) | |
) ? die('Mooo... :(') : wp_safe_redirect( admin_url() ); |
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 DataContainer | |
{ | |
private static $data = array(); | |
public static function __set( $name, $value ){ | |
if( ! isset( self::$data[$name] ) ) | |
self::$data[$name] = $value; | |
else | |
return FALSE; |