summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/plugin.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-22 18:31:50 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-22 18:31:50 +0000
commitd48e85e0ac5e675ca33fac173f30c75403d1033f (patch)
tree1164430fa3b83a4d9283961b09c1576f2885e6b2 /wp-inst/wp-includes/plugin.php
parent086dcde66603301531efc6d8087bd06d0546f148 (diff)
downloadwordpress-mu-d48e85e0ac5e675ca33fac173f30c75403d1033f.tar.gz
wordpress-mu-d48e85e0ac5e675ca33fac173f30c75403d1033f.tar.xz
wordpress-mu-d48e85e0ac5e675ca33fac173f30c75403d1033f.zip
Moved everything in wp-inst down a directory.
Uses's Ryan Boren's htaccess rules and mods If you're upgrading, try this on a test server first! git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@591 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/plugin.php')
-rw-r--r--wp-inst/wp-includes/plugin.php168
1 files changed, 0 insertions, 168 deletions
diff --git a/wp-inst/wp-includes/plugin.php b/wp-inst/wp-includes/plugin.php
deleted file mode 100644
index 266c271..0000000
--- a/wp-inst/wp-includes/plugin.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-
-//
-// Filter functions, the core of the WP plugin architecture.
-//
-
-function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
- global $wp_filter;
-
- // check that we don't already have the same filter at the same priority
- if ( isset($wp_filter[$tag]["$priority"]) ) {
- foreach($wp_filter[$tag]["$priority"] as $filter) {
- // uncomment if we want to match function AND accepted_args
- // if ( $filter == array($function, $accepted_args) ) {
- if ( $filter['function'] == $function_to_add ) {
- return true;
- }
- }
- }
-
- // So the format is wp_filter['tag']['array of priorities']['array of ['array (functions, accepted_args)]']
- $wp_filter[$tag]["$priority"][] = array('function'=>$function_to_add, 'accepted_args'=>$accepted_args);
- return true;
-}
-
-function apply_filters($tag, $string) {
- global $wp_filter;
-
- $args = array_slice(func_get_args(), 2);
-
- merge_filters($tag);
-
- if ( !isset($wp_filter[$tag]) ) {
- return $string;
- }
- foreach ($wp_filter[$tag] as $priority => $functions) {
- if ( !is_null($functions) ) {
- foreach($functions as $function) {
-
- $all_args = array_merge(array($string), $args);
- $function_name = $function['function'];
- $accepted_args = $function['accepted_args'];
-
- if ( $accepted_args == 1 )
- $the_args = array($string);
- elseif ( $accepted_args > 1 )
- $the_args = array_slice($all_args, 0, $accepted_args);
- elseif ( $accepted_args == 0 )
- $the_args = NULL;
- else
- $the_args = $all_args;
-
- $string = call_user_func_array($function_name, $the_args);
- }
- }
- }
- return $string;
-}
-
-
-function merge_filters($tag) {
- global $wp_filter;
- if ( isset($wp_filter['all']) ) {
- foreach ($wp_filter['all'] as $priority => $functions) {
- if ( isset($wp_filter[$tag][$priority]) )
- $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], $wp_filter[$tag][$priority]);
- else
- $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], array());
- $wp_filter[$tag][$priority] = array_unique($wp_filter[$tag][$priority]);
- }
- }
-
- if ( isset($wp_filter[$tag]) )
- ksort( $wp_filter[$tag] );
-}
-
-
-
-function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
- global $wp_filter;
-
- // rebuild the list of filters
- if ( isset($wp_filter[$tag]["$priority"]) ) {
- $new_function_list = array();
- foreach($wp_filter[$tag]["$priority"] as $filter) {
- if ( $filter['function'] != $function_to_remove ) {
- $new_function_list[] = $filter;
- }
- }
- $wp_filter[$tag]["$priority"] = $new_function_list;
- }
- return true;
-}
-
-//
-// Action functions
-//
-
-function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
- add_filter($tag, $function_to_add, $priority, $accepted_args);
-}
-
-function do_action($tag, $arg = '') {
- global $wp_filter;
- $extra_args = array_slice(func_get_args(), 2);
- if ( is_array($arg) )
- $args = array_merge($arg, $extra_args);
- else
- $args = array_merge(array($arg), $extra_args);
-
- merge_filters($tag);
-
- if ( !isset($wp_filter[$tag]) ) {
- return;
- }
- foreach ($wp_filter[$tag] as $priority => $functions) {
- if ( !is_null($functions) ) {
- foreach($functions as $function) {
-
- $function_name = $function['function'];
- $accepted_args = $function['accepted_args'];
-
- if ( $accepted_args == 1 ) {
- if ( is_array($arg) )
- $the_args = $arg;
- else
- $the_args = array($arg);
- } elseif ( $accepted_args > 1 ) {
- $the_args = array_slice($args, 0, $accepted_args);
- } elseif ( $accepted_args == 0 ) {
- $the_args = NULL;
- } else {
- $the_args = $args;
- }
-
- $string = call_user_func_array($function_name, $the_args);
- }
- }
- }
-}
-
-function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
- remove_filter($tag, $function_to_remove, $priority, $accepted_args);
-}
-
-//
-// Functions for handling plugins.
-//
-
-function plugin_basename($file) {
- $file = preg_replace('|\\\\+|', '\\\\', $file);
- $file = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $file);
- return $file;
-}
-
-function register_activation_hook($file, $function) {
- $file = plugin_basename($file);
-
- add_action('activate_' . $file, $function);
-}
-
-function register_deactivation_hook($file, $function) {
- $file = plugin_basename($file);
-
- add_action('deactivate_' . $file, $function);
-}
-
-?>