Esempio n. 1
0
 public function get_menus()
 {
     $menu_args = array('hide_empty' => true, 'orderby' => 'name');
     $_menus = wp_get_nav_menus($menu_args);
     $menus = array();
     foreach ($_menus as $_menu) {
         try {
             $menu = new cfd_menu($_menu->slug);
             if ($menu->last_modified() != null && strtotime($menu->last_modified()) > strtotime($this->start_date) || !empty($this->data['menus']) && in_array($_menu->term_id, $this->data['menus'])) {
                 $menus[$_menu->slug] = new cfd_menu($_menu->slug);
             }
         } catch (Exception $e) {
             // no error handling yet
             error_log('cfd_menu object error: ' . $e->getMessage() . ' - ' . __FILE__ . '::' . __LINE__);
         }
     }
     return $menus;
 }
Esempio n. 2
0
 protected function compare_menus($data)
 {
     $menus = array();
     if (count($data)) {
         foreach ($data as $menu) {
             try {
                 $m = new cfd_menu($menu['guid']);
                 $menus[$m->guid()] = array('guid' => $m->guid(), 'last_modified' => $m->last_modified());
             } catch (Exception $e) {
                 // doesn't exist, which is fine here
             }
         }
     }
     return $menus;
 }