services[$name] ) ) { return false; } $this->services[$name] = $service; } public function add_category( $name, $title ) { $name = sanitize_key( $name ); if ( empty( $name ) || isset( $this->categories[$name] ) ) { return false; } $this->categories[$name] = $title; } public function service_exists( $name = '' ) { if ( '' == $name ) { return (bool) count( $this->services ); } else { return isset( $this->services[$name] ); } } public function get_service( $name ) { if ( $this->service_exists( $name ) ) { return $this->services[$name]; } else { return false; } } public function list_services( $args = '' ) { $args = wp_parse_args( $args, array( 'include' => array(), ) ); $singular = false; $services = (array) $this->services; if ( ! empty( $args['include'] ) ) { $services = array_intersect_key( $services, array_flip( (array) $args['include'] ) ); if ( 1 == count( $services ) ) { $singular = true; } } if ( empty( $services ) ) { return; } $action = wpcf7_current_action(); foreach ( $services as $name => $service ) { $cats = array_intersect_key( $this->categories, array_flip( $service->get_categories() ) ); ?>