diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..b46aef3 --- /dev/null +++ b/composer.json @@ -0,0 +1,4 @@ +{ + "name": "hookpress", + "type": "wordpress-plugin" +} diff --git a/hookpress.php b/hookpress.php index 9cab3ee..f6fd5a4 100644 --- a/hookpress.php +++ b/hookpress.php @@ -3,14 +3,14 @@ Plugin Name: HookPress Plugin URI: http://mitcho.com/code/hookpress/ Description: HookPress turns all of your WordPress-internal hooks into webhooks. Possible uses include generating push notifications or using non-PHP web technology to extend WordPress. Read more about webhooks at the webhooks site. -Version: 1.14 +Version: 1.16 Author: mitcho (Michael Yoshitaka Erlewine) Author URI: http://mitcho.com/ Donate link: http://tinyurl.com/donatetomitcho */ define('HOOKPRESS_PRIORITY',12838790321); -$hookpress_version = "1.14"; +$hookpress_version = "1.16"; require('includes.php'); function hookpress_init() { @@ -21,9 +21,11 @@ function hookpress_init() { update_option('hookpress_version',$hookpress_version); add_action('admin_menu', 'hookpress_config_page'); + hookpress_register_hooks(); + } + add_action('init', 'hookpress_init'); -hookpress_register_hooks(); // register ajax service add_action('wp_ajax_hookpress_get_fields', 'hookpress_ajax_get_fields'); diff --git a/includes.php b/includes.php index 467b3d7..50eca36 100644 --- a/includes.php +++ b/includes.php @@ -27,14 +27,22 @@ function hookpress_get_fields( $type ) { } // if it's a POST, we have a URL for it as well. - if ($type == 'POST' || $type == 'PARENT_POST') + if ($type == 'POST' || $type == 'PARENT_POST') { + $fields[] = 'post_url'; + $meta_keys = $wpdb->get_col("select distinct(meta_key) from $wpdb->postmeta"); + + $fields = array_merge($fields, $meta_keys); + } + if ($type == 'PARENT_POST') - $fields = array_map(create_function('$x','return "parent_$x";'),$fields); + $fields = array_map(function ($x) { return "parent_$x"; }, $fields); if ($type == 'OLD_USER_OBJ') - $fields = array_map(create_function('$x','return "old_$x";'),$fields); + $fields = array_map(function ($x) { return "old_$x"; }, $fields); + + $fields = apply_filters('hookpress_get_fields', $fields, $type); return array_unique($fields); } @@ -43,12 +51,14 @@ function hookpress_print_edit_webhook( $id ){ ?> @@ -58,7 +68,7 @@ function hookpress_print_edit_webhook( $id ){ -
> +> >