$path = sprintf('%s/%s', $this->theme_templates_dir(), $handle); } $template_info = get_file_data( $path, $this->template_headers ); $template_name = $template_info[ 'Template Name' ]; if ( $template_name ) { $files[ $template_name ] = $path; } } } } } return $files; } /** * * Retrieves template list from template directory. * * @param false $sort * @return array */ public function get_template_list_for_dropdown($sort = false) { $files = []; $templates = $this->get_template_files(); if (!empty( $templates)) { foreach ($templates as $key => $handler) { foreach ($handler as $handle) { if (strpos($handle, '.php') !== false) { $path = $this->_get_path($key, $handle); $template_info = get_file_data($path, $this->template_headers); $template_name = $template_info['Template Name']; $template_key = str_replace( ' ', '-', strtolower( $template_name ) ); if ( $template_name ) { $files[$template_key] = sprintf("%s (%s)", ucfirst($template_name), ucfirst($key)); } } } } } if($sort){ ksort($files); } return $files; } public function _get_path($key, $handle) { $path = ''; if ($key === 'lite') { $path = sprintf('%s/%s', $this->get_template_dir(), $handle); } else if ($key === 'pro') { $path = sprintf('%s/%s', $this->get_pro_template_dir(), $handle); } else if ($key === 'theme') { $path = sprintf('%s/%s', $this->theme_templates_dir(), $handle); } return $path; } /** * Preparing template options for frontend select * * @return array teplate select options. */ private function get_template_options() { $files = []; if ( $this->get_template_list() ) { foreach ( $this->get_template_list() as $filename => $path ) { $filename = \str_replace( ' ', '-', $filename ); $files[ strtolower( $filename ) ] = $path; } } return $files; } /** * Adding key value pairs in template options. * * @return array */ private function template_options() { $keys = array_keys( $this->get_template_options() ); $values = array_keys( $this->get_template_list() ); return array_combine( $keys, $values ); } /** * Retrieve template * * @param string $filename * * @return string include-able full template path. */ public function get_template( $filename ) { if ( in_array( $filename, array_keys( $this->get_template_options() ) ) ) { $file = $this->get_template_options()[ $filename ]; return $file; } return false; } /** * Set default option in frontend select control. * * @return string first option. */ public function get_default() { $dt = array_reverse( $this->template_options() ); return strtolower( array_pop( $dt ) ); } /** * Get directory name based on given file name * @param $filename * @return int|string */ protected function get_temp_dir_name($filename){ if(empty($filename)){ return 'free'; } $template_files = array_reverse($this->get_template_files()); foreach ($template_files as $key => $handler) { if(in_array($filename,$handler)){ return $key; } } return 'free'; } }
Fatal error: Trait "Essential_Addons_Elementor\Traits\Template_Query" not found in /htdocs/wp-content/plugins/essential-addons-for-elementor-lite/includes/Traits/Helper.php on line 14