function process_export() { // look for an Export command first if (isset($_POST['_easy_t_do_export']) && $_POST['_easy_t_do_export'] == '_easy_t_do_export') { $exporter = new TestimonialsPlugin_Exporter(); $exporter->process_export(); exit; } }
function import_export_settings_page() { $this->settings_page_top(); ?> <form method="post" action="options.php"> <?php settings_fields('easy-testimonials-import-export-settings-group'); ?> <fieldset> <legend>Hello Testimonials Integration</legend> <p><strong>Want to learn more about Hello Testimonials? <a href="http://hellotestimonials.com/p/welcome-easy-testimonials-users/">Click Here!</a></strong></p> <table class="form-table"> <tr valign="top"> <th scope="row"><label for="easy_t_hello_t_json_url">Hello Testimonials JSON Feed URL</label></th> <td><textarea name="easy_t_hello_t_json_url" id="easy_t_hello_t_json_url" rows=1 style="width: 100%"><?php echo get_option('easy_t_hello_t_json_url'); ?> </textarea> <p class="description">This is the JSON URL you copied from the Custom Integrations page inside Hello Testimonials.</p> </td> </tr> </table> <table class="form-table"> <tr valign="top"> <th scope="row"><label for="easy_t_hello_t_enable_cron">Enable Hello Testimonials Integration</label></th> <td><input type="checkbox" name="easy_t_hello_t_enable_cron" id="easy_t_hello_t_enable_cron" value="1" <?php if (get_option('easy_t_hello_t_enable_cron', 0)) { ?> checked="CHECKED" <?php } ?> /> <p class="description">If checked, new Testimonials will be loaded from your Hello Testimonials account and automatically added to your Testimonials list.</p> </td> </tr> </table> </fieldset> <p class="submit"> <input type="submit" class="button-primary" value="<?php _e('Save Changes', 'easy-testimonials'); ?> " /> </p> <p class="submit" style="margin-top:0;"> <a href="?page=easy-testimonials-import-export&run-cron-now=true" class="button-primary" title="<?php _e('Import From Hello Testimonials Now', 'easy-testimonials'); ?> "><?php _e('Import From Hello Testimonials Now', 'easy-testimonials'); ?> </a> </p> </form> <?php if (isValidKey()) { ?> <form method="POST" action="" enctype="multipart/form-data"> <fieldset> <legend>CSV Import / Export</legend> <h3>Testimonials Importer</h3> <?php //CSV Importer $importer = new TestimonialsPlugin_Importer($this); $importer->csv_importer(); // outputs form and handles input. TODO: break into 2 functions (one to show form, one to process input) ?> <h3>Testimonials Exporter</h3> <?php //CSV Exporter TestimonialsPlugin_Exporter::output_form(); ?> </fieldset> </form> <?php } else { ?> <form method="POST" action="" enctype="multipart/form-data"> <fieldset> <legend>CSV Import / Export</legend> <h3>Testimonials Importer</h3> <p class="easy_testimonials_not_registered"><strong>This feature require Easy Testimonials Pro.</strong> <a class="button" target="blank" href="https://goldplugins.com/our-plugins/easy-testimonials-details/upgrade-to-easy-testimonials-pro/?utm_campaign=upgrade&utm_source=plugin&utm_banner=import_upgrade">Upgrade Now</a></p> <h3>Testimonials Exporter</h3> <p class="easy_testimonials_not_registered"><strong>This feature require Easy Testimonials Pro.</strong> <a class="button" target="blank" href="https://goldplugins.com/our-plugins/easy-testimonials-details/upgrade-to-easy-testimonials-pro/?utm_campaign=upgrade&utm_source=plugin&utm_banner=import_upgrade">Upgrade Now</a></p> </fieldset> </form> <?php } ?> </div><?php //schedule cron if enabled if (get_option('easy_t_hello_t_enable_cron', 0)) { //and if the cron job hasn't already been scheduled if (!wp_get_schedule('hello_t_subscription')) { //schedule the cron job hello_t_cron_activate(); } //if the run cron now button has been clicked if (isset($_GET['run-cron-now']) && $_GET['run-cron-now'] == 'true') { //go ahead and add the testimonials, too add_hello_t_testimonials(); echo '<div id="message" class="updated fade"><p>Success! Your Testimonials have been imported!</p></div>'; } } else { //else if the cron job option has been unchecked //clear the scheduled job hello_t_cron_deactivate(); //if the run cron now button has been clicked if (isset($_GET['run-cron-now']) && $_GET['run-cron-now'] == 'true') { echo '<div id="message" class="updated fade"><p>Hello Testimonials Integration is disabled! Please enable to Import Testimonials.</p></div>'; } } }