1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
<?php
namespace WPForms\Admin\Pages;
/** * Community Sub-page. * * @since 1.5.6 */ class Community {
/** * Admin menu page slug. * * @since 1.5.6 * * @var string */ const SLUG = 'wpforms-community';
/** * Constructor. * * @since 1.5.6 */ public function __construct() {
if ( \wpforms_current_user_can() ) { $this->hooks(); } }
/** * Hooks. * * @since 1.5.6 */ public function hooks() {
// Check what page we are on. $page = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.CSRF.NonceVerification
// Only load if we are actually on the Community page. if ( self::SLUG !== $page ) { return; }
add_action( 'wpforms_admin_page', array( $this, 'output' ) );
// Hook for addons. do_action( 'wpforms_admin_community_init' ); }
/** * Page data. * * @since 1.5.6 */ public function get_blocks_data() {
$type = wpforms()->pro ? 'plugin' : 'liteplugin'; $data = [];
$data['vip_circle'] = array( 'title' => esc_html__( 'WPForms VIP Circle Facebook Group', 'wpforms-lite' ), 'description' => esc_html__( 'Powered by the community, for the community. Anything and everything WPForms: Discussions. Questions. Tutorials. Insights and sneak peaks. Also, exclusive giveaways!', 'wpforms-lite' ), 'button_text' => esc_html__( 'Join WPForms VIP Circle', 'wpforms-lite' ), 'button_link' => 'https://www.facebook.com/groups/wpformsvip/', 'cover_bg_color' => '#E4F0F6', 'cover_img' => 'vip-circle.png', 'cover_img2x' => 'vip-circle@2x.png', );
$data['dev_docs'] = array( 'title' => esc_html__( 'WPForms Developer Documentation', 'wpforms-lite' ), 'description' => esc_html__( 'Customize and extend WPForms with code. Our comprehensive developer resources include tutorials, snippets, and documentation on core actions, filters, functions, and more.', 'wpforms-lite' ), 'button_text' => esc_html__( 'View WPForms Dev Docs', 'wpforms-lite' ), 'button_link' => 'https://wpforms.com/developers/?utm_source=WordPress&utm_medium=Community&utm_campaign=' . esc_attr( $type ) . '&utm_content=Developers', 'cover_bg_color' => '#EBEBEB', 'cover_img' => 'dev-docs.png', 'cover_img2x' => 'dev-docs@2x.png', );
$data['wpbeginner'] = array( 'title' => esc_html__( 'WPBeginner Engage Facebook Group', 'wpforms-lite' ), 'description' => esc_html__( 'Hang out with other WordPress experts and like minded website owners such as yourself! Hosted by WPBeginner, the largest free WordPress site for beginners.', 'wpforms-lite' ), 'button_text' => esc_html__( 'Join WPBeginner Engage', 'wpforms-lite' ), 'button_link' => 'https://www.facebook.com/groups/wpbeginner/', 'cover_bg_color' => '#FCEBDF', 'cover_img' => 'wpbeginner.png', 'cover_img2x' => 'wpbeginner@2x.png', );
$data['translators'] = array( 'title' => esc_html__( 'WPForms Translators Community', 'wpforms-lite' ), 'description' => esc_html__( 'We\'re building a community of translators and i18n experts to translate WPForms. Sign up to our translator community newsletter to learn more and get information on how you can contribute!', 'wpforms-lite' ), 'button_text' => esc_html__( 'Join Translators Community', 'wpforms-lite' ), 'button_link' => 'https://wpforms.com/translator-community-signup/?utm_source=WordPress&utm_medium=Community&utm_campaign=' . esc_attr( $type ) . '&utm_content=Translators', 'cover_bg_color' => '#F2FAED', 'cover_img' => 'translators.png', 'cover_img2x' => 'translators@2x.png', );
$data['suggest'] = array( 'title' => esc_html__( 'Suggest a Feature', 'wpforms-lite' ), 'description' => esc_html__( 'Do you have an idea or suggestion for WPForms? If you have thoughts on features, integrations, addons, or improvements - we want to hear it! We appreciate all feedback and insight from our users.', 'wpforms-lite' ), 'button_text' => esc_html__( 'Suggest a Feature', 'wpforms-lite' ), 'button_link' => 'https://wpforms.com/features/suggest/?utm_source=WordPress&utm_medium=Community&utm_campaign=' . esc_attr( $type ) . '&utm_content=Feature', 'cover_bg_color' => '#FFF9EF', 'cover_img' => 'suggest.png', 'cover_img2x' => 'suggest@2x.png', );
return $data; }
/** * Generate and output page HTML. * * @since 1.5.6 */ public function output() {
?> <div id="wpforms-admin-community" class="wrap wpforms-admin-wrap"> <h1 class="page-title"><?php esc_html_e( 'Community', 'wpforms-lite' ); ?></h1> <div class="items"> <?php $data = $this->get_blocks_data(); foreach ( $data as $item ) { printf( '<div class="item"> <a href="%6$s" target="_blank" rel="noopener noreferrer" class="item-cover" style="background-color: %s;" title="%4$s"><img class="item-img" src="%s" srcset="%s 2x" alt="%4$s"/></a> <h3 class="item-title">%s</h3> <p class="item-description">%s</p> <div class="item-footer"> <a class="button" href="%s" target="_blank" rel="noopener noreferrer">%s</a> </div> </div>', esc_attr( $item['cover_bg_color'] ), esc_url( WPFORMS_PLUGIN_URL . 'assets/images/community/' . $item['cover_img'] ), esc_url( WPFORMS_PLUGIN_URL . 'assets/images/community/' . $item['cover_img2x'] ), esc_html( $item['title'] ), esc_html( $item['description'] ), esc_url( $item['button_link'] ), esc_html( $item['button_text'] ) ); } ?> </div> </div> <?php } }
|