| Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/ |
| Current File : /home/x/b/o/xbodynamge/namtation/wp-content/Templates.php.tar |
home/xbodynamge/namtation/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Templates.php 0000644 00000005504 15113704206 0026617 0 ustar 00 <?php
namespace AIOSEO\Plugin\Common\Utils;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Templates
*
* @since 4.0.17
*
* @package AIOSEO\Plugin\Common\Utils
*/
class Templates {
/**
* This plugin absolute path.
*
* @since 4.0.17
*
* @var string
*/
protected $pluginPath = AIOSEO_DIR;
/**
* Paths were our template files are located.
*
* @since 4.0.17
*
* @var string Array of paths.
*/
protected $paths = [
'app/Common/Views'
];
/**
*
* The theme folder.
*
* @since 4.0.17
*
* @var string
*/
private $themeTemplatePath = 'aioseo/';
/**
*
* A theme subfolder.
*
* @since 4.0.17
*
* @var string
*/
protected $themeTemplateSubpath = '';
/**
* Locate a template file in the theme or our plugin paths.
*
* @since 4.0.17
*
* @param string $templateName The template name.
* @return string The template absolute path.
*/
public function locateTemplate( $templateName ) {
// Try to find template file in the theme.
$template = locate_template(
[
trailingslashit( $this->getThemeTemplatePath() ) . trailingslashit( $this->getThemeTemplateSubpath() ) . $templateName
]
);
if ( ! $template ) {
// Try paths, in order.
foreach ( $this->paths as $path ) {
$template = trailingslashit( $this->addPluginPath( $path ) ) . $templateName;
if ( aioseo()->core->fs->exists( $template ) ) {
break;
}
}
}
return apply_filters( 'aioseo_locate_template', $template, $templateName );
}
/**
* Includes a template if the file exists.
*
* @param string $templateName The template path/name.php to be included.
* @param null $data Data passed down to the template.
* @return void
*/
public function getTemplate( $templateName, $data = null ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$template = $this->locateTemplate( $templateName );
if ( ! empty( $template ) and aioseo()->core->fs->exists( $template ) ) {
include $template;
}
}
/**
* Add this plugin path when trying the paths.
*
* @since 4.0.17
*
* @param string $path A path.
* @return string A path with the plugin absolute path.
*/
protected function addPluginPath( $path ) {
return trailingslashit( $this->pluginPath ) . $path;
}
/**
* Returns the theme folder for templates.
*
* @since 4.0.17
*
* @return string The theme folder for templates.
*/
public function getThemeTemplatePath() {
return apply_filters( 'aioseo_template_path', $this->themeTemplatePath );
}
/**
*
* Returns the theme subfolder for templates.
*
* @since 4.0.17
*
* @return string The theme subfolder for templates.
*/
public function getThemeTemplateSubpath() {
return apply_filters( 'aioseo_template_subpath', $this->themeTemplateSubpath );
}
} home/xbodynamge/lebauwcentre/wp-content/plugins/wpforms-lite/src/Helpers/Templates.php 0000644 00000007222 15114111332 0025353 0 ustar 00 <?php
namespace WPForms\Helpers;
/**
* Template related helper methods.
*
* @package WPForms\Helpers
* @author WPForms
* @since 1.5.4
* @license GPL-2.0+
* @copyright Copyright (c) 2019, WPForms LLC
*/
class Templates {
/**
* Returns a list of paths to check for template locations
*
* @since 1.5.4
*
* @return array
*/
public static function get_theme_template_paths() {
$template_dir = 'wpforms';
$file_paths = array(
1 => \trailingslashit( \get_stylesheet_directory() ) . $template_dir,
10 => \trailingslashit( \get_template_directory() ) . $template_dir,
100 => \trailingslashit( \WPFORMS_PLUGIN_DIR ) . 'templates',
);
$file_paths = \apply_filters( 'wpforms_helpers_templates_get_theme_template_paths', $file_paths );
// Sort the file paths based on priority.
\ksort( $file_paths, SORT_NUMERIC );
return \array_map( 'trailingslashit', $file_paths );
}
/**
* Locate a template and return the path for inclusion.
*
* @since 1.5.4
*
* @param string $template_name Template name.
*
* @return string
*/
public static function locate( $template_name ) {
// Trim off any slashes from the template name.
$template_name = \ltrim( $template_name, '/' );
if ( empty( $template_name ) ) {
return \apply_filters( 'wpforms_helpers_templates_locate', '', $template_name );
}
$located = '';
// Try locating this template file by looping through the template paths.
foreach ( self::get_theme_template_paths() as $template_path ) {
if ( \file_exists( $template_path . $template_name ) ) {
$located = $template_path . $template_name;
break;
}
}
return \apply_filters( 'wpforms_helpers_templates_locate', $located, $template_name );
}
/**
* Include a template.
* Uses 'require' if $args are passed or 'load_template' if not.
*
* @since 1.5.4
*
* @param string $template_name Template name.
* @param array $args Arguments.
* @param bool $extract Extract arguments.
*
* @throws \RuntimeException If extract() tries to modify the scope.
*/
public static function include_html( $template_name, $args = array(), $extract = false ) {
$template_name .= '.php';
// Allow 3rd party plugins to filter template file from their plugin.
$located = \apply_filters( 'wpforms_helpers_templates_include_html_located', self::locate( $template_name ), $template_name, $args, $extract );
$args = \apply_filters( 'wpforms_helpers_templates_include_html_args', $args, $template_name, $extract );
if ( empty( $located ) || ! \is_readable( $located ) ) {
return;
}
// Load template WP way if no arguments were passed.
if ( empty( $args ) ) {
\load_template( $located, false );
return;
}
$extract = \apply_filters( 'wpforms_helpers_templates_include_html_extract_args', $extract, $template_name, $args );
if ( $extract && \is_array( $args ) ) {
$created_vars_count = extract( $args, EXTR_SKIP ); // phpcs:ignore WordPress.PHP.DontExtract
// Protecting existing scope from modification.
if ( count( $args ) !== $created_vars_count ) {
throw new \RuntimeException( 'Extraction failed: variable names are clashing with the existing ones.' );
}
}
require $located;
}
/**
* Like self::include_html, but returns the HTML instead of including.
*
* @since 1.5.4
*
* @param string $template_name Template name.
* @param array $args Arguments.
* @param bool $extract Extract arguments.
*
* @return string
*/
public static function get_html( $template_name, $args = array(), $extract = false ) {
\ob_start();
self::include_html( $template_name, $args, $extract );
return \ob_get_clean();
}
}
home/xbodynamge/dev/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Templates.php 0000644 00000005504 15114646427 0025416 0 ustar 00 <?php
namespace AIOSEO\Plugin\Common\Utils;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Templates
*
* @since 4.0.17
*
* @package AIOSEO\Plugin\Common\Utils
*/
class Templates {
/**
* This plugin absolute path.
*
* @since 4.0.17
*
* @var string
*/
protected $pluginPath = AIOSEO_DIR;
/**
* Paths were our template files are located.
*
* @since 4.0.17
*
* @var string Array of paths.
*/
protected $paths = [
'app/Common/Views'
];
/**
*
* The theme folder.
*
* @since 4.0.17
*
* @var string
*/
private $themeTemplatePath = 'aioseo/';
/**
*
* A theme subfolder.
*
* @since 4.0.17
*
* @var string
*/
protected $themeTemplateSubpath = '';
/**
* Locate a template file in the theme or our plugin paths.
*
* @since 4.0.17
*
* @param string $templateName The template name.
* @return string The template absolute path.
*/
public function locateTemplate( $templateName ) {
// Try to find template file in the theme.
$template = locate_template(
[
trailingslashit( $this->getThemeTemplatePath() ) . trailingslashit( $this->getThemeTemplateSubpath() ) . $templateName
]
);
if ( ! $template ) {
// Try paths, in order.
foreach ( $this->paths as $path ) {
$template = trailingslashit( $this->addPluginPath( $path ) ) . $templateName;
if ( aioseo()->core->fs->exists( $template ) ) {
break;
}
}
}
return apply_filters( 'aioseo_locate_template', $template, $templateName );
}
/**
* Includes a template if the file exists.
*
* @param string $templateName The template path/name.php to be included.
* @param null $data Data passed down to the template.
* @return void
*/
public function getTemplate( $templateName, $data = null ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$template = $this->locateTemplate( $templateName );
if ( ! empty( $template ) and aioseo()->core->fs->exists( $template ) ) {
include $template;
}
}
/**
* Add this plugin path when trying the paths.
*
* @since 4.0.17
*
* @param string $path A path.
* @return string A path with the plugin absolute path.
*/
protected function addPluginPath( $path ) {
return trailingslashit( $this->pluginPath ) . $path;
}
/**
* Returns the theme folder for templates.
*
* @since 4.0.17
*
* @return string The theme folder for templates.
*/
public function getThemeTemplatePath() {
return apply_filters( 'aioseo_template_path', $this->themeTemplatePath );
}
/**
*
* Returns the theme subfolder for templates.
*
* @since 4.0.17
*
* @return string The theme subfolder for templates.
*/
public function getThemeTemplateSubpath() {
return apply_filters( 'aioseo_template_subpath', $this->themeTemplateSubpath );
}
} home/xbodynamge/namtation/wp-content/plugins/wpforms-lite/src/Helpers/Templates.php 0000644 00000007222 15115073404 0024675 0 ustar 00 <?php
namespace WPForms\Helpers;
/**
* Template related helper methods.
*
* @package WPForms\Helpers
* @author WPForms
* @since 1.5.4
* @license GPL-2.0+
* @copyright Copyright (c) 2019, WPForms LLC
*/
class Templates {
/**
* Returns a list of paths to check for template locations
*
* @since 1.5.4
*
* @return array
*/
public static function get_theme_template_paths() {
$template_dir = 'wpforms';
$file_paths = array(
1 => \trailingslashit( \get_stylesheet_directory() ) . $template_dir,
10 => \trailingslashit( \get_template_directory() ) . $template_dir,
100 => \trailingslashit( \WPFORMS_PLUGIN_DIR ) . 'templates',
);
$file_paths = \apply_filters( 'wpforms_helpers_templates_get_theme_template_paths', $file_paths );
// Sort the file paths based on priority.
\ksort( $file_paths, SORT_NUMERIC );
return \array_map( 'trailingslashit', $file_paths );
}
/**
* Locate a template and return the path for inclusion.
*
* @since 1.5.4
*
* @param string $template_name Template name.
*
* @return string
*/
public static function locate( $template_name ) {
// Trim off any slashes from the template name.
$template_name = \ltrim( $template_name, '/' );
if ( empty( $template_name ) ) {
return \apply_filters( 'wpforms_helpers_templates_locate', '', $template_name );
}
$located = '';
// Try locating this template file by looping through the template paths.
foreach ( self::get_theme_template_paths() as $template_path ) {
if ( \file_exists( $template_path . $template_name ) ) {
$located = $template_path . $template_name;
break;
}
}
return \apply_filters( 'wpforms_helpers_templates_locate', $located, $template_name );
}
/**
* Include a template.
* Uses 'require' if $args are passed or 'load_template' if not.
*
* @since 1.5.4
*
* @param string $template_name Template name.
* @param array $args Arguments.
* @param bool $extract Extract arguments.
*
* @throws \RuntimeException If extract() tries to modify the scope.
*/
public static function include_html( $template_name, $args = array(), $extract = false ) {
$template_name .= '.php';
// Allow 3rd party plugins to filter template file from their plugin.
$located = \apply_filters( 'wpforms_helpers_templates_include_html_located', self::locate( $template_name ), $template_name, $args, $extract );
$args = \apply_filters( 'wpforms_helpers_templates_include_html_args', $args, $template_name, $extract );
if ( empty( $located ) || ! \is_readable( $located ) ) {
return;
}
// Load template WP way if no arguments were passed.
if ( empty( $args ) ) {
\load_template( $located, false );
return;
}
$extract = \apply_filters( 'wpforms_helpers_templates_include_html_extract_args', $extract, $template_name, $args );
if ( $extract && \is_array( $args ) ) {
$created_vars_count = extract( $args, EXTR_SKIP ); // phpcs:ignore WordPress.PHP.DontExtract
// Protecting existing scope from modification.
if ( count( $args ) !== $created_vars_count ) {
throw new \RuntimeException( 'Extraction failed: variable names are clashing with the existing ones.' );
}
}
require $located;
}
/**
* Like self::include_html, but returns the HTML instead of including.
*
* @since 1.5.4
*
* @param string $template_name Template name.
* @param array $args Arguments.
* @param bool $extract Extract arguments.
*
* @return string
*/
public static function get_html( $template_name, $args = array(), $extract = false ) {
\ob_start();
self::include_html( $template_name, $args, $extract );
return \ob_get_clean();
}
}