static function pf_opml_subscriber_validate($input) { $feed_obj = new PF_Feeds_Schema(); if (!empty($input['list'])) { if (!is_array($input['list'])) { if (!$feed_obj->has_feed($input['list'])) { $check = $feed_obj->create((string) $input['list'], array('title' => 'OPML Subscription at ' . $input['list'], 'htmlUrl' => $input['list'], 'type' => 'opml', 'tags' => 'OPML Subscription', 'module_added' => get_called_class())); if (is_wp_error($check) || !$check) { wp_die($check); } self::get_data_object(get_post($check)); } else { $feed_obj->update_url($input['list']); } } else { wp_die('Bad feed input. Why are you trying to place an array?'); } } }
function create_object($args) { $pf_feed_schema = new PF_Feeds_Schema(); return $pf_feed_schema->feed_post_setup($args); }
public function feed_handler($obj, $check = false) { global $pf; $Feeds = new PF_Feeds_Schema(); pf_log('Invoked: PF_Feed_retrieve::feed_handler()'); pf_log('Are we just checking?'); pf_log($check); #setup_postdata( $obj ); $id = $obj->ID; pf_log('Feed ID ' . $id); $type = $Feeds->get_pf_feed_type($id); pf_log('Checking for feed type ' . $type); $module_to_use = $this->does_type_exist($type); if (!$module_to_use) { # Be a better error. pf_log('The feed type does not exist.'); return false; } pf_log('Begin the process to retrieve the object full of feed items.'); //Has this process already occurring? $feed_go = update_option(PF_SLUG . '_feeds_go_switch', 0); pf_log('The Feeds go switch has been updated?'); pf_log($feed_go); $is_it_going = get_option(PF_SLUG . '_iterate_going_switch', 1); if ($is_it_going == 0) { //WE ARE? SHUT IT DOWN!!! update_option(PF_SLUG . '_feeds_go_switch', 0); update_option(PF_SLUG . '_feeds_iteration', 0); update_option(PF_SLUG . '_iterate_going_switch', 0); //print_r( '<br /> We\'re doing this thing already in the data object. <br />' ); if (get_option(PF_SLUG . '_ready_to_chunk', 1) === 0) { pf_log('The chunk is still open because there are no more feeds. [THIS SHOULD NOT OCCUR except at the conclusion of feeds retrieval.]'); # Wipe the checking option for use next time. update_option(PF_SLUG . '_feeds_meta_state', array()); update_option(PF_SLUG . '_ready_to_chunk', 1); } else { pf_log('We\'re doing this thing already in the data object.', true); } //return false; die; } if ('rss-quick' == $type) { # Let's update the RSS-Quick so it has real data. $rq_update = array('type' => 'rss-quick', 'ID' => $id, 'url' => $obj->guid); $Feeds->update($id, $rq_update); } # module function to return a set of standard pf feed_item object # Like get_items in SimplePie $feedObj = $this->get_the_feed_object($module_to_use, $obj); if ($check) { # Be a better error. if (!$feedObj) { return false; } else { return true; } } else { # We've completed the feed retrieval, the system should know it is now ok to ask for another feed. $feed_go = update_option(PF_SLUG . '_feeds_go_switch', 1); pf_log('The Feeds go switch has been updated to on?'); pf_log($feed_go); $prev_iteration = get_option(PF_SLUG . '_prev_iteration', 0); $iterate_op_check = get_option(PF_SLUG . '_feeds_iteration', 1); pf_log('Did the option properly iterate so that the previous iteration count of ' . $prev_iteration . ' is not equal to the current of ' . $iterate_op_check . '?'); if ($prev_iteration === $iterate_op_check) { pf_log('Nope. Did the iteration option emergency update function here?'); $check_iteration = update_option(PF_SLUG . '_feeds_iteration', $iterate_op_check + 1); pf_log($check_iteration); } else { pf_log('Yes'); } if (false == $feedObj || is_wp_error($feedObj)) { } else { if (function_exists('the_alert_box')) { $alert_box = the_alert_box(); $ab_status = $alert_box->status(); if ($ab_status == $obj->post_status) { # The feed has been retrieved, therefor this is a good feed. We can remove the alert. the_alert_box()->remove_alert_on_edit($obj->ID); } } } return $feedObj; } #foreach ( $feedObj as $item ) { # $item #} }