PluginProbe
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls / 6.5.1
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls v6.5.1
6.5.1 6.5.0 6.4.9 6.4.8 6.4.7 6.4.6 6.4.5 6.4.4 6.4.3 6.4.2 6.4.1 6.4.0 6.3.9 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 5.6.0 5.6.1 5.6.2 5.6.3 5.6.4 5.6.5 All 154 releases
← All changes | includes/class-poll-maker-ays-welcome.php +287 -48 5.6.4 → 6.5.1 View file →
@@ -21,9 +21,9 @@
21 21 public function hooks() {
22 22 add_action( 'admin_menu', [ $this, 'register' ] );
23 23 add_action( 'admin_head', [ $this, 'hide_menu' ] );
24 24 add_action( 'admin_init', [ $this, 'redirect' ], 9999 );
25 - add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_styles' ] );
25 + add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_styles' ], 10, 1 );
26 26 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
27 27 }
28 28
29 29 /**
@@ -73,9 +73,29 @@
73 73 if ( $current_page === self::SLUG ) {
74 74 return;
75 75 }
76 76
77 + // Get the activation status
77 78 $first_activation = get_option('ays_poll_maker_first_time_activation_page', false);
79 +
80 + // Check if we're in a multisite environment
81 + if (function_exists('is_multisite') && is_multisite()) {
82 + // Get current blog ID
83 + $blog_id = get_current_blog_id();
84 +
85 + // Use a blog-specific option name to track activation for each site
86 + $blog_specific_option = 'ays_poll_maker_first_time_activation_page_blog_' . $blog_id;
87 + $blog_first_activation = get_option($blog_specific_option, null);
88 +
89 + // If blog-specific option doesn't exist yet, set it based on the main option
90 + if ($blog_first_activation === null) {
91 + update_option($blog_specific_option, $first_activation);
92 + $first_activation = $first_activation;
93 + } else {
94 + // Use the blog-specific activation status
95 + $first_activation = $blog_first_activation;
96 + }
97 + }
78 98
79 99 if (isset($_GET['page']) && strpos($_GET['page'], POLL_MAKER_AYS_NAME) !== false && $first_activation) {
80 100 wp_safe_redirect( admin_url( 'index.php?page=' . self::SLUG ) );
81 101 exit;
@@ -86,14 +106,21 @@
86 106 * Enqueue custom CSS styles for the welcome page.
87 107 *
88 108 * @since 4.6.4
89 109 */
90 - public function enqueue_styles() {
110 + public function enqueue_styles( $hook ) {
111 +
112 + if (strpos( $hook, 'poll-maker-ays-dashboard' ) === false && strpos( $hook, 'poll-maker-getting-started' ) === false) {
113 + return;
114 + }
115 +
91 116 wp_enqueue_style(
92 117 'poll-maker-ays-welcome-css',
93 - POLL_MAKER_AYS_ADMIN_URL . '/css/poll-maker-ays-welcome.css',
94 - array(), false, 'all');
118 + esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/css/poll-maker-ays-welcome.css',
119 + array(), false, 'all'
120 + );
95 121 }
122 +
96 123
97 124 /**
98 125 * Register the JavaScript for the welcome page.
99 126 *
@@ -100,70 +127,282 @@
100 127 * @since 4.6.4
101 128 */
102 129 public function enqueue_scripts() {
103 130
104 - wp_enqueue_script( 'poll-maker-ays-welcome', POLL_MAKER_AYS_ADMIN_URL . '/js/poll-maker-ays-welcome.js', array('jquery'), false, true);
131 + wp_enqueue_script( 'poll-maker-ays-welcome', esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/js/poll-maker-ays-welcome.js', array('jquery'), false, true);
132 + wp_localize_script( 'poll-maker-ays-welcome', 'poll_maker_ays_welcome', array(
133 + 'show_more' => esc_html__( 'Show More', "poll-maker" ),
134 + 'show_less' => esc_html__( 'Show Less', "poll-maker" ),
135 + ) );
105 136 }
106 137
138 + private function get_latest_changelog_entries($limit = 3) {
139 + $readme_path = plugin_dir_path(__FILE__) . '../README.txt';
140 + if ( ! file_exists( $readme_path ) ) {
141 + return array();
142 + }
143 +
144 + $content = file_get_contents( $readme_path );
145 +
146 + // Extract only the Changelog section
147 + if ( preg_match( '/==\s*Changelog\s*==(.*)/is', $content, $matches ) ) {
148 + $changelog = trim($matches[1]);
149 + } else {
150 + return array();
151 + }
152 +
153 + // Split each version entry
154 + preg_match_all( '/=+\s*(.*?)\s*=+\s*(.*?)(?=(?:=+\s*[\d\.]+|\Z))/is', $changelog, $entries, PREG_SET_ORDER );
155 +
156 + $releases = array();
157 + foreach ( $entries as $entry ) {
158 + $title = trim($entry[1]);
159 + $changes = trim($entry[2]);
160 +
161 + // Extract version and date if available
162 + if ( preg_match('/([\d\.]+).*?\((.*?)\)/', $title, $version_match) ) {
163 + $version = trim($version_match[1]);
164 + $date = trim($version_match[2]);
165 + } else {
166 + $version = $title;
167 + $date = '';
168 + }
169 +
170 + // Split lines like * Added: Something
171 + $lines = array_filter(array_map('trim', preg_split('/\r\n|\r|\n/', $changes)));
172 + $lines = array_map(function($line) {
173 + return preg_replace('/^\*\s*/', '', $line);
174 + }, $lines);
175 +
176 + $releases[] = array(
177 + 'version' => $version,
178 + 'date' => $date,
179 + 'changes' => $lines,
180 + );
181 + }
182 +
183 + return array_slice($releases, 0, $limit);
184 + }
185 +
107 186 /**
108 187 * Getting Started screen. Shows after first install.
109 188 *
110 189 * @since 1.0.0
111 190 */
112 - public function output() {
191 + public function output($hide_close_button = false) {
192 +
193 + $latest_changelog = $this->get_latest_changelog_entries(3);
194 +
113 195 ?>
114 - <style>
115 - #wpcontent {
116 - padding-left: 0 !important;
117 - position: relative;
118 - }
119 - </style>
120 - <div id="poll-maker-welcome">
121 -
122 - <div class="poll-maker-welcome-container">
123 -
124 - <div class="poll-maker-welcome-intro">
125 -
126 - <div class="poll-maker-welcome-logo">
127 - <img src="<?php echo POLL_MAKER_AYS_ADMIN_URL; ?>/images/icons/poll-maker-logo.png" alt="<?php echo __( 'Poll Maker Logo', "poll-maker" ); ?>">
196 + <div class="ays-pm-w-container">
197 + <!-- Header -->
198 + <section class="ays-pm-w-section ays-pm-w-header-wrapper ays-pm-w-text-center">
199 + <div class="ays-pm-w-header-dismiss" <?php if($hide_close_button) echo 'style="display: none"'; ?>>
200 + <a href="<?php echo admin_url( 'admin.php?page=' . POLL_MAKER_AYS_NAME ) ?> ">
201 + <img src="<?php echo esc_url(POLL_MAKER_AYS_ADMIN_URL); ?>/images/icons/close.svg" alt="<?php echo esc_html__( 'Close', "poll-maker" ); ?>">
202 + </a>
203 + </div>
204 + <div class="ays-pm-w-header-icon">
205 + <img src="<?php echo esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/icons/poll-maker-logo.png'?>" alt="poll-w-logo">
206 + </div>
207 + <h1 class="ays-pm-w-header-title"><?php echo esc_html__( 'Welcome to Poll Maker', "poll-maker" ); ?></h1>
208 + <p class="ays-pm-w-header-desc"><?php echo esc_html__( 'Thank you for choosing Poll Maker — the best poll and survey plugin for WordPress', "poll-maker" ); ?></p>
209 + <div class="ays-pm-w-header-create">
210 + <a href="<?php echo esc_url( admin_url( 'admin.php?page=' . POLL_MAKER_AYS_NAME . "&action=add") ); ?>" class="poll-maker-btn poll-maker-btn-block poll-maker-btn-lg poll-maker-btn-orange">
211 + <?php echo esc_html__( 'Create Your First Poll', "poll-maker" ); ?>
212 + </a>
213 + </div>
214 + </section>
215 +
216 + <!-- Quick Start Steps -->
217 + <section class="ays-pm-w-section">
218 + <div class="ays-pm-w-text-center">
219 + <h2 class="ays-pm-w-header-title" style="font-size:1.5rem;"><?php echo esc_html__( 'Get Started in a Few Steps', "poll-maker" ); ?></h2>
220 + <p class="ays-pm-w-header-desc" style="font-size:1rem;"><?php echo esc_html__( 'Follow these simple steps to create your first poll', "poll-maker" ); ?></p>
221 + </div>
222 +
223 + <div class="ays-pm-w-steps-wrapper" style="margin-top:2rem;">
224 + <!-- Step 1 -->
225 + <div class="ays-pm-w-step-item">
226 + <div class="ays-pm-w-step-number"><?php echo esc_html__( 'Step 1', "poll-maker" ); ?></div>
227 + <div class="ays-pm-w-step-content">
228 + <h3><?php echo esc_html__( 'Add a New Poll', "poll-maker" ); ?></h3>
128 229 </div>
230 + </div>
231 + <!-- Step 2 -->
232 + <div class="ays-pm-w-step-item">
233 + <div class="ays-pm-w-step-number"><?php echo esc_html__( 'Step 2', "poll-maker" ); ?></div>
234 + <div class="ays-pm-w-step-content">
235 + <h3><?php echo esc_html__( 'Add Options', "poll-maker" ); ?></h3>
236 + </div>
237 + </div>
238 + <!-- Step 3 -->
239 + <div class="ays-pm-w-step-item">
240 + <div class="ays-pm-w-step-number"><?php echo esc_html__( 'Step 3', "poll-maker" ); ?></div>
241 + <div class="ays-pm-w-step-content">
242 + <h3><?php echo esc_html__( 'Save the Poll', "poll-maker" ); ?></h3>
243 + </div>
244 + </div>
245 + <!-- Step 4 -->
246 + <div class="ays-pm-w-step-item">
247 + <div class="ays-pm-w-step-number"><?php echo esc_html__( 'Step 4', "poll-maker" ); ?></div>
248 + <div class="ays-pm-w-step-content">
249 + <h3><?php echo esc_html__( 'Copy the Shortcode', "poll-maker" ); ?></h3>
250 + </div>
251 + </div>
252 + </div>
253 + </section>
129 254
130 - <div class="poll-maker-welcome-close">
131 - <a href="<?php echo admin_url( 'admin.php?page=' . POLL_MAKER_AYS_NAME ) ?> ">
132 - <img src="<?php echo POLL_MAKER_AYS_ADMIN_URL; ?>/images/icons/close.svg" alt="<?php echo __( 'Close', "poll-maker" ); ?>">
133 - </a>
255 + <!-- Video Tutorials -->
256 + <section class="ays-pm-w-section">
257 + <div class="ays-pm-w-text-center">
258 + <h2 class="ays-pm-w-header-title" style="font-size:1.5rem;"><?php echo esc_html__( 'Learn with Video', "poll-maker" ); ?></h2>
259 + <p class="ays-pm-w-header-desc" style="font-size:1rem;"><?php echo esc_html__( 'Watch these quick tutorials to master Poll Maker', "poll-maker" ); ?></p>
260 + </div>
261 +
262 + <div class="ays-pm-w-video-grid" style="margin-top:2rem;">
263 + <!-- Video 1 -->
264 + <div class="ays-pm-w-video-card" data-video-id="8Z4aJ0jhSa8">
265 + <div class="ays-pm-w-video-thumb">
266 + <img src="https://img.youtube.com/vi/8Z4aJ0jhSa8/hqdefault.jpg" alt="Getting Started with Poll Maker">
267 + <div class="ays-pm-w-video-overlay">
268 + <div class="ays-pm-w-play-btn">
269 + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18" style="margin-left:3px">
270 + <polygon points="6 4 20 12 6 20 6 4"></polygon>
271 + </svg>
272 + </div>
273 + </div>
274 + <span class="ays-pm-w-video-duration">1:18</span>
134 275 </div>
135 - <div class="poll-maker-welcome-block">
136 - <h1><?php echo __( 'Welcome to Poll Maker', "poll-maker" ); ?></h1>
137 - <h6><?php echo __( 'Thank you for choosing Poll Maker - the best poll and survey plugin for WordPress.', "poll-maker" ); ?></h6>
276 + <div class="ays-pm-w-video-title"><?php echo esc_html__( 'WordPress Poll Plugin', "poll-maker" ); ?></div>
138 277 </div>
139 -
140 - <a href="#" class="play-video" title="<?php esc_attr_e( 'Watch how to create your first poll', "poll-maker" ); ?>">
141 - <img src="<?php echo POLL_MAKER_AYS_ADMIN_URL; ?>/images/ays-poll-welcome-video.png" alt="<?php echo __( 'Watch how to create your first poll', "poll-maker" ); ?>" class="poll-maker-welcome-video-thumbnail">
142 - </a>
143 -
144 - <div class="poll-maker-welcome-block">
145 -
146 - <div class="poll-maker-welcome-button-wrap poll-maker-clear">
147 - <div class="poll-maker-welcome-left">
148 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=' . POLL_MAKER_AYS_NAME . "&action=add") ); ?>" class="poll-maker-btn poll-maker-btn-block poll-maker-btn-lg poll-maker-btn-orange">
149 - <?php echo __( 'Create Your First Poll', "poll-maker" ); ?>
150 - </a>
278 +
279 + <!-- Video 2 -->
280 + <div class="ays-pm-w-video-card" data-video-id="JrTkFtliTVQ">
281 + <div class="ays-pm-w-video-thumb">
282 + <img src="https://img.youtube.com/vi/JrTkFtliTVQ/hqdefault.jpg" alt="Advanced Poll Customization">
283 + <div class="ays-pm-w-video-overlay">
284 + <div class="ays-pm-w-play-btn">
285 + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18" style="margin-left:3px">
286 + <polygon points="6 4 20 12 6 20 6 4"></polygon>
287 + </svg>
288 + </div>
289 + </div>
290 + <span class="ays-pm-w-video-duration">2:00</span>
291 + </div>
292 + <div class="ays-pm-w-video-title"><?php echo esc_html__( 'Best Way to Create WordPress Anonymous Poll', "poll-maker" ); ?></div>
293 + </div>
294 +
295 + <!-- Video 3 -->
296 + <div class="ays-pm-w-video-card" data-video-id="y9yu9Md4vCs">
297 + <div class="ays-pm-w-video-thumb">
298 + <img src="https://img.youtube.com/vi/y9yu9Md4vCs/hqdefault.jpg" alt="Embedding Polls on Your Site">
299 + <div class="ays-pm-w-video-overlay">
300 + <div class="ays-pm-w-play-btn">
301 + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18" style="margin-left:3px">
302 + <polygon points="6 4 20 12 6 20 6 4"></polygon>
303 + </svg>
304 + </div>
305 + </div>
306 + <span class="ays-pm-w-video-duration">3:26</span>
307 + </div>
308 + <div class="ays-pm-w-video-title"><?php echo esc_html__( 'How to Create a Password Protected Poll', "poll-maker" ); ?></div>
309 + </div>
310 + </div>
311 + </section>
312 +
313 + <!-- Useful Resources -->
314 + <section class="ays-pm-w-section">
315 + <div class="ays-pm-w-text-center">
316 + <h2 class="ays-pm-w-header-title" style="font-size:1.5rem;"><?php echo esc_html__( 'Help & Support', "poll-maker" ); ?></h2>
317 + </div>
318 +
319 + <div class="ays-pm-w-resource-grid" style="margin-top:2rem;">
320 + <!-- Card Template -->
321 + <div class="ays-pm-w-resource-card">
322 + <div class="ays-pm-w-resource-icon ays-pm-w-demo" style="background:#d1fae5;color:#047857;"><img src="<?php echo esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/icons/poll-w-demo.svg'?>" alt="demo"></div>
323 + <div class="ays-pm-w-resource-content">
324 + <div class="ays-pm-w-resource-title"><?php echo esc_html__( 'Demo', "poll-maker" ); ?></div>
325 + <p class="ays-pm-w-resource-desc"><?php echo esc_html__( 'See Poll Maker in action with live examples and use cases', "poll-maker" ); ?></p>
326 + <a href="https://poll-plugin.com/wordpress-poll-plugin-free-demo" target="_blank" class="ays-pm-w-resource-action"><?php echo esc_html__( 'View Demo →', "poll-maker" ); ?></a>
327 + </div>
328 + </div>
329 + <div class="ays-pm-w-resource-card">
330 + <div class="ays-pm-w-resource-icon ays-pm-w-doc" style="background:#dbeafe;color:#2563eb;"><img src="<?php echo esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/icons/poll-w-doc.svg'?>" alt="doc"></div>
331 + <div class="ays-pm-w-resource-content">
332 + <div class="ays-pm-w-resource-title"><?php echo esc_html__( 'Documentation', "poll-maker" ); ?></div>
333 + <p class="ays-pm-w-resource-desc"><?php echo esc_html__( 'Complete guides, tutorials, and API reference for developers', "poll-maker" ); ?></p>
334 + <a href="https://ays-pro.com/wordpress-poll-maker-user-manual" target="_blank" class="ays-pm-w-resource-action"><?php echo esc_html__( 'Read Docs →', "poll-maker" ); ?></a>
335 + </div>
336 + </div>
337 + <div class="ays-pm-w-resource-card">
338 + <div class="ays-pm-w-resource-icon ays-pm-w-community" style="background:#ffedd5;color:#c2410c;"><img src="<?php echo esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/icons/poll-w-community.svg'?>" alt="community"></div>
339 + <div class="ays-pm-w-resource-content">
340 + <div class="ays-pm-w-resource-title"><?php echo esc_html__( 'Community Forum', "poll-maker" ); ?></div>
341 + <p class="ays-pm-w-resource-desc"><?php echo esc_html__( 'Ask questions, share ideas, and get help from the Poll Maker community', "poll-maker" ); ?></p>
342 + <a href="https://wordpress.org/support/plugin/poll-maker" target="_blank" class="ays-pm-w-resource-action"><?php echo esc_html__( 'Join Forum →', "poll-maker" ); ?></a>
343 + </div>
344 + </div>
345 + <div class="ays-pm-w-resource-card">
346 + <div class="ays-pm-w-resource-icon ays-pm-w-support" style="background:#ede9fe;color:#6b21a8;"><img src="<?php echo esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/icons/poll-w-support.svg'?>" alt="support"></div>
347 + <div class="ays-pm-w-resource-content">
348 + <div class="ays-pm-w-resource-title"><?php echo esc_html__( 'Contact Support', "poll-maker" ); ?></div>
349 + <p class="ays-pm-w-resource-desc"><?php echo esc_html__( 'Get help from our friendly support team whenever you need it', "poll-maker" ); ?></p>
350 + <a href="https://ays-pro.com/contact" target="_blank" class="ays-pm-w-resource-action"><?php echo esc_html__( 'Get Support →', "poll-maker" ); ?></a>
351 + </div>
352 + </div>
353 + </div>
354 + </section>
355 +
356 + <!-- What's New -->
357 + <?php
358 + if ( ! empty( $latest_changelog ) ) :
359 + ?>
360 + <section class="ays-pm-w-section ays-pm-w-wn-section" style="position:relative;">
361 + <div class="ays-pm-w-text-center">
362 + <h2 class="ays-pm-w-header-title" style="font-size:1.5rem;"><?php echo esc_html__( "What's New", "poll-maker" ); ?></h2>
363 + <button id="wn-toggle" class="ays-pm-w-wn-toggle" style="position:absolute; top:1rem; right:1rem; background:none;border:none;font-size:0.875rem;color:#2563eb;cursor:pointer;display:flex;align-items:center;gap:0.25rem;"><?php echo esc_html__( "Show More", "poll-maker" ); ?> <span class="ays-pm-w-wn-arrow">▾</span></button>
364 + <p class="ays-pm-w-header-desc" style="font-size:1rem;margin-top:0.5rem;"><?php echo esc_html__( "Latest updates and improvements to Poll Maker", "poll-maker" ); ?></p>
365 + </div>
366 + <div class="ays-pm-w-changelog ays-pm-w-collapsed" style="margin-top:2rem;">
367 + <?php foreach ( $latest_changelog as $release ) : ?>
368 + <div class="ays-pm-w-release">
369 + <div class="ays-pm-w-release-header">
370 + <span class="ays-pm-w-badge">v<?php echo esc_html( $release['version'] ); ?></span>
371 + <?php if ( ! empty( $release['date'] ) ) : ?>
372 + <span class="ays-pm-w-release-date"><?php echo esc_html( $release['date'] ); ?></span>
373 + <?php endif; ?>
151 374 </div>
152 - <div class="poll-maker-welcome-right">
153 - <a href="<?php echo 'https://ays-pro.com/wordpress-poll-maker-user-manual'; ?>"
154 - class="poll-maker-btn poll-maker-btn-block poll-maker-btn-lg poll-maker-btn-grey" target="_blank" rel="noopener noreferrer">
155 - <?php echo __( 'Documentation', "poll-maker" ); ?>
156 - </a>
157 - </div>
375 + <ul class="ays-pm-w-release-list">
376 + <?php foreach ( $release['changes'] as $change ) : ?>
377 + <li><?php echo esc_html( $change ); ?></li>
378 + <?php endforeach; ?>
379 + </ul>
158 380 </div>
159 -
160 - </div>
161 -
381 + <?php endforeach; ?>
162 382 </div>
383 + </section>
384 + <?php endif; ?>
385 + </div>
386 + <!-- Video Lightbox -->
387 + <div id="ays-pm-w-video-lightbox" class="ays-pm-w-video-lightbox">
388 + <div class="ays-pm-w-video-lightbox-content">
389 + <button id="ays-pm-w-video-lightbox-close" class="ays-pm-w-video-lightbox-close">
390 + <img src="<?php echo esc_url(POLL_MAKER_AYS_ADMIN_URL); ?>/images/icons/close.svg" alt="<?php echo esc_html__( 'Close', "poll-maker" ); ?>">
391 + </button>
392 + <div class="ays-pm-w-video-wrapper">
393 + <iframe id="ays-pm-w-video-iframe" width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>
163 394 </div>
395 + </div>
164 396 </div>
165 397 <?php
398 + // Update both the general option and the blog-specific option if in multisite
166 399 update_option('ays_poll_maker_first_time_activation_page', false);
400 +
401 + if (function_exists('is_multisite') && is_multisite()) {
402 + $blog_id = get_current_blog_id();
403 + $blog_specific_option = 'ays_poll_maker_first_time_activation_page_blog_' . $blog_id;
404 + update_option($blog_specific_option, false);
405 + }
167 406 }
168 407 }
169 408 new Poll_Maker_Ays_Welcome();