PluginProbe
Post Snippets – Custom WordPress Code Snippets Customizer / 4.2.2
Post Snippets – Custom WordPress Code Snippets Customizer v4.2.2
4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.1 1.7.2 1.7.3 1.8 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.8.9.1 1.8.9.2 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 All 115 releases
post-snippets / src / PS_functions.php

PS_functions.php in Post Snippets – Custom WordPress Code Snippets Customizer 4.2.2, at src/PS_functions.php

58 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit;
4
5 /**
6 * @return gutenbergBlocks
7 * removing post-snippet-block from gutenberg Editor for custom post type when exclude form custom editor is unchecked.
8 * @since post-snippet 4.0
9 */
10 function ps_block_remove_from_gutenbergEditor( $allowed_blocks, $editor_context ) {
11
12
13 $blocks = WP_Block_Type_Registry::get_instance()->get_all_registered();
14 unset($blocks['greentreelabs/post-snippets-block']);
15
16 return array_keys( $blocks );
17
18 }
19
20
21 add_filter('post_snippets_snippets_list','remove_inActiveSnippets');
22
23 function remove_inActiveSnippets($snippets) {
24 $active_snippets = array();
25 foreach($snippets as $key => $snippet) {
26
27 if($snippet['snippet_status']==true) {
28
29 array_push($active_snippets, $snippets[$key]);
30
31 }
32 }
33
34 return $active_snippets;
35
36 }
37
38 // Adding the ps update notification
39 add_action('admin_notices', 'ps_plugin_update_notification');
40 function ps_plugin_update_notification() {
41 $ps_prvious_version = 'https://downloads.wordpress.org/plugin/post-snippets.3.1.7.zip';
42 if ( is_admin() ) {
43
44 if(isset($_REQUEST['ps_update_msg']) && !empty($_REQUEST['ps_update_msg'])) {
45 update_option('ps_update_msg', 'dismissed');
46 }
47
48 if(empty(get_option('ps_update_msg')) || 'dismissed' != get_option('ps_update_msg')) {
49
50 echo '<div style = "background-color:#CFD2CF; color:black" class="notice notice-success">
51 <p>Thank you to updating Post Snippets v 4.0, we have recoded the entire plugin please check your all snippets if there is any issue you can download the previous version from <a href='."$ps_prvious_version".' style="color:blue"> here </a></p>
52 <form action="" method="post">
53 <input type="submit" name="ps_update_msg" value="dismiss">
54 </form>
55 </div>';
56 }
57 }
58 }