@@ -28,34 +28,42 @@ class AddPlayer
2828 * Init.
2929 *
3030 * @since 4.0.0
31+ * @since 6.0.0 Make static.
3132 */
32- public function init ()
33+ public static function init ()
3334 {
34- add_action ('init ' , array ($ this , 'registerBlock ' ));
35- add_action ('enqueue_block_editor_assets ' , array ($ this , 'addBlockEditorStylesheet ' ));
35+ add_action ('init ' , array (__CLASS__ , 'registerBlock ' ));
36+ add_action ('enqueue_block_editor_assets ' , array (__CLASS__ , 'addBlockEditorStylesheet ' ));
3637
37- add_action ('admin_head ' , array ($ this , 'addEditorStyles ' ));
38- add_filter ('tiny_mce_before_init ' , array ($ this , 'filterTinyMceSettings ' ));
38+ add_action ('admin_head ' , array (__CLASS__ , 'addEditorStyles ' ));
39+ add_filter ('tiny_mce_before_init ' , array (__CLASS__ , 'filterTinyMceSettings ' ));
3940
40- add_filter ('mce_external_plugins ' , array ($ this , 'addPlugin ' ));
41- add_filter ('mce_buttons ' , array ($ this , 'addButton ' ));
42- add_filter ('mce_css ' , array ($ this , 'addStylesheet ' ));
41+ add_filter ('mce_external_plugins ' , array (__CLASS__ , 'addPlugin ' ));
42+ add_filter ('mce_buttons ' , array (__CLASS__ , 'addButton ' ));
43+ add_filter ('mce_css ' , array (__CLASS__ , 'addStylesheet ' ));
4344 }
4445
4546 /**
4647 * Register Block.
48+ *
49+ * @since 3.2.0
50+ * @since 6.0.0 Make static.
4751 */
48- public function registerBlock ()
52+ public static function registerBlock ()
4953 {
5054 \register_block_type (__DIR__ );
5155 }
5256
5357 /**
5458 * Add TinyMCE buttons.
5559 *
60+ * @since 6.0.0 Make static.
61+ *
5662 * @param array TinyMCE plugin array
63+ *
64+ * @return array
5765 */
58- public function addPlugin ($ plugin_array )
66+ public static function addPlugin ($ plugin_array )
5967 {
6068 $ plugin_array ['beyondwords_player ' ] = BEYONDWORDS__PLUGIN_URI . 'src/Component/Post/AddPlayer/tinymce.js ' ;
6169 return $ plugin_array ;
@@ -64,9 +72,13 @@ public function addPlugin($plugin_array)
6472 /**
6573 * Register TinyMCE buttons.
6674 *
75+ * @since 6.0.0 Make static.
76+ *
6777 * @param array TinyMCE buttons array
78+ *
79+ * @return array
6880 */
69- public function addButton ($ buttons )
81+ public static function addButton ($ buttons )
7082 {
7183 $ advIndex = array_search ('wp_adv ' , $ buttons );
7284
@@ -81,8 +93,14 @@ public function addButton($buttons)
8193
8294 /**
8395 * Filters the comma-delimited list of stylesheets to load in TinyMCE.
96+ *
97+ * @since 6.0.0 Make static.
98+ *
99+ * @param string $stylesheets Comma-delimited list of stylesheets.
100+ *
101+ * @return string Comma-delimited list of stylesheets with the "Add Player" CSS appended.
84102 */
85- public function addStylesheet ($ stylesheets )
103+ public static function addStylesheet ($ stylesheets )
86104 {
87105 return $ stylesheets . ', ' . BEYONDWORDS__PLUGIN_URI . 'src/Component/Post/AddPlayer/AddPlayer.css ' ;
88106 }
@@ -93,10 +111,11 @@ public function addStylesheet($stylesheets)
93111 * Player preview uses the CSS :after to set the content so we pass the CSS through WordPress i18n functions here.
94112 *
95113 * @since 3.3.0
114+ * @since 6.0.0 Make static.
96115 *
97116 * @return string CSS Block for player preview i18n delcerations.
98117 */
99- public function playerPreviewI18nStyles ()
118+ public static function playerPreviewI18nStyles ()
100119 {
101120 return sprintf (
102121 self ::PLAYER_PREVIEW_STYLE_FORMAT ,
@@ -110,17 +129,18 @@ public function playerPreviewI18nStyles()
110129 * Adds i18n-compatible TinyMCE Classic Editor CSS for the player placeholder.
111130 *
112131 * @since 3.3.0
132+ * @since 6.0.0 Make static.
113133 *
114134 * @param mixed[] $setings An array with TinyMCE config.
115135 *
116136 * @return mixed[] An array with TinyMCE config.
117137 */
118- public function filterTinyMceSettings ($ settings )
138+ public static function filterTinyMceSettings ($ settings )
119139 {
120140 if (isset ($ settings ['content_style ' ])) {
121- $ settings ['content_style ' ] .= ' ' . $ this -> playerPreviewI18nStyles () . ' ' ;
141+ $ settings ['content_style ' ] .= ' ' . self :: playerPreviewI18nStyles () . ' ' ;
122142 } else {
123- $ settings ['content_style ' ] = $ this -> playerPreviewI18nStyles () . ' ' ;
143+ $ settings ['content_style ' ] = self :: playerPreviewI18nStyles () . ' ' ;
124144 }
125145
126146 return $ settings ;
@@ -132,23 +152,26 @@ public function filterTinyMceSettings($settings)
132152 * Adds i18n-compatible Block Editor CSS for the player placeholder.
133153 *
134154 * @since 3.3.0
155+ * @since 6.0.0 Make static.
135156 */
136- public function addEditorStyles ()
157+ public static function addEditorStyles ()
137158 {
138159 $ allowed_html = array (
139160 'style ' => array (),
140161 );
141162
142163 echo wp_kses (
143- sprintf ('<style>%s</style> ' , $ this -> playerPreviewI18nStyles ()),
164+ sprintf ('<style>%s</style> ' , self :: playerPreviewI18nStyles ()),
144165 $ allowed_html
145166 );
146167 }
147168
148169 /**
149170 * Add Block Editor Stylesheet.
171+ *
172+ * @since 6.0.0 Make static.
150173 */
151- public function addBlockEditorStylesheet ($ hook )
174+ public static function addBlockEditorStylesheet ($ hook )
152175 {
153176 // Only enqueue for Gutenberg/Post screens
154177 if (CoreUtils::isGutenbergPage () || $ hook === 'post.php ' || $ hook === 'post-new.php ' ) {
0 commit comments