Black_Studio_TinyMCE_Plugin

The Black Studio TinyMCE Widget Black Studio TinyMCE Plugin class.

Defined (1)

The class is defined in the following location(s).

/black-studio-tinymce-widget.php  
  1. final class Black_Studio_TinyMCE_Plugin { 
  2.  
  3. /** 
  4. * Plugin version 
  5. * @var string 
  6. * @since 2.0.0 
  7. */ 
  8. public static $version = '2.2.9'; 
  9.  
  10. /** 
  11. * The single instance of the plugin class 
  12. * @var object 
  13. * @since 2.0.0 
  14. */ 
  15. protected static $_instance = null; 
  16.  
  17. /** 
  18. * Instance of admin class 
  19. * @var object 
  20. * @since 2.0.0 
  21. */ 
  22. protected static $admin = null; 
  23.  
  24. /** 
  25. * Instance of admin pointer class 
  26. * @var object 
  27. * @since 2.1.0 
  28. */ 
  29. protected static $admin_pointer = null; 
  30.  
  31. /** 
  32. * Instance of compatibility class 
  33. * @var object 
  34. * @since 2.0.0 
  35. */ 
  36. protected static $compatibility = null; 
  37.  
  38. /** 
  39. * Instance of the text filters class 
  40. * @var object 
  41. * @since 2.0.0 
  42. */ 
  43. protected static $text_filters = null; 
  44.  
  45. /** 
  46. * Return the main plugin instance 
  47. * @return object 
  48. * @since 2.0.0 
  49. */ 
  50. public static function instance() { 
  51. if ( is_null( self::$_instance ) ) { 
  52. self::$_instance = new self(); 
  53. return self::$_instance; 
  54.  
  55. /** 
  56. * Return the instance of the admin class 
  57. * @return object 
  58. * @since 2.0.0 
  59. */ 
  60. public static function admin() { 
  61. return self::$admin; 
  62.  
  63. /** 
  64. * Return the instance of the admin pointer class 
  65. * @return object 
  66. * @since 2.1.0 
  67. */ 
  68. public static function admin_pointer() { 
  69. return self::$admin_pointer; 
  70.  
  71. /** 
  72. * Return the instance of the compatibility class 
  73. * @return object 
  74. * @since 2.0.0 
  75. */ 
  76. public static function compatibility() { 
  77. return self::$compatibility; 
  78.  
  79. /** 
  80. * Return the instance of the text filters class 
  81. * @return object 
  82. * @since 2.0.0 
  83. */ 
  84. public static function text_filters() { 
  85. return self::$text_filters; 
  86.  
  87. /** 
  88. * Get plugin version 
  89. * @return string 
  90. * @since 2.0.0 
  91. */ 
  92. public static function get_version() { 
  93. return self::$version; 
  94.  
  95. /** 
  96. * Get plugin basename 
  97. * @uses plugin_basename() 
  98. * @return string 
  99. * @since 2.0.0 
  100. */ 
  101. public static function get_basename() { 
  102. return plugin_basename( __FILE__ ); 
  103.  
  104. /** 
  105. * Class constructor 
  106. * @uses add_action() 
  107. * @uses add_filter() 
  108. * @uses get_option() 
  109. * @uses get_bloginfo() 
  110. * @global object $wp_embed 
  111. * @since 2.0.0 
  112. */ 
  113. protected function __construct() { 
  114. // Include required files 
  115. include_once( plugin_dir_path( __FILE__ ) . 'includes/class-widget.php' ); 
  116. // Include and instantiate admin class on admin pages 
  117. if ( is_admin() ) { 
  118. include_once( plugin_dir_path( __FILE__ ) . 'includes/class-admin.php' ); 
  119. self::$admin = Black_Studio_TinyMCE_Admin::instance(); 
  120. include_once( plugin_dir_path( __FILE__ ) . 'includes/class-admin-pointer.php' ); 
  121. self::$admin_pointer = Black_Studio_TinyMCE_Admin_Pointer::instance(); 
  122. // Include and instantiate text filter class on frontend pages 
  123. else { 
  124. include_once( plugin_dir_path( __FILE__ ) . 'includes/class-text-filters.php' ); 
  125. self::$text_filters = Black_Studio_TinyMCE_Text_Filters::instance(); 
  126. // Register action and filter hooks 
  127. add_action( 'plugins_loaded', array( $this, 'load_compatibility' ), 50 ); 
  128. add_action( 'widgets_init', array( $this, 'widgets_init' ) ); 
  129.  
  130. /** 
  131. * Prevent the class from being cloned 
  132. * @return void 
  133. * @since 2.0.0 
  134. */ 
  135. protected function __clone() { 
  136. _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ uh?' ), '2.0' ); 
  137.  
  138. /** 
  139. * Load compatibility class 
  140. * @uses apply_filters() 
  141. * @uses get_bloginfo() 
  142. * @uses plugin_dir_path() 
  143. * @return void 
  144. * @since 2.0.0 
  145. */ 
  146. public function load_compatibility() { 
  147. // Compatibility load flag (for both deprecated functions and code for compatibility with other plugins) 
  148. $load_compatibility = apply_filters( 'black_studio_tinymce_load_compatibility', true ); 
  149. if ( $load_compatibility ) { 
  150. include_once( plugin_dir_path( __FILE__ ) . 'includes/class-compatibility.php' ); 
  151. self::$compatibility = Black_Studio_TinyMCE_Compatibility::instance(); 
  152.  
  153. /** 
  154. * Widget initialization 
  155. * @uses is_blog_installed() 
  156. * @uses register_widget() 
  157. * @return null|void 
  158. * @since 2.0.0 
  159. */ 
  160. public function widgets_init() { 
  161. if ( ! is_blog_installed() ) { 
  162. return; 
  163. register_widget( 'WP_Widget_Black_Studio_TinyMCE' ); 
  164.  
  165. /** 
  166. * Check if a widget is a Black Studio Tinyme Widget instance 
  167. * @param object $widget 
  168. * @return boolean 
  169. * @since 2.0.0 
  170. */ 
  171. public function check_widget( $widget ) { 
  172. return 'object' == gettype( $widget ) && ( 'WP_Widget_Black_Studio_TinyMCE' == get_class( $widget ) || is_subclass_of( $widget , 'WP_Widget_Black_Studio_TinyMCE' ) ); 
  173.  
  174. } // END class Black_Studio_TinyMCE_Plugin