. * * @package ReduxFramework * @subpackage field_import_export * @author Dovy Paukstys * @author Kevin Provance (kprovance) * @version 3.1.8 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Redux_import_export' ) ) { /** * Main ReduxFramework_import_export class * * @since 1.0.0 */ class Redux_import_export { public $is_field = false; public $field_args = array(); public function __construct( $parent ) { $this->parent = $parent; add_action( "wp_ajax_redux_link_options", array( $this, "link_options" ) ); add_action( "wp_ajax_nopriv_redux_link_options", array( $this, "link_options" ) ); add_action( "wp_ajax_redux_download_options", array( $this, "download_options" ) ); add_action( "wp_ajax_nopriv_redux_download_options", array( $this, "download_options" ) ); } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { $secret = md5( md5( AUTH_KEY . SECURE_AUTH_KEY ) . '-' . $this->parent->args['opt_name'] ); if ( true == $this->is_field ) { $fullWidth = $this->field_args['full_width']; } $c = ''; $bDoClose = false; if ( false == $this->is_field ) { $c = 'redux-group-tab hide'; } elseif ( true == $this->is_field && false == $fullWidth ) { echo '
';
$bDoClose = true;
}
echo ' ';
if ( false == $this->is_field ) {
echo ' ';
echo '' . __( 'Import / Export Options', 'redux-framework' ) . ''; } echo '' . __( 'Import Options', 'redux-framework' ) . ''; echo '' . __( 'Import from file', 'redux-framework' ) . ' ' . __( 'Import from URL', 'redux-framework' ) . ' '; echo '';
echo ' ';
echo '' . apply_filters( 'redux-import-file-description', __( 'Input your backup file below and hit Import to restore your sites options from a backup.', 'redux-framework' ) ) . ' '; echo ''; echo '';
echo ' ';
echo '' . apply_filters( 'redux-import-link-description', __( 'Input the URL to another sites options set and hit Import to load the options from that site.', 'redux-framework' ) ) . ' '; echo ''; echo '' . apply_filters( 'redux-import-warning', __( 'WARNING! This will overwrite all existing option values, please proceed with caution!', 'redux-framework' ) ) . ' '; echo '' . __( 'Export Options', 'redux-framework' ) . ''; echo '';
echo ' ';
$link = admin_url( 'admin-ajax.php?action=redux_download_options&secret=' . $secret );
echo '' . apply_filters( 'redux-backup-description', __( 'Here you can copy/download your current option settings. Keep this safe as you can use it as a backup should anything go wrong, or you can use it to restore your settings on this site (or any other site).', 'redux-framework' ) ) . ' '; echo '' . __( 'Copy', 'redux-framework' ) . ' ' . __( 'Download', 'redux-framework' ) . ' ' . __( 'Copy Link', 'redux-framework' ) . ' '; $backup_options = $this->parent->options; $backup_options['redux-backup'] = '1'; echo ""; echo ''; $link = admin_url( 'admin-ajax.php?action=redux_link_options&secret=' . $secret ); echo ''; echo " "; echo ''; if ( true == $bDoClose ) { echo ' |
';
}
}
public function in_field() {
$this->is_field = Redux_Helpers::isFieldInUse( $this->parent, 'import_export' );
}
public function render_tab() {
echo ' |