--- a/new-image-gallery/include/docs.php
+++ b/new-image-gallery/include/docs.php
@@ -1,39 +1,92 @@
+<style>
+ .ig-docs-section h3 {
+ color: var(--wp-admin-theme-color, #2271b1);
+ }
+
+ .ig-docs-section p,
+ .ig-docs-section li {
+ font-size: 14px;
+ color: var(--wp--preset--color--text, #3c434a);
+ line-height: 1.5;
+ }
+
+ .ig-docs-section strong {
+ color: var(--wp--preset--color--text, #1d2327);
+ }
+
+ .ig-docs-section code {
+ color: var(--wp-admin-theme-color, #2271b1);
+ }
+</style>
<div class="wrap">
- <div id="welcome-panel" class="welcome-panel">
+ <div id="welcome-panel" class="">
<div class="welcome-panel-content">
- <h1>Welcome to Image Gallery Plugin Docs</h1>
- <p class="about-description">Getting started with pluign - Follow steps to create & publish gallery</p>
+ <h1><?php esc_html_e('Welcome to New Image Gallery Documentation', 'new-image-gallery'); ?></h1>
+ <p class="about-description"><?php esc_html_e('Getting started with the New Image Gallery plugin - Follow these simple steps to create, configure, and publish your beautiful galleries.', 'new-image-gallery'); ?></p>
<hr>
- <h3>Step 1 - Install & Activate Plugin<h3>
- <p>After downloaded plugin from WordPress.</p>
- <p>Login to your WordPress site upload the plugin, install and activate.</p>
-
- <h3>Step 2 - Create A Gallery<h3>
- <p>Plugin has been installed on site.</p>
- <p>Now, go to the plugin's menu "New Image Gallery" and click on "Add Image Gallery" page.</p>
- <p>Using "Add Image" button upload images through media library.</p>
- <p>Set gallery setting like Thumbnail Quality & Size, Coulmns Layout, Light Box Style, Hover Effect, Spacing, Order and Custom CSS etc according to you.</p>
- <p>Finally click on "Publish" button to create gallery.</p>
-
- <h3>Step 3 - Display Gallery On Site<h3>
- <p>Our gallery shortcode has been created in last step.</p>
- <p>Copy the heighlighted shortcode above the gallery setting.
- <p>Now create a new Page / Post and paste the copied gallery shortcode into content part.</p>
- <p>Publish the Page / Post and view the page for gallery display.</p>
- <pre>[IMG-Gal id=4]</pre>
- <p>Here id = 4 is your gallery post id.</p>
+ <div class="ig-docs-section">
+ <h3><span class="dashicons dashicons-download" style="vertical-align: middle;"></span> <?php esc_html_e('Step 1: Install & Activate', 'new-image-gallery'); ?></h3>
+ <p><?php esc_html_e('If you have downloaded the plugin zip file from WordPress.org:', 'new-image-gallery'); ?></p>
+ <ol>
+ <li><?php esc_html_e('Log in to your WordPress admin dashboard.', 'new-image-gallery'); ?></li>
+ <li><?php esc_html_e('Navigate to ', 'new-image-gallery'); ?><strong><?php esc_html_e('Plugins > Add New', 'new-image-gallery'); ?></strong><?php esc_html_e(' and click on the ', 'new-image-gallery'); ?><strong><?php esc_html_e('Upload Plugin', 'new-image-gallery'); ?></strong><?php esc_html_e(' button.', 'new-image-gallery'); ?></li>
+ <li><?php esc_html_e('Choose the downloaded zip file, install it, and then click ', 'new-image-gallery'); ?><strong><?php esc_html_e('Activate', 'new-image-gallery'); ?></strong>.</li>
+ </ol>
+ </div>
+
+ <div class="ig-docs-section">
+ <h3><span class="dashicons dashicons-format-gallery" style="vertical-align: middle;"></span> <?php esc_html_e('Step 2: Create a New Gallery', 'new-image-gallery'); ?></h3>
+ <p><?php esc_html_e('Now that the plugin is active, let's create your first gallery:', 'new-image-gallery'); ?></p>
+ <ol>
+ <li><?php esc_html_e('Go to the ', 'new-image-gallery'); ?><strong><?php esc_html_e('New Image Gallery > Add Image Gallery', 'new-image-gallery'); ?></strong><?php esc_html_e(' menu in your WordPress dashboard.', 'new-image-gallery'); ?></li>
+ <li><?php esc_html_e('Enter a title for your gallery at the top.', 'new-image-gallery'); ?></li>
+ <li><?php esc_html_e('Click the ', 'new-image-gallery'); ?><strong><?php esc_html_e('Add Images', 'new-image-gallery'); ?></strong><?php esc_html_e(' button to upload or select images from your WordPress Media Library.', 'new-image-gallery'); ?></li>
+ <li><?php esc_html_e('You can drag and drop images to reorder them, or add a specific Title and Alt Text for each image.', 'new-image-gallery'); ?></li>
+ </ol>
+ </div>
+
+ <div class="ig-docs-section">
+ <h3><span class="dashicons dashicons-admin-generic" style="vertical-align: middle;"></span> <?php esc_html_e('Step 3: Configure Settings', 'new-image-gallery'); ?></h3>
+ <p><?php esc_html_e('Customize your gallery to match your site's design by exploring the configuration tabs:', 'new-image-gallery'); ?></p>
+ <ul style="list-style-type: disc; margin-left: 20px;">
+ <li><strong><?php esc_html_e('Configure:', 'new-image-gallery'); ?></strong> <?php esc_html_e('Set the Gallery Thumbnail Size, adjust Column Layouts for different devices (Desktops, Tablets, Phones), toggle Thumbnail Titles or Spacing, and define the Image Order.', 'new-image-gallery'); ?></li>
+ <li><strong><?php esc_html_e('Animation Effect:', 'new-image-gallery'); ?></strong> <?php esc_html_e('Choose a smooth 2D Transition (like Grow, Float, or Glow) to play when users hover over your images.', 'new-image-gallery'); ?></li>
+ <li><strong><?php esc_html_e('LightBox Settings:', 'new-image-gallery'); ?></strong> <?php esc_html_e('Select a Light Box style (e.g., Bootstrap Light Box or LD Light Box) to display your images in a beautiful popup when clicked.', 'new-image-gallery'); ?></li>
+ <li><strong><?php esc_html_e('Custom CSS:', 'new-image-gallery'); ?></strong> <?php esc_html_e('Add your own CSS rules perfectly tailored to this specific gallery.', 'new-image-gallery'); ?></li>
+ </ul>
+ <p><?php esc_html_e('Once you are satisfied with your settings, click the ', 'new-image-gallery'); ?><strong><?php esc_html_e('Publish', 'new-image-gallery'); ?></strong><?php esc_html_e(' (or Update) button to save your gallery.', 'new-image-gallery'); ?></p>
+ </div>
+
+ <div class="ig-docs-section">
+ <h3><span class="dashicons dashicons-shortcode" style="vertical-align: middle;"></span> <?php esc_html_e('Step 4: Display Gallery On Your Site', 'new-image-gallery'); ?></h3>
+ <p><?php esc_html_e('After publishing, you need to embed the gallery into a post or page using its unique shortcode.', 'new-image-gallery'); ?></p>
+ <ol>
+ <li><?php esc_html_e('Look for the ', 'new-image-gallery'); ?><strong><?php esc_html_e('Gallery Shortcode', 'new-image-gallery'); ?></strong><?php esc_html_e(' meta box on the right side of the gallery editor page.', 'new-image-gallery'); ?></li>
+ <li><?php esc_html_e('Copy the highlighted shortcode. It will look something like this:', 'new-image-gallery'); ?>
+ <div style="margin: 10px 0;">
+ <code style="background: #f0f0f1; padding: 5px 10px; border-left: 4px solid var(--wp-admin-theme-color, #00a0d2); display: inline-block; font-size: 14px;">[IMG-Gal id=4]</code>
+ </div>
+ <em><?php esc_html_e('(Here, "id=4" is the unique ID of your gallery.)', 'new-image-gallery'); ?></em>
+ </li>
+ <li><?php esc_html_e('Go to ', 'new-image-gallery'); ?><strong><?php esc_html_e('Pages > Add New', 'new-image-gallery'); ?></strong><?php esc_html_e(' (or Posts).', 'new-image-gallery'); ?></li>
+ <li><?php esc_html_e('Paste the copied shortcode directly into the content editor (or use a Shortcode block if you are using the Gutenberg editor).', 'new-image-gallery'); ?></li>
+ <li><?php esc_html_e('Publish the page and view it on the front-end to see your stunning image gallery in action!', 'new-image-gallery'); ?></li>
+ </ol>
+ </div>
<hr>
</div>
+
<div class="welcome-panel-content">
-
- <p class="">
- <h1><strong>Early Bird Offer:</strong> Upgrade To Premium Just In Half Prise <strike>$15</strike> <strong>$10</strong></h1>
- <br>
- <a href="https://awplife.com/wordpress-plugins/image-gallery-premium/" target="_blank" class="button button-primary button-hero load-customize hide-if-no-customize">Premium Version Details</a>
- <a href="https://awplife.com/demo/image-gallery-premium/" target="_blank" class="button button-primary button-hero load-customize hide-if-no-customize">Check Live Demo</a>
- <a href="https://awplife.com/demo/image-gallery-premium-admin-demo/" target="_blank" class="button button-primary button-hero load-customize hide-if-no-customize">Try Premium Version</a>
- </p>
+ <div style="background: #fff8e5; border-left: 4px solid #ffb900; padding: 20px; margin-top: 10px;">
+ <h2 style="margin-top: 0; color: #d63638;"><strong><?php esc_html_e('Early Bird Offer:', 'new-image-gallery'); ?></strong> <?php esc_html_e('Upgrade To Premium at Discounted Price', 'new-image-gallery'); ?> <strike>$15</strike> <strong>$12</strong></h2>
+ <p style="font-size: 15px; margin-bottom: 20px; line-height: 1.5;"><?php esc_html_e('Unlock advanced features, more stunning hover effects, additional lightbox styles, masonry layouts, unlimited priority support, and much more by upgrading to the Pro version today!', 'new-image-gallery'); ?></p>
+ <p>
+ <a href="https://awplife.com/wordpress-plugins/image-gallery-premium/" target="_blank" class="button button-primary button-hero load-customize hide-if-no-customize" style="margin-right: 10px; margin-bottom: 10px;"><?php esc_html_e('Premium Version Details', 'new-image-gallery'); ?></a>
+ <a href="https://awplife.com/demo/image-gallery-premium/" target="_blank" class="button button-primary button-hero load-customize hide-if-no-customize" style="margin-right: 10px; margin-bottom: 10px;"><?php esc_html_e('Check Live Demo', 'new-image-gallery'); ?></a>
+ <a href="https://awplife.com/account/signup/image-gallery-premium" target="_blank" class="button button-primary button-hero load-customize hide-if-no-customize" style="margin-bottom: 10px;"><?php esc_html_e('Buy Premium Version', 'new-image-gallery'); ?></a>
+ </p>
+ </div>
</div>
</div>
</div>
No newline at end of file
--- a/new-image-gallery/include/gallery-settings.php
+++ b/new-image-gallery/include/gallery-settings.php
@@ -121,7 +121,7 @@
<div class="bhoechie-tab-content active">
<h1>
<?php esc_html_e('Add Images', 'new-image-gallery'); ?>
- <?php wp_nonce_field( 'igp_add_images', 'igp_add_images_nonce' ); ?>
+ <?php wp_nonce_field('igp_add_images', 'igp_add_images_nonce'); ?>
</h1>
<hr>
<div id="slider-gallery">
@@ -132,33 +132,24 @@
<?php
$post_id = esc_attr($post->ID);
- if (!function_exists('is_sr_serialized')) {
- function is_sr_serialized($str) {
- return ($str == serialize(false) || @unserialize($str) !== false);
- }
- }
-
// Retrieve the base64 encoded data
$encodedData = get_post_meta($post_id, 'awl_ig_settings_' . $post_id, true);
// Decode the base64 encoded data
$decodedData = base64_decode($encodedData);
- // Check if the data is serialized
- if (is_sr_serialized($decodedData)) {
-
- // The data is serialized, so unserialize it
- $gallery_settings = unserialize($decodedData);
+ // Check if the data is serialized safely
+ $gallery_settings = awl_ig_safe_unserialize($decodedData);
+ if ($gallery_settings !== false) {
// Optionally, convert the unserialized data to JSON and save it back in base64 encoding for future access
// This step is optional but recommended to transition your data format
-
+
$jsonEncodedData = json_encode($gallery_settings);
update_post_meta($post_id, 'awl_ig_settings_' . $post_id, $jsonEncodedData);
// Now, to use the newly saved format, fetch and decode again
$encodedData = get_post_meta($post_id, 'awl_ig_settings_' . $post_id, true);
$gallery_settings = json_decode(($encodedData), true);
-
} else {
// Assume the data is in JSON format
$jsonData = get_post_meta($post_id, 'awl_ig_settings_' . $post_id, true);
@@ -168,10 +159,14 @@
if (isset($gallery_settings['slide-ids'])) {
$count = 0;
foreach ($gallery_settings['slide-ids'] as $id) {
- $image_alt = $gallery_settings['slide-alt'][$count];
+ if (isset($gallery_settings['slide-alt'][$count]) && !empty($gallery_settings['slide-alt'][$count])) {
+ $image_alt = $gallery_settings['slide-alt'][$count];
+ } else {
+ $image_alt = get_post_meta($id, '_wp_attachment_image_alt', true);
+ }
$thumbnail = wp_get_attachment_image_src($id, 'medium', true);
$attachment = get_post($id);
- ?>
+ ?>
<li class="slide">
<img class="new-slide" src="<?php echo esc_url($thumbnail[0]); ?>"
alt="<?php echo esc_html(get_the_title($id)); ?>"
@@ -187,7 +182,7 @@
<a class="pw-trash-icon" name="remove-slide" id="remove-slide" href="#"><span
class="dashicons dashicons-trash"></span></a>
</li>
- <?php
+ <?php
$count++;
} // end of foreach
} //end of if
@@ -223,31 +218,31 @@
?>
<select id="gal_thumb_size" name="gal_thumb_size" style="width:50%">
<option value="thumbnail" <?php
- if ($gal_thumb_size == 'thumbnail') {
- echo 'selected=selected';
- }
- ?>>
+ if ($gal_thumb_size == 'thumbnail') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('Thumbnail – 150 × 150', 'new-image-gallery'); ?>
</option>
<option value="medium" <?php
- if ($gal_thumb_size == 'medium') {
- echo 'selected=selected';
- }
- ?>>
+ if ($gal_thumb_size == 'medium') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('Medium – 300 × 169', 'new-image-gallery'); ?>
</option>
<option value="large" <?php
- if ($gal_thumb_size == 'large') {
- echo 'selected=selected';
- }
- ?>>
+ if ($gal_thumb_size == 'large') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('Large – 840 × 473', 'new-image-gallery'); ?>
</option>
<option value="full" <?php
- if ($gal_thumb_size == 'full') {
- echo 'selected=selected';
- }
- ?>>
+ if ($gal_thumb_size == 'full') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('Full Size – 1280 × 720', 'new-image-gallery'); ?>
</option>
</select>
@@ -274,45 +269,45 @@
?>
<select id="col_large_desktops" name="col_large_desktops" style="width:40%">
<option value="col-lg-12" <?php
- if ($col_large_desktops == 'col-lg-12') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_large_desktops == 'col-lg-12') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('1 Column', 'new-image-gallery'); ?>
</option>
<option value="col-lg-6" <?php
- if ($col_large_desktops == 'col-lg-6') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_large_desktops == 'col-lg-6') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('2 Column', 'new-image-gallery'); ?>
</option>
<option value="col-lg-4" <?php
- if ($col_large_desktops == 'col-lg-4') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_large_desktops == 'col-lg-4') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('3 Column', 'new-image-gallery'); ?>
</option>
<option value="col-lg-3" <?php
- if ($col_large_desktops == 'col-lg-3') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_large_desktops == 'col-lg-3') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('4 Column', 'new-image-gallery'); ?>
</option>
<option value="col-lg-2" <?php
- if ($col_large_desktops == 'col-lg-2') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_large_desktops == 'col-lg-2') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('6 Column', 'new-image-gallery'); ?>
</option>
<option value="col-lg-1" <?php
- if ($col_large_desktops == 'col-lg-1') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_large_desktops == 'col-lg-1') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('12 Column', 'new-image-gallery'); ?>
</option>
</select>
@@ -340,45 +335,45 @@
?>
<select id="col_desktops" name="col_desktops" style="width:40%">
<option value="col-md-12" <?php
- if ($col_desktops == 'col-md-12') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_desktops == 'col-md-12') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('1 Column', 'new-image-gallery'); ?>
</option>
<option value="col-md-6" <?php
- if ($col_desktops == 'col-md-6') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_desktops == 'col-md-6') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('2 Column', 'new-image-gallery'); ?>
</option>
<option value="col-md-4" <?php
- if ($col_desktops == 'col-md-4') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_desktops == 'col-md-4') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('3 Column', 'new-image-gallery'); ?>
</option>
<option value="col-md-3" <?php
- if ($col_desktops == 'col-md-3') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_desktops == 'col-md-3') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('4 Column', 'new-image-gallery'); ?>
</option>
<option value="col-md-2" <?php
- if ($col_desktops == 'col-md-2') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_desktops == 'col-md-2') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('6 Column', 'new-image-gallery'); ?>
</option>
<option value="col-md-1" <?php
- if ($col_desktops == 'col-md-1') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_desktops == 'col-md-1') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('12 Column', 'new-image-gallery'); ?>
</option>
</select>
@@ -405,38 +400,38 @@
?>
<select id="col_tablets" name="col_tablets" style="width:40%">
<option value="col-sm-12" <?php
- if ($col_tablets == 'col-sm-12') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_tablets == 'col-sm-12') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('1 Column', 'new-image-gallery'); ?>
</option>
<option value="col-sm-6" <?php
- if ($col_tablets == 'col-sm-12') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_tablets == 'col-sm-12') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('2 Column', 'new-image-gallery'); ?>
</option>
<option value="col-sm-4" <?php
- if ($col_tablets == 'col-sm-4') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_tablets == 'col-sm-4') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('3 Column', 'new-image-gallery'); ?>
</option>
<option value="col-sm-3" <?php
- if ($col_tablets == 'col-sm-3') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_tablets == 'col-sm-3') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('4 Column', 'new-image-gallery'); ?>
</option>
<option value="col-sm-2" <?php
- if ($col_tablets == 'col-sm-2') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_tablets == 'col-sm-2') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('6 Column', 'new-image-gallery'); ?>
</option>
</select>
@@ -463,31 +458,31 @@
?>
<select id="col_phones" name="col_phones" style="width:40%">
<option value="col-12" <?php
- if ($col_phones == 'col-12') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_phones == 'col-12') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('1 Column', 'new-image-gallery'); ?>
</option>
<option value="col-6" <?php
- if ($col_phones == 'col-6') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_phones == 'col-6') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('2 Column', 'new-image-gallery'); ?>
</option>
<option value="col-4" <?php
- if ($col_phones == 'col-4') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_phones == 'col-4') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('3 Column', 'new-image-gallery'); ?>
</option>
<option value="col-3" <?php
- if ($col_phones == 'col-3') {
- echo 'selected=selected';
- }
- ?>>
+ if ($col_phones == 'col-3') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('4 Column', 'new-image-gallery'); ?>
</option>
</select>
@@ -513,18 +508,18 @@
}
?>
<input type="radio" name="img_title" id="img_title1" value="1" <?php
- if ($img_title == 1) {
- echo 'checked=checked';
- }
- ?>>
+ if ($img_title == 1) {
+ echo 'checked=checked';
+ }
+ ?>>
<label for="img_title1">
<?php esc_html_e('Yes', 'new-image-gallery'); ?>
</label>
<input type="radio" name="img_title" id="img_title2" value="0" <?php
- if ($img_title == 0) {
- echo 'checked=checked';
- }
- ?>>
+ if ($img_title == 0) {
+ echo 'checked=checked';
+ }
+ ?>>
<label for="img_title2">
<?php esc_html_e('No', 'new-image-gallery'); ?>
</label>
@@ -550,18 +545,18 @@
}
?>
<input type="radio" name="no_spacing" id="no_spacing1" value="1" <?php
- if ($no_spacing == 1) {
- echo 'checked=checked';
- }
- ?>>
+ if ($no_spacing == 1) {
+ echo 'checked=checked';
+ }
+ ?>>
<label for="no_spacing1">
<?php esc_html_e('Yes', 'new-image-gallery'); ?>
</label>
<input type="radio" name="no_spacing" id="no_spacing2" value="0" <?php
- if ($no_spacing == 0) {
- echo 'checked=checked';
- }
- ?>>
+ if ($no_spacing == 0) {
+ echo 'checked=checked';
+ }
+ ?>>
<label for="no_spacing2">
<?php esc_html_e('No', 'new-image-gallery'); ?>
</label>
@@ -587,26 +582,26 @@
}
?>
<input type="radio" name="thumbnail_order" id="thumbnail_order1" value="ASC" <?php
- if ($thumbnail_order == 'ASC') {
- echo 'checked=checked';
- }
- ?>>
+ if ($thumbnail_order == 'ASC') {
+ echo 'checked=checked';
+ }
+ ?>>
<label for="thumbnail_order1">
<?php esc_html_e('Old First', 'new-image-gallery'); ?>
</label>
<input type="radio" name="thumbnail_order" id="thumbnail_order2" value="DESC" <?php
- if ($thumbnail_order == 'DESC') {
- echo 'checked=checked';
- }
- ?>>
+ if ($thumbnail_order == 'DESC') {
+ echo 'checked=checked';
+ }
+ ?>>
<label for="thumbnail_order2">
<?php esc_html_e('New First', 'new-image-gallery'); ?>
</label>
<input type="radio" name="thumbnail_order" id="thumbnail_order3" value="RANDOM" <?php
- if ($thumbnail_order == 'RANDOM') {
- echo 'checked=checked';
- }
- ?>>
+ if ($thumbnail_order == 'RANDOM') {
+ echo 'checked=checked';
+ }
+ ?>>
<label for="thumbnail_order3">
<?php esc_html_e('Random', 'new-image-gallery'); ?>
</label>
@@ -632,18 +627,18 @@
}
?>
<input type="radio" name="igp_loop_st" id="igp_loop_st1" value="true" <?php
- if ($igp_loop_st == 'true') {
- echo 'checked=checked';
- }
- ?>>
+ if ($igp_loop_st == 'true') {
+ echo 'checked=checked';
+ }
+ ?>>
<label for="igp_loop_st1">
<?php esc_html_e('Yes', 'new-image-gallery'); ?>
</label>
<input type="radio" name="igp_loop_st" id="igp_loop_st2" value="false" <?php
- if ($igp_loop_st == 'false') {
- echo 'checked=checked';
- }
- ?>>
+ if ($igp_loop_st == 'false') {
+ echo 'checked=checked';
+ }
+ ?>>
<label for="igp_loop_st2">
<?php esc_html_e('No', 'new-image-gallery'); ?>
</label>
@@ -721,38 +716,38 @@
label="<?php esc_html_e('Shadow and Glow Transitions Effects', 'new-image-gallery'); ?>"
class="sg">
<option value="hvr-grow-shadow" <?php
- if ($image_hover_effect_four == 'hvr-grow-shadow') {
- echo 'selected=selected';
- }
- ?>>
+ if ($image_hover_effect_four == 'hvr-grow-shadow') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('Grow Shadow', 'new-image-gallery'); ?>
</option>
<option value="hvr-float-shadow" <?php
- if ($image_hover_effect_four == 'hvr-float-shadow') {
- echo 'selected=selected';
- }
- ?>>
+ if ($image_hover_effect_four == 'hvr-float-shadow') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('Float Shadow', 'new-image-gallery'); ?>
</option>
<option value="hvr-glow" <?php
- if ($image_hover_effect_four == 'hvr-glow') {
- echo 'selected=selected';
- }
- ?>>
+ if ($image_hover_effect_four == 'hvr-glow') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('Glow', 'new-image-gallery'); ?>
</option>
<option value="hvr-box-shadow-inset" <?php
- if ($image_hover_effect_four == 'hvr-box-shadow-inset') {
- echo 'selected=selected';
- }
- ?>>
+ if ($image_hover_effect_four == 'hvr-box-shadow-inset') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('Box Shadow Inset', 'new-image-gallery'); ?>
</option>
<option value="hvr-box-shadow-outset" <?php
- if ($image_hover_effect_four == 'hvr-box-shadow-outset') {
- echo 'selected=selected';
- }
- ?>>
+ if ($image_hover_effect_four == 'hvr-box-shadow-outset') {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('Box Shadow Outset', 'new-image-gallery'); ?>
</option>
</optgroup>
@@ -789,24 +784,24 @@
?>
<select name="light_box" id="light_box" style="width:50%">
<option value="0" <?php
- if ($light_box == 0) {
- echo 'selected=selected';
- }
- ?>>
+ if ($light_box == 0) {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('None', 'new-image-gallery'); ?>
</option>
<option value="6" <?php
- if ($light_box == 6) {
- echo 'selected=selected';
- }
- ?>>
+ if ($light_box == 6) {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('Bootstrap Light Box', 'new-image-gallery'); ?>
</option>
<option value="4" <?php
- if ($light_box == 4) {
- echo 'selected=selected';
- }
- ?>>
+ if ($light_box == 4) {
+ echo 'selected=selected';
+ }
+ ?>>
<?php esc_html_e('LD Light Box', 'new-image-gallery'); ?>
</option>
</select>
@@ -856,8 +851,9 @@
</div>
<div class="">
- <h1><strong>Offer:</strong> Upgrade To Premium Just In Half Price <strike>$15</strike>
- <strong>$12</strong></h1>
+ <h1><strong>Offer:</strong> Upgrade To Premium At Discounted Price <strike>$15</strike>
+ <strong>$12</strong>
+ </h1>
<br>
<a href="https://awplife.com/demo/image-gallery-free-wordpress-plugin/" target="_blank"
class="button button-primary button-hero load-customize hide-if-no-customize">Check Free Plugin
@@ -868,9 +864,9 @@
<a href="https://awplife.com/wordpress-plugins/image-gallery-wordpress-plugin/" target="_blank"
class="button button-primary button-hero load-customize hide-if-no-customize">Premium Version
Details</a>
- <a href="https://awplife.com/demo/image-gallery-premium-admin-demo/" target="_blank"
- class="button button-primary button-hero load-customize hide-if-no-customize">Try Pro
- Version</a>
+ <a href="https://awplife.com/account/signup/image-gallery-premium" target="_blank"
+ class="button button-primary button-hero load-customize hide-if-no-customize"
+ style="margin-bottom: 10px;"><?php esc_html_e('Buy Premium Version', 'new-image-gallery'); ?></a>
</div>
</div>
@@ -887,8 +883,6 @@
<!-- Return to Top -->
<script>
-
-
var effect_type = jQuery('input[name="image_hover_effect_type"]:checked').val();
//alert(effect_type);
if (effect_type == "no") {
@@ -899,8 +893,8 @@
}
//on change effect
- jQuery(document).ready(function () {
- jQuery('input[name="image_hover_effect_type"]').change(function () {
+ jQuery(document).ready(function() {
+ jQuery('input[name="image_hover_effect_type"]').change(function() {
var effect_type = jQuery('input[name="image_hover_effect_type"]:checked').val();
if (effect_type == "no") {
jQuery('.he_four').hide();
@@ -912,7 +906,7 @@
});
// tab
- jQuery("div.bhoechie-tab-menu>div.list-group>a").click(function (e) {
+ jQuery("div.bhoechie-tab-menu>div.list-group>a").click(function(e) {
e.preventDefault();
jQuery(this).siblings('a.active').removeClass("active");
jQuery(this).addClass("active");
@@ -920,5 +914,4 @@
jQuery("div.bhoechie-tab>div.bhoechie-tab-content").removeClass("active");
jQuery("div.bhoechie-tab>div.bhoechie-tab-content").eq(index).addClass("active");
});
-
</script>
No newline at end of file
--- a/new-image-gallery/include/ig-ld-lightbox.php
+++ b/new-image-gallery/include/ig-ld-lightbox.php
@@ -1,5 +1,5 @@
<?php
-if ( ! defined( 'ABSPATH' ) ) {
+if (! defined('ABSPATH')) {
exit; // Exit if accessed directly
}
/**
@@ -7,125 +7,134 @@
*/
-wp_enqueue_script( 'awl-ld-lightbox-js' );
-wp_enqueue_style( 'awl-ld-lightbox-css' );
+wp_enqueue_script('awl-ld-lightbox-js');
+wp_enqueue_style('awl-ld-lightbox-css');
$allslides = array(
'p' => $image_gallery_id,
'post_type' => 'image_gallery',
'orderby' => 'ASC',
);
-$loop = new WP_Query( $allslides );
-while ( $loop->have_posts() ) :
+$loop = new WP_Query($allslides);
+while ($loop->have_posts()) :
$loop->the_post();
$post_id = esc_attr(get_the_ID());
- // Check if the data is serialized
- if (is_ig_serialized($decodedData)) {
-
- // The data is serialized, so unserialize it
- $gallery_settings = unserialize($decodedData);
+ // Retrieve the base64 encoded data
+ $encodedData = get_post_meta($post_id, 'awl_ig_settings_' . $post_id, true);
+ // Decode the base64 encoded data
+ $decodedData = base64_decode($encodedData);
+ // Check if the data is serialized safely
+ $gallery_settings = awl_ig_safe_unserialize($decodedData);
+ if ($gallery_settings !== false) {
+
// Optionally, convert the unserialized data to JSON and save it back in base64 encoding for future access
// This step is optional but recommended to transition your data format
-
+
$jsonEncodedData = json_encode($gallery_settings);
update_post_meta($image_gallery_id, 'awl_ig_settings_' . $image_gallery_id, $jsonEncodedData);
-
+
// Now, to use the newly saved format, fetch and decode again
$encodedData = get_post_meta($image_gallery_id, 'awl_ig_settings_' . $image_gallery_id, true);
$gallery_settings = json_decode(($encodedData), true);
-
} else {
-
+
// Assume the data is in JSON format
- $jsonData = get_post_meta($image_gallery_id, 'awl_ig_settings_' . $image_gallery_id, true);
+ $jsonData = get_post_meta($image_gallery_id, 'awl_ig_settings_' . $image_gallery_id, true);
// Decode the JSON string into an associative array
$gallery_settings = json_decode($jsonData, true); // Ensure true is passed to get an associative array
}
- count( $gallery_settings['slide-ids'] );
+ count($gallery_settings['slide-ids']);
// start the image gallery contents
- ?>
- <div id="image_gallery_<?php echo esc_attr( $image_gallery_id ); ?>" class="row all-images-<?php echo esc_attr( $image_gallery_id ); ?>">
+?>
+ <div id="image_gallery_<?php echo esc_attr($image_gallery_id); ?>" class="row all-images-<?php echo esc_attr($image_gallery_id); ?>">
<?php
- if ( isset( $gallery_settings['slide-ids'] ) && count( $gallery_settings['slide-ids'] ) > 0 ) {
+ if (isset($gallery_settings['slide-ids']) && count($gallery_settings['slide-ids']) > 0) {
$count = 0;
- if ( $thumbnail_order == 'DESC' ) {
- $gallery_settings['slide-ids'] = array_reverse( $gallery_settings['slide-ids'] );
+ if ($thumbnail_order == 'DESC') {
+ $gallery_settings['slide-ids'] = array_reverse($gallery_settings['slide-ids']);
}
- if ( $thumbnail_order == 'RANDOM' ) {
- shuffle( $gallery_settings['slide-ids'] );
+ if ($thumbnail_order == 'RANDOM') {
+ shuffle($gallery_settings['slide-ids']);
}
- foreach ( $gallery_settings['slide-ids'] as $attachment_id ) {
- $thumb = wp_get_attachment_image_src( $attachment_id, 'thumb', true );
- $thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true );
- $medium = wp_get_attachment_image_src( $attachment_id, 'medium', true );
- $large = wp_get_attachment_image_src( $attachment_id, 'large', true );
- $full = wp_get_attachment_image_src( $attachment_id, 'full', true );
- $postthumbnail = wp_get_attachment_image_src( $attachment_id, 'post-thumbnail', true );
- $attachment_details = get_post( $attachment_id );
- $href = get_permalink( $attachment_details->ID );
+ foreach ($gallery_settings['slide-ids'] as $attachment_id) {
+ $thumb = wp_get_attachment_image_src($attachment_id, 'thumb', true);
+ $thumbnail = wp_get_attachment_image_src($attachment_id, 'thumbnail', true);
+ $medium = wp_get_attachment_image_src($attachment_id, 'medium', true);
+ $large = wp_get_attachment_image_src($attachment_id, 'large', true);
+ $full = wp_get_attachment_image_src($attachment_id, 'full', true);
+ $postthumbnail = wp_get_attachment_image_src($attachment_id, 'post-thumbnail', true);
+ $attachment_details = get_post($attachment_id);
+ $href = get_permalink($attachment_details->ID);
$src = $attachment_details->guid;
$title = $attachment_details->post_title;
$description = $attachment_details->post_content;
-
- if ( !empty( $gallery_settings['slide-alt'][ $count ] ) ) {
- $image_alt = $gallery_settings['slide-alt'][ $count ];
+
+ if (isset($gallery_settings['slide-alt'][$count]) && !empty($gallery_settings['slide-alt'][$count])) {
+ $image_alt = $gallery_settings['slide-alt'][$count];
} else {
- $image_alt = $title;
+ $image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
+ if (empty($image_alt)) {
+ $image_alt = $title;
+ }
}
-
+
// set thumbnail size
- if ( $gal_thumb_size == 'thumbnail' ) {
- $thumbnail_url = $thumbnail[0]; }
- if ( $gal_thumb_size == 'medium' ) {
- $thumbnail_url = $medium[0]; }
- if ( $gal_thumb_size == 'large' ) {
- $thumbnail_url = $large[0]; }
- if ( $gal_thumb_size == 'full' ) {
- $thumbnail_url = $full[0]; }
- ?>
- <div class="single-image-<?php echo esc_attr( $image_gallery_id ); ?> <?php echo esc_attr( $col_large_desktops ); ?> <?php echo esc_attr( $col_desktops ); ?> <?php echo esc_attr( $col_tablets ); ?> <?php echo esc_attr( $col_phones ); ?>">
- <a href="<?php echo esc_url( $full[0] ); ?>" data-lightbox="lightbox-<?php echo esc_attr( $image_gallery_id ); ?>" data-gallery="gallery-<?php echo esc_attr( $image_gallery_id ); ?>" data-title="<?php echo esc_html( $title ); ?>">
- <img class="thumbnail <?php echo esc_attr( $image_hover_effect ); ?>" src="<?php echo esc_url( $thumbnail_url ); ?>" alt="<?php echo esc_html( $image_alt ); ?>" title="<?php echo esc_html( $title ); ?>">
- <?php if ( $img_title == 0 ) { ?>
- <span class="item-title"><?php echo esc_html( $title ); ?></span>
- <?php } ?>
- </a>
- </div>
- <?php
- $count++;
- }// end of attachment foreach
+ if ($gal_thumb_size == 'thumbnail') {
+ $thumbnail_url = $thumbnail[0];
+ }
+ if ($gal_thumb_size == 'medium') {
+ $thumbnail_url = $medium[0];
+ }
+ if ($gal_thumb_size == 'large') {
+ $thumbnail_url = $large[0];
+ }
+ if ($gal_thumb_size == 'full') {
+ $thumbnail_url = $full[0];
+ }
+ ?>
+ <div class="single-image-<?php echo esc_attr($image_gallery_id); ?> <?php echo esc_attr($col_large_desktops); ?> <?php echo esc_attr($col_desktops); ?> <?php echo esc_attr($col_tablets); ?> <?php echo esc_attr($col_phones); ?>">
+ <a href="<?php echo esc_url($full[0]); ?>" data-lightbox="lightbox-<?php echo esc_attr($image_gallery_id); ?>" data-gallery="gallery-<?php echo esc_attr($image_gallery_id); ?>" data-title="<?php echo esc_html($title); ?>">
+ <img class="thumbnail <?php echo esc_attr($image_hover_effect); ?>" src="<?php echo esc_url($thumbnail_url); ?>" alt="<?php echo esc_html($image_alt); ?>">
+ <?php if ($img_title == 0) { ?>
+ <span class="item-title"><?php echo esc_html($title); ?></span>
+ <?php } ?>
+ </a>
+ </div>
+ <?php
+ $count++;
+ } // end of attachment foreach
} else {
- esc_html_e( 'Sorry! No image gallery found.', 'new-image-gallery' );
- echo ": [IMG-Gal id=" . esc_attr( $post_id ) . "]";
+ esc_html_e('Sorry! No image gallery found.', 'new-image-gallery');
+ echo ": [IMG-Gal id=" . esc_attr($post_id) . "]";
} // end of if else of images available check into gallery
?>
</div>
- <?php
+<?php
endwhile;
wp_reset_query();
?>
<script>
-jQuery(document).ready(function () {
- // Method 1 - Initialize Isotope, then trigger layout after each image loads.
- var $grid = jQuery('.all-images-<?php echo esc_js( $image_gallery_id ); ?>').isotope({
- // options...
- itemSelector: '.single-image-<?php echo esc_js( $image_gallery_id ); ?>',
- });
- // layout Isotope after each image loads
- $grid.imagesLoaded().progress( function() {
- $grid.isotope('layout');
- });
-
-
- lightbox.option({
- 'wrapAround': <?php echo esc_js( $igp_loop_st ); ?>,
- })
-
- jQuery(document).on('click', '[data-toggle="lightbox-<?php echo esc_js( $image_gallery_id ); ?>"]', function(event) {
- event.preventDefault();
- jQuery(this).ekkoLightbox();
+ jQuery(document).ready(function() {
+ // Method 1 - Initialize Isotope, then trigger layout after each image loads.
+ var $grid = jQuery('.all-images-<?php echo esc_js($image_gallery_id); ?>').isotope({
+ // options...
+ itemSelector: '.single-image-<?php echo esc_js($image_gallery_id); ?>',
+ });
+ // layout Isotope after each image loads
+ $grid.imagesLoaded().progress(function() {
+ $grid.isotope('layout');
+ });
+
+
+ lightbox.option({
+ 'wrapAround': <?php echo esc_js($igp_loop_st); ?>,
+ })
+
+ jQuery(document).on('click', '[data-toggle="lightbox-<?php echo esc_js($image_gallery_id); ?>"]', function(event) {
+ event.preventDefault();
+ jQuery(this).ekkoLightbox();
+ });
});
-});
-</script>
+</script>
No newline at end of file
--- a/new-image-gallery/include/nig-bootstrap-lightbox.php
+++ b/new-image-gallery/include/nig-bootstrap-lightbox.php
@@ -12,11 +12,14 @@
$loop->the_post();
$post_id = esc_attr(get_the_ID());
- // Check if the data is serialized
- if (is_ig_serialized($decodedData)) {
+ // Retrieve the base64 encoded data
+ $encodedData = get_post_meta($post_id, 'awl_ig_settings_' . $post_id, true);
+ // Decode the base64 encoded data
+ $decodedData = base64_decode($encodedData);
+ // Check if the data is serialized safely
+ $gallery_settings = awl_ig_safe_unserialize($decodedData);
+ if ($gallery_settings !== false) {
- // The data is serialized, so unserialize it
- $gallery_settings = unserialize($decodedData);
// Optionally, convert the unserialized data to JSON and save it back in base64 encoding for future access
// This step is optional but recommended to transition your data format
@@ -26,7 +29,6 @@
// Now, to use the newly saved format, fetch and decode again
$encodedData = get_post_meta($image_gallery_id, 'awl_ig_settings_' . $image_gallery_id, true);
$gallery_settings = json_decode(($encodedData), true);
-
} else {
// Assume the data is in JSON format
@@ -36,7 +38,7 @@
}
count($gallery_settings['slide-ids']);
// start the image gallery contents
- ?>
+?>
<div id="image_gallery_<?php echo esc_attr($image_gallery_id); ?>"
class="row all-images-<?php echo esc_attr($image_gallery_id); ?>">
<?php
@@ -62,10 +64,13 @@
$title = $attachment_details->post_title;
$description = $attachment_details->post_content;
- if (!empty($gallery_settings['slide-alt'][$count])) {
+ if (isset($gallery_settings['slide-alt'][$count]) && !empty($gallery_settings['slide-alt'][$count])) {
$image_alt = $gallery_settings['slide-alt'][$count];
} else {
- $image_alt = $title;
+ $image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
+ if (empty($image_alt)) {
+ $image_alt = $title;
+ }
}
// set thumbnail size
@@ -81,15 +86,14 @@
if ($gal_thumb_size == 'full') {
$thumbnail_url = $full[0];
}
- ?>
+ ?>
<div
class="single-image-<?php echo esc_attr($image_gallery_id); ?> <?php echo esc_attr($col_large_desktops); ?> <?php echo esc_attr($col_desktops); ?> <?php echo esc_attr($col_tablets); ?> <?php echo esc_attr($col_phones); ?>">
<a href="<?php echo esc_url($full[0]); ?>" data-toggle="lightbox-<?php echo esc_attr($image_gallery_id); ?>"
data-gallery="gallery-<?php echo esc_attr($image_gallery_id); ?>"
data-title="<?php echo esc_html($title); ?>">
<img class="thumbnail <?php echo esc_attr($image_hover_effect); ?>"
- src="<?php echo esc_url($thumbnail_url); ?>" alt="<?php echo esc_html($image_alt); ?>"
- alt="<?php echo esc_html($title); ?>">
+ src="<?php echo esc_url($thumbnail_url); ?>" alt="<?php echo esc_html($image_alt); ?>">
<?php if ($img_title == 0) { ?>
<span class="item-title">
<?php echo esc_html($title); ?>
@@ -97,28 +101,28 @@
<?php } ?>
</a>
</div>
- <?php
+ <?php
$count++;
- }// end of attachment foreach
+ } // end of attachment foreach
} else {
esc_html_e('Sorry! No image gallery found.', 'new-image-gallery');
echo ": [IMG-Gal id=" . esc_attr($post_id) . "]";
} // end of if else of images available check into gallery
?>
</div>
- <?php
+<?php
endwhile;
wp_reset_query();
?>
<script>
- jQuery(document).ready(function () {
+ jQuery(document).ready(function() {
// Method 1 - Initialize Isotope, then trigger layout after each image loads.
var $grid = jQuery('.all-images-<?php echo esc_js($image_gallery_id); ?>').isotope({
// options...
itemSelector: '.single-image-<?php echo esc_js($image_gallery_id); ?>',
});
// layout Isotope after each image loads
- $grid.imagesLoaded().progress(function () {
+ $grid.imagesLoaded().progress(function() {
$grid.isotope('layout');
});
@@ -126,8 +130,8 @@
'wrapAround': <?php echo esc_js($igp_loop_st); ?>,
})
});
- jQuery(document).ready(function (jQuery) {
- jQuery(document).on('click', '[data-toggle="lightbox-<?php echo esc_js($image_gallery_id); ?>"]', function (event) {
+ jQuery(document).ready(function(jQuery) {
+ jQuery(document).on('click', '[data-toggle="lightbox-<?php echo esc_js($image_gallery_id); ?>"]', function(event) {
event.preventDefault();
jQuery(this).ekkoLightbox();
});
--- a/new-image-gallery/include/nig-no-lightbox.php
+++ b/new-image-gallery/include/nig-no-lightbox.php
@@ -9,11 +9,14 @@
$loop->the_post();
$post_id = esc_attr(get_the_ID());
- // Check if the data is serialized
- if (is_ig_serialized($decodedData)) {
+ // Retrieve the base64 encoded data
+ $encodedData = get_post_meta($post_id, 'awl_ig_settings_' . $post_id, true);
+ // Decode the base64 encoded data
+ $decodedData = base64_decode($encodedData);
+ // Check if the data is serialized safely
+ $gallery_settings = awl_ig_safe_unserialize($decodedData);
+ if ($gallery_settings !== false) {
- // The data is serialized, so unserialize it
- $gallery_settings = unserialize($decodedData);
// Optionally, convert the unserialized data to JSON and save it back in base64 encoding for future access
// This step is optional but recommended to transition your data format
@@ -23,7 +26,6 @@
// Now, to use the newly saved format, fetch and decode again
$encodedData = get_post_meta($image_gallery_id, 'awl_ig_settings_' . $image_gallery_id, true);
$gallery_settings = json_decode(($encodedData), true);
-
} else {
// Assume the data is in JSON format
@@ -33,7 +35,7 @@
}
count($gallery_settings['slide-ids']);
// start the image gallery contents
- ?>
+?>
<div id="image_gallery_<?php echo esc_attr($image_gallery_id); ?>" class="row all-images">
<?php
if (isset($gallery_settings['slide-ids']) && count($gallery_settings['slide-ids']) > 0) {
@@ -58,10 +60,13 @@
$title = $attachment_details->post_title;
$description = $attachment_details->post_content;
- if (!empty($gallery_settings['slide-alt'][$count])) {
+ if (isset($gallery_settings['slide-alt'][$count]) && !empty($gallery_settings['slide-alt'][$count])) {
$image_alt = $gallery_settings['slide-alt'][$count];
} else {
- $image_alt = $title;
+ $image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
+ if (empty($image_alt)) {
+ $image_alt = $title;
+ }
}
// set thumbnail size
@@ -77,40 +82,39 @@
if ($gal_thumb_size == 'full') {
$thumbnail_url = $full[0];
}
- ?>
+ ?>
<div
class="single-image <?php echo esc_attr($col_large_desktops); ?> <?php echo esc_attr($col_desktops); ?> <?php echo esc_attr($col_tablets); ?> <?php echo esc_attr($col_phones); ?>">
<img class="thumbnail <?php echo esc_attr($image_hover_effect); ?>"
- src="<?php echo esc_url($thumbnail_url); ?>" alt="<?php echo esc_html($image_alt); ?>"
- alt="<?php echo esc_html($title); ?>">
+ src="<?php echo esc_url($thumbnail_url); ?>" alt="<?php echo esc_html($image_alt); ?>">
<?php if ($img_title == 0) { ?>
<span class="item-title">
<?php echo esc_html($title); ?>
</span>
<?php } ?>
</div>
- <?php
+ <?php
$count++;
- }// end of attachment foreach
+ } // end of attachment foreach
} else {
esc_html_e('Sorry! No image gallery found.', 'new-image-gallery');
echo ": [IMG-Gal id=" . esc_attr($post_id) . "]";
} // end of if esle of slides avaialble check into slider
?>
</div>
- <?php
+<?php
endwhile;
wp_reset_query();
?>
<script>
- jQuery(document).ready(function () {
+ jQuery(document).ready(function() {
// Method 1 - Initialize Isotope, then trigger layout after each image loads.
var $grid = jQuery('.all-images').isotope({
// options...
itemSelector: '.single-image',
});
// layout Isotope after each image loads
- $grid.imagesLoaded().progress(function () {
+ $grid.imagesLoaded().progress(function() {
$grid.isotope('layout');
});
--- a/new-image-gallery/include/shortcode.php
+++ b/new-image-gallery/include/shortcode.php
@@ -1,4 +1,5 @@
<?php
+
/**
* Slider Responsive Premium Shortcode
*
@@ -9,10 +10,6 @@
*/
add_shortcode('IMG-Gal', 'awl_image_gallery_shortcode');
-function is_ig_serialized($str) {
- return ($str == serialize(false) || @unserialize($str) !== false);
-}
-
function awl_image_gallery_shortcode($post_id)
{
ob_start();
@@ -33,11 +30,10 @@
// Decode the base64 encoded data
$decodedData = base64_decode($encodedData);
- // Check if the data is serialized
- if (is_ig_serialized($decodedData)) {
+ // Check if the data is serialized safely
+ $gallery_settings = awl_ig_safe_unserialize($decodedData);
+ if ($gallery_settings !== false) {
- // The data is serialized, so unserialize it
- $gallery_settings = unserialize($decodedData);
// Optionally, convert the unserialized data to JSON and save it back in base64 encoding for future access
// This step is optional but recommended to transition your data format
@@ -47,7 +43,6 @@
// Now, to use the newly saved format, fetch and decode again
$encodedData = get_post_meta($image_gallery_id, 'awl_ig_settings_' . $image_gallery_id, true);
$gallery_settings = json_decode(($encodedData), true);
-
} else {
// Assume the data is in JSON format
@@ -129,7 +124,7 @@
} else {
$slide_alt = '';
}
- ?>
+?>
<!-- CSS Part Start From Here-->
<style>
.all-images {
@@ -145,55 +140,9 @@
margin-bottom: 20px !important;
}
- <?php if ($no_spacing) { ?>
- #image_gallery_<?php echo esc_html($image_gallery_id); ?> .col-xs-1,
- .col-sm-1,
- .col-md-1,
- .col-lg-1,
- .col-xs-2,
- .col-sm-2,
- .col-md-2,
- .col-lg-2,
- .col-xs-3,
- .col-sm-3,
- .col-md-3,
- .col-lg-3,
- .col-xs-4,
- .col-sm-4,
- .col-md-4,
- .col-lg-4,
- .col-xs-5,
- .col-sm-5,
- .col-md-5,
- .col-lg-5,
- .col-xs-6,
- .col-sm-6,
- .col-md-6,
- .col-lg-6,
- .col-xs-7,
- .col-sm-7,
- .col-md-7,
- .col-lg-7,
- .col-xs-8,
- .col-sm-8,
- .col-md-8,
- .col-lg-8,
- .col-xs-9,
- .col-sm-9,
- .col-md-9,
- .col-lg-9,
- .col-xs-10,
- .col-sm-10,
- .col-md-10,
- .col-lg-10,
- .col-xs-11,
- .col-sm-11,
- .col-md-11,
- .col-lg-11,
- .col-xs-12,
- .col-sm-12,
- .col-md-12,
- .col-lg-12 {
+ <?php
+ if ($no_spacing) { ?>
+ #image_gallery_<?php echo esc_html($image_gallery_id); ?> .single-image-<?php echo esc_html($image_gallery_id); ?> {
padding-right: 0px !important;
padding-left: 0px !important;
}
@@ -204,7 +153,8 @@
border: 0px !important;
}
- <?php } ?>
+ <?php
+ } ?>
.item-title {
background-color: rgba(0, 0, 0, 0.5);
bottom: 45px;
@@ -221,7 +171,7 @@
<?php echo esc_html($custom_css); ?>
</style>
- <?php
+<?php
// load without lightbox gallery output
if ($light_box == 0) {
require 'nig-no-lightbox.php';
@@ -234,7 +184,7 @@
if ($light_box == 4) {
require 'ig-ld-lightbox.php';
}
-
+
wp_reset_query();
return ob_get_clean();
}
--- a/new-image-gallery/new-image-gallery.php
+++ b/new-image-gallery/new-image-gallery.php
@@ -1,10 +1,11 @@
<?php
+
/**
@package New Image Gallery
Plugin Name: New Image Gallery
Plugin URI: http://awplife.com/
Description: The best image gallery plugin with responsive design multiple columns lightbox preview.
-Version: 1.6.0
+Version: 1.6.1
Author: A WP Life
Author URI: https://awplife.com/
Text Domain: new-image-gallery
@@ -25,6 +26,25 @@
along with New Image Gallery. If not, see https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html.
*/
+if (!function_exists('awl_ig_safe_unserialize')) {
+ function awl_ig_safe_unserialize($serialized_data)
+ {
+ if (!is_serialized($serialized_data)) {
+ return false;
+ }
+ // Prevent PHP Object Injection: Fail if serialized string contains objects (O:...)
+ if (preg_match('/(^|;)O:d+:/', $serialized_data)) {
+ return false;
+ }
+ // PHP 7.0+ supports allowed_classes
+ if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
+ return @unserialize($serialized_data, array('allowed_classes' => false));
+ } else {
+ return @unserialize($serialized_data);
+ }
+ }
+}
+
if (!class_exists('New_Image_Gallery')) {
class New_Image_Gallery
@@ -42,7 +62,7 @@
protected function _constants()
{
// Plugin Version
- define('IG_PLUGIN_VER', '1.6.0');
+ define('IG_PLUGIN_VER', '1.6.1');
// Plugin Text Domain
define('IGP_TXTDM', 'new-image-gallery');
@@ -62,7 +82,6 @@
* @uses NONCE_KEY Defined in the WP root config.php
*/
define('IG_SECURE_KEY', md5(NONCE_KEY));
-
} // end of constructor function
@@ -108,7 +127,6 @@
add_action('manage_image_gallery_posts_custom_column', array(&$this, 'custom_image_gallery_shodrcode_data'), 10, 2);
add_action('wp_enqueue_scripts', array(&$this, 'image_enqueue_scripts_in_header'));
-
} // end of hook function
public function image_enqueue_scripts_in_header()
@@ -232,7 +250,6 @@
'capability_type' => 'page',
);
register_post_type('image_gallery', $args);
-
} // end of post type function
/**
@@ -275,6 +292,7 @@
</style>
<script>
jQuery("#igm-copy-code").hide();
+
function copyToClipboard(element) {
var $temp = jQuery("<input>");
jQuery("body").append($temp);
@@ -285,13 +303,13 @@
jQuery("#igm-copy-code").fadeIn();
}
</script>
- <?php
+ <?php
}
// meta rate us
public function ig_rate_plugin()
{
- ?>
+ ?>
<div style="text-align:center">
<p>If you like our plugin then please <b>Rate us</b> on WordPress</p>
</div>
@@ -308,7 +326,7 @@
class="button button-primary button-large" style="background: #496481; text-shadow: none;"><span
class="dashicons dashicons-heart" style="line-height:1.4;"></span> Please Rate Us</a>
</div>
- <?php
+ <?php
}
public function ig_upload_multiple_images($post)
@@ -317,7 +335,7 @@
wp_enqueue_script('awl-ig-uploader.js', IG_PLUGIN_URL . 'assets/js/awl-ig-uploader.js', array('jquery'));
wp_enqueue_style('awl-ig-uploader-css', IG_PLUGIN_URL . 'assets/css/awl-ig-uploader.css');
wp_enqueue_media();
- ?>
+ ?>
<div class="row">
<!--Add New Image Button-->
<div class="file-upload">
@@ -327,7 +345,7 @@
<div class="drag-text">
<h3>
<?php esc_html_e('ADD IMAGES', 'new-image-gallery'); ?>
- <?php wp_nonce_field( 'igp_add_images', 'igp_add_images_nonce' ); ?>
+ <?php wp_nonce_field('igp_add_images', 'igp_add_images_nonce'); ?>
</h3>
</div>
</div>
@@ -336,7 +354,7 @@
<div style="clear:left;"></div>
- <?php
+ <?php
require_once 'include/gallery-settings.php';
} // end of upload multiple image
@@ -347,7 +365,7 @@
// thumb, thumbnail, medium, large, post-thumbnail
$thumbnail = wp_get_attachment_image_src($id, 'medium', true);
$attachment = get_post($id); // $id = attachment id
- ?>
+ ?>
<li class="slide">
<img class="new-slide" src="<?php echo esc_url($thumbnail[0]); ?>"
alt="<?php echo esc_html(get_the_title($id)); ?>" style="height: 150px; width: 98%; border-radius: 8px;">
@@ -361,14 +379,14 @@
<a class="pw-trash-icon" name="remove-slide" id="remove-slide" href="#"><span
class="dashicons dashicons-trash"></span></a>
</li>
- <?php
+<?php
}
public function _ajax_image_gallery()
{
if (current_user_can('manage_options')) {
if (isset($_POST['igp_add_images_nonce']) && wp_verify_nonce($_POST['igp_add_images_nonce'], 'igp_add_images')) {
- echo esc_attr($this->_ig_ajax_callback_function($_POST['slideId']));
+ echo $this->_ig_ajax_callback_function($_POST['slideId']);
} else {
print 'Sorry, your nonce did not verify.';
exit;
@@ -399,15 +417,16 @@
$image_ids = array();
$image_titles = array();
+ $image_alt = array();
$image_ids_val = isset($_POST['slide-ids']) ? (array) $_POST['slide-ids'] : array();
$image_ids_val = array_map('sanitize_text_field', $image_ids_val);
foreach ($image_ids_val as $image_id) {
- $image_ids[] = sanitize_text_field($_POST['slide-ids'][$i]);
- $image_titles[] = sanitize_text_field($_POST['slide-title'][$i]);
- $image_alt[] = sanitize_text_field($_POST['slide-alt'][$i]);
+ $image_ids[] = sanitize_text_field(isset($_POST['slide-ids'][$i]) ? $_POST['slide-ids'][$i] : '');
+ $image_titles[] = sanitize_text_field(isset($_POST['slide-title'][$i]) ? $_POST['slide-title'][$i] : '');
+ $image_alt[] = sanitize_text_field(isset($_POST['slide-alt'][$i]) ? $_POST['slide-alt'][$i] : '');
$single_image_update = array(
'ID' => $image_id,
@@ -465,7 +484,6 @@
{
require_once 'our-theme/awp-theme.php';
}
-
} // end of class
// register sf scripts
@@ -485,7 +503,6 @@
wp_register_style('awl-bootstrap-lightbox-css', plugin_dir_url(__FILE__) . 'include/lightbox/bootstrap/css/ekko-lightbox.css');
wp_register_script('awl-bootstrap-lightbox-js', plugin_dir_url(__FILE__) . 'include/lightbox/bootstrap/js/ekko-lightbox.js');
-
}
add_action('wp_enqueue_scripts', 'awplife_igp_register_scripts');
@@ -523,6 +540,5 @@
$ig_gallery_object = new New_Image_Gallery();
require_once 'include/shortcode.php';
require_once 'class-tgm-plugin-activation.php';
-
} // end of class exists
?>
No newline at end of file