PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / trunk
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel vtrunk
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / addon-api / fields / gallery.php
wp-all-export / addon-api / fields Last commit date
checkbox.php 2 months ago date.php 2 months ago datetime.php 2 months ago field.php 2 months ago gallery.php 2 months ago media.php 2 months ago number.php 2 months ago post.php 2 months ago radio.php 2 months ago repeater.php 2 months ago select.php 2 months ago switcher.php 2 months ago text.php 2 months ago time.php 2 months ago toggle.php 2 months ago user.php 2 months ago
gallery.php
58 lines
1 <?php
2
3 namespace Wpae\AddonAPI;
4
5 if ( ! defined( 'ABSPATH' ) ) exit;
6
7 class PMXE_Addon_Gallery_Field extends PMXE_Addon_Media_Field {
8
9 public function toString() {
10 $format = $this->settings['value_format'] ?? 'url';
11 $urls = is_string( $this->value ) ? explode( ',', $this->value ) : $this->value;
12
13 if ( empty( $urls ) ) {
14 return '';
15 }
16
17 $urls = array_map( function ( $item ) use ( $format ) {
18 switch ( $format ) {
19 case 'id':
20 return $this->getMediaId( $item );
21 case 'filename':
22 return $this->getFileName( $item );
23 default:
24 return $this->getMediaUrl( $item );
25 }
26 }, $urls );
27
28 return implode( $this->getImplode(), $urls );
29 }
30
31 public function exportCustomXml( $article, $value, $write = true ) {
32
33 $this->local_value = $value;
34
35 $formatted_values = $this->toString();
36
37 $exported_value = $this->runPhpFunction( $formatted_values );
38
39 // By default we write the values to $article and return it.
40 // But if !$write we return the list of subfields we built instead.
41 if ( $write ) {
42 wp_all_export_write_article( $article, $this->elName, $exported_value );
43
44 return $article;
45 } else {
46 return $exported_value;
47 }
48 }
49
50 public static function getImportTemplate( $field, $name, $field_tpl_key, $implode_delimiter, $is_xml_template ) {
51 return [
52 'search_in_media' => 1,
53 'delim' => $implode_delimiter,
54 'gallery' => '{' . $field_tpl_key . '}'
55 ];
56 }
57 }
58