name = $post_type; $this->set_properties( $args ); } /** * Sets comment type properties. * * @param array|string $args Array or string of arguments for registering a comment type. */ public function set_properties( $args ) { $args = wp_parse_args( $args ); /** * Filters the arguments for registering a comment type. * * @param array $args Array of arguments for registering a comment type. * @param string $comment_type Comment type key. */ $args = apply_filters( 'register_webmention_comment_type_args', $args, $this->name ); // Args prefixed with an underscore are reserved for internal use. $defaults = array( 'description' => '', ); $args = array_merge( $defaults, $args ); $args['name'] = $this->name; foreach ( $args as $property_name => $property_value ) { $this->$property_name = $property_value; } } /** * Magic function for getter/setter. * * @param string $method * @param array $params * * @return void */ public function __call( $method, $params ) { if ( ! array_key_exists( 1, $params ) ) { $params[1] = false; } $var = strtolower( substr( $method, 4 ) ); if ( strncasecmp( $method, 'get', 3 ) === 0 ) { return $this->$var; } if ( strncasecmp( $method, 'has', 3 ) === 0 ) { return ! empty( $this->$var ); } if ( strncasecmp( $method, 'set', 3 ) === 0 ) { $this->$var = current( $params ); } } public function get( $param ) { if ( isset( $this->$param ) ) { return $this->$param; } return null; } }