HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: /datos/www/embajadasyconsulados.procolombia.co/public_html/wp-content/mu-plugins/colombia.php
<?php
class colombia {
	const version = '2016';

	function setup() {
		add_action( 'init', array( __CLASS__, 'colombia_post_types' ) );
		add_action( 'p2p_init',  array( __CLASS__, 'my_connection_types' ) );

		add_filter( 'kc_plugin_settings', array( __CLASS__, 'kc_settings_colombia') );
		add_filter( 'kc_term_settings', array( __CLASS__, 'colombia_term_fields' ) );
		add_filter( 'kc_post_settings', array( __CLASS__, 'colombia_custom_fields' ) );
		add_filter( 'wp_kses_allowed_html', array( __CLASS__, 'esw_author_cap_filter' ),1,1 );

	}

	function colombia_post_types() {
		register_post_type('home-slide', array(
			'label' => __('Home Slides', 'colombia'),
			'labels' => array (
				'name' => __('Home Slides', 'colombia'),
				'add_new' => __('Agregar nuevo', 'colombia'),
				'add_new_item' => __('Agregar nuevo slide', 'colombia'),
				'edit_item' => __('Editar slide', 'colombia'),
				'new_item' => __('Nuevo slide', 'colombia'),
				'view_item' => __('Ver slide', 'colombia')
			),
			'public' => true,
			'hierarchical' => false,
			'has_archive' => true,
			'supports' => array('title','post-formats','editor','excerpt','revisions','thumbnail')
			)
		);


		/*register_post_type('download', array(
			'label' => __('Descargas', 'colombia'),
			'labels' => array (
				'name' => __('Descargas', 'colombia'),
				'add_new' => __('Agregar nuevo', 'colombia'),
				'add_new_item' => __('Agregar nueva descarga', 'colombia'),
				'edit_item' => __('Editar descarga', 'colombia'),
				'new_item' => __('Nueva descarga', 'colombia'),
				'view_item' => __('Ver descarga', 'colombia')
			),
			'taxonomies' => array('category'),
			'public' => true,
			'hierarchical' => true,
			'has_archive' => true,
			'supports' => array('title','editor', 'thumbnail','post-formats','page-attributes','revisions')
			)
		);*/
		

	    register_post_type('portales', array(
	        'labels' => array(
	            'name' => __('Portales Asociados', 'colombia'),
	            'singular_name' => __('Portal', 'colombia')
	        ),
	        // 'taxonomies' => array('category', 'post_tag'),
	        'public' => true,
	        'has_archive' => false,
	        'exclude_from_search' => true,
	        'supports' => array('title', 'thumbnail', 'revisions')
	            )
	    );
	}


	function kc_settings_colombia( $settings ) {

		$my_settings = array(
			/**
			 * Only alphanumerics, dashes and underscores are allowed here.
			 */
			'prefix'  => 'colombia',
			'menu_location' => 'themes.php',
			'menu_title'    => __('Configuración', 'colombia'),
			'page_title'    => __('Configuración', 'colombia'),
			'options' => array(
				array(
					'id'     => 'conectate_section',
					'title'  => __('Secciones Conéctate', 'colombia'),
					'desc'   => __('Imágenes, títulos y links para la sección "Conéctate con Colombia"', 'colombia'),
					'fields' => array(
						array(
							'id' => 'conectate_1_title',
							'type' => 'text',
							'title' => __('Título Conéctate 1', 'colombia')
						),
						array(
							'id' => 'conectate_1_link',
							'type' => 'text',
							'title' => __('Link Conéctate 1', 'colombia')
						),
						array(
							'id'      => 'conectate_1_image',
							'title'   => __('Imagen Conéctate 1', 'colombia'),
							'type'    => 'radio',
							'options' => array(
								'icon-visit'  => 'Visit',
								'icon-export'  => 'Export',
								'icon-invest'  => 'Invest'
							),
							'default' => 'icon-visit'
						),
						array(
							'id' => 'conectate_2_title',
							'type' => 'text',
							'title' => __('Título Conéctate 2', 'colombia')
						),
						array(
							'id' => 'conectate_2_link',
							'type' => 'text',
							'title' => __('Link Conéctate 2', 'colombia')
						),
						array(
							'id'      => 'conectate_2_image',
							'title'   => __('Imagen Conéctate 2', 'colombia'),
							'type'    => 'radio',
							'options' => array(
								'icon-visit'  => 'Visit',
								'icon-export'  => 'Export',
								'icon-invest'  => 'Invest'
							),
							'default' => 'icon-visit'
						),
						array(
							'id' => 'conectate_3_title',
							'type' => 'text',
							'title' => __('Título Conéctate 3', 'colombia')
						),
						array(
							'id' => 'conectate_3_link',
							'type' => 'text',
							'title' => __('Link Conéctate 2', 'colombia')
						),
						array(
							'id'      => 'conectate_3_image',
							'title'   => __('Imagen Conéctate 3', 'colombia'),
							'type'    => 'radio',
							'options' => array(
								'icon-visit'  => 'Visit',
								'icon-export'  => 'Export',
								'icon-invest'  => 'Invest'
							),
							'default' => 'icon-visit'
						)
					)					
				),
			)
		);

		$settings[] = $my_settings;
		return $settings;
	}

	function colombia_custom_fields( $groups ) {
		$groups[] = array(
			'home-slide' => array(
				array(
					'id' => 'extra-data',
					'title' => __('Campos opcionales', 'colombia'),
					'fields' => array(
						array(
							'id' => 'url',
							'title' => __('Link URL', 'colombia'),
							'desc' => __('Link de slide (opcional)', 'colombia'),
							'type' => 'text'
						)
					)
				)
			),
			'portales' => array(
				array(
					'id' => 'banner-extra-data',
					'title' => __('Campos adicionales', 'colombia'),
					'fields' => array(
						array(
							'id' => 'url',
							'title' => __('Link URL', 'colombia'),
							'type' => 'text'
						)
					)
				)
			),
		);

		return $groups;
	}

	function colombia_term_fields( $groups ) {

		$my_group = array(
			'category' => array(
				array(
					'id'     => 'category_data',
					'title'  => __('Datos de categoría', 'colombia'),
					'role'   => array('administrator', 'editor'),
					'fields' => array(
						array(
							'id'      => 'category_subtitle',
							'title'   => __('Subtítulo de categoría', 'colombia'),
							'type'    => 'text'
						),
						array(
							'id'      => 'category_subtitle_home',
							'title'   => __('Subtítulo de categoría en el Home', 'colombia'),
							'type'    => 'text'
						)
					)
				)
			)
		);

		$groups[] = $my_group;
		return $groups;
	}

	function esw_author_cap_filter( $allowedposttags ) {

	//Here put your conditions, depending your context

	if ( !current_user_can( 'publish_posts' ) )
		return $allowedposttags;

		// Here add tags and attributes you want to allow

		$allowedposttags['iframe']=array(

			'align' => true,
			'width' => true,
			'height' => true,
			'frameborder' => true,
			'name' => true,
			'src' => true,
			'id' => true,
			'class' => true,
			'style' => true,
			'scrolling' => true,
			'marginwidth' => true,
			'marginheight' => true,

		);

	return $allowedposttags;

	}
}

add_action( 'plugins_loaded', array('colombia', 'setup') );