Ejemplo n.º 1
0
 public static function instance($options = array())
 {
     if (self::$_instance === null) {
         $className = __CLASS__;
         self::$_instance = new $className($options);
     }
     return self::$_instance;
 }
Ejemplo n.º 2
0
 static function wf_widgets()
 {
     // v5.3
     global $post;
     // v6.44
     //$regions = Wf_Widget::$regions;  // v5.3
     $regions = get_regions_list($post);
     // v6.47
     $widget_list = self::list_wf_widgets($regions);
     WF_Debug::stash(array('$widget_list' => $widget_list));
     $region_html = Wf_Widget::$region_html;
     // v4.4
     foreach ($regions as $region) {
         // v3.60
         if (!isset($region_html[$region])) {
             $region_html[$region] = '';
             // v4.4
         }
         $w_list = array();
         // v6.44?  WCTS  errors
         //Cannot use string offset as an array in ... wf_widgets.php on line 175 (= the 'disinherit' line)
         if (count($widget_list[$region]['current']) > 0) {
             $w_list[$region] = $widget_list[$region]['current'];
             if (!is_array($w_list[$region][0])) {
                 // v6.44?
                 error_log("WF bug trap: wf_widgets.php, REQUEST_URI = " . $_SERVER['REQUEST_URI'] . ", REMOTE_ADDR = " . $_SERVER['REMOTE_ADDR']);
             } else {
                 //if($w_list[$region][0]['qstring'] == "0") { // disinherit!
                 if ($w_list[$region][0]['widget_type'] == "cancel") {
                     // disinherit!  // v6.66
                     continue;
                     // skip to next region
                 }
             }
         } elseif (count($widget_list[$region]['inherited']) > 0 && $widget_list[$region]['inherited'][0]['widget_type'] != "cancel") {
             // v6.66
             $w_list[$region] = $widget_list[$region]['inherited'];
         } else {
             continue;
             // skip to next region
         }
         foreach ($w_list[$region] as $widgnum => $widget) {
             // widgnum introduced 12.3.12 to allow id for widget
             $qstring = $widget['qstring'] . "&widgnum=" . $widgnum;
             // ."&widget=".$widget['widget_type'];  // v6.48
             $widget_class = Wf_Widget::$current_specs[$widget['widget_type']]['class_name'];
             // eg: Post_widget
             $widget_obj = new $widget_class($region, $widget['widget_type'], $qstring);
             $region_html[$region] .= $widget_obj->get_html();
             // ($region, $qstring); // v4.4
             WF_Debug::stash(array('$qstring' => $qstring, '$widget_class' => $widget_class, '$region' => $region, '$region_html["' . $region . '"]' => $region_html[$region]));
         }
     }
     Wf_Widget::$region_html = $region_html;
     // v5.3
     //WF_Debug::stash(array('$region_html' => $region_html));
 }