| @@ -13,17 +13,17 @@ | ||
| 13 | 13 | private $key; |
| 14 | 14 | |
| 15 | 15 | public function __construct() { |
| 16 | 16 | $this->key = 'dfrapi_export'; |
| 17 | - add_action( 'admin_init', array( &$this, 'register_settings' ) ); | |
| 18 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); | |
| 17 | + add_action( 'admin_init', array( $this, 'register_settings' ) ); | |
| 18 | + add_action( 'admin_menu', array( $this, 'admin_menu' ), 50 ); | |
| 19 | 19 | } |
| 20 | - | |
| 20 | + | |
| 21 | 21 | function admin_menu() { |
| 22 | 22 | add_submenu_page( |
| 23 | 23 | 'dfrapi', |
| 24 | - __( 'Export — Datafeedr API', DFRAPI_DOMAIN ), | |
| 25 | - __( 'Export', DFRAPI_DOMAIN ), | |
| 24 | + __( 'Export — Datafeedr API', 'datafeedr-api' ), | |
| 25 | + __( 'Export', 'datafeedr-api' ), | |
| 26 | 26 | 'manage_options', |
| 27 | 27 | $this->key, |
| 28 | 28 | array( $this, 'output' ) |
| 29 | 29 | ); |
| @@ -35,36 +35,35 @@ | ||
| 35 | 35 | settings_fields( $this->page ); |
| 36 | 36 | do_settings_sections( $this->page); |
| 37 | 37 | echo '</div>'; |
| 38 | 38 | } |
| 39 | - | |
| 39 | + | |
| 40 | 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 ); | |
| 41 | + add_settings_section( 'export_network_data', __( 'Network Data', 'datafeedr-api' ), array( &$this, 'section_export_network_data' ), $this->page ); | |
| 42 | + add_settings_section( 'export_merchant_data', __( 'Merchant Data', 'datafeedr-api' ), array( &$this, 'section_export_merchant_data' ), $this->page ); | |
| 44 | 43 | } |
| 45 | - | |
| 44 | + | |
| 46 | 45 | function section_export_network_data() { |
| 47 | 46 | $network_settings = (array) get_option( 'dfrapi_networks' ); |
| 48 | 47 | 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 | 48 | echo '<textarea rows="4" cols="100%" onclick="this.focus();this.select()" readonly="readonly">'; |
| 50 | - echo '[NETWORKS]' . serialize( $network_settings ) . '[/NETWORKS]'; | |
| 49 | + echo esc_textarea( '[NETWORKS]' . serialize( $network_settings ) . '[/NETWORKS]' ); | |
| 51 | 50 | echo '</textarea>'; |
| 52 | 51 | echo '<p class="description">' . __( 'Click within the box to select all your networks and affiliate IDs.' ) . '</p>'; |
| 53 | 52 | } |
| 54 | - | |
| 53 | + | |
| 55 | 54 | function section_export_merchant_data() { |
| 56 | 55 | $merchant_settings = (array) get_option( 'dfrapi_merchants' ); |
| 57 | 56 | 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 | 57 | echo '<textarea rows="4" cols="100%" onclick="this.focus();this.select()" readonly="readonly">'; |
| 59 | - echo '[MERCHANTS]' . serialize( $merchant_settings ) . '[/MERCHANTS]'; | |
| 58 | + echo esc_textarea( '[MERCHANTS]' . serialize( $merchant_settings ) . '[/MERCHANTS]' ); | |
| 60 | 59 | echo '</textarea>'; |
| 61 | 60 | echo '<p class="description">' . __( 'Click within the box to select all your merchant IDs.' ) . '</p>'; |
| 62 | 61 | } |
| 63 | - | |
| 62 | + | |
| 64 | 63 | function validate( $input ) { |
| 65 | 64 | return $input; |
| 66 | 65 | } |
| 67 | - | |
| 66 | + | |
| 68 | 67 | } // class Dfrapi_Export |
| 69 | 68 | |
| 70 | 69 | } // class_exists check |