'', 'description' => '', 'tier' => 'free', 'image' => '', 'link_target' => '', 'link_label' => '', 'priority' => 10, 'coming_soon' => false, ) ); $this->set_title( $args['title'] ); $this->set_description( $args['description'] ); $this->set_tier( $args['tier'] ); $this->set_image( $args['image'] ); $this->set_link_target( $args['link_target'] ); $this->set_link_label( $args['link_label'] ); $this->set_priority( $args['priority'] ); $this->set_coming_soon( $args['coming_soon'] ); } /** * Set the feature title * * @param string $title The feature title. */ public function set_title( $title ) { $this->title = $title; } /** * Set the feature description * * @param string $description The feature description. */ public function set_description( $description ) { $this->description = $description; } /** * Set the required tier * * @param string $tier The required tier (default: free). */ public function set_tier( $tier ) { $this->tier = $tier; } /** * Set the image url * * @param string $image The image url. */ public function set_image( $image ) { $this->image = $image; } /** * Set the link link_target * * @param string $link_target The link target. */ public function set_link_target( $link_target ) { $this->link_target = $link_target; } /** * Set the link label * * @param string $link_label The link label. */ public function set_link_label( $link_label ) { $this->link_label = $link_label; } /** * Set the feature priority * * @param int $priority The feature priority. */ public function set_priority( $priority ) { $this->priority = intval( $priority ); } /** * Set the feature priority * * @param bool $coming_soon The feature priority. */ public function set_coming_soon( $coming_soon ) { $this->coming_soon = (bool) $coming_soon; } /** * Check if this feature is part of this tier * * @return boolean If this feature is active in this tier. */ private function is_active() { if ( 'free' === $this->tier ) { return true; } else { return agncy_fs()->is_premium() && agncy_fs()->is_plan( $this->tier ); } } /** * Render the feature markup * * @return string The feature markup */ public function render() { $feature_classes = array( 'the_feature' ); if ( ! $this->is_active() ) { $feature_classes[] = 'is_not_active'; $image_link = admin_url( 'themes.php?page=agncy-welcome_page-pricing' ); } else { $image_link = $this->link_target; } $feature_html = '