Example #1
0
 /**
  * Queues the import on the Aggregator service
  */
 public function queue_import($args = array())
 {
     $meetup_api_key = tribe_get_option('meetup_api_key');
     $defaults = array('meetup_api_key' => $meetup_api_key);
     $args = wp_parse_args($args, $defaults);
     return parent::queue_import($args);
 }
 /**
  * Queues the import on the Aggregator service
  */
 public function queue_import($args = array())
 {
     $fb_token = tribe_get_option('fb_token');
     $defaults = array('facebook_token' => $fb_token);
     $args = wp_parse_args($args, $defaults);
     return parent::queue_import($args);
 }
Example #3
0
    /**
     * Finalizes the saving of a scheduled import
     *
     * @param Tribe__Events__Aggregator__Record__Abstract $record Record object
     * @param array $post_data Massaged POSTed data
     * @param array $meta Meta to be saved to the schedule
     */
    public function finalize_schedule_edit($record, $post_data, $meta)
    {
        $this->messages = array('error' => array(), 'success' => array(), 'warning' => array());
        $meta['post_status'] = empty($post_data['post_status']) ? 'draft' : $post_data['post_status'];
        $meta['category'] = empty($post_data['category']) ? null : $post_data['category'];
        $result = $record->save($post_data['post_id'], array(), $meta);
        if (is_wp_error($result)) {
            $this->messages['error'][] = $result->get_error_message();
            ob_start();
            ?>
			<p>
				<?php 
            echo implode(' ', $this->messages['error']);
            ?>
			</p>
			<?php 
            $html = ob_get_clean();
            tribe_notice('tribe-aggregator-schedule-edit-failed', $html, 'type=error');
            return $result;
        }
        $this->messages['success'][] = esc_html__('Scheduled import was successfully updated.');
        ob_start();
        ?>
		<p>
			<?php 
        echo implode(' ', $this->messages['success']);
        ?>
			<a href="<?php 
        echo esc_url(admin_url('edit.php?post_type=' . Tribe__Events__Main::POSTTYPE . '&page=aggregator&tab=scheduled'));
        ?>
" ><?php 
        esc_html_e('View All Scheduled Imports', 'the-events-calendar');
        ?>
</a>
		</p>
		<?php 
        $html = ob_get_clean();
        $this->messages['success'][] = __('Your Scheduled Import has been updated!', 'the-events-calendar');
        tribe_notice('tribe-aggregator-schedule-edit-complete', $html, 'type=success');
        return $result;
    }
Example #4
0
 /**
  * Creates an import record
  *
  * @param string $origin EA origin
  * @param string $type Type of record to create - import or schedule
  * @param array $args Post type args
  *
  * @return WP_Post|WP_Error
  */
 public function create($type = 'manual', $args = array(), $meta = array())
 {
     $defaults = array('file' => empty($this->meta['file']) ? null : $this->meta['file']);
     $meta = wp_parse_args($meta, $defaults);
     return parent::create($type, $args, $meta);
 }