PluginProbe
Export All Posts, Products, Orders & Users | WP Ultimate Exporter | WordPress CSV Export / trunk
Export All Posts, Products, Orders & Users | WP Ultimate Exporter | WordPress CSV Export vtrunk
3.0 2.24.2 2.24.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 2.0 2.0.1 2.1 2.1.1 2.1.2 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.16.1 2.16.2 All 96 releases
wp-ultimate-exporter / exportExtensions / JetEngine.php

JetEngine.php in Export All Posts, Products, Orders & Users | WP Ultimate Exporter | WordPress CSV Export trunk, at exportExtensions/JetEngine.php

156 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WP Ultimate Exporter plugin file.
4 *
5 * Copyright (C) 2010-2020, Smackcoders Inc - info@smackcoders.com
6 */
7 namespace Smackcoders\SMEXP;
8
9 if ( ! defined( 'ABSPATH' ) )
10 exit; // Exit if accessed directly
11
12 /**
13 * Class LearnPressExport
14 * @package Smackcoders\SMEXP
15 */
16
17 class JetEngineExport extends ExportExtension{
18
19 protected static $instance = null,$export_instance;
20 public static function getInstance() {
21 if ( null == self::$instance ) {
22 self::$instance = new self;
23 JetEngineExport::$export_instance = ExportExtension::getInstance();
24 }
25 return self::$instance;
26 }
27
28 /**
29 * CustomerReviewExport constructor.
30 */
31 /**
32 * Function to export the meta information based on Fetch ACF field information to be export
33 * @param $id
34 * @return mixed
35 */
36 public function __construct() {
37
38 global $wpdb;
39 global $optionalType;
40 $this->plugin = Plugin::getInstance();
41
42
43 }
44 public function jetEngineActivate($id)
45 {
46
47 if(is_plugin_active('jet-engine/jet-engine.php')){
48 global $wpdb;
49 global $optionalType;
50
51 $jetEnginefields = $wpdb->get_results($wpdb->prepare("SELECT id, meta_fields FROM {$wpdb->prefix}jet_post_types WHERE slug = %s AND status IN ('publish','built-in')", $optionalType), ARRAY_A);
52 $jetEnginefields[0]['meta_fields']=isset($jetEnginefields[0]['meta_fields'])?$jetEnginefields[0]['meta_fields']:'';
53
54 $unserializedMeta = maybe_unserialize($jetEnginefields[0]['meta_fields']);
55 $unserializedMeta=isset($unserializedMeta)?$unserializedMeta:'';
56
57 if(is_array($unserializedMeta)){
58 foreach($unserializedMeta as $jet_key => $jetValue){
59 $jetFieldLabel = $jetValue['title'];
60 $jetFieldType = $jetValue['type'];
61 if($jetFieldType != 'repeater' && $jetFieldType != 'media' && $jetFieldType != 'gallery' && $jetFieldType != 'posts' && $jetFieldType != 'html' ){
62 $jetFieldNameArr[] = $jetValue['name'];
63 }
64 else{
65 $jetFieldNameArr[] = $jetValue['name'];
66 $fields=$jetValue['repeater-fields'];
67 if(is_array($fields)){
68 foreach($fields as $repFieldKey => $repFieldVal){
69 $jetFieldName[] = $repFieldVal['name'];
70
71 }
72 }
73 }
74 }
75 }
76
77 if(isset($jetFieldName) && is_array($jetFieldName) ){
78 if(is_array($jetFieldNameArr)){
79 $jetCPTFieldsName=array_merge($jetFieldNameArr,$jetFieldName);
80 }
81 else{
82 $jetCPTFieldsName= $jetFieldName;
83 }
84
85 }
86 else{
87 $jetFieldNameArr = isset($jetFieldNameArr) ? $jetFieldNameArr : '';
88 $jetCPTFieldsName= $jetFieldNameArr;
89 }
90
91 //jeteng metabox fields
92
93 global $wpdb;
94
95 $getMetaFields = $wpdb->get_results( $wpdb->prepare("SELECT option_value FROM {$wpdb->prefix}options WHERE option_name=%s",'jet_engine_meta_boxes'),ARRAY_A);
96 if(!empty($getMetaFields)){
97 $unserializedMeta = maybe_unserialize($getMetaFields[0]['option_value']);
98 }
99 else{
100 $unserializedMeta = '';
101 }
102
103 if(is_array($unserializedMeta)){
104 $arraykeys = array_keys($unserializedMeta);
105
106 foreach($arraykeys as $val){
107 $values = explode('-',$val);
108 $v = $values[1];
109 }
110 }
111
112
113 $jetMetaFieldName = [];
114 if(isset($v)){
115 for($i=1 ; $i<=$v ; $i++){
116 $unserializedMeta['meta-'.$i]= isset($unserializedMeta['meta-'.$i])? $unserializedMeta['meta-'.$i] : '';
117 $fields= $unserializedMeta['meta-'.$i];
118 if(!empty($fields)){
119 foreach($fields['meta_fields'] as $jet_key => $jetValue){
120 if($jetValue['type'] != 'repeater'){
121 $jetMetaFieldName[] = $jetValue['name'];
122 }
123 else{
124 $jetMetaFieldName[] = $jetValue['name'];
125 $jetRepFields = $jetValue['repeater-fields'];
126 foreach($jetRepFields as $jetRepKey => $jetRepVal){
127 $jetRepFieldName[] = $jetRepVal['name'];
128 }
129 }
130 }
131 }
132
133 }
134 }
135 if( isset($jetRepFieldName) && is_array($jetRepFieldName)){
136 if(is_array($jetMetaFieldName)){
137 $jetFName = array_merge($jetMetaFieldName,$jetRepFieldName);
138 }
139 else{
140 $jetFName= $jetRepFieldName;
141 }
142 }
143 else{
144 $jetFName= $jetMetaFieldName;
145 }
146 }
147 else{
148 $jetCPTFieldsName =$jetFName= $jet_tax_fields_name = '';
149 }
150 }
151
152
153 }
154
155 global $jetengine_exp_class;
156 $jetengine_exp_class = new JetEngineExport();