public function widget_category_headlines($h)
 {
     $h->vars['category_headlines'] = $h->getSerializedSettings('category_headlines');
     $cats = parse_object_to_array($h->vars['category_headlines']['cats']);
     foreach ($cats as $cat_id) {
         $h->vars['category_headlines']['cat_name'] = $h->getCatName($cat_id);
         $h->vars['category_headlines']['posts'] = $this->getCats($h, $cat_id, $h->vars['category_headlines']['type'], $h->vars['category_headlines']['limit']);
         if ($h->vars['category_headlines']['posts']) {
             $h->displayTemplate('category_headlines_box', 'category_headlines', false);
         }
     }
 }
 /**
  * Save Post Images settings
  */
 public function saveSettings($h)
 {
     // Get settings from database if they exist...
     $category_headlines_settings = $h->getSerializedSettings();
     $category_headlines_settings['cats'] = $h->cage->post->getHtmLawed('show_cats');
     $category_headlines_settings['limit'] = $h->cage->post->getInt('limit');
     $category_headlines_settings['type'] = $h->cage->post->getAlnum('type');
     $category_headlines_settings['image_icon'] = $h->cage->post->getAlnum('image_icon');
     $category_headlines_settings['options'] = parse_object_to_array($h->cage->post->getInt('options'));
     //print_r($category_headlines_settings['options']);
     // options
     //        if($h->cage->post->keyExists('options') )
     //        {
     //           foreach($h->cage->post->keyExists('options') as $key => $value) {
     //            $category_headlines_settings['options'][] = $value;
     //         }
     //        }
     // update settings and set message
     $h->updateSetting('category_headlines_settings', serialize($category_headlines_settings));
     $result = array('message' => $h->lang["main_settings_saved"]);
     return json_encode($result);
 }