For example, I have a code like this:
<?php class WC_Order { public $id; public $status; public $order_date; public $modified_date; public $customer_note; public $order_custom_fields; global $wpdb, $woocommerce; if ( empty( $type ) ) $type = array( 'line_item' ); if ( ! is_array( $type ) ) $type = array( $type ); $items = $this->get_items( $type ); $count = 0; foreach ( $items as $item ) { if ( ! empty( $item['qty'] ) ) $count += $item['qty']; else $count ++; } return apply_filters( 'woocommerce_get_item_count', $count, $type, $this ); } public function get_fees() { return $this->get_items( 'fee' ); } public function get_taxes() { return $this->get_items( 'tax' ); } public function get_tax_totals() { $taxes = $this->get_items( 'tax' ); $tax_totals = array(); foreach ( $taxes as $key => $tax ) { $code = $tax[ 'name' ]; if ( ! isset( $tax_totals[ $code ] ) ) { $tax_totals[ $code ] = new stdClass(); $tax_totals[ $code ]->amount = 0; } $tax_totals[ $code ]->is_compound = $tax[ 'compound' ]; $tax_totals[ $code ]->label = isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ]; $tax_totals[ $code ]->amount += $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ]; $tax_totals[ $code ]->formatted_amount = woocommerce_price( $tax_totals[ $code ]->amount ); } return apply_filters( 'woocommerce_order_tax_totals', $tax_totals, $this ); } public function has_meta( $order_item_id ) { global $wpdb; return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, order_item_id FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE order_item_id = %d ORDER BY meta_key,meta_id", absint( $order_item_id ) ), ARRAY_A ); } public function get_item_meta( $order_item_id, $key = '', $single = false ) { return get_metadata( 'order_item', $order_item_id, $key, $single ); }
I want to combine all Wordpress hooks: "do_action" and "apply_filters" with three parameters: apply_filters ('woocommerce_order_tax_totals', $ tax_totals, $ this), file, line number
An example of what I'm trying to do can be seen here: http://etivite.com/api-hooks/buddypress/trigger/apply_filters/bp_get_total_mention_count_for_user/
http://adambrown.info/p/wp_hooks/hook/activated_plugin?version=3.6&file=wp-admin/includes/plugin.php
I tried to pull something, but without success:
<?php $path = $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins/iphorm-form-builder'; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename) { if (substr($filename, -3) == 'php') { $file = file($filename); if ($file !== false) { $matches1 = preg_grep( '/do_action\((.+)\);/', $file); $matches2 = preg_grep( '/apply_filters\((.+)\);/', $file ); $arr = array_filter(array_merge($matches1, $matches2)); $out = ''; echo "found in $filename:"; echo "<pre>"; foreach ($arr as $key => $value) { $out .= $file[$key-2]; $out .= $file[$key-1]; $out .= $file[$key]; $out .= $file[$key+1]; $out .= $file[$key+2]; } echo htmlentities($out); echo "</pre>"; } else { echo "failed reading to array"; } } }