Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/wp-content/themes/deeds/includes/classes/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/wp-content/themes/deeds/includes/classes/base.php

<?php

namespace deeds\Includes\Classes;

use deeds\Includes\Classes\Header_Enqueue;
use deeds\Includes\Classes\Options;

/**
 * Header and Enqueue class
 */
class Base {

	public static $instance;

	/**
	 * Set this value for theme options key
	 *
	 * @var string
	 */
	private $option_key = deeds_NAME;

	function __construct() {

	}

	function loadDefaults() {
		
		$this->protocol = ( is_ssl() ) ? 'https' : 'http';

		Header_Enqueue::init();

		( new Options )->init();
	}
	
	public static function instance() {

		if ( isset( $GLOBALS['deeds_base'] ) ) {
			return $GLOBALS['deeds_base'];
		}

		if ( is_null( self::$instance ) ) {
			self::$instance = new self();
		}

		$GLOBALS['deeds_base'] = self::$instance;

		return self::$instance;
	}	

	/**
	 * Return the theme options.
	 *
	 * @param  string $key [description]
	 * @return [type]      [description]
	 */
	function option( $key = '' ) {

		$options = (array) get_theme_mod( deeds_NAME . '_options-mods' );

		$dn = deeds_dot( $options );

		if ( $key ) {
			return $dn->get( $key );
		}

		return $dn;
	}


	/**
	 * [config description]
	 *
	 * @param  string $name [description].
	 * @return array       [description]
	 */
	function config( $name = '' ) {

		$config = include get_template_directory() . '/includes/config.php';

		$dn = new DotNotation( $config );
		$found = $dn->get( $name );

		if ( $found ) {
			return $found;
		}

		return $config;
	}

		/**
	 * [get_meta description]
	 *
	 * @param  string $key [description].
	 * @param  string $id  [description].
	 * @return [type]      [description]
	 */
	function get_meta( $key = '', $id = '' ) {
		global $post, $post_type;

		if ( ! $post_type ) {
			return;
		}

		$id = ( $id ) ? $id : deeds_set( $post, 'ID' );

		$key = ( $key ) ? $key : '_sh_'.$post_type.'_settings';

		$meta = get_post_meta( $id, $key, true );

		return ( $meta ) ? $meta : false;
	}

	/**
	 * Get name
	 * @return [type] [description]
	 */
	public static function get_pagename() {
		$name = 'home';

		if (is_home()) {
			$name = 'home';
		} elseif (is_archive()) {
			$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
			if ($term) {
				$name = 'term';
			} elseif (is_post_type_archive() || is_day() || is_month() || is_year() ) {
				$name = 'archive';
			} elseif (is_author()) {
				$name = 'author';
			} else {
				$name = 'single';
			}
		} elseif (is_search()) {
			$name = 'search';
		} elseif (is_404()) {
			$name = '404';
		} else {
			$name = 'single';
		}

		return $name;
	}
}


Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists