Skip to content

Instantly share code, notes, and snippets.

View franz-josef-kaiser's full-sized avatar

Franz Josef Kaiser franz-josef-kaiser

View GitHub Profile
@franz-josef-kaiser
franz-josef-kaiser / script_deamon.php
Created June 10, 2011 15:59
WordPress Plugin to check your DataBase for injected links
<?php
/**
Plugin Name: AntiScript deamon
Plugin URI: https://github.com/franz-josef-kaiser
Description: Removes script-links to spam sites from your post content after your site got hacked. Please go to <a href="tools.php?page=script_deamon.php">Tools &rarr; Remove Hack</a>. Thank you. Proudly brought to you by <a href="http://example.com">Franz Josef Kaiser</a>.
Version: 0.1
Author: Franz Josef Kaiser
Author URI: https://github.com/franz-josef-kaiser
License: GPL2
WP-Version: Tested in 2.7.1, 2.9.2, 3.0
@franz-josef-kaiser
franz-josef-kaiser / get_container_data.php
Created June 14, 2011 00:57
How to: Get Theme/Plugin/MU-Plugin data if the container location is unknown?
<?php
/**
* Plugin root
* @return Full Path to plugin folder
*/
public function set_root_path()
{
$_path = trailingslashit( str_replace( basename( __FILE__ ), "", plugin_basename( __FILE__ ) ) );
// Allow overriding the location
@franz-josef-kaiser
franz-josef-kaiser / _debug.php
Created June 23, 2011 15:52
WordPress debug plugin
<?php
/*
Plugin Name Easy Debug function
Plugin URI https://gist.github.com/1042827
Description Allows the use of <code>_dump( $example_var );</code> or <code>_dump( 'example_global' );</code> for debugging variables. Collects everything in a global & prints in the footer (admin & public). If you want to not print, just return, then set <code>$hook</code> to <code>false</code> when calling the function.
Author Franz Josef Kaiser
Author URI https://github.com/franz-josef-kaiser
Version 0.1
Options Version 0.1
License MIT Extended
@franz-josef-kaiser
franz-josef-kaiser / add_method.php
Created July 4, 2011 14:32
add_method() - automagically hook a method from inside a class into a hook named exactly like the function
<?php
/**
* Adds a method from inside a class to an action hook.
* The method must be named exactly like the hook it's attached to.
*
* @param (string) $method | The called method/action to hook
* @param (integer) $priority | The priority the action hooks into
* @param (integer) $accepted_args | Number of arguments the hook accepts
* @return (boolean) | true on success, throws exception on failure.
*/
@franz-josef-kaiser
franz-josef-kaiser / codex-generator.php
Created July 16, 2011 22:27
Codex Generator that turns functions into Codex pages
<?php
/*
Plugin Name: Codex Generator
Description: Creates ready-made wiki page content for Codex. With magic. Okay - with PHPDoc and Reflect.
Author: Rarst
Author URL: http://www.rarst.net/
Version: 0.1
License Notes: GPLv3+, includes modified Parser class from Doqumentor (GPLv3+)
*/
@franz-josef-kaiser
franz-josef-kaiser / user_deamon.php
Created July 25, 2011 18:17
Current User Data - Plugin (wordpress)
<?php
/*
Plugin Name: Your friendly "Current User Data" Deamon
Plugin URI: http://not-going-to-come-anytime.com
Description: Gives you an overview about any Data of the currently logged in user including all code to get or display it. Includes different code-approaches of user_role and the (depracated) user_level inside the code. So just take a look at the code and inline-comments. Makes a new menu at "Tools" > "Show User Data".
Version: 0.5
Author: F. J. Kaiser
Author URI: http://unserkaiser.com
License: GPL2
=========================================================================
@franz-josef-kaiser
franz-josef-kaiser / wp-error-api.php
Created October 28, 2011 18:28
Draft of "Theme Errors API"
<?php
/**
* Wordpress "Theme Errors API"
*
* @package Wordpress
* @subpackage Theme Errors API
* @since 3.4
* @uses WP_Error
*/
@franz-josef-kaiser
franz-josef-kaiser / insert_menu_separator.php
Last active February 21, 2023 11:21
Add separators to WP Admin menus
<?php
namespace WCM;
// Add the filter
add_action( 'admin_menu', __NAMESPACE__.'\add_menu_separator' );
function add_menu_separator()
{
add_filter( 'add_menu_classes', __NAMESPACE__.'\insert_admin_menu_separator' );
}
@franz-josef-kaiser
franz-josef-kaiser / remove_role_caps.php
Created November 3, 2011 01:35
Wordpress: Remove capabilities from role objects
<?php
function remove_role_cap()
{
// use with caution, as it could match some other capability name too
$target = 'SET PART OF CAP NAME TO CHECK FOR HERE';
$roles = $GLOBALS['wp_roles']->role_objects;
// collect targeted caps in role objects
foreach ( $roles as $role )
{
@franz-josef-kaiser
franz-josef-kaiser / GNU_GPL2.txt
Created November 14, 2011 21:04
The GNU GPL 2 license in a little more readable form than the original.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
//----------------------------------------------------------------------\\
| |
| Copyright (C) 1989, 1991 Free Software Foundation, Inc., |
| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| Everyone is permitted to copy and distribute verbatim copies |
| of this license document, but changing it is not allowed. |
| |