PluginProbe
Code Snippets / 3.9.1
Code Snippets v3.9.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 / welcome.php

welcome.php in Code Snippets 3.9.1, at php/views/welcome.php

201 lines 6.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 welcome page.
4 *
5 * @package Code_Snippets
6 * @subpackage Views
7 */
8
9 namespace Code_Snippets;
10
11 /**
12 * Loaded from the Welcome_Menu class.
13 *
14 * @var Welcome_Menu $this
15 */
16
17 if ( ! defined( 'ABSPATH' ) ) {
18 return;
19 }
20
21 $hero = $this->api->get_hero_item();
22
23 $changelog_sections = [
24 'Added' => [
25 'title' => __( 'New features', 'code-snippets' ),
26 'icon' => 'lightbulb',
27 ],
28 'Improved' => [
29 'title' => __( 'Improvements', 'code-snippets' ),
30 'icon' => 'chart-line',
31 ],
32 'Fixed' => [
33 'title' => __( 'Bug fixes', 'code-snippets' ),
34 'icon' => 'buddicons-replies',
35 ],
36 'Other' => [
37 'title' => __( 'Other', 'code-snippets' ),
38 'icon' => 'open-folder',
39 ],
40 ];
41
42 $plugin_types = [
43 'core' => __( 'Core', 'code-snippets' ),
44 'pro' => __( 'Pro', 'code-snippets' ),
45 ];
46
47 ?>
48
49 <div class="csp-welcome-wrap">
50 <div class="csp-welcome-header">
51 <header>
52 <img width="50px"
53 src="<?php echo esc_url( plugins_url( 'assets/icon.svg', PLUGIN_FILE ) ); ?>"
54 alt="<?php esc_attr_e( 'Code Snippets Logo', 'code-snippets' ); ?>">
55 <h1>
56 <?php echo wp_kses( __( "Resources and <span>What's New</span>", 'code-snippets' ), [ 'span' => [] ] ); ?>
57 </h1>
58 </header>
59 <nav>
60 <ul>
61 <?php foreach ( $this->get_header_links() as $link_name => $link_info ) { ?>
62 <li>
63 <a href="<?php echo esc_url( $link_info['url'] ); ?>" target="_blank"
64 class="csp-link-<?php echo esc_attr( $link_name ); ?>">
65 <span><?php echo esc_html( $link_info['label'] ); ?></span>
66
67 <?php if ( 'discord' === $link_info['icon'] ) { ?>
68 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 127.14 96.36">
69 <path d="M107.7,8.07A105.15,105.15,0,0,0,81.47,0a72.06,72.06,0,0,0-3.36,6.83A97.68,97.68,0,0,0,49,6.83,72.37,72.37,0,0,0,45.64,0,105.89,105.89,0,0,0,19.39,8.09C2.79,32.65-1.71,56.6.54,80.21h0A105.73,105.73,0,0,0,32.71,96.36,77.7,77.7,0,0,0,39.6,85.25a68.42,68.42,0,0,1-10.85-5.18c.91-.66,1.8-1.34,2.66-2a75.57,75.57,0,0,0,64.32,0c.87.71,1.76,1.39,2.66,2a68.68,68.68,0,0,1-10.87,5.19,77,77,0,0,0,6.89,11.1A105.25,105.25,0,0,0,126.6,80.22h0C129.24,52.84,122.09,29.11,107.7,8.07ZM42.45,65.69C36.18,65.69,31,60,31,53s5-12.74,11.43-12.74S54,46,53.89,53,48.84,65.69,42.45,65.69Zm42.24,0C78.41,65.69,73.25,60,73.25,53s5-12.74,11.44-12.74S96.23,46,96.12,53,91.08,65.69,84.69,65.69Z" />
70 </svg>
71 <?php } else { ?>
72 <span class="dashicons dashicons-<?php echo esc_attr( $link_info['icon'] ); ?>"></span>
73 <?php } ?>
74 </a>
75 </li>
76 <?php } ?>
77 </ul>
78 </nav>
79 </div>
80
81 <section class="csp-section-changes">
82 <h1>📰 <?php esc_html_e( 'Latest news', 'code-snippets' ); ?></h1>
83 <div class="csp-cards">
84 <a class="csp-card" href="<?php echo esc_url( $hero['follow_url'] ); ?>" target="_blank"
85 title="<?php esc_attr_e( 'Read more', 'code-snippets' ); ?>">
86 <header>
87 <span class="dashicons dashicons-external"></span>
88 <h2><?php echo esc_html( $hero['name'] ); ?></h2>
89 </header>
90 <figure>
91 <div id="csp-loading-spinner" class="csp-loading-spinner"></div>
92 <img id="csp-changes-img"
93 onload="hideLoadingAnimation()"
94 src="<?php echo esc_url( $hero['image_url'] ); ?>"
95 alt="<?php esc_attr_e( 'Latest news image', 'code-snippets' ); ?>);">
96 </figure>
97 </a>
98
99 <a class="csp-card csp-changelog-wrapper" href="https://wordpress.org/plugins/code-snippets/changelog" target="_blank"
100 title="<?php esc_attr_e( 'Read the full changelog', 'code-snippets' ); ?>">
101 <header>
102 <span class="dashicons dashicons-external"></span>
103 <h2><?php esc_html_e( 'Latest changes', 'code-snippets' ); ?></h2>
104 </header>
105 <div class="csp-section-changelog">
106 <?php foreach ( $this->api->get_changelog() as $version => $version_changes ) { ?>
107 <h3><?php echo esc_html( $version ); ?></h3>
108 <article>
109 <?php
110 foreach ( $changelog_sections as $section_key => $section ) {
111 if ( empty( $version_changes[ $section_key ] ) ) {
112 continue;
113 }
114 ?>
115 <h4>
116 <span class="dashicons dashicons-<?php echo esc_attr( $section['icon'] ); ?>"></span>
117 <?php echo esc_html( $section['title'] ); ?>
118 </h4>
119 <ul>
120 <?php
121 foreach ( $plugin_types as $plugin_type => $type_label ) {
122 if ( empty( $version_changes[ $section_key ][ $plugin_type ] ) ) {
123 continue;
124 }
125
126 foreach ( $version_changes[ $section_key ][ $plugin_type ] as $change ) {
127 ?>
128 <li>
129 <span class="badge <?php echo esc_attr( $plugin_type ); ?>-badge">
130 <?php echo esc_html( $type_label ); ?>
131 </span>
132 <span><?php echo esc_html( $change ); ?></span>
133 </li>
134 <?php
135 }
136 }
137 ?>
138 </ul>
139 <?php } ?>
140 </article>
141 <?php } ?>
142 </div>
143 </a>
144 </div>
145 </section>
146
147 <section class="csp-section-articles csp-section-links">
148 <h1>🛟 <?php esc_html_e( 'Helpful articles', 'code-snippets' ); ?></h1>
149 <div class="csp-cards">
150 <?php foreach ( $this->api->get_features() as $feature ) { ?>
151 <a class="csp-card"
152 href="<?php echo esc_url( $feature['follow_url'] ); ?>" target="_blank"
153 title="<?php esc_attr_e( 'Read more', 'code-snippets' ); ?>">
154 <figure>
155 <img src="<?php echo esc_url( $feature['image_url'] ); ?>"
156 alt="<?php esc_attr_e( 'Feature image', 'code-snippets' ); ?>">
157 </figure>
158 <header>
159 <h2><?php echo esc_html( $feature['title'] ); ?></h2>
160 <p class="csp-card-item-description"><?php echo esc_html( $feature['description'] ); ?></p>
161 </header>
162 <footer>
163 <p class="csp-card-item-category"><?php echo esc_html( $feature['category'] ); ?></p>
164 <span class="dashicons dashicons-external"></span>
165 </footer>
166 </a>
167 <?php } ?>
168 </div>
169 </section>
170
171 <section class="csp-section-links csp-section-partners">
172 <h1>🚀 <?php esc_html_e( 'Partners and apps', 'code-snippets' ); ?></h1>
173 <div class="csp-cards">
174 <?php foreach ( $this->api->get_partners() as $partner ) { ?>
175 <a class="csp-card"
176 href="<?php echo esc_url( $partner['follow_url'] ); ?>" target="_blank"
177 title="<?php esc_attr_e( 'Go to Partner', 'code-snippets' ); ?>">
178 <figure>
179 <img src="<?php echo esc_url( $partner['image_url'] ); ?>"
180 alt="<?php esc_attr_e( 'Partner image', 'code-snippets' ); ?>">
181 </figure>
182 <header>
183 <span class="dashicons dashicons-external"></span>
184 <h2><?php echo esc_html( $partner['title'] ); ?></h2>
185 </header>
186 </a>
187 <?php } ?>
188 </div>
189 </section>
190 </div>
191
192 <script type="text/javascript">
193 function hideLoadingAnimation() {
194 const spinner = document.getElementById<HTMLDivElement>('csp-loading-spinner')
195 const image = document.getElementById<HTMLDivElement>('csp-changes-img')
196
197 spinner.style.display = 'none'
198 image.style.display = 'block'
199 }
200 </script>
201