PluginProbe
Code Snippets / 3.8.1
Code Snippets v3.8.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.8.1, at php/views/manage.php

130 lines 3.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
9 namespace Code_Snippets;
10
11 use function Code_Snippets\Settings\get_setting;
12
13 /**
14 * Loaded from the manage menu class.
15 *
16 * @var Manage_Menu $this
17 */
18
19 if ( ! defined( 'ABSPATH' ) ) {
20 return;
21 }
22
23 $types = array_merge( [ 'all' => __( 'All Snippets', 'code-snippets' ) ], Plugin::get_types() );
24 $current_type = $this->get_current_type();
25
26 if ( false !== strpos( code_snippets()->version, 'beta' ) ) {
27 echo '<div class="notice beta-test-notice"><p id="beta-testing">';
28 echo wp_kses(
29 __( 'Thank you for testing this <span class="highlight-yellow">beta version of Code Snippets</span>. We would love to hear your thoughts.', 'code-snippets' ),
30 [ 'span' => [ 'class' => [ 'highlight-yellow' ] ] ]
31 );
32
33 printf(
34 ' <a href="%s" class="button button-secondary" target="_blank">%s</a>',
35 esc_url( __( 'https://codesnippets.pro/beta-testing/feedback/', 'code-snippets' ) ),
36 esc_html__( 'Share feedback', 'code-snippets' )
37 );
38 echo '</p></div>';
39 }
40
41 ?>
42
43 <div class="wrap">
44 <h1>
45 <?php
46 esc_html_e( 'Snippets', 'code-snippets' );
47
48 $this->render_page_title_actions( code_snippets()->is_compact_menu() ? [ 'add', 'import', 'settings' ] : [ 'add', 'import' ] );
49
50 $this->list_table->search_notice();
51 ?>
52 </h1>
53
54 <?php $this->print_messages(); ?>
55
56 <h2 class="nav-tab-wrapper" id="snippet-type-tabs">
57 <?php
58
59 Admin::render_snippet_type_tabs( $types, $current_type );
60
61 if ( ! get_setting( 'general', 'hide_upgrade_menu' ) ) { ?>
62 <a class="button button-large nav-tab-button nav-tab-inactive"
63 href="https://codesnippets.pro/pricing/" target="_blank"
64 aria-label="<?php esc_attr_e( 'Find more about Pro (opens in external tab)', 'code-snippets' ); ?>">
65 <?php echo wp_kses( __( 'Upgrade to <span class="badge pro-badge small-badge">Pro</span>', 'code-snippets' ), [ 'span' => [ 'class' => true ] ] ); ?>
66 <span class="dashicons dashicons-external"></span>
67 </a>
68 <?php } ?>
69 </h2>
70
71 <?php
72
73 $type_info = [
74 'php' => [
75 __( 'Function snippets are run on your site as if there were in a plugin or theme functions.php file.', 'code-snippets' ),
76 __( 'Learn more about function snippets &rarr;', 'code-snippets' ),
77 'https://codesnippets.pro/learn-php/',
78 ],
79 'html' => [
80 __( 'Content snippets are bits of reusable PHP and HTML content that can be inserted into posts and pages.', 'code-snippets' ),
81 __( 'Learn more about content snippets &rarr;', 'code-snippets' ),
82 'https://codesnippets.pro/learn-html/',
83 ],
84 'css' => [
85 __( 'Style snippets are written in CSS and loaded in the admin area or on the site front-end, just like the theme style.css.', 'code-snippets' ),
86 __( 'Learn more about style snippets &rarr;', 'code-snippets' ),
87 'https://codesnippets.pro/learn-css/',
88 ],
89 'js' => [
90 __( 'Script snippets are loaded on the site front-end in a JavaScript file, either in the head or body sections.', 'code-snippets' ),
91 __( 'Learn more about javascript snippets &rarr;', 'code-snippets' ),
92 'https://codesnippets.pro/learn-js/',
93 ],
94 'cloud' => [
95 __( 'See all your public and private snippets that are stored in your Code Snippet Cloud codevault.', 'code-snippets' ),
96 __( 'Learn more about Code Snippets Cloud &rarr;', 'code-snippets' ),
97 'https://codesnippets.cloud/getstarted/',
98 ],
99 ];
100
101
102 if ( isset( $type_info[ $current_type ] ) ) {
103 $info = $type_info[ $current_type ];
104
105 printf(
106 '<p class="snippet-type-description">%s <a href="%s" target="_blank">%s</a></p>',
107 esc_html( $info[0] ),
108 esc_url( $info[2] ),
109 esc_html( $info[1] )
110 );
111 }
112
113 do_action( 'code_snippets/admin/manage/before_list_table' );
114 $this->list_table->views();
115
116 switch ( $current_type ) {
117 case 'cloud_search':
118 include_once 'partials/cloud-search.php';
119 break;
120
121 default:
122 include_once 'partials/list-table.php';
123 break;
124 }
125
126 do_action( 'code_snippets/admin/manage', $current_type );
127
128 ?>
129 </div>
130