_template; } protected function _render( $options ) { extract( $options ); ob_start(); include $this->_get_template(); $output = ob_get_contents(); ob_end_clean(); return $output; } public static function get_form_action( $lang = null ) { $lang = $lang ?: FQP::get_curr_lang(); $lang = rawurlencode( $lang ); return admin_url( "admin-post.php?lang={$lang}" ); } public static function get_form_ajax_action( $lang = null ) { $lang = $lang ?: FQP::get_curr_lang(); $lang = rawurlencode( $lang ); return admin_url( "admin-ajax.php?lang={$lang}" ); } public static function get_page_url( $lang = null ) { $url = ''; $option = get_option( FQP::QUOTE_FORM_PAGE_ID_OPTION ); if ( $option ) { if ( null === $lang ) { $lang = FQP::get_curr_lang(); } if ( array_key_exists( $lang, $option ) && !empty( $option[$lang] ) ) { $post_ID = $option[$lang]; } else { $post_ID = reset( $option ); } if ( $post_ID ) { $url = get_permalink( $post_ID ); } } return $url; } protected function _get_template_options() { $options = []; $options['curr_lang'] = FQP::get_curr_lang(); $options['entry_types'] = DB::get_entry_types(); $options['backing_types'] = DB::get_backing_types(); $options['prices'] = get_option( Settings::OPTION_PRICES ); $options['action'] = self::get_form_action(); return $options; } public function exec() { $options = $this->_get_template_options(); return $this->_render( $options ); } }