????

Your IP : 216.73.216.174


Current Path : /home2/morganrand/www/wp-content/themes/wanderfuls-2/framework/addons/
Upload File :
Current File : /home2/morganrand/www/wp-content/themes/wanderfuls-2/framework/addons/editor-formats.php

<?php
/**
 * Adds custom styles to the tinymce editor "Formats" dropdown
 *
 * @package Wanderfuls WordPress Theme
 * @subpackage Framework
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

// Start Class
if ( ! class_exists( 'TB_Editor_Formats' ) ) {
	class TB_Editor_Formats {

		/**
		 * Main constructor
		 *
		 * @since 2.1.0
		 */
		public function __construct() {
			add_filter( 'tiny_mce_before_init', array( $this, 'settings' ) );
		}

		/**
		 * Adds custom styles to the formats dropdown by altering the $settings
		 *
		 * @since 2.1.0
		 */
		public function settings( $settings ) {

			// General
			$items = apply_filters( 'tb_tiny_mce_formats_items', array(
				array(
					'title'    => __( 'Theme Button', 'tb' ),
					'selector' => 'a',
					'classes'  => 'theme-button',
				),
				array(
					'title'   => __( 'Highlight', 'tb' ),
					'inline'  => 'span',
					'classes' => 'text-highlight',
				),
				array(
					'title'   => __( 'Thin Font', 'tb' ),
					'inline'  => 'span',
					'classes' => 'thin-font'
				),
				array(
					'title'   => __( 'White Text', 'tb' ),
					'inline'  => 'span',
					'classes' => 'white-text'
				),
				array(
					'title'    => __( 'Check List', 'tb' ),
					'selector' => 'ul',
					'classes'  => 'check-list'
				),
			) );

			// Dropcaps
			$dropcaps = apply_filters( 'tb_tiny_mce_formats_dropcaps', array(
				array(
					'title'   => __( 'Dropcap', 'tb' ),
					'inline'  => 'span',
					'classes' => 'dropcap',
				),
				array(
					'title'   => __( 'Boxed Dropcap', 'tb' ),
					'inline'  => 'span',
					'classes' => 'dropcap boxed',
				),
			) );

			// Color buttons
			$color_buttons = apply_filters( 'tb_tiny_mce_formats_color_buttons', array(
				array(
					'title'     => __( 'Blue', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button blue',
				),
				array(
					'title'     => __( 'Black', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button black',
				),
				array(
					'title'     => __( 'Red', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button red',
				),
				array(
					'title'     => __( 'Orange', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button orange',
				),
				array(
					'title'     => __( 'Green', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button green',
				),
				array(
					'title'     => __( 'Gold', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button gold',
				),
				array(
					'title'     => __( 'Teal', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button teal',
				),
				array(
					'title'     => __( 'Purple', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button purple',
				),
				array(
					'title'     => __( 'Pink', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button pink',
				),
				array(
					'title'     => __( 'Brown', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button brown',
				),
				array(
					'title'     => __( 'Rosy', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button rosy',
				),
				array(
					'title'     => __( 'White', 'tb' ),
					'selector'  => 'a',
					'classes'   => 'color-button white',
				),
			) );

			// Create array of formats
			$new_formats = array(
				// Wanderfuls Buttons
				array(
					'title' => TB_THEME_BRANDING .' '. __( 'Styles', 'tb' ),
					'items' => $items,
				),
				array(
					'title' => __( 'Dropcaps', 'tb' ),
					'items' => $dropcaps,
				),
				array(
					'title' =>  __( 'Color Buttons', 'tb' ),
					'items' => $color_buttons,
				),
			);

			// Merge Formats
			$settings['style_formats_merge'] = true;

			// Add new formats
			$settings['style_formats'] = json_encode( $new_formats );

			// Return New Settings
			return $settings;

		}

	}
}
$tb_editor_formats = new TB_Editor_Formats();