public function hook( $hooked_class = null, $hook_prefix = '' ) {
		$this->hooked_class = $hooked_class;
		$this->hook_prefix = $hook_prefix;
		$this->class_reflector = new \ReflectionClass( $this->hooked_class );

		$methods = $this->class_reflector->getMethods();

		foreach ( $methods as $method ) {
			$method_parts  = $this->parse_method_name( $method->name );

			// This method is not for hooking
			if ( ! $method_parts ) {
				continue;
			}

			$method_reflector = $this->class_reflector->getMethod( $method->name );
			$statics          = $method_reflector->getStaticVariables();
			$defaults         = array(
				'wp_hook_override' => $method_parts['hook_name'],
				'wp_hook_priority' => 10,
				'wp_hook_args' => 99,
				'hook_type' => $method_parts['hook_type'],
				'method' => $method->name,
			);

			$hook_data = array_merge( $defaults, $statics );

			if ( isset( $hook_data['wp_shortcode_name'] ) ) {
				$hook_data['wp_shortcode_name'] = preg_replace( '|_|', '-', $hook_name );
			}

			if ( $hook_data ){
				extract( $hook_data );

				$this->add_hook( $hook_type, $wp_hook_override, $method, $wp_hook_priority, $wp_hook_args );
			}
		}

		add_action( 'after_setup_theme', array( $this, 'add_theme_hooks' ), 12 );

		return $this;
	}
public function hook( $hooked_class = null, $hook_prefix = '' ) {
		$this->hooked_class = $hooked_class;
		$this->hook_prefix = $hook_prefix;
		$this->class_reflector = new \ReflectionClass( $this->hooked_class );

		$methods = $this->class_reflector->getMethods();

		foreach ( $methods as $method ) {
			$method_parts  = $this->parse_method_name( $method->name );

			// This method is not for hooking
			if ( ! $method_parts ) {
				continue;
			}

			$method_reflector = $this->class_reflector->getMethod( $method->name );
			$statics          = $method_reflector->getStaticVariables();
			$defaults         = array(
				'wp_hook_override' => $method_parts['hook_name'],
				'wp_hook_priority' => 10,
				'wp_hook_args' => 99,
				'hook_type' => $method_parts['hook_type'],
				'method' => $method->name,
			);

			$hook_data = array_merge( $defaults, $statics );

			if ( isset( $hook_data['wp_shortcode_name'] ) ) {
				$hook_data['wp_shortcode_name'] = preg_replace( '|_|', '-', $hook_name );
			}

			if ( $hook_data ){
				extract( $hook_data );

				$this->add_hook( $hook_type, $wp_hook_override, $method, $wp_hook_priority, $wp_hook_args );
			}
		}

		add_action( 'after_setup_theme', array( $this, 'add_theme_hooks' ), 12 );

		return $this;
	}
public function hook ( $ hooked_class = null , $ hook_prefix = '' ) { $ this -> hooked_class = $ hooked_class ; $ this -> hook_prefix = $ hook_prefix ; $ this -> class_reflector = new \ ReflectionClass ( $ this -> hooked_class ) ; $ methods = $ this -> class_reflector -> getMethods ( ) ; foreach ( $ methods as $ method ) { $ method_parts = $ this -> parse_method_name ( $ method -> name ) ; // This method is not for hooking if ( ! $ method_parts ) { continue ; } $ method_reflector = $ this -> class_reflector -> getMethod ( $ method -> name ) ; $ statics = $ method_reflector -> getStaticVariables ( ) ; $ defaults = array ( 'wp_hook_override' => $ method_parts [ 'hook_name' ] , 'wp_hook_priority' => 10 , 'wp_hook_args' => 99 , 'hook_type' => $ method_parts [ 'hook_type' ] , 'method' => $ method -> name , ) ; $ hook_data = array_merge ( $ defaults , $ statics ) ; if ( isset ( $ hook_data [ 'wp_shortcode_name' ] ) ) { $ hook_data [ 'wp_shortcode_name' ] = preg_replace ( '|_|' , '-' , $ hook_name ) ; } if ( $ hook_data ) { extract ( $ hook_data ) ; $ this -> add_hook ( $ hook_type , $ wp_hook_override , $ method , $ wp_hook_priority , $ wp_hook_args ) ; } } add_action ( 'after_setup_theme' , array ( $ this , 'add_theme_hooks' ) , 12 ) ; return $ this ; }
Parses the methods and kicks of the hooking process
@param  stdClass $hooked_class The class being hooked
@param  string   $hook_prefix  Optional prefix for custom theme or plugin hooks
@return Hooker                 Returns the instance of the hooker class
Parses the methods and kicks of the hooking process