Plugin Directory

Changeset 3325832


Ignore:
Timestamp:
07/10/2025 04:40:10 PM (7 months ago)
Author:
realwebcare
Message:

Committing Responsive Portfolio Image Gallery v1.3

Location:
responsive-portfolio-image-gallery/trunk
Files:
21 added
13 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • responsive-portfolio-image-gallery/trunk/readme.txt

    r2952694 r3325832  
    1 === Portfolio Gallery - Photo Gallery and Image Gallery ===
     1=== Responsive Portfolio Image Gallery - Portfolio Gallery ===
    22Contributors: realwebcare
    3 Requires at least: 4.7
    4 Tested up to: 6.3
    5 Tags: responsive image gallery, responsive photo gallery, portfolio image gallery, portfolio photo gallery, photo album, lightweight image gallery, css3 image gallery, best gallery, grid portfolio, jquery portfolio, portfolio, portfolio gallery, portfolio image, responsive gallery, wordpress photo gallery plugin, wordpress responsive gallery, wp gallery, wp gallery plugin
     3Requires at least: 5.2
     4Tested up to: 6.8
     5Tags: responsive image gallery, grid portfolio, photo album, portfolio, responsive gallery
    66Stable Tag: 1.2
     7Requires PHP: 7.4
     8Donate link: https://www.realwebcare.com/billing/store/support/donation
    79License: GPLv2 or later
    810License URI: http://www.gnu.org/licenses/gpl-2.0.html
    911
    10 Build powerful, lightweight, filterable, responsive portfolio gallery or image gallery on different posts or pages by SHORTCODE.
    11 
    12 
    13 == Description ==
    14 
    15 = Responsive Portfolio Image Gallery =
    16 
    17 Portfolio Gallery is a powerful, lightweight, filterable, and responsive image/photo gallery plugin. The aim is to showcase your images/photos in a much more professional way. Using WordPress Post Editor, you can create as many portfolios as you like. There is a powerful settings tool in the plugin. By using portfolio settings, you can select the portfolio categories of your choice, you can set the description length, the number of portfolios to show, hover and filter effect, and lots more...
    18 
    19 The portfolio plugin represents image thumbnails using many CSS3 hover and filter effects. By clicking on a thumbnail, it will expand a preview box and display a larger image of that thumbnail. Also, show more carousel images related to the displayed portfolio! It will also feature some other content like titles, descriptions, and link buttons. Using a simple SHORTCODE on different posts or pages, you can showcase your portfolios in a smart way.
    20 
    21 
    22 = Portfolio Gallery DEMO =
    23 Free Version: **[DEMO](https://www.realwebcare.com/demo/responsive-portfolio-image-gallery-free/)**.
    24 Pro Version: **[DEMO](https://www.realwebcare.com/demo/plugins?theme=portfolio-image-gallery)**.
    25 
    26 
    27 = Attention for Version 1.1 =
    28 * In the earlier version, you had to exclude the portfolio categories. From version 1.1, you have to include the portfolio galleries. That's means, only selected categories will appear in the portfolio gallery lists.
    29 
    30 
    31 = Attention =
    32 * You must have to set featured image for the portfolios. Portfolio thumbnails are generating by this image.
    33 * You cannot select more than one category for each portfolio. The free version of the plugin support only one category per portfolio.
    34 
     12A powerful and lightweight WordPress plugin for creating responsive, filterable image or portfolio galleries using `[shortcode]`.
     13
     14== Description ==
     15
     16[FREE VERSION DEMO](https://www.realwebcare.com/demo/responsive-portfolio-image-gallery-free/) | [PRO VERSION DEMO](https://www.realwebcare.com/demo/plugins/?product_id=responsive-portfolio-gallery) | [EXPLORE PRO](https://www.realwebcare.com/item/responsive-portfolio-image-gallery-pro/) | [CONTACT US](https://www.realwebcare.com/billing/submitticket.php?step=2&deptid=6)
     17
     18**Responsive Portfolio Image Gallery** is a lightweight yet powerful plugin designed to help you display your portfolios in a modern, organized, and responsive layout. Whether you're a photographer, designer, or creative professional, this plugin allows you to build beautiful grid-style portfolio galleries with a filterable interface using WordPress posts and `[shortcode]`.
     19
     20Each portfolio item uses the featured image for its thumbnail, which opens up a stunning preview area displaying a larger version, along with optional titles, descriptions, buttons, and a related carousel.
     21
     22Customize the look and feel using the built-in settings panel - choose hover effects, filter animations, the number of posts to show, and much more.
     23
     24Use simple `[shortcode]` to place your gallery anywhere on your website.
     25
     26== Important Notes ==
     27* A featured image must be set for each portfolio item.
    3528
    3629<blockquote>
    37 <h4>Upgrade to Premium</h4>
    38 <p>The premium version includes lot of new hover and filter effects, colors and customization options with dedicated support.</p>
    39 <p><strong>Key features of Pro version:</strong></p>
     30<h4>Unlock more advanced features by upgrading to the Pro version:</h4>
    4031<ul>
    41 <li>Unlimited galleries with unlimited color schemes for each gallery.</li>
    42 <li>HTML tag allowed in the expanded preview mode's description area.</li>
    43 <li>Duplicate any Gallery rather than resetting a new one.</li>
    44 <li>Import/Export (Backup) portfolios and each gallery configurations</li>
    45 <li>More attractive hover and filter effects</li>
    46 <li>Buttons can be created as many as possible</li>
     32<li>Create unlimited galleries with unique styles</li>
     33<li>Add unlimited buttons in preview area</li>
     34<li>Duplicate any Portfolio rather than resetting a new one.</li>
     35<li>Backup and import/export settings</li>
     36<li>More attractive hover and filter animations</li>
    4737<li>Google Fonts support</li>
    4838<li>YouTube and Vimeo video support</li>
    49 <li>More than one categories can be selected for each portfolios.</li>
    50 <li>Preview each gallery in the admin panel.</li>
    51 <li>Easy Documentation</li>
    52 <li>Dedicated support for 24/7</li>
     39<li>Assign multiple categories per portfolio</li>
     40<li>Admin preview of each gallery</li>
    5341</ul>
    54 <p><a href="https://www.realwebcare.com/item/responsive-portfolio-image-gallery-pro/">View more Premium features</a></p>
     42<p><a href="https://www.realwebcare.com/item/responsive-portfolio-image-gallery-pro/">Explore Pro Features</a></p>
    5543</blockquote>
    5644
    57 
    58 = Pro Version Video DEMO =
    59 [youtube https://www.youtube.com/watch?v=4B1bbiBdtJg]
    60 
    61 
    62 = Features =
     45== Pro Version Video DEMO ==
     46https://youtu.be/4B1bbiBdtJg
     47
     48== Key Features ==
    6349
    6450* Responsive for all devices
    65 * Easy to use
    66 * Custom Post Type and Custom Taxonomy supported
    67 * 2 color schemes, Dark and Light
    68 * Set how many post to show
    69 * Image thumbnails can be shown as ascending or descending order
    70 * Image thumbnails can also be sorted by post date, name and ID
    71 * Width and height of the image thumbnail can be adjusted
    72 * Exclude selected taxonomies form portfolio
    73 * Several filters and hover effects for image thumbnails
    74 * Portfolio title and description will be shown on expanding preview
     51* Lightweight and fast-loading
     52* Built with custom post types and taxonomies
     53* Two built-in themes: `Light` and `Dark`
     54* Set the number of items and description length
     55* Sort portfolios by `date`, `name`, or `ID`
     56* Customize thumbnail `width` and `height`
     57* Choose from several hover and filter effects
     58* Display carousel of related images
     59* Hide/show description and carousel
    7560* Portfolio description can be hidden
    76 * Number of words to show for portfolio description is adjustable
    7761* Height of the expanding preview and carousel wrapper is adjustable
    78 * Multiple image carousel can be hidden
    79 * Custom CSS supported
    80 * Multiple language supported
    81 * Implement by Shortcode
    82 * All major browser supported
    83 
    84 
    85 = Custom Post & Custom Taxonomy =
    86 Custom Post will ensure all your portfolios to kept in a single post type. In this way, you can distinguish your portfolios from other post types. Taxonomies will categorize your portfolios. This will help you to organize your portfolios.
    87 
    88 
    89 = 2 color schemes in style =
     62* Enable custom CSS
     63* Shortcode-based implementation
     64* Fully compatible with all modern browsers
     65
     66== Custom Post Type &amp; Taxonomy ==
     67Portfolios are managed as a dedicated custom post type with their own taxonomy. This structure ensures easy organization and separation from other content types.
     68
     69== Two color schemes in style ==
    9070There are two color variations for the portfolio gallery plugin, dark and light. You can switch between them and load one up which is suitable for your website.
    9171
    92 
    93 = Filter effects for portfolio thumbnails =
    94 Filtering image thumbnails with effects is a great way to organize your portfolios. The plugin allows you to filter portfolio thumbnails by categories using CSS-based animations.
    95 
    96 
    97 = Hover Effects by CSS 3D Transforms =
    98 The power of CSS3 is enormous and a smart choice to present your portfolio items in a very creative way. The plugin lets you create thumbnails of your portfolio using animation & transition effects.
    99 
    100 
    101 = Thumbnail Grid with Expanding Preview =
    102 By clicking on a thumbnail, the plugin displays the larger image in an expanding preview box. It displays some other content like titles, descriptions, link buttons, and carousel images.
    103 
    104 
    105 = Custom CSS support =
    106 The portfolio gallery plugin has a custom CSS box. You can add all your custom CSS there to avoid modifying the core plugin files. Since that'll make upgrading the plugin problematic. Your custom CSS will come after the plugin's stylesheets. That means your rules will take precedence.
    107 
    108 
    109 = Credits =
    110 
    111 * [Classie - class helper functions](https://github.com/ded/bonzo) by bonzo
    112 * [Direction Aware Hover Effect](http://tympanus.net/codrops/2012/04/09/direction-aware-hover-effect-with-css3-and-jquery/) by Codrops
    113 * [Thumbnail Grid with Expanding Preview](http://tympanus.net/codrops/2013/03/19/thumbnail-grid-with-expanding-preview/) by Codrops
    114 * [Elastislide](http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/) by Codrops
    115 * Presented By: [Real Web Care](https://www.realwebcare.com/)
    116 * [Facebook Page](https://www.facebook.com/realwebcare)
    117 
     72== Hover &amp; Filter Effects ==
     73Add visual appeal with a wide variety of CSS-based hover and filter animations. Let users easily navigate your gallery by filtering items based on categories.
     74
     75== Expanding Preview Panel ==
     76When a thumbnail is clicked, a clean, expandable preview opens with more details including a large image, title, description, buttons, and related carousel.
     77
     78== Custom CSS Support ==
     79Add your own styles directly from the plugin settings panel. Your rules will override the default styles without needing to modify plugin files.
     80
     81== Frequently Asked Questions ==
     82
     83= How do I create a portfolio gallery? =
     84Create portfolio items under the Portfolio post type by assigning them to appropriate categories and setting featured images. After that, go to the `Generate Portfolio` section from the admin menu. There, you can create a new gallery by including the categories you want to display. Once generated, use the `[shortcode]` from the right sidebar on any post or page to showcase your gallery.
     85
     86= How do I display the gallery on a page? =
     87Use the `[shortcode]` provided by the plugin. Example: `[rpgal-gallery]`. The free version supports one gallery per page.
     88
     89= Can I add multiple categories to a portfolio item? =
     90In the free version, each portfolio can be assigned to only **one category**. For multiple categories per portfolio, please upgrade to the Pro version.
     91
     92= Do I need to set featured images for portfolio items? =
     93Yes. The featured image is used to generate the thumbnail for each portfolio item. Without a featured image, it won’t appear in the gallery.
     94
     95= How do I customize the hover and filter effects? =
     96Go to the `Generate Portfolio >> Advance Settings` page. You’ll find options for selecting different hover effects, filter styles, direction, and animation types.
     97
     98= Is it possible to hide the portfolio description or carousel? =
     99Yes. You can hide both the description and the carousel from the settings panel in the admin area.
     100
     101= Can I add custom CSS to style my gallery? =
     102Absolutely. There’s a Custom CSS box in the settings where you can add your own styles. Your CSS will override the default plugin styles.
     103
     104= Why aren’t my galleries showing after updating? =
     105Please make sure to include the portfolio categories (instead of excluding them, as in earlier versions). This change was introduced in version 1.1.
     106
     107= How do I add buttons in the preview section? =
     108In the free version, each portfolio supports a default button with text and link. In the Pro version, you can add unlimited buttons with custom labels, links, and open in new tab options.
     109
     110= Is this plugin compatible with the latest WordPress version? =
     111Yes. The plugin is regularly tested and updated to maintain full compatibility with the latest versions of WordPress.
     112
     113== Migration Notes for Version 1.3 ==
     114
     115**Version 1.3** is a major update with internal changes that may affect users upgrading from older versions. We've made structural improvements for better performance and flexibility, which means certain elements have been renamed or migrated.
     116
     117**Don't worry - most changes are applied automatically through the version checker method.**
     118
     119However, please visit `Portfolio → Guide` in your WordPress dashboard for detailed upgrade instructions.
     120
     121=== What You Should Do ===
     122
     123- ✅ **Shortcodes**: Go to the pages/posts where you added `[rcpig-gallery]` and replace them with `[rpgal-gallery]`.
     124- ✅ **Post Type Visibility**: If your portfolios are missing, go to your dashboard > Portfolios, and ensure items are listed under the new `rpgal` post type.
     125- ✅ **Check Gallery Settings**: Visit the `Generate Portfolio` section to confirm your included categories are set correctly.
     126- ✅ **Custom Button Data**: If you previously used buttons in your preview, confirm that they appear as expected. If not, re-enter them using the new fields.
     127
     128We’ve tried to make this transition as seamless as possible. However, if you notice anything missing or broken, re-saving your portfolio settings or re-adding buttons under the new structure usually resolves the issue. If you need help, you can contact us at anytime.
     129
     130== Upgrade Notice ==
     131
     132= 1.3 =
     133This is a major update with a fully redesigned admin UI, enhanced security, bug fixes, and improved compatibility. A new "Plain Text" preview mode is added, and older plugin options and post meta are migrated automatically. Please back up your site before upgrading.
    118134
    119135== Changelog ==
     136
     137= 1.3 (10th July 2025) =
     138* 13th major release.
     139* `NEW:` Option to display preview content as plain text or styled HTML.
     140* `ENHANCED:` Entire admin interface redesigned with a cleaner, modern look.
     141* `ENHANCED:` Improved codebase security and compliance with WP standards.
     142* `IMPROVED:` Carousel logic now skips empty image sets—no blank sliders.
     143* `FIXED:` Resolved all known JS and CSS conflicts.
     144* `COMPATIBILITY:` Verified and compatible with the latest WordPress version.
     145* `REFACTORED:` Complete migration to OOP for better structure.
     146* `NEW:` Help page added with plugin usage documentation.
    120147
    121148= 1.2 (30th April 2022) =
     
    170197* 1st release.
    171198
     199== Credits ==
     200
     201* [Classie – class helper functions](https://github.com/ded/bonzo) by bonzo
     202* [Direction Aware Hover Effect](http://tympanus.net/codrops/2012/04/09/direction-aware-hover-effect-with-css3-and-jquery/) by Codrops
     203* [Thumbnail Grid with Expanding Preview](http://tympanus.net/codrops/2013/03/19/thumbnail-grid-with-expanding-preview/) by Codrops
     204* [Elastislide](http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/) by Codrops
     205* Presented By: [Realwebcare](https://www.realwebcare.com/)
     206* [Facebook Page](https://www.facebook.com/realwebcare)
     207
    172208
    173209== Installation ==
    174210
    175 Installing Responsive Portfolio Image Gallery Plugin is as simple as installing any other WordPress Plugin
    176 
    177 1. Log In as an Admin on your WordPress blog.
    178 2. In the menu displayed on the left, there is a "Plugins" tab. Click it.
    179 3. Now click "Add New".
    180 4. There, you have the buttons: "Upload Plugin". Click it.
    181 5. Upload the responsive-portfolio-image-gallery.zip file and click Install Now button.
    182 6. After the installation is finished, click Activate Plugin.
    183 
    184 
    185 == License ==
    186 
    187     This program is free software; you can redistribute it and/or modify
    188     it under the terms of the GNU General Public License as published by
    189     the Free Software Foundation; either version 2 of the License, or
    190     (at your option) any later version.
    191 
    192     This program is distributed in the hope that it will be useful,
    193     but WITHOUT ANY WARRANTY; without even the implied warranty of
    194     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    195     GNU General Public License for more details.
    196 
    197     You should have received a copy of the GNU General Public License
    198     along with this program; if not, write to the Free Software
    199     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    200 
     211Responsive Portfolio Image Gallery can be installed in two convenient ways: manually or directly from the WordPress plugin directory.
     212
     213**Manual Installation:**
     2141. Log in to your WordPress admin dashboard.
     2152. Navigate to "Plugins" in the left menu and click "Add New."
     2163. Click "Upload Plugin" and choose the responsive-portfolio-image-gallery.zip file. Click "Install Now."
     2174. Once installed, activate the plugin.
     2185. Create your portfolio items and use the `[shortcode]` on any post/page.
     219
     220**Installation from WordPress Plugin Directory:**
     2211. Log in to your WordPress admin dashboard.
     2222. In the left menu, click "Plugins," then select "Add New."
     2233. In the search field, type "Responsive Portfolio Image Gallery Realwebcare".
     2244. Locate the plugin in the search results and click the "Install Now" button.
     2255. After installation, activate the plugin.
     2266. Create your portfolio items and use the `[shortcode]` on any post/page.
    201227
    202228== Screenshots ==
  • responsive-portfolio-image-gallery/trunk/responsive-gallery.php

    r2952694 r3325832  
    11<?php
    2 /*
    3 Plugin Name: Responsive Portfolio Image Gallery
    4 Plugin URI: http://wordpress.org/plugins/responsive-portfolio-image-gallery/
    5 Description: Responsive image gallery plugin to build powerful, lightweight, filterable portfolio galleries on different posts or pages by SHORTCODE.
    6 Version: 1.2
    7 Author: Realwebcare
    8 Author URI: https://www.realwebcare.com/
    9 Text Domain: rcpig
    10 Domain Path: /languages/
    11 */
    12 
    13 /*  Copyright 2023  Realwebcare  (email : [email protected])
    14 
    15     This program is free software; you can redistribute it and/or modify
    16     it under the terms of the GNU General Public License, version 2, as
    17     published by the Free Software Foundation.
    18 
    19     This program is distributed in the hope that it will be useful,
    20     but WITHOUT ANY WARRANTY; without even the implied warranty of
    21     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22     GNU General Public License for more details.
    23 
    24     You should have received a copy of the GNU General Public License
    25     along with this program; if not, write to the Free Software
    26     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    27 */
    28 
    29 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    30 define('RCPIG_PLUGIN_PATH', plugin_dir_path( __FILE__ ));
    31 
    32 /* Internationalization */
    33 function rcpig_textdomain() {
    34     $domain = 'rcpig';
    35     $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
    36     load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
    37     load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
     2/**
     3 * Plugin Name:         Responsive Portfolio Image Gallery - Portfolio Gallery
     4 * Plugin URI:          https://wordpress.org/plugins/responsive-portfolio-image-gallery/
     5 * Description:         Responsive image gallery plugin to build powerful, lightweight, filterable portfolio galleries on different posts or pages by SHORTCODE.
     6 * Version:             1.3
     7 * Requires at least:   5.2
     8 * Requires PHP:        7.4
     9 * Author:              Realwebcare
     10 * Author URI:          https://www.realwebcare.com/
     11 * Text Domain:         responsive-portfolio-image-gallery
     12 * Domain Path:         /languages
     13 * License:             GPL v2 or later
     14 * License URI:         http://www.gnu.org/licenses/gpl-2.0.html
     15 */
     16
     17if (!defined('ABSPATH')) {
     18    exit; // Exit if accessed directly
    3819}
    39 add_action( 'init', 'rcpig_textdomain' );
    40 
    41 /* Add plugin action links */
    42 function rcpig_plugin_actions( $links ) {
    43     $links[] = '<a href="'.menu_page_url('rcpig-settings', false).'">'. __('Settings','rcpig') .'</a>';
    44     return $links;
    45 }
    46 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'rcpig_plugin_actions' );
    47 
    48 /* Enqueue front js and css files */
    49 function rcpig_scripts() {
    50     $rcpig_enable = rcpig_get_option( 'rcpig_enable_portfolio_', 'rcpig_general', 'show' );
    51     $rcpig_css_style = rcpig_get_option( 'rcpig_css_style_', 'rcpig_style', 'light' );
    52     if($rcpig_enable == 'show') {
    53         wp_register_script('rcpig-modernizr', plugins_url( '/assets/js/modernizr.custom.js', __FILE__ ), array('jquery'), '2.6.2', false);
    54         wp_register_script('rcpig-grid-js', plugins_url( '/assets/js/rcpig_grid.min.js', __FILE__ ), array('jquery'), '1.2', false);
    55         wp_enqueue_script('rcpig-modernizr');
    56         wp_enqueue_script('rcpig-grid-js');
    57         if($rcpig_css_style == 'light') {
    58             wp_enqueue_style('rcpig-grid-light', plugins_url('/assets/css/rcpig_grid_light.css', __FILE__),'','1.2');
    59         } else {
    60             wp_enqueue_style('rcpig-grid-dark', plugins_url('/assets/css/rcpig_grid_dark.css', __FILE__),'','1.2');
     20
     21if (!class_exists('RPGAL_Index')) {
     22    class RPGAL_Index
     23    {
     24
     25        private static $instance;
     26        private function __construct()
     27        {
     28            // Check plugin version older than 1.3
     29            add_action('plugins_loaded', array($this, 'rpgal_check_version'));
     30
     31            // Define plugin-specific constants.
     32            $this->define_constants();
     33
     34            // Load necessary required files.
     35            $this->required_files();
     36        }
     37
     38        public static function get_instances()
     39        {
     40            if (self::$instance) {
     41                return self::$instance;
     42            }
     43
     44            self::$instance = new self();
     45
     46            return self::$instance;
     47        }
     48
     49        /**
     50         * Checks and updates plugin options if the installed version is lower than the required version.
     51         *
     52         * This function runs when the plugin is loaded. If the stored plugin version is older than
     53         * the specified version (1.3), it migrates existing options to the new format and updates
     54         * the version in the database to prevent re-running the migration in future updates.
     55         *
     56         * @return void
     57         */
     58        public function rpgal_check_version()
     59        {
     60            $current_version = '1.3'; // Set the new version
     61            $saved_version = get_option('rpgal_plugin_version', ''); // Get stored version
     62
     63            // Only run migration for versions below 1.3
     64            if (empty($saved_version) || version_compare($saved_version, '1.3', '<')) {
     65                // Step 1: Migrate options
     66                $old_version_general = get_option('rcpig_general', []);
     67                $old_version_advance = get_option('rcpig_advanced', []);
     68                $old_version_style = get_option('rcpig_style', []);
     69
     70                // Define option mappings: old_key => [new_option_group, new_key]
     71                $option_mappings = array(
     72                    // General Options
     73                    'rcpig_enable_portfolio_' => ['rpgal_general', 'rpgal_enable'],
     74                    'rcpig_cat_include_' => ['rpgal_general', 'rpgal_categories'],
     75                    'rcpig_number_of_post_' => ['rpgal_general', 'rpgal_postno'],
     76                    'rcpig_post_order_' => ['rpgal_general', 'rpgal_postorder'],
     77                    'rcpig_post_order_by_' => ['rpgal_general', 'rpgal_postorder_by'],
     78                    'rcpig_show_plain_' => ['rpgal_general', 'rpgal_show_plain'],
     79                    'rcpig_excerpt_length_' => ['rpgal_general', 'rpgal_excerpt_ln'],
     80                    'rcpig_image_width_' => ['rpgal_general', 'rpgal_img_width'],
     81                    'rcpig_image_height_' => ['rpgal_general', 'rpgal_img_height'],
     82                    // Advanced Options
     83                    'rcpig_filter_effect_' => ['rpgal_advanced', 'rpgal_filter_effect'],
     84                    'rcpig_hover_direction_' => ['rpgal_advanced', 'rpgal_hover_dir'],
     85                    'rcpig_hover_inverse_' => ['rpgal_advanced', 'rpgal_hover_inv'],
     86                    'rcpig_hover_effect_' => ['rpgal_advanced', 'rpgal_hover_effect'],
     87                    'rcpig_hide_excerpt_' => ['rpgal_advanced', 'rpgal_hide_excerpt'],
     88                    'rcpig_expanding_height_' => ['rpgal_advanced', 'rpgal_exp_height'],
     89                    'rcpig_show_wrapper_' => ['rpgal_advanced', 'rpgal_show_wrap'],
     90                    // Style Options
     91                    'rcpig_css_style_' => ['rpgal_style', 'rpgal_css_style'],
     92                    'rcpig_custom_css_' => ['rpgal_style', 'rpgal_custom_css'],
     93                );
     94
     95                // Prepare containers for new options
     96                $new_options = [
     97                    'rpgal_general' => [],
     98                    'rpgal_advanced' => [],
     99                    'rpgal_style' => [],
     100                ];
     101
     102                // Copy over values from old to new
     103                foreach ($option_mappings as $old_key => $map) {
     104                    list($new_group, $new_key) = $map;
     105
     106                    $value = null;
     107
     108                    if (strpos($old_key, 'rcpig_enable_portfolio_') === 0) {
     109                        $value = isset($old_version_general[$old_key]) ? $old_version_general[$old_key] : null;
     110                    } elseif (isset($old_version_general[$old_key])) {
     111                        $value = $old_version_general[$old_key];
     112                    } elseif (isset($old_version_advance[$old_key])) {
     113                        $value = $old_version_advance[$old_key];
     114                    } elseif (isset($old_version_style[$old_key])) {
     115                        $value = $old_version_style[$old_key];
     116                    }
     117
     118                    if (!is_null($value)) {
     119                        $new_options[$new_group][$new_key] = $value;
     120                    }
     121                }
     122
     123                // Save each grouped new option if it contains data
     124                foreach ($new_options as $option_name => $option_data) {
     125                    if (!empty($option_data)) {
     126                        update_option($option_name, $option_data);
     127                    }
     128                }
     129
     130                // Step 2: Delete old option groups
     131                delete_option('rcpig_general');
     132                delete_option('rcpig_advanced');
     133                delete_option('rcpig_style');
     134
     135                global $wpdb;
     136
     137                // Step 3: Rename post meta keys
     138                $meta_rename_map = [
     139                    '_first_button' => '_button_text',
     140                    '_first_button_link' => '_button_link',
     141                    '_first_button_tab' => '_button_ntab',
     142                ];
     143
     144                foreach ($meta_rename_map as $old_key => $new_key) {
     145                    $wpdb->query(
     146                        $wpdb->prepare(
     147                            "UPDATE {$wpdb->postmeta} SET meta_key = %s WHERE meta_key = %s",
     148                            $new_key,
     149                            $old_key
     150                        )
     151                    );
     152                }
     153
     154                // Step 4: Rename post type
     155                $wpdb->query(
     156                    "UPDATE {$wpdb->posts} SET post_type = 'rpgal' WHERE post_type = 'rcpig'"
     157                );
     158
     159                // Step 5: Rename taxonomy
     160                $wpdb->query(
     161                    "UPDATE {$wpdb->term_taxonomy} SET taxonomy = 'rpgal-category' WHERE taxonomy = 'rcpig-category'"
     162                );
     163
     164                // Step 6: Save updated plugin version
     165                update_option('rpgal_plugin_version', $current_version);
     166            }
     167        }
     168
     169        /**
     170         * Defines essential plugin constants.
     171         *
     172         * This method sets up constants that are used throughout the plugin for easy access
     173         * to important paths and URLs, ensuring a consistent and maintainable structure.
     174         *
     175         * Constants defined:
     176         * - `RPGAL_PLUGIN_PATH`: Absolute path to the plugin directory.
     177         * - `RPGAL_PLUGIN_URL`: URL to the plugin directory.
     178         * - `RPGAL_AUF`: Absolute path to the main plugin file.
     179         *
     180         * @return void
     181         */
     182        private function define_constants()
     183        {
     184            define('RPGAL_PLUGIN_PATH', plugin_dir_path(__FILE__));
     185            define('RPGAL_PLUGIN_URL', plugin_dir_url(__FILE__));
     186            define('RPGAL_AUF', __FILE__);
     187        }
     188
     189        /**
     190         * Includes initialized files for the plugin.
     191         *
     192         * @return void
     193         */
     194        private function required_files()
     195        {
     196            // Initialize the plugin
     197            require_once RPGAL_PLUGIN_PATH . 'init/init-rpgal.php';
    61198        }
    62199    }
    63200}
    64 add_action( 'wp_enqueue_scripts', 'rcpig_scripts' );
    65 
    66 /* Adding Custom styles */
    67 add_action( 'wp_head', 'rcpig_custom_style' );
    68 function rcpig_custom_style() {
    69     $custom_css = get_option( 'custom_css' );
    70     $rcpig_custom_style = rcpig_get_option( 'rcpig_custom_css_', 'rcpig_style', '' );
    71     if ( isset($rcpig_custom_style) && !empty( $rcpig_custom_style ) ) { ?>
    72 <style type="text/css">
    73 <?php echo $rcpig_custom_style; ?>
    74 </style><?php
    75     }
    76 }
    77 
    78 /* Enqueue CSS & JS For Admin */
    79 function rcpig_admin_adding_style() {
    80     wp_register_script( 'rcpig-admin', plugin_dir_url( __FILE__ ) . '/assets/js/rcpig-admin.js', array( 'jquery' ), '1.2' );
    81     wp_enqueue_script( 'rcpig-admin' );
    82     wp_enqueue_style( 'rcpig_admin_style', plugins_url('/assets/css/rcpig-admin.css', __FILE__),'','1.2', false );
    83 }
    84 add_action( 'admin_enqueue_scripts', 'rcpig_admin_adding_style', 11 );
    85 
    86 /* Custom Excerpts */
    87 function rcpig_excerptlength($length) {
    88     $rcpig_excerpt = rcpig_get_option( 'rcpig_excerpt_length_', 'rcpig_general', 30 );
    89     return $rcpig_excerpt;
    90 }
    91 function rcpig_excerpt_more($more) {
    92     global $post;
    93     return ' [...]';
    94 }
    95 function rcpig_excerpt($length_callback='', $more_callback='') {
    96     global $post;
    97     if(function_exists($length_callback)){
    98         add_filter('excerpt_length', $length_callback);
    99     }
    100     if(function_exists($more_callback)){
    101         add_filter('excerpt_more', $more_callback);
    102     }
    103     $output = get_the_excerpt();
    104     $output = apply_filters('wptexturize', $output);
    105     $output = apply_filters('convert_chars', $output);
    106     return $output;
    107 }
    108 
    109 require_once dirname( __FILE__ ) . '/rcpig-shortcode.php';
    110 require_once dirname( __FILE__ ) . '/custom-post/rcpig-post.php';
    111 require_once dirname( __FILE__ ) . '/class/rcpig_aq_resizer.php';
    112 require_once dirname( __FILE__ ) . '/inc/rcpig-admin.php';
    113 require_once dirname( __FILE__ ) . '/class/rcpig-class.settings-api.php';
    114 require_once dirname( __FILE__ ) . '/inc/rcpig-settings.php';
    115 require_once dirname( __FILE__ ) . '/custom-post/rcpig_metabox.php';
    116 ?>
     201
     202RPGAL_Index::get_instances();
Note: See TracChangeset for help on using the changeset viewer.