Ejemplo n.º 1
0
                            foreach ($titleArray as $titlePart) {
                                $titleSlug .= htmlentities(ucfirst($titlePart));
                            }
                            //$charsToElim = array('?','/','\\');
                            $titleSlug = $this->sanitize($titleSlug, false, true);
                            $link = 'http://academicblogs.org' . $link;
                            $sectionSlug = $htmlCounter[$spanSlug]['slug'];
                            $htmlCounter[$spanSlug]['links'][$titleSlug]['slug'] = $titleSlug;
                            $htmlCounter[$spanSlug]['links'][$titleSlug]['title'] = htmlspecialchars(strip_tags($title));
                            $htmlCounter[$spanSlug]['links'][$titleSlug]['link'] = $link;
                            //if ($childLink->){
                            $htmlCounter[$spanSlug]['links'][$titleSlug]['blogs'] = $this->getLinksFromSection($link);
                            //}
                            //$links[$sectionSlug][$titleSlug]['title'] = $title;
                            //$links[$sectionSlug][$titleSlug]['link'] = $link;
                        } else {
                            $counter--;
                            $htmlCounter[$spanSlug]['links'][$counter]['error'] = false;
                        }
                    }
                }
            }
        }
        return $htmlCounter;
    }
}
$ABSubscriptionBuilder = new AB_subscription_builder();
$ABLinksArray = $ABSubscriptionBuilder->build_the_ref_array();
echo '<pre>';
print_r($ABLinksArray);
echo '</pre>';
Ejemplo n.º 2
0
 /**
  * The AJAX callback function for refreshing the academicblogs.org feeds
  *
  * This is called by the ajax request to 'refresh_ab_feeds' in
  * modules/ab-subscribe/js/progressbar.js
  *
  * The value echoed from this function should be a percentage between
  * 0 and 100. This value is used by the progressbar javascript to show
  * the progress level
  */
 public function refresh_ab_feeds_callback()
 {
     if (!isset($_POST['start'])) {
         return;
     }
     $start = intval($_POST['start']);
     if (0 === $start) {
         // This is the beginning of a routine. Clear out previous caches
         // and refetch top-level cats
         delete_option('pf_ab_categories');
         $cats = AB_subscription_builder::get_blog_categories();
         update_option('pf_ab_categories', $cats);
         // Set the percentage to 1%. This is sort of a fib
         $pct = 1;
     } else {
         // Anything but zero: Pull up the categories and pick
         // up where last left off
         $cats = get_option('pf_ab_categories');
         $cats = AB_subscription_builder::add_category_links($cats, 1);
         if ($cats['nodes_populated'] >= $cats['node_count']) {
             $cats['last_updated'] = time();
         }
         update_option('pf_ab_categories', $cats);
         // Calculate progress
         $pct = intval(100 * ($cats['nodes_populated'] / $cats['node_count']));
     }
     echo $pct;
     die;
 }