PluginProbe
Code Snippets / 3.0.0
Code Snippets v3.0.0
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.0.0, at php/views/manage.php

108 lines 2.9 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 * @var Manage_Menu $this
9 */
10
11 namespace Code_Snippets;
12
13 /* Bail if accessed directly */
14 if ( ! defined( 'ABSPATH' ) ) {
15 return;
16 }
17
18 $types = array_merge( [ 'all' => __( 'All Snippets', 'code-snippets' ) ], code_snippets()->get_types() );
19
20 $current_type = isset( $_GET['type'] ) ? sanitize_text_field( wp_unslash( $_GET['type'] ) ) : 'all';
21 $current_type = isset( $types[ $current_type ] ) ? $current_type : 'all';
22
23 ?>
24
25 <div class="wrap">
26 <h1>
27 <?php
28 esc_html_e( 'Snippets', 'code-snippets' );
29
30 $this->page_title_actions( code_snippets()->is_compact_menu() ? [ 'add', 'import', 'settings' ] : [ 'add', 'import' ] );
31
32 $this->list_table->search_notice();
33 ?>
34 </h1>
35
36 <?php $this->print_messages(); ?>
37
38 <h2 class="nav-tab-wrapper" id="snippet-type-tabs">
39 <?php
40
41 foreach ( $types as $type_name => $label ) {
42
43 if ( $type_name === $current_type ) {
44 printf( '<a class="nav-tab nav-tab-active" data-type="%s">', esc_attr( $type_name ) );
45 } else {
46 printf( '<a class="nav-tab" href="%s" data-type="%s">',
47 esc_url( add_query_arg( 'type', $type_name ) ),
48 esc_attr( $type_name )
49 );
50 }
51
52 echo esc_html( $label ), 'all' === $type_name ? '' : ' <span>' . esc_html( $type_name ) . '</span>', '</a>';
53 }
54
55 ?>
56 <a class="button button-large nav-tab-button go-pro-button" href="https://codesnippets.pro" target="_blank">
57 <?php echo wp_kses( __( 'Go <span>Pro</span>', 'code-snippets' ), [ 'span' => [] ] ); ?>
58 </a>
59 </h2>
60
61 <?php
62 $desc = code_snippets()->get_type_description( $current_type );
63 if ( $desc ) {
64 echo '<p class="snippet-type-description">', esc_html( $desc );
65
66 $type_names = [
67 'php' => __( 'function snippets', 'code-snippets' ),
68 'html' => __( 'content snippets', 'code-snippets' ),
69 'css' => __( 'style snippets', 'code-snippets' ),
70 'js' => __( 'javascript snippets', 'code-snippets' ),
71 ];
72
73 /* translators: %s: snippet type name */
74 $learn_more_text = sprintf( __( 'Learn more about %s &rarr;', 'code-snippets' ), $type_names[ $current_type ] );
75
76 printf(
77 ' <a href="%s" target="_blank">%s</a></p>',
78 esc_url( "https://codesnippets.pro/learn-$current_type/" ),
79 esc_html( $learn_more_text )
80 );
81 }
82 ?>
83
84 <?php
85 do_action( 'code_snippets/admin/manage/before_list_table' );
86 $this->list_table->views();
87 ?>
88
89 <form method="get" action="">
90 <?php
91 $this->list_table->required_form_fields( 'search_box' );
92 $this->list_table->search_box( __( 'Search Snippets', 'code-snippets' ), 'search_id' );
93 ?>
94 </form>
95
96 <form method="post" action="">
97 <input type="hidden" id="code_snippets_ajax_nonce"
98 value="<?php echo esc_attr( wp_create_nonce( 'code_snippets_manage_ajax' ) ); ?>">
99
100 <?php
101 $this->list_table->required_form_fields();
102 $this->list_table->display();
103 ?>
104 </form>
105
106 <?php do_action( 'code_snippets/admin/manage' ); ?>
107 </div>
108