Пример #1
0
 function set_options($input)
 {
     // If reset defaults was clicked
     if (isset($_POST['reset_defaults'])) {
         $options = new Mappress_Options();
         return get_object_vars($this);
     }
     // If resize was clicked then resize ALL maps
     if (isset($_POST['force_resize']) && $_POST['resize_from']['width'] && $_POST['resize_from']['height'] && $_POST['resize_to']['width'] && $_POST['resize_to']['height']) {
         $maps = Mappress_Map::get_list();
         foreach ($maps as $map) {
             if ($map->width == $_POST['resize_from']['width'] && $map->height == $_POST['resize_from']['height']) {
                 $map->width = $_POST['resize_to']['width'];
                 $map->height = $_POST['resize_to']['height'];
                 $map->save($postid);
             }
         }
     }
     // Force checkboxes to boolean
     $input['mapTypeControl'] = isset($input['mapTypeControl']) ? true : false;
     $input['overviewMapControl'] = isset($input['overviewMapControl']) ? true : false;
     $input['overviewMapControlOptions']['opened'] = isset($input['overviewMapControlOptions']['opened']) ? true : false;
     $input['streetViewControl'] = isset($input['streetViewControl']) ? true : false;
     $input['scrollwheel'] = isset($input['scrollwheel']) ? true : false;
     $input['keyboardShortcuts'] = isset($input['keyboardShortcuts']) ? true : false;
     $input['initialOpenInfo'] = isset($input['initialOpenInfo']) ? true : false;
     $input['traffic'] = isset($input['traffic']) ? true : false;
     $input['tooltips'] = isset($input['tooltips']) ? true : false;
     if (class_exists('Mappress_Pro')) {
         $input = $this->set_options_pro($input);
     } else {
         $input['control'] = true;
         unset($input['metaKey'], $input['metaSyncSave'], $input['metaSyncUpdate']);
     }
     return $input;
 }