VariableProductTitle
8 years ago
.gitkeep
8 years ago
WpaeInvalidPhpException.php
8 years ago
WpaeInvalidStringException.php
8 years ago
WpaeMethodNotFoundException.php
8 years ago
WpaePhpInterpreterErrorHandler.php
8 years ago
WpaeString.php
8 years ago
WpaeTooMuchRecursionException.php
8 years ago
WpaeXmlProcessor.php
8 years ago
XmlCsvExport.php
8 years ago
XmlExportACF.php
8 years ago
XmlExportComment.php
8 years ago
XmlExportCpt.php
8 years ago
XmlExportEngine.php
8 years ago
XmlExportFiltering.php
8 years ago
XmlExportMediaGallery.php
8 years ago
XmlExportTaxonomy.php
8 years ago
XmlExportUser.php
8 years ago
XmlExportWooCommerce.php
8 years ago
XmlExportWooCommerceCoupon.php
8 years ago
XmlExportWooCommerceOrder.php
8 years ago
XmlGoogleMerchants.php
8 years ago
XmlSpec.php
8 years ago
XmlExportACF.php
1677 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! class_exists('XmlExportACF') ) |
| 4 | { |
| 5 | final class XmlExportACF |
| 6 | { |
| 7 | private $_existing_acf_meta_keys = array(); |
| 8 | |
| 9 | private $_acf_groups = array(); |
| 10 | |
| 11 | public function __construct() |
| 12 | { |
| 13 | add_filter("wp_all_export_csv_rows", array( &$this, "filter_csv_rows"), 10, 3); |
| 14 | } |
| 15 | |
| 16 | public function init( & $existing_meta_keys = array() ){ |
| 17 | |
| 18 | if ( ! class_exists( 'acf' ) ) return; |
| 19 | |
| 20 | global $acf; |
| 21 | |
| 22 | if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){ |
| 23 | |
| 24 | $saved_acfs = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field-group')); |
| 25 | |
| 26 | $acfs = acf_local()->groups; |
| 27 | |
| 28 | if ( ! empty($acfs) and is_array($acfs)) $this->_acf_groups = $acfs; |
| 29 | |
| 30 | } |
| 31 | else{ |
| 32 | |
| 33 | $this->_acf_groups = apply_filters('acf/get_field_groups', array()); |
| 34 | |
| 35 | } |
| 36 | |
| 37 | if ( ! empty($saved_acfs) ){ |
| 38 | foreach ($saved_acfs as $key => $obj) { |
| 39 | if ( ! isset($acfs[$obj->post_name])) |
| 40 | { |
| 41 | $this->_acf_groups[] = array( |
| 42 | 'ID' => $obj->ID, |
| 43 | 'title' => $obj->post_title |
| 44 | ); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | if ( ! empty($this->_acf_groups) ){ |
| 50 | |
| 51 | foreach ($this->_acf_groups as $key => $acfObj) |
| 52 | { |
| 53 | if (empty($this->_acf_groups[$key]['ID']) and ! empty($this->_acf_groups[$key]['key'])) |
| 54 | { |
| 55 | $this->_acf_groups[$key]['ID'] = $acfs[$key]['key']; |
| 56 | } |
| 57 | elseif (empty($this->_acf_groups[$key]['ID']) and ! empty($this->_acf_groups[$key]['id'])) |
| 58 | { |
| 59 | $this->_acf_groups[$key]['ID'] = $this->_acf_groups[$key]['id']; |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // get all ACF fields |
| 64 | if ($acf->settings['version'] and version_compare($acf->settings['version'], '5.0.0') >= 0) |
| 65 | { |
| 66 | |
| 67 | foreach ($this->_acf_groups as $key => $acf_obj) { |
| 68 | |
| 69 | if ( is_numeric($acf_obj['ID'])){ |
| 70 | |
| 71 | $acf_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => $acf_obj['ID'], 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC')); |
| 72 | |
| 73 | if ( ! empty($acf_fields) ){ |
| 74 | |
| 75 | foreach ($acf_fields as $field) { |
| 76 | |
| 77 | $fieldData = (!empty($field->post_content)) ? unserialize($field->post_content) : array(); |
| 78 | |
| 79 | $fieldData['ID'] = $field->ID; |
| 80 | $fieldData['id'] = $field->ID; |
| 81 | $fieldData['label'] = $field->post_title; |
| 82 | $fieldData['key'] = $field->post_name; |
| 83 | |
| 84 | if (in_array($fieldData['type'], array('tab'))) continue; |
| 85 | |
| 86 | if (empty($fieldData['name'])) $fieldData['name'] = $field->post_excerpt; |
| 87 | |
| 88 | if ( ! empty($fieldData['name'])){ |
| 89 | $this->_existing_acf_meta_keys[] = $fieldData['name']; |
| 90 | } |
| 91 | |
| 92 | $this->_acf_groups[$key]['fields'][] = $fieldData; |
| 93 | |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | else |
| 98 | { |
| 99 | $acf_fields = acf_local()->fields; |
| 100 | |
| 101 | if ( ! empty($acf_fields) ) |
| 102 | { |
| 103 | foreach ($acf_fields as $field_key => $field) |
| 104 | { |
| 105 | if ($field['parent'] == $acf_obj['key']) |
| 106 | { |
| 107 | $fieldData = $field; |
| 108 | |
| 109 | if (empty($fieldData['ID'])) |
| 110 | { |
| 111 | $fieldData['ID'] = $fieldData['id'] = uniqid(); |
| 112 | } |
| 113 | |
| 114 | if ( ! empty($fieldData['name'])){ |
| 115 | $this->_existing_acf_meta_keys[] = $fieldData['name']; |
| 116 | } |
| 117 | |
| 118 | $this->_acf_groups[$key]['fields'][] = $fieldData; |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | else |
| 126 | { |
| 127 | foreach ($this->_acf_groups as $key => $acf_obj) { |
| 128 | |
| 129 | $fields = array(); |
| 130 | |
| 131 | if (is_numeric($acf_obj['id'])){ |
| 132 | |
| 133 | foreach (get_post_meta($acf_obj['id'], '') as $cur_meta_key => $cur_meta_val) |
| 134 | { |
| 135 | if (strpos($cur_meta_key, 'field_') !== 0) continue; |
| 136 | |
| 137 | $fields[] = (!empty($cur_meta_val[0])) ? unserialize($cur_meta_val[0]) : array(); |
| 138 | |
| 139 | } |
| 140 | } |
| 141 | else |
| 142 | { |
| 143 | global $acf_register_field_group; |
| 144 | |
| 145 | if ( ! empty($acf_register_field_group) ) |
| 146 | { |
| 147 | foreach ($acf_register_field_group as $group) |
| 148 | { |
| 149 | if ($group['id'] == $acf_obj['ID']) |
| 150 | { |
| 151 | foreach ($group['fields'] as $field) |
| 152 | { |
| 153 | $fields[] = $field; |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | if (count($fields)){ |
| 161 | |
| 162 | $sortArray = array(); |
| 163 | |
| 164 | foreach($fields as $field){ |
| 165 | foreach($field as $key2=>$value){ |
| 166 | if(!isset($sortArray[$key2])){ |
| 167 | $sortArray[$key2] = array(); |
| 168 | } |
| 169 | $sortArray[$key2][] = $value; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | $orderby = "order_no"; |
| 174 | |
| 175 | @array_multisort($sortArray[$orderby],SORT_ASC, $fields); |
| 176 | |
| 177 | foreach ($fields as $field){ |
| 178 | if (in_array($field['type'], array('tab'))) continue; |
| 179 | $this->_acf_groups[$key]['fields'][] = $field; |
| 180 | if ( ! empty($field['name'])) $this->_existing_acf_meta_keys[] = $field['name']; |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | if ( ! empty($existing_meta_keys)){ |
| 187 | foreach ($existing_meta_keys as $key => $meta_key) { |
| 188 | foreach ($this->_existing_acf_meta_keys as $acf_key => $acf_value) { |
| 189 | if (in_array($meta_key, array($acf_value, "_" . $acf_value))) { |
| 190 | unset($existing_meta_keys[$key]); |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | private static $additional_articles = array(); |
| 199 | |
| 200 | private static $fc_sub_field_names = array(); |
| 201 | |
| 202 | public static function export_acf_field($field_value = '', $exportOptions, $ID, $pid, &$article, $xmlWriter = false, &$acfs, $element_name = '', $element_name_ns = '', $fieldSnipped = '', $group_id = '', $preview = false, $return_value = false, $is_sub_field = false ) |
| 203 | { |
| 204 | global $acf; |
| 205 | |
| 206 | $put_to_csv = true; |
| 207 | |
| 208 | $field_name = (!empty($exportOptions['cc_label'][$ID])) ? $exportOptions['cc_label'][$ID] : $exportOptions['name']; |
| 209 | $field_options = (!empty($exportOptions['cc_options'][$ID])) ? unserialize($exportOptions['cc_options'][$ID]) : $exportOptions; |
| 210 | $field_settings = (!empty($exportOptions['cc_settings'][$ID])) ? json_decode($exportOptions['cc_settings'][$ID], true) : false; |
| 211 | |
| 212 | $is_xml_export = false; |
| 213 | |
| 214 | if ( ! empty($xmlWriter) and XmlExportEngine::$exportOptions['export_to'] == 'xml' and ! in_array(XmlExportEngine::$exportOptions['xml_template_type'], array('custom', 'XmlGoogleMerchants')) ){ |
| 215 | $is_xml_export = true; |
| 216 | } |
| 217 | |
| 218 | $is_custom_xml_export = false; |
| 219 | |
| 220 | if ( XmlExportEngine::$exportOptions['export_to'] == 'xml' and in_array(XmlExportEngine::$exportOptions['xml_template_type'], array('custom')) ){ |
| 221 | $is_custom_xml_export = true; |
| 222 | } |
| 223 | |
| 224 | if ($field_options['type'] == 'message'){ |
| 225 | $field_value = empty($field_options['message']) ? '' : $field_options['message']; |
| 226 | } |
| 227 | |
| 228 | if ( ! empty($field_value) ) |
| 229 | { |
| 230 | $field_value = maybe_unserialize($field_value); |
| 231 | |
| 232 | $implode_delimiter = XmlExportEngine::$implode; |
| 233 | |
| 234 | switch ($field_options['type']) |
| 235 | { |
| 236 | case 'date_time_picker': |
| 237 | $format = empty($field_options['return_format']) ? 'Y-m-d H:i:s' : $field_options['return_format']; |
| 238 | $field_value = date($format, (is_numeric($field_value) ? $field_value : strtotime($field_value))); |
| 239 | break; |
| 240 | case 'date_picker': |
| 241 | $field_value = date('Ymd', strtotime($field_value)); |
| 242 | break; |
| 243 | |
| 244 | case 'file': |
| 245 | case 'image': |
| 246 | if (is_numeric($field_value)) |
| 247 | { |
| 248 | $field_value = wp_get_attachment_url($field_value); |
| 249 | } |
| 250 | elseif(is_array($field_value)) |
| 251 | { |
| 252 | $field_value = empty($field_value['url']) ? '' : $field_value['url']; |
| 253 | } |
| 254 | break; |
| 255 | |
| 256 | case 'gallery': |
| 257 | $v = array(); |
| 258 | |
| 259 | foreach ($field_value as $key => $item) |
| 260 | { |
| 261 | if (!empty($item['url'])){ |
| 262 | $v[] = $item['url']; |
| 263 | } |
| 264 | elseif (is_numeric($item)){ |
| 265 | $gallery_item_url = wp_get_attachment_url($item); |
| 266 | if (!empty($gallery_item_url)){ |
| 267 | $v[] = $gallery_item_url; |
| 268 | } |
| 269 | } |
| 270 | } |
| 271 | $field_value = implode($implode_delimiter, $v); |
| 272 | |
| 273 | break; |
| 274 | case 'location-field': |
| 275 | $localion_parts = explode("|", $field_value); |
| 276 | |
| 277 | if ($is_xml_export) |
| 278 | { |
| 279 | if ( ! empty($localion_parts) ){ |
| 280 | |
| 281 | $xmlWriter->beginElement($element_name_ns, $element_name, null); |
| 282 | $xmlWriter->startElement('address'); |
| 283 | $xmlWriter->writeData($localion_parts[0], 'address'); |
| 284 | $xmlWriter->closeElement(); |
| 285 | |
| 286 | if (!empty($localion_parts[1])){ |
| 287 | $coordinates = explode(",", $localion_parts[1]); |
| 288 | if (!empty($coordinates)){ |
| 289 | $xmlWriter->startElement('lat'); |
| 290 | $xmlWriter->writeData($coordinates[0], 'lat'); |
| 291 | $xmlWriter->closeElement(); |
| 292 | $xmlWriter->startElement('lng'); |
| 293 | $xmlWriter->writeData($coordinates[1], 'lng'); |
| 294 | $xmlWriter->closeElement(); |
| 295 | } |
| 296 | } |
| 297 | $xmlWriter->closeElement(); |
| 298 | |
| 299 | } |
| 300 | } |
| 301 | else |
| 302 | { |
| 303 | if ( ! $return_value ) |
| 304 | { |
| 305 | $acfs[$element_name] = array( |
| 306 | $element_name . '_address', |
| 307 | $element_name . '_lat', |
| 308 | $element_name . '_lng' |
| 309 | ); |
| 310 | |
| 311 | if ( ! empty($localion_parts) ) |
| 312 | { |
| 313 | $article[$element_name . '_address'] = $localion_parts[0]; |
| 314 | if (!empty($localion_parts[1])) |
| 315 | { |
| 316 | $coordinates = explode(",", $localion_parts[1]); |
| 317 | if (!empty($coordinates)) |
| 318 | { |
| 319 | $article[$element_name . '_lat'] = $coordinates[0]; |
| 320 | $article[$element_name . '_lng'] = $coordinates[1]; |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | else |
| 326 | { |
| 327 | if ( ! empty($localion_parts) ) |
| 328 | { |
| 329 | $return_value = array( |
| 330 | 'address' => $localion_parts[0], |
| 331 | ); |
| 332 | if (!empty($localion_parts[1])) |
| 333 | { |
| 334 | $coordinates = explode(",", $localion_parts[1]); |
| 335 | if (!empty($coordinates)) |
| 336 | { |
| 337 | $return_value['lat'] = $coordinates[0]; |
| 338 | $return_value['lng'] = $coordinates[1]; |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | $put_to_csv = false; |
| 346 | break; |
| 347 | |
| 348 | case 'paypal_item': |
| 349 | |
| 350 | if ($is_xml_export) |
| 351 | { |
| 352 | $xmlWriter->beginElement($element_name_ns, $element_name, null); |
| 353 | if ( is_array($field_value) ){ |
| 354 | foreach ($field_value as $key => $value) { |
| 355 | $xmlWriter->beginElement($element_name_ns, $key, null); |
| 356 | $xmlWriter->writeData($value, $key); |
| 357 | $xmlWriter->closeElement(); |
| 358 | } |
| 359 | } |
| 360 | $xmlWriter->closeElement(); |
| 361 | } |
| 362 | else |
| 363 | { |
| 364 | if ( ! $return_value ) |
| 365 | { |
| 366 | if ( $is_custom_xml_export ){ |
| 367 | $article[$element_name] = json_encode($field_value); |
| 368 | } |
| 369 | else{ |
| 370 | $acfs[$element_name] = array($element_name . '_item_name', $element_name . '_item_description', $element_name . '_price'); |
| 371 | |
| 372 | if ( is_array($field_value) ) |
| 373 | { |
| 374 | foreach ($field_value as $key => $value) |
| 375 | { |
| 376 | $article[$element_name . '_' . $key] = $value; |
| 377 | } |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | $put_to_csv = false; |
| 384 | |
| 385 | break; |
| 386 | |
| 387 | case 'google_map': |
| 388 | |
| 389 | if ($is_xml_export) |
| 390 | { |
| 391 | $xmlWriter->beginElement($element_name_ns, $element_name, null); |
| 392 | $xmlWriter->startElement('address'); |
| 393 | $xmlWriter->writeData($field_value['address'], 'address'); |
| 394 | $xmlWriter->closeElement(); |
| 395 | $xmlWriter->startElement('lat'); |
| 396 | $xmlWriter->writeData($field_value['lat'], 'lat'); |
| 397 | $xmlWriter->closeElement(); |
| 398 | $xmlWriter->startElement('lng'); |
| 399 | $xmlWriter->writeData($field_value['lng'], 'lng'); |
| 400 | $xmlWriter->closeElement(); |
| 401 | $xmlWriter->closeElement(); |
| 402 | } |
| 403 | else |
| 404 | { |
| 405 | if ( ! $return_value ) |
| 406 | { |
| 407 | if ( $is_custom_xml_export ){ |
| 408 | $article[$element_name] = json_encode($field_value); |
| 409 | } |
| 410 | else{ |
| 411 | $acfs[$element_name] = array($element_name . '_address', $element_name . '_lat', $element_name . '_lng'); |
| 412 | $article[$element_name . '_address'] = $field_value['address']; |
| 413 | $article[$element_name . '_lat'] = $field_value['lat']; |
| 414 | $article[$element_name . '_lng'] = $field_value['lng']; |
| 415 | } |
| 416 | } |
| 417 | } |
| 418 | $put_to_csv = false; |
| 419 | |
| 420 | break; |
| 421 | |
| 422 | case 'acf_cf7': |
| 423 | case 'gravity_forms_field': |
| 424 | |
| 425 | if ( ! empty($field_options['multiple']) ) |
| 426 | { |
| 427 | $field_value = implode($implode_delimiter, $field_value); |
| 428 | } |
| 429 | |
| 430 | break; |
| 431 | |
| 432 | case 'page_link': |
| 433 | |
| 434 | if (is_array($field_value)) |
| 435 | { |
| 436 | $field_value = implode($implode_delimiter, $field_value); |
| 437 | } |
| 438 | |
| 439 | break; |
| 440 | |
| 441 | case 'post_object': |
| 442 | |
| 443 | if ( ! empty($field_options['multiple'])){ |
| 444 | $v = array(); |
| 445 | foreach ($field_value as $key => $pid) { |
| 446 | |
| 447 | if (is_numeric($pid)){ |
| 448 | $entry = get_post($pid); |
| 449 | if ($entry) |
| 450 | { |
| 451 | $v[] = $entry->post_name; |
| 452 | } |
| 453 | } |
| 454 | else{ |
| 455 | $v[] = $pid->post_name; |
| 456 | } |
| 457 | } |
| 458 | $field_value = implode($implode_delimiter, $v); |
| 459 | } |
| 460 | else{ |
| 461 | if (is_numeric($field_value)){ |
| 462 | $entry = get_post($field_value); |
| 463 | if ($entry) |
| 464 | { |
| 465 | $field_value = $entry->post_name; |
| 466 | } |
| 467 | } |
| 468 | else{ |
| 469 | $field_value = $field_value->post_name; |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | break; |
| 474 | |
| 475 | case 'relationship': |
| 476 | |
| 477 | $v = array(); |
| 478 | foreach ($field_value as $key => $pid) { |
| 479 | $entry = get_post($pid); |
| 480 | if ($entry) |
| 481 | { |
| 482 | $v[] = $entry->post_title; |
| 483 | } |
| 484 | } |
| 485 | $field_value = implode($implode_delimiter, $v); |
| 486 | |
| 487 | break; |
| 488 | |
| 489 | case 'user': |
| 490 | |
| 491 | if ( ! empty($field_options['multiple'])){ |
| 492 | $v = array(); |
| 493 | foreach ($field_value as $key => $user) { |
| 494 | if (is_numeric($user)){ |
| 495 | $entry = get_user_by('ID', $user); |
| 496 | if ($entry) |
| 497 | { |
| 498 | $v[] = $entry->user_email; |
| 499 | } |
| 500 | } |
| 501 | else{ |
| 502 | $v[] = $user['user_email']; |
| 503 | } |
| 504 | } |
| 505 | $field_value = implode($implode_delimiter, $v); |
| 506 | } |
| 507 | else{ |
| 508 | if (is_numeric($field_value)){ |
| 509 | $entry = get_user_by('ID', $field_value); |
| 510 | if ($entry) |
| 511 | { |
| 512 | $field_value = $entry->user_email; |
| 513 | } |
| 514 | } |
| 515 | else{ |
| 516 | $field_value = $field_value['user_email']; |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | break; |
| 521 | |
| 522 | case 'taxonomy': |
| 523 | |
| 524 | if ($is_xml_export) |
| 525 | { |
| 526 | $xmlWriter->beginElement($element_name_ns, $element_name, null); |
| 527 | |
| 528 | if ( ! in_array($field_options['field_type'], array('radio', 'select'))){ |
| 529 | foreach ($field_value as $key => $tid) { |
| 530 | $entry = get_term($tid , $field_options['taxonomy']); |
| 531 | if ($entry and !is_wp_error($entry)) |
| 532 | { |
| 533 | $xmlWriter->startElement('term'); |
| 534 | $xmlWriter->writeData($entry->name, 'term'); |
| 535 | $xmlWriter->closeElement(); |
| 536 | } |
| 537 | } |
| 538 | } |
| 539 | else{ |
| 540 | $entry = get_term($field_value, $field_options['taxonomy']); |
| 541 | if ($entry) |
| 542 | { |
| 543 | $xmlWriter->startElement('term'); |
| 544 | $xmlWriter->writeData($entry->name, 'term'); |
| 545 | $xmlWriter->closeElement(); |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | $xmlWriter->closeElement(); |
| 550 | |
| 551 | $put_to_csv = false; |
| 552 | } |
| 553 | else |
| 554 | { |
| 555 | if ( ! in_array($field_options['field_type'], array('radio', 'select'))){ |
| 556 | $v = array(); |
| 557 | foreach ($field_value as $key => $tid) { |
| 558 | $entry = get_term($tid , $field_options['taxonomy']); |
| 559 | if ($entry and !is_wp_error($entry)) |
| 560 | { |
| 561 | $v[] = $entry->name; |
| 562 | } |
| 563 | } |
| 564 | $field_value = implode($implode_delimiter, $v); |
| 565 | } |
| 566 | else{ |
| 567 | $entry = get_term($field_value, $field_options['taxonomy']); |
| 568 | if ($entry) |
| 569 | { |
| 570 | $field_value = $entry->name; |
| 571 | } |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | break; |
| 576 | |
| 577 | case 'select': |
| 578 | |
| 579 | if ( ! empty($field_options['multiple'])) |
| 580 | { |
| 581 | $field_value = implode($implode_delimiter, $field_value); |
| 582 | } |
| 583 | |
| 584 | break; |
| 585 | |
| 586 | case 'checkbox': |
| 587 | |
| 588 | if ( is_array($field_value) ) |
| 589 | { |
| 590 | $field_value = implode($implode_delimiter, $field_value); |
| 591 | } |
| 592 | |
| 593 | break; |
| 594 | |
| 595 | case 'clone': |
| 596 | |
| 597 | if ( ! empty($field_options['clone']) ) { |
| 598 | $values = maybe_unserialize($field_value); |
| 599 | |
| 600 | $sub_fields = array(); |
| 601 | foreach ($field_options['clone'] as $sub_field_key) { |
| 602 | |
| 603 | if (strpos($sub_field_key, 'group_') === 0){ |
| 604 | $acf_groups = get_posts(array( |
| 605 | 'posts_per_page' => 1, |
| 606 | 'post_type' => 'acf-field-group', |
| 607 | 'name' => $sub_field_key, |
| 608 | 'post_status' => 'publish' |
| 609 | )); |
| 610 | if (!empty($acf_groups)){ |
| 611 | foreach ($acf_groups as $acf_group){ |
| 612 | $sub_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => $acf_group->ID, 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC')); |
| 613 | } |
| 614 | } |
| 615 | } |
| 616 | else{ |
| 617 | $args = array( |
| 618 | 'name' => $sub_field_key, |
| 619 | 'post_type' => 'acf-field', |
| 620 | 'post_status' => 'publish', |
| 621 | 'posts_per_page' => 1 |
| 622 | ); |
| 623 | $my_posts = get_posts($args); |
| 624 | if ($my_posts) { |
| 625 | $sub_fields[] = $my_posts[0]; |
| 626 | } |
| 627 | } |
| 628 | } |
| 629 | if ( ! empty($sub_fields) ){ |
| 630 | |
| 631 | foreach ($sub_fields as $sub_field){ |
| 632 | |
| 633 | $field_value = isset($values[$sub_field->post_excerpt]) ? $values[$sub_field->post_excerpt] : ''; |
| 634 | |
| 635 | $sub_field_name = empty($sub_field->post_excerpt) ? str_replace("-","_", sanitize_title($sub_field->post_title)) : $sub_field->post_excerpt; |
| 636 | |
| 637 | $field_options = unserialize($sub_field->post_content); |
| 638 | |
| 639 | $sub_field_value = self::export_acf_field( |
| 640 | $field_value, |
| 641 | $field_options, |
| 642 | false, |
| 643 | $pid, |
| 644 | $article, |
| 645 | $xmlWriter, |
| 646 | $acfs, |
| 647 | $is_xml_export ? $sub_field_name : $element_name . '_' . $sub_field_name, |
| 648 | $element_name_ns, |
| 649 | '', |
| 650 | '', |
| 651 | $preview, |
| 652 | $is_xml_export ? false : true, |
| 653 | true |
| 654 | ); |
| 655 | |
| 656 | $acfs[$element_name][] = $element_name . '_' . $sub_field_name; |
| 657 | $article[$element_name . '_' . $sub_field_name] = ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars($sub_field_value))) : $sub_field_value; |
| 658 | } |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | $put_to_csv = false; |
| 663 | |
| 664 | break; |
| 665 | |
| 666 | case 'repeater': |
| 667 | |
| 668 | if ($is_xml_export) $xmlWriter->beginElement($element_name_ns, $element_name, null); |
| 669 | |
| 670 | if( have_rows($field_name, $pid) ): |
| 671 | |
| 672 | $rowValues = array(); |
| 673 | |
| 674 | $repeater_sub_field_names = array(); |
| 675 | |
| 676 | while( have_rows($field_name, $pid) ): |
| 677 | |
| 678 | the_row(); |
| 679 | |
| 680 | $row = self::acf_get_row(); |
| 681 | |
| 682 | if ($is_xml_export) $xmlWriter->startElement('row'); |
| 683 | |
| 684 | foreach ($row['field']['sub_fields'] as $sub_field) { |
| 685 | |
| 686 | if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0) |
| 687 | { |
| 688 | $v = $row['value'][ $row['i'] ][ $sub_field['key'] ]; |
| 689 | $cache_slug = "format_value/post_id=".$row['post_id']."/name={$sub_field['name']}"; |
| 690 | wp_cache_delete($cache_slug, 'acf'); |
| 691 | if ($is_xml_export) $v = acf_format_value($v, $row['post_id'], $sub_field); |
| 692 | } |
| 693 | else |
| 694 | { |
| 695 | $v = get_sub_field($sub_field['name']); |
| 696 | } |
| 697 | |
| 698 | if ($preview && ! $is_xml_export){ |
| 699 | switch ($sub_field['type']) { |
| 700 | case 'textarea': |
| 701 | case 'oembed': |
| 702 | case 'wysiwyg': |
| 703 | case 'wp_wysiwyg': |
| 704 | case 'date_time_picker': |
| 705 | case 'date_picker': |
| 706 | $v = preg_replace( "/\r|\n/", "", esc_html($v) ); |
| 707 | break; |
| 708 | default: |
| 709 | break; |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | $sub_field['delimiter'] = $implode_delimiter; |
| 714 | |
| 715 | $sub_field_name = empty($sub_field['name']) ? str_replace("-","_", sanitize_title($sub_field['label'])) : $sub_field['name']; |
| 716 | |
| 717 | $sub_field_value = self::export_acf_field( |
| 718 | $v, |
| 719 | $sub_field, |
| 720 | false, |
| 721 | $pid, |
| 722 | $article, |
| 723 | $xmlWriter, |
| 724 | $acfs, |
| 725 | $is_xml_export ? $sub_field_name : $element_name . '_' . $sub_field_name, |
| 726 | $element_name_ns, |
| 727 | $fieldSnipped, |
| 728 | '', |
| 729 | $preview, |
| 730 | $is_xml_export ? false : true, |
| 731 | true |
| 732 | ); |
| 733 | |
| 734 | if ( ! $is_xml_export ) |
| 735 | { |
| 736 | switch ($sub_field['type']) |
| 737 | { |
| 738 | case 'google_map': |
| 739 | case 'paypal_item': |
| 740 | case 'location-field': |
| 741 | if ( ! empty($sub_field_value)) |
| 742 | { |
| 743 | foreach ($sub_field_value as $repeater_key => $repeater_value) |
| 744 | { |
| 745 | $rowValues[$sub_field['name']][$repeater_key][] = (is_array($repeater_value)) ? implode($exportOptions['delimiter'], $repeater_value) : $repeater_value; |
| 746 | } |
| 747 | } |
| 748 | break; |
| 749 | case 'repeater': |
| 750 | if ( ! empty($sub_field_value)){ |
| 751 | foreach ($sub_field_value as $repeater_key => $repeater_value) { |
| 752 | if (is_array($repeater_value)){ |
| 753 | $rv = array(); |
| 754 | foreach ($repeater_value as $repeater_key2 => $repeater_value2) { |
| 755 | $rv[] = (is_array($repeater_value2)) ? implode($exportOptions['delimiter'], $repeater_value2) : $repeater_value2; |
| 756 | } |
| 757 | $rowValues[$sub_field_name][$repeater_key][] = implode($exportOptions['delimiter'], $rv); |
| 758 | } |
| 759 | else{ |
| 760 | $rowValues[$sub_field_name][$repeater_key][] = $repeater_value; |
| 761 | } |
| 762 | } |
| 763 | } |
| 764 | break; |
| 765 | default: |
| 766 | $sub_field_name = empty($sub_field['name']) ? str_replace("-","_", sanitize_title($sub_field['label'])) : $sub_field['name']; |
| 767 | $rowValues[$sub_field_name][] = apply_filters('pmxe_acf_field', pmxe_filter( (is_array($sub_field_value)) ? implode($exportOptions['delimiter'], $sub_field_value) : $sub_field_value, $fieldSnipped), $sub_field_name, $pid); |
| 768 | break; |
| 769 | } |
| 770 | } |
| 771 | } |
| 772 | |
| 773 | if ($is_xml_export) $xmlWriter->closeElement(); |
| 774 | |
| 775 | endwhile; |
| 776 | |
| 777 | if ($return_value) return $rowValues; |
| 778 | |
| 779 | if ( ! $is_xml_export ) |
| 780 | { |
| 781 | $additional_articles = array(); |
| 782 | |
| 783 | foreach ($rowValues as $key => $values) |
| 784 | { |
| 785 | $is_have_subvalues = array_filter(array_keys($values), 'is_numeric'); |
| 786 | |
| 787 | if (empty($is_have_subvalues)) |
| 788 | { |
| 789 | foreach ($values as $subkey => $subvalue) |
| 790 | { |
| 791 | if ( ! in_array($element_name . '_' . $key . '_' . $subkey, $repeater_sub_field_names)) |
| 792 | { |
| 793 | $repeater_sub_field_names[] = $element_name . '_' . $key . '_' . $subkey; |
| 794 | } |
| 795 | // Display each repeater row in its own csv line |
| 796 | if ( ! empty($field_settings) and $field_settings['repeater_field_item_per_line'] ) |
| 797 | { |
| 798 | $base_value = array_shift($subvalue); |
| 799 | |
| 800 | $article[$element_name . '_' . $key . '_' . $subkey] = ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars($base_value))) : $base_value; |
| 801 | |
| 802 | if ( ! empty($subvalue)) |
| 803 | { |
| 804 | foreach ($subvalue as $i => $addRowValue) |
| 805 | { |
| 806 | $additional_articles[$i]['settings'] = $field_settings; |
| 807 | $additional_articles[$i]['content'][$element_name . '_' . $key . '_' . $subkey] = $addRowValue; |
| 808 | } |
| 809 | } |
| 810 | } |
| 811 | else |
| 812 | { |
| 813 | if ($is_custom_xml_export){ |
| 814 | $article[$element_name][$key . '_' . $subkey] = apply_filters('pmxe_acf_field', pmxe_filter(($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars(implode("|", $subvalue)))) : implode("|", $subvalue), $fieldSnipped), $key . '_' . $subkey, $pid); |
| 815 | } |
| 816 | else{ |
| 817 | $article[$element_name . '_' . $key . '_' . $subkey] = apply_filters('pmxe_acf_field', pmxe_filter(($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars(implode($implode_delimiter, $subvalue)))) : implode($implode_delimiter, $subvalue), $fieldSnipped), $element_name . '_' . $key . '_' . $subkey, $pid); |
| 818 | } |
| 819 | } |
| 820 | } |
| 821 | |
| 822 | } |
| 823 | else |
| 824 | { |
| 825 | if ( ! in_array($element_name . '_' . $key, $repeater_sub_field_names)) |
| 826 | { |
| 827 | $repeater_sub_field_names[] = $element_name . '_' . $key; |
| 828 | } |
| 829 | // Display each repeater row in its own csv line |
| 830 | if ( ! empty($field_settings) and $field_settings['repeater_field_item_per_line'] ) |
| 831 | { |
| 832 | $base_value = array_shift($values); |
| 833 | |
| 834 | $article[$element_name . '_' . $key] = ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars($base_value))) : $base_value; |
| 835 | |
| 836 | if ( ! empty($values)) |
| 837 | { |
| 838 | foreach ($values as $i => $addRowValue) |
| 839 | { |
| 840 | $additional_articles[$i]['settings'] = $field_settings; |
| 841 | $additional_articles[$i]['content'][$element_name . '_' . $key] = $addRowValue; |
| 842 | } |
| 843 | } |
| 844 | } |
| 845 | else |
| 846 | { |
| 847 | if ($is_custom_xml_export){ |
| 848 | $article[$element_name][$key] = apply_filters('pmxe_acf_field', pmxe_filter(($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars(implode("|", $values)))) : implode("|", $values), $fieldSnipped), $key, $pid); |
| 849 | } |
| 850 | else{ |
| 851 | $article[$element_name . '_' . $key] = apply_filters('pmxe_acf_field', pmxe_filter(($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars(implode($implode_delimiter, $values)))) : implode($implode_delimiter, $values), $fieldSnipped), $element_name . '_' . $key, $pid); |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | } |
| 856 | |
| 857 | if ($is_custom_xml_export){ |
| 858 | $article[$element_name] = serialize($article[$element_name]); |
| 859 | } |
| 860 | |
| 861 | if ( ! empty($repeater_sub_field_names)) $acfs[$element_name] = $repeater_sub_field_names; |
| 862 | |
| 863 | if ( ! empty($additional_articles) ) |
| 864 | { |
| 865 | foreach ($additional_articles as $i => $additional_article) { |
| 866 | self::$additional_articles[] = $additional_article; |
| 867 | } |
| 868 | } |
| 869 | } |
| 870 | |
| 871 | endif; |
| 872 | |
| 873 | if ($is_xml_export) $xmlWriter->closeElement(); |
| 874 | |
| 875 | $put_to_csv = false; |
| 876 | |
| 877 | break; |
| 878 | |
| 879 | case 'flexible_content': |
| 880 | |
| 881 | if ( ! $is_sub_field ) self::$fc_sub_field_names = array(); |
| 882 | |
| 883 | if ($is_xml_export) $xmlWriter->beginElement($element_name_ns, $element_name, null); |
| 884 | |
| 885 | // check if the flexible content field has rows of data |
| 886 | if( have_rows($field_name, $pid) ): |
| 887 | |
| 888 | // loop through the rows of data |
| 889 | while ( have_rows($field_name, $pid) ) : the_row(); |
| 890 | |
| 891 | $row = self::acf_get_row(); |
| 892 | |
| 893 | foreach ($row['field']['layouts'] as $layout) { |
| 894 | |
| 895 | if ($layout['name'] == $row['value'][ $row['i'] ]['acf_fc_layout']){ |
| 896 | |
| 897 | if ($is_xml_export) $xmlWriter->startElement(preg_replace('#^\d+#', '', $row['value'][ $row['i'] ]['acf_fc_layout']) . '_' . $row['i']); |
| 898 | |
| 899 | foreach ($layout['sub_fields'] as $sub_field) { |
| 900 | |
| 901 | $layout_field_name = $element_name . '_' . $layout['name'] . '_' . $row['i']; |
| 902 | |
| 903 | $v = ''; |
| 904 | |
| 905 | if (isset($row['value'][ $row['i'] ][ $sub_field['key'] ])) |
| 906 | { |
| 907 | $v = $row['value'][ $row['i'] ][ $sub_field['key'] ]; |
| 908 | |
| 909 | if ($is_xml_export) |
| 910 | { |
| 911 | // apply filters |
| 912 | $v = apply_filters( "acf/format_value", $v, $pid, $sub_field ); |
| 913 | $v = apply_filters( "acf/format_value/type={$sub_field['type']}", $v, $pid, $sub_field ); |
| 914 | $v = apply_filters( "acf/format_value/name={$sub_field['_name']}", $v, $pid, $sub_field ); |
| 915 | $v = apply_filters( "acf/format_value/key={$sub_field['key']}", $v, $pid, $sub_field ); |
| 916 | } |
| 917 | } |
| 918 | |
| 919 | if ($preview && ! $is_xml_export){ |
| 920 | switch ($sub_field['type']) { |
| 921 | case 'textarea': |
| 922 | case 'oembed': |
| 923 | case 'wysiwyg': |
| 924 | case 'wp_wysiwyg': |
| 925 | case 'date_time_picker': |
| 926 | case 'date_picker': |
| 927 | $v = preg_replace( "/\r|\n/", "", esc_html($v) ); |
| 928 | break; |
| 929 | default: |
| 930 | break; |
| 931 | } |
| 932 | } |
| 933 | |
| 934 | $sub_field['delimiter'] = $implode_delimiter; |
| 935 | |
| 936 | $sub_field_values = self::export_acf_field( |
| 937 | $v, |
| 938 | $sub_field, |
| 939 | false, |
| 940 | $pid, |
| 941 | $article, |
| 942 | $xmlWriter, |
| 943 | $acfs, |
| 944 | $is_xml_export ? $sub_field['name'] : $layout_field_name . '_' . $sub_field['name'], |
| 945 | $element_name_ns, |
| 946 | $fieldSnipped, |
| 947 | '', |
| 948 | $preview, |
| 949 | $is_xml_export ? false : true, |
| 950 | true |
| 951 | ); |
| 952 | |
| 953 | if ( ! $is_xml_export ) |
| 954 | { |
| 955 | switch ($sub_field['type']) |
| 956 | { |
| 957 | case 'repeater': |
| 958 | |
| 959 | if ( ! empty($sub_field_values)) |
| 960 | { |
| 961 | foreach ($sub_field_values as $key => $values) { |
| 962 | $article[$layout_field_name . '_' . $key] = ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars(implode($implode_delimiter, $values)))) : implode($implode_delimiter, $values); |
| 963 | if ( ! in_array($layout_field_name . '_' . $key, self::$fc_sub_field_names)) self::$fc_sub_field_names[] = $layout_field_name . '_' . $key; |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | break; |
| 968 | case 'flexible_content': |
| 969 | |
| 970 | |
| 971 | break; |
| 972 | |
| 973 | default: |
| 974 | |
| 975 | $article[$layout_field_name . '_' . $sub_field['name']] = is_array($sub_field_values) ? implode($implode_delimiter, $sub_field_values) : $sub_field_values; |
| 976 | |
| 977 | if ( ! in_array($layout_field_name . '_' . $sub_field['name'], self::$fc_sub_field_names)) |
| 978 | self::$fc_sub_field_names[] = $layout_field_name . '_' . $sub_field['name']; |
| 979 | |
| 980 | break; |
| 981 | } |
| 982 | } |
| 983 | } |
| 984 | if ($is_xml_export) $xmlWriter->closeElement(); |
| 985 | } |
| 986 | } |
| 987 | |
| 988 | endwhile; |
| 989 | |
| 990 | else : |
| 991 | |
| 992 | // no layouts found |
| 993 | |
| 994 | endif; |
| 995 | |
| 996 | if ($is_xml_export) $xmlWriter->closeElement(); |
| 997 | |
| 998 | $put_to_csv = false; |
| 999 | |
| 1000 | break; |
| 1001 | |
| 1002 | default: |
| 1003 | |
| 1004 | break; |
| 1005 | } |
| 1006 | } |
| 1007 | |
| 1008 | if ($return_value) return $field_value; |
| 1009 | |
| 1010 | if ( ! empty(self::$fc_sub_field_names)) $acfs[$element_name] = self::$fc_sub_field_names; |
| 1011 | |
| 1012 | if ($put_to_csv) |
| 1013 | { |
| 1014 | $val = apply_filters('pmxe_acf_field', pmxe_filter( ( ! empty($field_value) ) ? maybe_serialize($field_value) : '', $fieldSnipped), $field_name, $pid); |
| 1015 | |
| 1016 | if ($is_xml_export) |
| 1017 | { |
| 1018 | $xmlWriter->beginElement($element_name_ns, $element_name, null); |
| 1019 | $xmlWriter->writeData($val, $element_name); |
| 1020 | $xmlWriter->closeElement(); |
| 1021 | } |
| 1022 | else |
| 1023 | { |
| 1024 | // $article[$element_name] = ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars($val))) : $val; |
| 1025 | wp_all_export_write_article( $article, $element_name, ($preview) ? trim(preg_replace('~[\r\n]+~', ' ', htmlspecialchars($val))) : $val); |
| 1026 | if ( ! isset($acfs[$element_name]) && ! in_array($field_options['type'], array('repeater', 'clone'))) $acfs[$element_name] = $element_name; |
| 1027 | } |
| 1028 | } |
| 1029 | } |
| 1030 | |
| 1031 | public function filter_csv_rows($articles, $options, $export_id) |
| 1032 | { |
| 1033 | if ( ! empty(self::$additional_articles) and $options['export_to'] == 'csv') |
| 1034 | { |
| 1035 | $base_article = $articles[count($articles) - 1]; |
| 1036 | |
| 1037 | if ( ! empty(self::$additional_articles ) ) |
| 1038 | { |
| 1039 | foreach (self::$additional_articles as $article) |
| 1040 | { |
| 1041 | if ($article['settings']['repeater_field_fill_empty_columns']) |
| 1042 | { |
| 1043 | foreach ($article['content'] as $key => $value) { |
| 1044 | unset($base_article[$key]); |
| 1045 | } |
| 1046 | $articles[] = @array_merge($base_article, $article['content']); |
| 1047 | } |
| 1048 | else |
| 1049 | { |
| 1050 | $articles[] = $article['content']; |
| 1051 | } |
| 1052 | } |
| 1053 | self::$additional_articles = array(); |
| 1054 | } |
| 1055 | } |
| 1056 | |
| 1057 | return $articles; |
| 1058 | } |
| 1059 | |
| 1060 | public function get_fields_options( &$fields, $field_keys = array() ){ |
| 1061 | |
| 1062 | if ( ! empty($this->_acf_groups) ) |
| 1063 | { |
| 1064 | foreach ($this->_acf_groups as $key => $group) |
| 1065 | { |
| 1066 | if ( ! empty($group['fields'])) |
| 1067 | { |
| 1068 | foreach ($group['fields'] as $field) |
| 1069 | { |
| 1070 | $field_key = $field['label']; |
| 1071 | |
| 1072 | if ( ! in_array($field_key, $field_keys) ) continue; |
| 1073 | |
| 1074 | $fields['ids'][] = 1; |
| 1075 | $fields['cc_label'][] = $field['name']; |
| 1076 | $fields['cc_php'][] = ''; |
| 1077 | $fields['cc_code'][] = ''; |
| 1078 | $fields['cc_sql'][] = ''; |
| 1079 | $fields['cc_options'][] = serialize(array_merge($field, array('group_id' => ((!empty($group['ID'])) ? $group['ID'] : $group['id']) ))); |
| 1080 | $fields['cc_type'][] = 'acf'; |
| 1081 | $fields['cc_value'][] = $field['name']; |
| 1082 | $fields['cc_name'][] = $field_key; |
| 1083 | $fields['cc_settings'][] = ''; |
| 1084 | } |
| 1085 | } |
| 1086 | } |
| 1087 | } |
| 1088 | } |
| 1089 | |
| 1090 | public function render( & $i ){ |
| 1091 | |
| 1092 | if ( ! empty($this->_acf_groups) ) |
| 1093 | { |
| 1094 | ?> |
| 1095 | <p class="wpae-available-fields-group"><?php _e("ACF", "wp_all_export_plugin"); ?><span class="wpae-expander">+</span></p> |
| 1096 | <div class="wp-all-export-acf-wrapper wpae-custom-field"> |
| 1097 | <?php |
| 1098 | |
| 1099 | foreach ($this->_acf_groups as $key => $group) |
| 1100 | { |
| 1101 | $is_acf_group_visible = false; |
| 1102 | if (!empty($group['location'])){ |
| 1103 | foreach ( $group['location'] as $locationRule ){ |
| 1104 | $rule = array_shift($locationRule); |
| 1105 | if ( XmlExportEngine::$is_user_export && $rule['param'] == 'user_form'){ |
| 1106 | $is_acf_group_visible = true; |
| 1107 | break; |
| 1108 | } |
| 1109 | elseif ( XmlExportEngine::$is_taxonomy_export && $rule['param'] == 'taxonomy'){ |
| 1110 | $is_acf_group_visible = true; |
| 1111 | break; |
| 1112 | } |
| 1113 | elseif ( 'specific' == XmlExportEngine::$exportOptions['export_type'] && $rule['param'] == 'post_type'){ |
| 1114 | if ( $rule['operator'] == '==' && in_array($rule['value'], XmlExportEngine::$post_types)){ |
| 1115 | $is_acf_group_visible = true; |
| 1116 | break; |
| 1117 | } |
| 1118 | elseif ( $rule['operator'] != '==' && ! in_array($rule['value'], XmlExportEngine::$post_types)){ |
| 1119 | $is_acf_group_visible = true; |
| 1120 | break; |
| 1121 | } |
| 1122 | } |
| 1123 | elseif( 'advanced' == XmlExportEngine::$exportOptions['export_type']){ |
| 1124 | $is_acf_group_visible = true; |
| 1125 | break; |
| 1126 | } |
| 1127 | } |
| 1128 | } |
| 1129 | else{ |
| 1130 | $is_acf_group_visible = true; |
| 1131 | } |
| 1132 | |
| 1133 | if ( ! $is_acf_group_visible ) continue; |
| 1134 | |
| 1135 | ?> |
| 1136 | <div class="wpae-acf-field"> |
| 1137 | <ul> |
| 1138 | <li> |
| 1139 | <div class="default_column" rel=""> |
| 1140 | <label class="wpallexport-element-label"><?php echo $group['title']; ?></label> |
| 1141 | <input type="hidden" name="rules[]" value="pmxe_acf_<?php echo (!empty($group['ID'])) ? $group['ID'] : $group['id'];?>"/> |
| 1142 | </div> |
| 1143 | </li> |
| 1144 | <?php |
| 1145 | if ( ! empty($group['fields'])) |
| 1146 | { |
| 1147 | foreach ($group['fields'] as $field) |
| 1148 | { |
| 1149 | ?> |
| 1150 | <li class="pmxe_acf_<?php echo (!empty($group['ID'])) ? $group['ID'] : $group['id'];?> wp_all_export_auto_generate"> |
| 1151 | <div class="custom_column" rel="<?php echo ($i + 1);?>"> |
| 1152 | <label class="wpallexport-xml-element"><?php echo $field['label']; ?></label> |
| 1153 | <input type="hidden" name="ids[]" value="1"/> |
| 1154 | <input type="hidden" name="cc_label[]" value="<?php echo $field['name']; ?>"/> |
| 1155 | <input type="hidden" name="cc_php[]" value=""/> |
| 1156 | <input type="hidden" name="cc_code[]" value=""/> |
| 1157 | <input type="hidden" name="cc_sql[]" value=""/> |
| 1158 | <input type="hidden" name="cc_options[]" value="<?php echo esc_html(serialize(array_merge($field, array('group_id' => ((!empty($group['ID'])) ? $group['ID'] : $group['id']) ))));?>"/> |
| 1159 | <input type="hidden" name="cc_type[]" value="acf"/> |
| 1160 | <input type="hidden" name="cc_value[]" value="<?php echo $field['name']; ?>"/> |
| 1161 | <input type="hidden" name="cc_name[]" value="<?php echo $field['label'];?>"/> |
| 1162 | <input type="hidden" name="cc_settings[]" value=""/> |
| 1163 | </div> |
| 1164 | </li> |
| 1165 | <?php |
| 1166 | $i++; |
| 1167 | } |
| 1168 | } |
| 1169 | ?> |
| 1170 | </ul> |
| 1171 | </div> |
| 1172 | <?php |
| 1173 | } |
| 1174 | ?> |
| 1175 | </div> |
| 1176 | <?php |
| 1177 | } |
| 1178 | } |
| 1179 | |
| 1180 | public function render_new_field(){ |
| 1181 | |
| 1182 | if ( ! empty($this->_acf_groups) ) |
| 1183 | { |
| 1184 | foreach ($this->_acf_groups as $key => $group) |
| 1185 | { |
| 1186 | ?> |
| 1187 | <optgroup label="<?php _e("ACF", "wp_all_export_plugin"); ?> - <?php echo $group['title']; ?>"> |
| 1188 | <?php |
| 1189 | if ( ! empty($group['fields'])) |
| 1190 | { |
| 1191 | foreach ($group['fields'] as $field) |
| 1192 | { |
| 1193 | $field_options = esc_html(serialize(array_merge($field, array('group_id' => ((!empty($group['ID'])) ? $group['ID'] : $group['id']) )))); |
| 1194 | ?> |
| 1195 | <option |
| 1196 | value="acf" |
| 1197 | label="<?php echo $field['name'];?>" |
| 1198 | options="<?php echo $field_options; ?>"><?php echo $field['label'];?></option> |
| 1199 | <?php |
| 1200 | } |
| 1201 | } |
| 1202 | ?> |
| 1203 | </optgroup> |
| 1204 | <?php |
| 1205 | } |
| 1206 | ?> |
| 1207 | </div> |
| 1208 | <?php |
| 1209 | } |
| 1210 | } |
| 1211 | |
| 1212 | public function render_filters(){ |
| 1213 | |
| 1214 | if ( ! empty($this->_acf_groups) ){ |
| 1215 | ?> |
| 1216 | <optgroup label="<?php _e("ACF", "wp_all_export_plugin"); ?>"> |
| 1217 | <?php |
| 1218 | foreach ($this->_acf_groups as $key => $group) { |
| 1219 | if ( ! empty($group['fields'])){ |
| 1220 | foreach ($group['fields'] as $field) { |
| 1221 | ?> |
| 1222 | <option value="<?php echo 'cf_' . $field['name']; ?>"><?php echo $field['label']; ?></option> |
| 1223 | <?php |
| 1224 | } |
| 1225 | } |
| 1226 | } |
| 1227 | ?> |
| 1228 | </optgroup> |
| 1229 | <?php |
| 1230 | } |
| 1231 | |
| 1232 | } |
| 1233 | |
| 1234 | public static function prepare_import_template( $exportOptions, &$templateOptions, &$acf_list, $element_name, $field_options) |
| 1235 | { |
| 1236 | $field_tpl_key = $element_name . '[1]'; |
| 1237 | |
| 1238 | $acf_list[] = '[' . $field_options['name'] . '] ' . $field_options['label']; |
| 1239 | |
| 1240 | $field_template = false; |
| 1241 | |
| 1242 | $is_multiple_field_value = false; |
| 1243 | |
| 1244 | $is_xml_template = $exportOptions['export_to'] == 'xml'; |
| 1245 | |
| 1246 | $xpath_separator = $is_xml_template ? '/' : '_'; |
| 1247 | |
| 1248 | $implode_delimiter = XmlExportEngine::$implode; |
| 1249 | |
| 1250 | switch ($field_options['type']) |
| 1251 | { |
| 1252 | case 'text': |
| 1253 | case 'textarea': |
| 1254 | case 'number': |
| 1255 | case 'email': |
| 1256 | case 'password': |
| 1257 | case 'url': |
| 1258 | case 'oembed': |
| 1259 | case 'wysiwyg': |
| 1260 | case 'image': |
| 1261 | case 'file': |
| 1262 | case 'date_picker': |
| 1263 | case 'color_picker': |
| 1264 | case 'acf_cf7': |
| 1265 | case 'gravity_forms_field': |
| 1266 | case 'limiter': |
| 1267 | case 'wp_wysiwyg': |
| 1268 | case 'date_time_picker': |
| 1269 | $field_template = '{' . $field_tpl_key . '}'; |
| 1270 | break; |
| 1271 | case 'gallery': |
| 1272 | |
| 1273 | $field_template = array( |
| 1274 | 'search_in_media' => 1, |
| 1275 | 'delim' => $implode_delimiter, |
| 1276 | 'gallery' => '{' . $field_tpl_key . '}' |
| 1277 | ); |
| 1278 | |
| 1279 | break; |
| 1280 | case 'relationship': |
| 1281 | |
| 1282 | $field_template = array( |
| 1283 | 'delim' => $implode_delimiter, |
| 1284 | 'value' => '{' . $field_tpl_key . '}' |
| 1285 | ); |
| 1286 | |
| 1287 | break; |
| 1288 | case 'post_object': |
| 1289 | case 'page_link': |
| 1290 | case 'user': |
| 1291 | |
| 1292 | if ($is_xml_template) |
| 1293 | { |
| 1294 | $field_template = '{' . $field_tpl_key . '}'; |
| 1295 | } |
| 1296 | else |
| 1297 | { |
| 1298 | $field_tpl_key = str_replace("[1]", "", $field_tpl_key); |
| 1299 | |
| 1300 | if ($field_options['multiple']) |
| 1301 | { |
| 1302 | if ($implode_delimiter == "|") |
| 1303 | $field_template = '[str_replace("|", ",",{' . $field_tpl_key . '[1]})]'; |
| 1304 | else |
| 1305 | $field_template = '{' . $field_tpl_key . '[1]}'; |
| 1306 | } |
| 1307 | else |
| 1308 | { |
| 1309 | $field_template = '{' . $field_tpl_key . '[1]}'; |
| 1310 | } |
| 1311 | } |
| 1312 | |
| 1313 | break; |
| 1314 | case 'select': |
| 1315 | case 'checkbox': |
| 1316 | |
| 1317 | $templateOptions['is_multiple_field_value'][$field_options['key']] = "no"; |
| 1318 | |
| 1319 | if ($is_xml_template) |
| 1320 | { |
| 1321 | if ($implode_delimiter == "|") |
| 1322 | $field_template = '[str_replace("|", ",",{' . $field_tpl_key . '})]'; |
| 1323 | else |
| 1324 | $field_template = '{' . $field_tpl_key . '}'; |
| 1325 | } |
| 1326 | else |
| 1327 | { |
| 1328 | $field_tpl_key = str_replace("[1]", "", $field_tpl_key); |
| 1329 | |
| 1330 | if ($implode_delimiter == "|") |
| 1331 | $field_template = '[str_replace("|", ",",{' . $field_tpl_key . '[1]})]'; |
| 1332 | else |
| 1333 | $field_template = '{' . $field_tpl_key . '[1]}'; |
| 1334 | } |
| 1335 | |
| 1336 | break; |
| 1337 | case 'radio': |
| 1338 | case 'true_false': |
| 1339 | |
| 1340 | $templateOptions['is_multiple_field_value'][$field_options['key']] = "no"; |
| 1341 | |
| 1342 | $field_template = '{' . $field_tpl_key . '}'; |
| 1343 | |
| 1344 | break; |
| 1345 | case 'location-field': |
| 1346 | case 'google_map': |
| 1347 | |
| 1348 | if ( ! $is_xml_template) $field_tpl_key = str_replace("[1]", "", $field_tpl_key); |
| 1349 | |
| 1350 | $field_template = array( |
| 1351 | 'address' => '{' . $field_tpl_key . $xpath_separator . 'address[1]}', |
| 1352 | 'address_geocode' => 'address_no_key', |
| 1353 | 'address_google_developers_api_key' => '', |
| 1354 | 'address_google_for_work_client_id' => '', |
| 1355 | 'address_google_for_work_digital_signature' => '', |
| 1356 | 'lat' => '{' . $field_tpl_key . $xpath_separator . 'lat[1]}', |
| 1357 | 'lng' => '{' . $field_tpl_key . $xpath_separator . 'lng[1]}' |
| 1358 | ); |
| 1359 | |
| 1360 | break; |
| 1361 | case 'paypal_item': |
| 1362 | |
| 1363 | if ( ! $is_xml_template) $field_tpl_key = str_replace("[1]", "", $field_tpl_key); |
| 1364 | |
| 1365 | $field_template = array( |
| 1366 | 'item_name' => '{' . $field_tpl_key . $xpath_separator . 'item_name[1]}', |
| 1367 | 'item_description' => '{' . $field_tpl_key . $xpath_separator . 'item_description[1]}', |
| 1368 | 'price' => '{' . $field_tpl_key . $xpath_separator . 'price[1]}' |
| 1369 | ); |
| 1370 | |
| 1371 | break; |
| 1372 | case 'taxonomy': |
| 1373 | |
| 1374 | $taxonomy_options = array(); |
| 1375 | |
| 1376 | $single_term = new stdClass; |
| 1377 | $single_term->item_id = 1; |
| 1378 | $single_term->parent_id = NULL; |
| 1379 | $single_term->xpath = $is_xml_template ? '{' . $field_tpl_key . '/term[1]}' : '{' . $field_tpl_key . '}'; |
| 1380 | $single_term->assign = false; |
| 1381 | |
| 1382 | if ($implode_delimiter == "|"){ |
| 1383 | $single_term->xpath = '[str_replace("|", ",", '. $single_term->xpath .')]'; |
| 1384 | } |
| 1385 | |
| 1386 | $taxonomy_options[] = $single_term; |
| 1387 | |
| 1388 | $templateOptions['is_multiple_field_value'][$field_options['key']] = "no"; |
| 1389 | |
| 1390 | $field_template = json_encode($taxonomy_options); |
| 1391 | |
| 1392 | break; |
| 1393 | |
| 1394 | case 'clone': |
| 1395 | |
| 1396 | if (!empty($field_options['clone'])) { |
| 1397 | $sub_fields = array(); |
| 1398 | foreach ($field_options['clone'] as $sub_field_key) { |
| 1399 | if (strpos($sub_field_key, 'group_') === 0) { |
| 1400 | $acf_groups = get_posts(array( |
| 1401 | 'posts_per_page' => 1, |
| 1402 | 'post_type' => 'acf-field-group', |
| 1403 | 'name' => $sub_field_key, |
| 1404 | 'post_status' => 'publish' |
| 1405 | )); |
| 1406 | if (!empty($acf_groups)) { |
| 1407 | foreach ($acf_groups as $acf_group) { |
| 1408 | $sub_fields = get_posts(array( |
| 1409 | 'posts_per_page' => -1, |
| 1410 | 'post_type' => 'acf-field', |
| 1411 | 'post_parent' => $acf_group->ID, |
| 1412 | 'post_status' => 'publish', |
| 1413 | 'orderby' => 'menu_order', |
| 1414 | 'order' => 'ASC' |
| 1415 | )); |
| 1416 | } |
| 1417 | } |
| 1418 | } |
| 1419 | else { |
| 1420 | $args = array( |
| 1421 | 'name' => $sub_field_key, |
| 1422 | 'post_type' => 'acf-field', |
| 1423 | 'post_status' => 'publish', |
| 1424 | 'posts_per_page' => 1 |
| 1425 | ); |
| 1426 | $my_posts = get_posts($args); |
| 1427 | if ($my_posts) { |
| 1428 | $sub_fields[] = $my_posts[0]; |
| 1429 | } |
| 1430 | } |
| 1431 | } |
| 1432 | if ( ! empty($sub_fields) ){ |
| 1433 | |
| 1434 | foreach ($sub_fields as $n => $sub_field){ |
| 1435 | |
| 1436 | $sub_field_options = unserialize($sub_field->post_content); |
| 1437 | $sub_field_options['label'] = $sub_field->post_title; |
| 1438 | $sub_field_options['name'] = $sub_field->post_excerpt; |
| 1439 | $sub_field_options['ID'] = $sub_field->ID; |
| 1440 | $sub_field_options['key'] = $sub_field->post_name; |
| 1441 | |
| 1442 | $sub_field_tpl_key = $is_xml_template ? $sub_field->post_excerpt : $element_name . '_' . strtolower($sub_field->post_excerpt); |
| 1443 | $field_template[$sub_field->post_name] = self::prepare_import_template( $exportOptions, $templateOptions, $acf_list, $sub_field_tpl_key, $sub_field_options ); |
| 1444 | } |
| 1445 | } |
| 1446 | } |
| 1447 | |
| 1448 | break; |
| 1449 | |
| 1450 | case 'repeater': |
| 1451 | |
| 1452 | if ($is_xml_template) |
| 1453 | { |
| 1454 | $field_template = array( |
| 1455 | 'is_variable' => 'yes', |
| 1456 | 'foreach' => '{' . $field_tpl_key . '/row}', |
| 1457 | 'rows' => array() |
| 1458 | ); |
| 1459 | } |
| 1460 | else |
| 1461 | { |
| 1462 | $field_template = array( |
| 1463 | 'is_variable' => 'csv', |
| 1464 | 'separator' => $implode_delimiter, |
| 1465 | 'rows' => array() |
| 1466 | ); |
| 1467 | } |
| 1468 | |
| 1469 | if (class_exists('acf')){ |
| 1470 | |
| 1471 | global $acf; |
| 1472 | |
| 1473 | if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){ |
| 1474 | |
| 1475 | $sub_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => (( ! empty($field_options['id'])) ? $field_options['id'] : $field_options['ID']), 'post_status' => 'publish')); |
| 1476 | |
| 1477 | if ( ! empty($sub_fields) ){ |
| 1478 | |
| 1479 | foreach ($sub_fields as $n => $sub_field){ |
| 1480 | |
| 1481 | $sub_field_options = unserialize($sub_field->post_content); |
| 1482 | $sub_field_options['label'] = $sub_field->post_title; |
| 1483 | $sub_field_options['name'] = $sub_field->post_excerpt; |
| 1484 | $sub_field_options['ID'] = $sub_field->ID; |
| 1485 | $sub_field_options['key'] = $sub_field->post_name; |
| 1486 | |
| 1487 | $sub_field_tpl_key = $is_xml_template ? $sub_field->post_excerpt : $element_name . '_' . strtolower($sub_field->post_excerpt); |
| 1488 | $field_template['rows']['1'][$sub_field->post_name] = self::prepare_import_template( $exportOptions, $templateOptions, $acf_list, $sub_field_tpl_key, $sub_field_options ); |
| 1489 | |
| 1490 | $templateOptions['is_multiple_field_value'][$field_options['key']]['rows']['1'][$sub_field->post_name] = "no"; |
| 1491 | |
| 1492 | } |
| 1493 | } |
| 1494 | |
| 1495 | } |
| 1496 | else |
| 1497 | { |
| 1498 | if ( ! empty($field['sub_fields'])) |
| 1499 | { |
| 1500 | foreach ($field['sub_fields'] as $n => $sub_field) |
| 1501 | { |
| 1502 | $sub_field_tpl_key = $is_xml_template ? $sub_field['name'] : $element_name . '_' . strtolower($sub_field['name']); |
| 1503 | |
| 1504 | $field_template['rows']['1'][$sub_field['key']] = self::prepare_import_template( $exportOptions, $templateOptions, $acf_list, $sub_field_tpl_key, $sub_field ); |
| 1505 | |
| 1506 | $templateOptions['is_multiple_field_value'][$field_options['key']]['rows']['1'][$sub_field['key']] = "no"; |
| 1507 | } |
| 1508 | } |
| 1509 | } |
| 1510 | } |
| 1511 | |
| 1512 | break; |
| 1513 | |
| 1514 | case 'flexible_content': |
| 1515 | |
| 1516 | $field_template = array( |
| 1517 | 'layouts' => array() |
| 1518 | ); |
| 1519 | |
| 1520 | if (class_exists('acf')){ |
| 1521 | |
| 1522 | global $acf; |
| 1523 | |
| 1524 | if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){ |
| 1525 | |
| 1526 | $sub_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => (( ! empty($field_options['id'])) ? $field_options['id'] : $field_options['ID']), 'post_status' => 'publish')); |
| 1527 | |
| 1528 | if ( ! empty($field_options['layouts'])) |
| 1529 | { |
| 1530 | foreach ($field_options['layouts'] as $key => $layout) |
| 1531 | { |
| 1532 | if ( ! empty($sub_fields) ) |
| 1533 | { |
| 1534 | $field_template['layouts'][(string)($key + 1)]['acf_fc_layout'] = $layout['name']; |
| 1535 | |
| 1536 | foreach ($sub_fields as $n => $sub_field) |
| 1537 | { |
| 1538 | $sub_field_options = unserialize($sub_field->post_content); |
| 1539 | |
| 1540 | if ($sub_field_options['parent_layout'] == $layout['key']) |
| 1541 | { |
| 1542 | $sub_field_options['label'] = $sub_field->post_title; |
| 1543 | $sub_field_options['name'] = $sub_field->post_excerpt; |
| 1544 | $sub_field_options['ID'] = $sub_field->ID; |
| 1545 | $sub_field_options['key'] = $sub_field->post_name; |
| 1546 | |
| 1547 | if ($is_xml_template) |
| 1548 | { |
| 1549 | $sub_field_tpl_key = $field_tpl_key . '/' . $layout['name'] . '_' . $key . '[1]/' . $sub_field->post_excerpt; |
| 1550 | } |
| 1551 | else |
| 1552 | { |
| 1553 | $sub_field_tpl_key = $element_name . '_' . $layout['name'] . '_' . $key . '_' . strtolower($sub_field->post_excerpt); |
| 1554 | } |
| 1555 | |
| 1556 | $field_template['layouts'][(string)($key + 1)][$sub_field->post_name] = self::prepare_import_template( $exportOptions, $templateOptions, $acf_list, $sub_field_tpl_key, $sub_field_options ); |
| 1557 | |
| 1558 | $templateOptions['is_multiple_field_value'][$field_options['key']]['layouts'][(string)($key + 1)][$sub_field->post_name] = "no"; |
| 1559 | } |
| 1560 | } |
| 1561 | } |
| 1562 | } |
| 1563 | } |
| 1564 | } |
| 1565 | else |
| 1566 | { |
| 1567 | if ( ! empty($field['layouts'])) |
| 1568 | { |
| 1569 | foreach ($field['layouts'] as $key => $layout) |
| 1570 | { |
| 1571 | if ( ! empty($layout['sub_fields'])) |
| 1572 | { |
| 1573 | $field_template['layouts'][(string)($key + 1)]['acf_fc_layout'] = $layout['key']; |
| 1574 | |
| 1575 | foreach ($layout['sub_fields'] as $n => $sub_field){ |
| 1576 | |
| 1577 | if ($is_xml_template) |
| 1578 | { |
| 1579 | $sub_field_tpl_key = $field_tpl_key . '/' . $layout['name'] . '_' . $key . '[1]/' . $sub_field['name']; |
| 1580 | } |
| 1581 | else |
| 1582 | { |
| 1583 | $sub_field_tpl_key = $element_name . '_' . $layout['name'] . '_' . $key . '_' . strtolower($sub_field['name']); |
| 1584 | } |
| 1585 | |
| 1586 | $field_template['layouts'][(string)($key + 1)][$sub_field['key']] = self::prepare_import_template( $exportOptions, $templateOptions, $acf_list, $sub_field_tpl_key, $sub_field ); |
| 1587 | |
| 1588 | $templateOptions['is_multiple_field_value'][$field_options['key']]['layouts'][(string)($key + 1)][$sub_field['key']] = "no"; |
| 1589 | } |
| 1590 | } |
| 1591 | } |
| 1592 | } |
| 1593 | } |
| 1594 | } |
| 1595 | |
| 1596 | break; |
| 1597 | |
| 1598 | default: |
| 1599 | |
| 1600 | $field_template = '{' . $field_tpl_key . '}'; |
| 1601 | |
| 1602 | break; |
| 1603 | |
| 1604 | } |
| 1605 | return $field_template; |
| 1606 | } |
| 1607 | |
| 1608 | public function auto_generate_export_fields( & $fields ){ |
| 1609 | |
| 1610 | if ( ! empty($this->_acf_groups) ) |
| 1611 | { |
| 1612 | foreach ($this->_acf_groups as $key => $group) |
| 1613 | { |
| 1614 | if ( ! empty($group['fields'])) |
| 1615 | { |
| 1616 | foreach ($group['fields'] as $field) |
| 1617 | { |
| 1618 | $fields['ids'][] = 1; |
| 1619 | $fields['cc_label'][] = $field['name']; |
| 1620 | $fields['cc_php'][] = 0; |
| 1621 | $fields['cc_code'][] = ''; |
| 1622 | $fields['cc_sql'][] = ''; |
| 1623 | $fields['cc_settings'][] = ''; |
| 1624 | $fields['cc_type'][] = 'acf'; |
| 1625 | $fields['cc_options'][] = serialize(array_merge($field, array('group_id' => ((!empty($group['ID'])) ? $group['ID'] : $group['id']) ))); |
| 1626 | $fields['cc_value'][] = $field['name']; |
| 1627 | $fields['cc_name'][] = $field['label']; |
| 1628 | } |
| 1629 | } |
| 1630 | } |
| 1631 | } |
| 1632 | } |
| 1633 | |
| 1634 | /** |
| 1635 | * __get function. |
| 1636 | * |
| 1637 | * @access public |
| 1638 | * @param mixed $key |
| 1639 | * @return mixed |
| 1640 | */ |
| 1641 | public function __get( $key ) { |
| 1642 | return $this->get( $key ); |
| 1643 | } |
| 1644 | |
| 1645 | /** |
| 1646 | * Get a session variable |
| 1647 | * |
| 1648 | * @param string $key |
| 1649 | * @param mixed $default used if the session variable isn't set |
| 1650 | * @return mixed value of session variable |
| 1651 | */ |
| 1652 | public function get( $key, $default = null ) { |
| 1653 | return isset( $this->{$key} ) ? $this->{$key} : $default; |
| 1654 | } |
| 1655 | |
| 1656 | public static function acf_get_row() { |
| 1657 | |
| 1658 | global $acf; |
| 1659 | |
| 1660 | if ($acf and version_compare($acf->settings['version'], '5.3.6.0') >= 0) |
| 1661 | { |
| 1662 | return acf_get_loop('active'); |
| 1663 | } |
| 1664 | // check and return row |
| 1665 | elseif( !empty($GLOBALS['acf_field']) ) { |
| 1666 | |
| 1667 | return end( $GLOBALS['acf_field'] ); |
| 1668 | |
| 1669 | } |
| 1670 | |
| 1671 | // return |
| 1672 | return false; |
| 1673 | |
| 1674 | } |
| 1675 | } |
| 1676 | } |
| 1677 |