PluginProbe
Datafeedr API / 1.0.75
Datafeedr API v1.0.75
1.4.2 1.0.125 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.29 1.0.3 1.0.30 1.0.31 1.0.32 1.0.33 All 181 releases
datafeedr-api / classes / class-dfrapi-export.php

class-dfrapi-export.php in Datafeedr API 1.0.75, at classes/class-dfrapi-export.php

71 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
5 if ( ! class_exists( 'Dfrapi_Export' ) ) {
6
7 /**
8 * Configuration page.
9 */
10 class Dfrapi_Export {
11
12 private $page = 'dfrapi-export';
13 private $key;
14
15 public function __construct() {
16 $this->key = 'dfrapi_export';
17 add_action( 'admin_init', array( $this, 'register_settings' ) );
18 add_action( 'admin_menu', array( $this, 'admin_menu' ), 50 );
19 }
20
21 function admin_menu() {
22 add_submenu_page(
23 'dfrapi',
24 __( 'Export &#8212; Datafeedr API', DFRAPI_DOMAIN ),
25 __( 'Export', DFRAPI_DOMAIN ),
26 'manage_options',
27 $this->key,
28 array( $this, 'output' )
29 );
30 }
31
32 function output() {
33 echo '<div class="wrap" id="' . $this->key . '">';
34 echo '<h2>' . dfrapi_setting_pages( $this->page ) . ' &#8212; Datafeedr API</h2>';
35 settings_fields( $this->page );
36 do_settings_sections( $this->page);
37 echo '</div>';
38 }
39
40 function register_settings() {
41 register_setting( $this->page, $this->key, array( $this, 'validate' ) );
42 add_settings_section( 'export_network_data', __( 'Network Data', DFRAPI_DOMAIN ), array( &$this, 'section_export_network_data' ), $this->page );
43 add_settings_section( 'export_merchant_data', __( 'Merchant Data', DFRAPI_DOMAIN ), array( &$this, 'section_export_merchant_data' ), $this->page );
44 }
45
46 function section_export_network_data() {
47 $network_settings = (array) get_option( 'dfrapi_networks' );
48 echo '<p>' . __( 'To use the same selection of networks on another website, export this store\'s network data by copying the code below. Paste the code into the Import page of your other site.' ) . '</p>';
49 echo '<textarea rows="4" cols="100%" onclick="this.focus();this.select()" readonly="readonly">';
50 echo '[NETWORKS]' . serialize( $network_settings ) . '[/NETWORKS]';
51 echo '</textarea>';
52 echo '<p class="description">' . __( 'Click within the box to select all your networks and affiliate IDs.' ) . '</p>';
53 }
54
55 function section_export_merchant_data() {
56 $merchant_settings = (array) get_option( 'dfrapi_merchants' );
57 echo '<p>' . __( 'To use the same selection of merchants on another website, export this store\'s merchant data by copying the code below. Paste the code into the Import page of your other site.' ) . '</p>';
58 echo '<textarea rows="4" cols="100%" onclick="this.focus();this.select()" readonly="readonly">';
59 echo '[MERCHANTS]' . serialize( $merchant_settings ) . '[/MERCHANTS]';
60 echo '</textarea>';
61 echo '<p class="description">' . __( 'Click within the box to select all your merchant IDs.' ) . '</p>';
62 }
63
64 function validate( $input ) {
65 return $input;
66 }
67
68 } // class Dfrapi_Export
69
70 } // class_exists check
71