PluginProbe
Code Snippets / 3.4.1
Code Snippets v3.4.1
3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 3.0.1 All 64 releases
code-snippets / php / views / manage.php

manage.php in Code Snippets 3.4.1, at php/views/manage.php

106 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * HTML for the Manage Snippets page.
4 *
5 * @package Code_Snippets
6 * @subpackage Views
7 */
8
9 namespace Code_Snippets;
10
11 /**
12 * Loaded from the Manage_Menu class.
13 *
14 * @var Manage_Menu $this
15 */
16
17 if ( ! defined( 'ABSPATH' ) ) {
18 return;
19 }
20
21 $types = array_merge( [ 'all' => __( 'All Snippets', 'code-snippets' ) ], Plugin::get_types() );
22
23 $current_type = isset( $_GET['type'] ) ? sanitize_text_field( wp_unslash( $_GET['type'] ) ) : 'all';
24 $current_type = isset( $types[ $current_type ] ) ? $current_type : 'all';
25
26 ?>
27
28 <div class="wrap">
29 <h1>
30 <?php
31 esc_html_e( 'Snippets', 'code-snippets' );
32
33 $this->render_page_title_actions( code_snippets()->is_compact_menu() ? [ 'add', 'import', 'settings' ] : [ 'add', 'import' ] );
34
35 $this->list_table->search_notice();
36 ?>
37 </h1>
38
39 <?php $this->print_messages(); ?>
40
41 <h2 class="nav-tab-wrapper" id="snippet-type-tabs">
42 <?php
43
44 foreach ( $types as $type_name => $label ) {
45 Admin::render_snippet_type_tab( $type_name, $label, $current_type );
46 }
47
48 ?>
49 <a class="button button-large nav-tab-button nav-tab-inactive go-pro-button"
50 href="https://codesnippets.pro/pricing/" target="_blank"
51 title="Find more about Pro (opens in external tab)">
52 <?php echo wp_kses( __( 'Upgrade to <span class="badge">Pro</span>', 'code-snippets' ), [ 'span' => [ 'class' => 'badge' ] ] ); ?>
53 <span class="dashicons dashicons-external"></span>
54 </a>
55 </h2>
56
57 <?php
58 $desc = code_snippets()->get_type_description( $current_type );
59 if ( $desc ) {
60 echo '<p class="snippet-type-description">', esc_html( $desc );
61
62 $type_names = [
63 'php' => __( 'function snippets', 'code-snippets' ),
64 'html' => __( 'content snippets', 'code-snippets' ),
65 'css' => __( 'style snippets', 'code-snippets' ),
66 'js' => __( 'javascript snippets', 'code-snippets' ),
67 ];
68
69 $type_names = apply_filters( 'code_snippets/admin/manage/type_names', $type_names );
70
71 /* translators: %s: snippet type name */
72 $learn_more_text = sprintf( __( 'Learn more about %s &rarr;', 'code-snippets' ), $type_names[ $current_type ] );
73
74 printf(
75 ' <a href="%s" target="_blank">%s</a></p>',
76 esc_url( "https://codesnippets.pro/learn-$current_type/" ),
77 esc_html( $learn_more_text )
78 );
79 }
80 ?>
81
82 <?php
83 do_action( 'code_snippets/admin/manage/before_list_table' );
84 $this->list_table->views();
85 ?>
86
87 <form method="get" action="">
88 <?php
89 $this->list_table->required_form_fields( 'search_box' );
90 $this->list_table->search_box( __( 'Search Snippets', 'code-snippets' ), 'search_id' );
91 ?>
92 </form>
93
94 <form method="post" action="">
95 <input type="hidden" id="code_snippets_ajax_nonce"
96 value="<?php echo esc_attr( wp_create_nonce( 'code_snippets_manage_ajax' ) ); ?>">
97
98 <?php
99 $this->list_table->required_form_fields();
100 $this->list_table->display();
101 ?>
102 </form>
103
104 <?php do_action( 'code_snippets/admin/manage' ); ?>
105 </div>
106