/** * Determine some helpful info about this module * * Sets the module ID based on the key used to register the module in * the $pf global * * Also sets up the module_dir and module_url for use throughout */ function setup_module_info() { $pf = pressforward(); // Determine the ID by checking which module this class belongs to $module_class = get_class($this); foreach ($pf->modules as $module_id => $module) { if (is_a($module, $module_class)) { $this->id = $module_id; break; } } // If we've found an id, use it to create some paths if ($this->id) { $this->module_dir = trailingslashit(PF_ROOT . '/modules/' . $this->id); $this->module_url = trailingslashit(PF_URL . 'modules/' . $this->id); } $enabled = get_option(PF_SLUG . '_' . $this->id . '_enable'); if (!in_array($enabled, array('yes', 'no'))) { $enabled = 'yes'; } if ('yes' == $enabled) { // Run at 15 to make sure the core menu is loaded first add_action('admin_menu', array($this, 'setup_admin_menus'), 15); add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_styles')); // There's no admin_enqueue_styles action add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts')); add_action('wp_enqueue_styles', array($this, 'wp_enqueue_styles')); add_action('feeder_menu', array($this, 'add_to_feeder')); add_filter('dash_widget_bar', array($this, 'add_dash_widgets_filter')); } if (method_exists($this, 'post_setup_module_info')) { $this->post_setup_module_info(); } }
private function set($key, $value) { switch ($key) { case 'ID': $this->ID = $value; break; case 'guid': $this->related_identifiers[] = array('relation' => 'isAlternativeIdentifier', 'identifier' => pressforward('controller.metas')->get_post_pf_meta($this->ID, 'item_link')); break; case 'post_title': $this->title = $value; break; default: $this->{$key} = $value; break; } }
public function zenodo_meta_maker($id) { //var_dump($_POST); //var_dump($_GET); //die(); pf_log($id); pf_log($_POST); $valid_metas = array_merge($this->metas, array('zen_source_title' => array('name' => 'source_title'), 'zen_item_date' => array('name' => 'item_date'))); $check = pressforward('controller.metas')->update_pf_meta($id, 'pf_zenodo_ready', true); foreach ($valid_metas as $get_key => $descript) { pf_log($id . '-' . $get_key . '-' . $descript['name']); pf_log($_POST[$get_key]); $check = pressforward('controller.metas')->update_pf_meta($id, $descript['name'], $_POST[$get_key]); pf_log($check); } return ''; }
/** * Enqueue our scripts and styles for the progressbar to work */ public function admin_enqueue_scripts() { global $pagenow; $pf = pressforward(); $hook = 0 != func_num_args() ? func_get_arg(0) : ''; if (!in_array($pagenow, array('admin.php'))) { return; } if (!in_array($hook, array('pressforward_page_pf-feeder'))) { return; } wp_enqueue_script('jquery-ui'); wp_enqueue_script('jquery-ui-progressbar'); wp_enqueue_script('ab-refresh-progressbar', $pf->modules['ab-subscribe']->module_url . 'js/progressbar.js', array('jquery', 'jquery-ui-progressbar')); wp_enqueue_script('ab-dropdowns', $pf->modules['ab-subscribe']->module_url . 'js/dropdowns.js', array('jquery')); wp_enqueue_style('ab-refresh-progressbar', $pf->modules['ab-subscribe']->module_url . 'css/progressbar.css'); }
public function admin_enqueue_scripts() { global $pagenow; $pf = pressforward(); $hook = 0 != func_num_args() ? func_get_arg(0) : ''; if (!in_array($pagenow, array('admin.php'))) { return; } if (!in_array($hook, array('pressforward_page_pf-feeder'))) { return; } wp_enqueue_script('feed-manip-ajax', $pf->modules['rss-import']->module_url . 'assets/js/feed-manip-imp.js', array('jquery', PF_SLUG . '-twitter-bootstrap')); wp_enqueue_style(PF_SLUG . '-feeder-style', $pf->modules['rss-import']->module_url . 'assets/css/feeder-styles.css'); }
esc_html_e('Loading...'); ?> </span></div> <div id="extra-fields" style="display: none"></div> <div class="postdivrich"> <?php $editor_settings = array('teeny' => true, 'textarea_rows' => '15'); $content = ''; if ($selection) { $content .= $selection; } if (!$selection) { if ($url != '') { $content .= pressforward()->pf_feed_items->get_content_through_aggregator($url); } } if ($url) { $content .= '<p>'; if ($selection) { $content .= __('via '); } $content .= sprintf("<a href='%s'>%s</a>.</p>", esc_url($url), esc_html($title)); } remove_action('media_buttons', 'media_buttons'); add_action('media_buttons', 'nominate_this_media_buttons'); function nominate_this_media_buttons() { _e('Add:', 'pf'); if (current_user_can('upload_files')) {
public function fill_journal_title($id) { $filled = ''; $filled = pressforward('controller.metas')->get_post_pf_meta($id, 'source_title'); if (!empty($filled)) { $filled .= '; '; } $filled .= 'Aggregated by ' . get_bloginfo('name'); return $filled; }
<?php wp_nonce_field('pf_settings'); ?> <h2 class="nav-tab-wrapper" id="pf-settings-tabs"> <?php $tabs = pressforward()->form_of->permitted_tabs(); foreach ($tabs as $tab => $tab_meta) { if (current_user_can($tab_meta['cap'])) { $title = $tab_meta['title']; $class = $tab == $current ? 'nav-tab-active' : ''; echo "<a class='nav-tab {$class}' id='{$tab}-tab' href='#top#{$tab}' data-tab-target='#{$tab}'>{$title}</a>"; } } ?> </h2> <div class="tabwrappper"> <?php pressforward()->form_of->settings_tab_group($current); ?> </div> <br /> <input type="submit" name="submit" class="button-primary" value="<?php _e("Save Changes", 'pf'); ?> " /> <br /> </form> </div> </div> </div>
public function get_feeds_without_folders($ids = true) { $q = new WP_Query(array('post_type' => pressforward()->pf_feeds->post_type, 'fields' => 'ids', 'orderby' => 'title', 'order' => 'ASC', 'nopaging' => true, 'tax_query' => array(array('taxonomy' => pressforward()->pf_feeds->tag_taxonomy, 'operator' => 'NOT EXISTS')))); $ids = $q->posts; return $ids; }
function all_feed_assembler() { ob_start(); if (isset($_GET['from'])) { $fromUT = $_GET['from']; } else { $fromUT = 0; } if (isset($_GET['limitless']) && $_GET['limitless'] == 'true') { $limitless = true; } else { $limitless = false; } if ($fromUT < 100 || $fromUT > date('U')) { $fromUT = false; } #var_dump($fromUT); die(); header('Content-Type: application/rss+xml; charset=' . get_option('blog_charset'), true); echo '<?xml version="1.0" encoding="utf-8"?>'; echo "<!-- RSS Generated by PressForward plugin on " . get_site_url() . " on " . date('m/d/Y; h:i:s A T') . " -->\n"; ?> <rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:freebase="http://rdf.freebase.com/ns/internet/website_category" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"> <channel> <title><?php bloginfo('name'); ?> - PressForward Unfiltered Feed</title> <link><?php echo home_url('/?feed=feedforward'); ?> </link> <description>The aggregation of all feeds collected with PressForward at <?php bloginfo('name'); ?> </description> <language><?php bloginfo('language'); ?> </language> <?php #<blogChannel:blogRoll></blogChannel:blogRoll> #<blogChannel:mySubscriptions></blogChannel:mySubscriptions> ?> <blogChannel:blink>http://pressforward.org/news/</blogChannel:blink> <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license> <lastBuildDate><?php echo date('D, d M Y H:i:s O'); ?> </lastBuildDate> <atom:link href="<?php echo home_url('/?feed=feedforward'); ?> " rel="self" type="application/rss+xml" /> <docs>http://feed2.w3.org/docs/rss2.html</docs> <generator>PressForward</generator> <?php #Built based on MQL spec (http://wiki.freebase.com/wiki/MQL) for queries in style of [{ "type": "/internet/website_category", "id": null, "name": "Aggregator" }] ?> <category domain="Freebase">Aggregator</category> <category domain="Freebase">/m/075x5v</category> <category domain="Freebase">/en/aggregator</category> <freebase:name>Aggregator</freebase:name> <freebase:mid>/m/075x5v</freebase:mid> <freebase:id>/en/aggregator</freebase:id> <?php $admin_email = get_bloginfo('admin_email'); $userObj = get_user_by('email', $admin_email); if (!$userObj) { $firstAdmin = get_users(array('role' => 'administrator', 'number' => 1)); foreach ($firstAdmin as $admin) { $admin_email = $admin->user_email; } $userObj = get_user_by('email', $admin_email); } #var_dump($admin_email); echo '2'; die(); ?> <managingEditor><?php bloginfo('admin_email'); ?> (<?php echo $userObj->display_name; ?> )</managingEditor> <webMaster><?php bloginfo('admin_email'); ?> (<?php echo $userObj->display_name; ?> )</webMaster> <ttl>30</ttl> <?php $c = 0; foreach (pressforward()->pf_feed_items->archive_feed_to_display(0, 50, $fromUT, $limitless) as $item) { echo '<item>'; ?> <title><![CDATA[<?php echo strip_tags($item['item_title']); ?> ]]></title> <?php # <link> should send users to published nominations when available. ?> <link><?php echo $item['item_link']; ?> </link> <guid isPermaLink="true"><?php echo $item['item_link']; ?> </guid> <?php if (!empty($item['item_tags'])) { $items = explode(',', $item['item_tags']); if (!empty($items)) { foreach ($items as $tag) { echo '<category><![CDATA[' . $tag . ']]></category>'; } } } ?> <dc:creator><?php echo $item['item_author']; ?> </dc:creator> <?php $content = $item['item_content']; $excerpt = pf_feed_excerpt($content); ?> <description><![CDATA[<?php echo strip_tags($excerpt); ?> ]]></description> <content:encoded><![CDATA[<?php echo strip_tags($content); ?> ]]></content:encoded> <pubDate><?php echo date('D, d M Y H:i:s O', strtotime($item['item_date'])); ?> </pubDate> <?php # Should use <source>, but not passing along RSS link, something to change. # <guid></guid> echo '</item>'; if ($c++ == 50) { break; } } ?> </channel> </rss> <?php ob_end_flush(); }
public function get_the_folder_view_title() { if (isset($_GET['feed'])) { $title = get_the_title($_GET['feed']); } else { if (isset($_GET['folder'])) { $term = get_term($_GET['folder'], pressforward()->pf_feeds->tag_taxonomy); $title = $term->name; } else { $title = ''; } } return $title; }
/** * Set up first feed and other install/upgrade tasks * Code via Boone * * @since 3.1.1 * * */ public function check_installed() { global $wp_rewrite; $current_version = PF_VERSION; // define this constant in the loader file $saved_version = get_option('pf_version'); // This is a new installation if (!$saved_version) { // Do whatever you need to do during first installation $check = pressforward()->pf_feeds->create('http://pressforward.org/feed/', array('title' => 'PressForward', 'htmlUrl' => 'http://pressforward.org/', 'description' => 'The news feed for the PressForward project.', 'type' => 'rss', 'module_added' => 'rss-import')); $wp_rewrite->flush_rules(false); // This is an upgrade } else { if (version_compare($saved_version, $current_version, '<')) { // Do whatever you need to do on an upgrade // Version is up to date - do nothing } else { return; } } // Update the version number stored in the db (so this does not run again) update_option('pf_version', PF_VERSION); }
/** * Abstract function to make everything readable. * * Potential arguments to base via array * $args = array( * 'force' => $force, * 'descrip' => $_POST['content'], * 'url' => $url, * 'authorship' => $_POST['authorship'] * ); */ public static function get_readable_text($args) { ob_start(); extract($args, EXTR_SKIP); set_time_limit(0); $url = pf_de_https($url); $readability_stat = $url; $descrip = rawurldecode($descrip); if (get_magic_quotes_gpc()) { $descrip = stripslashes($descrip); } if ($authorship == 'aggregation') { $aggregated = true; } else { $aggregated = false; } $stripped_descrip = strip_tags($descrip); if (str_word_count($stripped_descrip) <= 150 || $aggregated || $force == 'force') { $itemReadReady = self::readability_object($url); #print_r( wp_richedit_pre($itemReadReady)); if ($itemReadReady != 'error-secured') { if (!$itemReadReady) { $read_status = 'failed_readability'; $readability_stat .= __(" This content failed Readability.", 'pf'); //$itemReadReady .= '<br />'; $url = str_replace('&', '&', $url); #Try and get the OpenGraph description. if (pressforward()->og_reader->fetch($url)) { $node = pressforward()->og_reader->fetch($url); $itemReadReady .= $node->description; } elseif ('' != ($contentHtml = @get_meta_tags($url))) { # Try and get the HEAD > META DESCRIPTION tag. $read_status = 'failed_readability_og'; //$itemReadReady .= '<br />'; $itemReadReady = $contentHtml['description']; } else { # Ugh... we can't get anything huh? $read_status = 'failed_readability_og_meta'; //$itemReadReady .= '<br />'; # We'll want to return a false to loop with. $itemReadReady = $descrip; } if (strlen($itemReadReady) < strlen($descrip)) { $itemReadReady = $descrip; $readability_stat .= ' Retrieved text is less than original text.'; $read_status = 'already_readable'; } } else { $read_status = 'made_readable'; } } else { $read_status = 'secured'; $itemReadReady = $descrip; } } else { $read_status = 'already_readable'; $itemReadReady = $descrip; } $return_args = array('status' => $read_status, 'readable' => $itemReadReady); ob_end_flush(); return $return_args; }
echo '<h1>' . PF_TITLE . ': Under Review</h1>'; ?> <?php if ($page > 0) { $pageNumForPrint = sprintf(__('Page %1$d', 'pf'), $page); echo '<span> - ' . $pageNumForPrint . '</span>'; } ?> <span id="h-after"> • </span> <button class="btn btn-small" id="fullscreenfeed"> <?php _e('Full Screen', 'pf'); ?> </button> </div><!-- End title --> <?php pressforward()->admin->pf_search_template(); ?> </header><!-- End Header --> <div role="main"> <?php $this->toolbox(); ?> <div id="entries"> <?php echo '<img class="loading-top" src="' . PF_URL . 'assets/images/ajax-loader.gif" alt="Loading..." style="display: none" />'; ?> <div id="errors"> <div class="pressforward-alertbox" style="display:none;"> <div class="row-fluid"> <div class="span11 pf-alert">
/** * Get the feed item tag taxonomy * * @since 1.7 * * @return string */ public function get_feed_item_tag_taxonomy() { if (isset($this->schema)) { return $this->schema->feed_item_tag_taxonomy; } return ''; } } /** * Bootstrap * * You can also use this to get a value out of the global, eg * * $foo = pressforward()->bar; * * @since 1.7 */ function pressforward() { return PressForward::init(); } // Start me up! pressforward();
/** * Runs a URL through Readability and hands back the stripped content * * @since 1.7 * @see http://www.keyvan.net/2010/08/php-readability/ * @param $url */ public static function readability_object($url) { set_time_limit(0); $url = pressforward()->pf_feed_items->resolve_full_url($url); $request = pf_de_https($url, 'wp_remote_get', array('timeout' => '30')); //print_r($url); print_r(' - Readability<br />'); // change from Boone - use wp_remote_get() instead of file_get_contents() //$request = wp_remote_get( $url, array('timeout' => '30') ); if (is_wp_error($request)) { $content = 'error-secured'; //print_r($request); die(); return $content; } if (!empty($request['body'])) { $html = $request['body']; } elseif (!empty($request) && !is_array($request)) { $html = $request; } else { $content = false; return $content; } //check if tidy exists to clean up the input. if (function_exists('tidy_parse_string')) { $tidy = tidy_parse_string($html, array('wrap' => 0), 'UTF8'); $tidy->cleanRepair(); $html = $tidy->value; } // give it to Readability $readability = new Readability($html, $url); // print debug output? // useful to compare against Arc90's original JS version - // simply click the bookmarklet with FireBug's // console window open $readability->debug = false; // convert links to footnotes? $readability->convertLinksToFootnotes = false; // process it $result = $readability->init(); if ($result) { $content = $readability->getContent()->innerHTML; //$content = $contentOut->innerHTML; //if we've got tidy, let's use it. if (function_exists('tidy_parse_string')) { $tidy = tidy_parse_string($content, array('indent' => true, 'show-body-only' => true, 'wrap' => 0), 'UTF8'); $tidy->cleanRepair(); $content = $tidy->value; } $content = balanceTags($content, true); $content = ent2ncr($content); $content = convert_chars($content); $domRotated = 0; $dom = new domDocument('1.0', 'utf-8'); $dom->preserveWhiteSpace = true; $dom->substituteEntities = true; $dom->resolveExternals = true; $dom->loadXML('<fullContent>' . $content . '</fullContent>'); $images = $dom->getElementsByTagName('img'); foreach ($images as $image) { $img = $image->getAttribute('src'); if (strpos($img, '/') === 0 || strpos($img, 'http') != 0) { $urlArray = parse_url($url); if (strpos($img, 'http') != 0) { $urlBase = 'http://' . $urlArray['host'] . '/'; } else { $urlBase = 'http://' . $urlArray['host']; } if (!is_wp_error(wp_remote_head($urlBase . $img))) { $image->setAttribute('src', $urlBase . $img); $domRotated++; } elseif (!is_wp_error(wp_remote_head($url . $img))) { $image->setAttribute('src', $url . $img); $domRotated++; } else { $image->parentNode->removeChild($image); $domRotated++; } } } if ($domRotated > 0) { $content = $dom->saveXML(); $rel = '(<\\?xml version="1\\.0" encoding="utf-8"\\?>)'; $content = preg_replace("/" . $rel . "/is", ' ', $content); $rel = '(<\\?xml version="1\\.0"\\?>)'; $content = preg_replace("/" . $rel . "/is", ' ', $content); } if (120 > strlen($content)) { $content = false; } # $content = stripslashes($content); # print_r($content); # var_dump($content); die(); // this will also output doctype and comments at top level # $content = ""; # foreach($dom->childNodes as $node){ # $content .= $dom->saveXML($node)."\n"; # } } else { # If Readability can't get the content, send back a FALSE to loop with. $content = false; # and let's throw up an error via AJAX as well, so we know what's going on. //print_r($url . ' fails Readability.<br />'); } if ($content != false) { $contentObj = new pf_htmlchecker($content); $content = $contentObj->closetags($content); } return $content; }
public function simple_nom_to_draft() { pressforward()->nominations->simple_nom_to_draft(); die; }
/** * Get the feed item tag taxonomy name * * @since 1.7 * * @return string */ function pf_feed_item_tag_taxonomy() { return pressforward()->get_feed_item_tag_taxonomy(); }
function build_nom_draft() { global $post; // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything //if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) $pf_drafted_nonce = $_POST['pf_drafted_nonce']; if (!wp_verify_nonce($pf_drafted_nonce, 'drafter')) { die($this->__('Nonce not recieved. Are you sure you should be drafting?', 'pf')); } else { ##Check # print_r(__('Sending to Draft.', 'pf')); ##Check //print_r($_POST); ob_start(); $item_content = $_POST['nom_content']; $item_content = htmlspecialchars_decode($item_content); #$args_fi['url'] = $_POST['item_link']; #$posts = $pf->pf_feed_items->get($args_fi); $linked = get_option('pf_link_to_source', 0); if ($linked < 1) { $item_content = $item_content . $this->get_the_source_statement($_POST['nom_id']); } $item_title = $_POST['nom_title']; $data = array('post_status' => 'draft', 'post_type' => 'post', 'post_title' => $item_title, 'post_content' => $item_content); //Will need to use a meta field to pass the content's md5 id around to check if it has already been posted. //We assume that it is already in nominations, so no need to check there. This might be why we can't use post_exists here. //No need to origonate the check at the time of the feed item either. It can't become a post with the proper meta if it wasn't a nomination first. $item_id = $_POST['item_id']; //YYYY-MM-DD $nom_date = strtotime($_POST['nom_date']); $nom_date = date('Y-m-d', $nom_date); //Now function will not update nomination count when it pushes nomination to publication. $post_check = $this->get_post_nomination_status($nom_date, $item_id, 'post', false); $newPostID = 'repeat'; # # Check if the item was rendered readable, if not, make it so. $readable_state = get_post_meta($_POST['nom_id'], 'readable_status', true); if ($readable_state != 1) { $readArgs = array('force' => false, 'descrip' => htmlspecialchars_decode($item_content), 'url' => $_POST['item_link'], 'authorship' => $_POST['item_author']); $readReady = pressforward()->readability->get_readable_text($readArgs); #var_dump($readReady); die(); $data['post_content'] = $readReady['readable']; } # //Alternative check with post_exists? or use same as above? if ($post_check != true) { ##Check #var_dump($data); die(); //print_r('No Post exists.'); $newPostID = wp_insert_post($data, true); ##Check add_post_meta($_POST['nom_id'], 'nom_id', $_POST['nom_id'], true); pf_meta_transition_post($_POST['nom_id'], $newPostID); $already_has_thumb = has_post_thumbnail($_POST['nom_id']); if ($already_has_thumb) { $post_thumbnail_id = get_post_thumbnail_id($_POST['nom_id']); set_post_thumbnail($newPostID, $post_thumbnail_id); } } $response = array('what' => 'draft', 'action' => 'build_nom_draft', 'id' => $newPostID, 'data' => $data['post_content'] . ' drafted.', 'supplemental' => array('content' => $item_content, 'originID' => $item_id, 'repeat' => $post_check, 'buffered' => ob_get_contents())); $xmlResponse = new WP_Ajax_Response($response); $xmlResponse->send(); ob_end_flush(); die; } }
<div class="title-span title"> <?php pressforward()->form_of->the_page_headline('Nominated'); ?> <button class="btn btn-small" id="fullscreenfeed"> <?php _e('Full Screen', 'pf'); ?> </button> </div><!-- End title --> <?php pressforward()->admin->pf_search_template(); ?> </header><!-- End Header --> <?php pressforward()->admin->nav_bar('pf-review'); ?> <div role="main"> <?php $this->toolbox(); ?> <div id="entries"> <?php echo '<img class="loading-top" src="' . PF_URL . 'assets/images/ajax-loader.gif" alt="Loading..." style="display: none" />'; ?> <div id="errors"> <div class="pressforward-alertbox" style="display:none;"> <div class="row-fluid"> <div class="span11 pf-alert">
public function archive_a_nom() { pressforward()->nominations->archive_a_nom(); die; }
public function trigger_source_data() { $feed_go = get_option(PF_SLUG . '_feeds_go_switch', 0); $feed_iteration = get_option(PF_SLUG . '_feeds_iteration', 0); $retrieval_state = get_option(PF_SLUG . '_iterate_going_switch', 0); $chunk_state = get_option(PF_SLUG . '_ready_to_chunk', 1); pf_log('Invoked: PF_Feed_Retrieve::trigger_source_data()'); pf_log('Feeds go?: ' . $feed_go); pf_log('Feed iteration: ' . $feed_iteration); pf_log('Retrieval state: ' . $retrieval_state); pf_log('Chunk state: ' . $chunk_state); if ($feed_iteration == 0 && $retrieval_state == 0 && $chunk_state == 1) { $status = update_option(PF_SLUG . '_iterate_going_switch', 1); # Echo to the user. pf_log(__('Beginning the retrieval process', 'pf'), true, true); pf_iterate_cycle_state('retrieval_cycles_begun', true); if ($status) { pf_log(__('Iterate switched to going.', 'pf')); } else { pf_log(__('Iterate option not switched.', 'pf')); } pressforward()->pf_feed_items->assemble_feed_for_pull(); } else { $feeds_meta_state = get_option(PF_SLUG . '_feeds_meta_state', array()); if (empty($feeds_meta_state)) { $feeds_meta_state = array('feed_go' => $feed_go, 'feed_iteration' => $feed_iteration, 'retrieval_state' => $retrieval_state, 'chunk_state' => $chunk_state, 'retrigger' => time() + 2 * 60 * 60); update_option(PF_SLUG . '_feeds_meta_state', $feeds_meta_state); pf_log(__('Created new metastate.', 'pf'), true); } else { pf_log(__('Metastate saved and active for check.', 'pf'), true); pf_log($feeds_meta_state); } if ($feeds_meta_state['retrigger'] > time()) { pf_log(__('The sources are already being retrieved.', 'pf'), true); } else { if ($feed_go == $feeds_meta_state['feed_go'] && $feed_iteration == $feeds_meta_state['feed_iteration'] && $retrieval_state == $feeds_meta_state['retrieval_state'] && $chunk_state == $feeds_meta_state['chunk_state']) { pf_log(__('The sources are stuck.', 'pf'), true); # Wipe the checking option for use next time. update_option(PF_SLUG . '_feeds_meta_state', array()); update_option(PF_SLUG . '_ready_to_chunk', 1); update_option(PF_SLUG . '_iterate_going_switch', 1); pressforward()->pf_feed_items->assemble_feed_for_pull(); } elseif ($feeds_meta_state['retrigger'] < time() + 86400 && !empty($feeds_meta_state)) { # If it has been more than 24 hours and retrieval has been frozen in place # and the retrieval state hasn't been reset, reset the check values and reset # the meta state. If it is actually mid-process things should progress. # Otherwise next meta-state check will iterate forward. update_option(PF_SLUG . '_feeds_go_switch', 0); update_option(PF_SLUG . '_ready_to_chunk', 1); update_option(PF_SLUG . '_feeds_meta_state', array()); update_option(PF_SLUG . '_iterate_going_switch', 0); update_option(PF_SLUG . '_feeds_iteration', 0); $double_check = array('feed_go' => 0, 'feed_iteration' => 0, 'retrieval_state' => 0, 'chunk_state' => 1, 'retrigger' => $feeds_meta_state['retrigger']); update_option(PF_SLUG . '_feeds_meta_state', $double_check); pf_log(__('The meta-state is too old. It is now reset. Next time, we should start over.', 'pf'), true); } else { $double_check = array('feed_go' => $feeds_meta_state['feed_go'], 'feed_iteration' => $feed_iteration, 'retrieval_state' => $feeds_meta_state['retrieval_state'], 'chunk_state' => $feeds_meta_state['chunk_state'], 'retrigger' => $feeds_meta_state['retrigger']); update_option(PF_SLUG . '_feeds_meta_state', $double_check); pf_log($double_check); pf_log(__('The sources are already being retrieved.', 'pf'), true); } } } }
-enable"><?php echo $parts['title']; ?> </label> </th> <td> <select id="<?php echo $right; ?> " name="<?php echo $right; ?> "> <?php pressforward()->admin->pf_get_user_role_select($right, pf_get_defining_capability_by_role($parts['default'])); ?> </select> </td> </tr> </table> <p> <?php if (!empty($parts['details'])) { echo $parts['details']; } ?> </p> <br /> <hr />
/** * Get the source data object, in a standardized format * * For the moment, all this data comes from the RSS_Import module. In * the future, other modules can hook in to provide their own data * sources. */ public function source_data_object() { // Loop through each module to get its source data $source_data_object = array(); foreach (pressforward()->modules as $module) { $source_data_object = array_merge($source_data_object, $module->get_data_object()); } return $source_data_object; }
<header id="app-banner"> <div class="title-span title"> <h1>PressForward: Add Feeds</h1> <span id="h-after"> • </span> <!-- <button class="btn btn-small" id="fullscreenfeed"> Full Screen </button> --> </div><!-- End title --> </header> <div class="container-fluid"> <?php if (current_user_can('edit_posts')) { ?> <div class="alert-box postbox"> <div class="handlediv" title="Click to toggle"><br></div> <h3 class="hndle"><span>Feed Problems</span></h3> <div class="inside"> <?php pressforward()->admin->pf_alert_displayer(); ?> </div> </div> <?php } ?> <form method="post" action="options.php" enctype="multipart/form-data"> <?php //settings_fields(PF_SLUG . '_feeder_options'); //$options = get_option(PF_SLUG . '_plugin_feeder_options'); settings_fields(PF_SLUG . '_feedlist_group'); do_action('feeder_menu'); ?> </form> </div>
<?php ignore_user_abort(true); set_time_limit(0); define('IC_SITEBASE', dirname(dirname(dirname(dirname(dirname(__FILE__)))))); // print_r(IC_SITEBASE . '\wp-load.php'); if (!defined('ABSPATH')) { /** Set up WordPress environment */ require_once IC_SITEBASE . '\\wp-load.php'; } $string_to_log = "\nimport-cron.php triggered.\n"; pf_log($string_to_log); pressforward()->pf_feed_items->assemble_feed_for_pull(); pf_log("import-cron.php compleated.\n\n\n"); //do_action('get_more_feeds'); //print_r('<br /><br />Triggered <br />'); //print_r('Iteration active: ' . get_option( PF_SLUG . '_feeds_iteration') . '<br />');