/** Update a particular instance. * * This function should check that $new_opts is set correctly. * The newly calculated value of $opts should be returned. * If "false" is returned, the instance won't be saved/updated. * * @param array $new_opts New settings for this instance as input by the user via form() * @param array $old_opts Old settings for this instance * @return array Settings to save or bool false to cancel saving */ function update($new_opts, $old_opts) { $opts = $old_opts; # use setting from json import if available $new_opts = !empty($new_opts["import"]) ? king_import_json($new_opts["import"]) : $new_opts; # save new form values $opts['orderby'] = $new_opts["orderby"]; $opts['order'] = $new_opts["order"]; $opts['style'] = isset($new_opts["style"]) ? 'list' : 'none'; $opts['show_date'] = $new_opts["show_date"]; $opts['show_count'] = $new_opts["show_count"]; $opts['hide_empty'] = $new_opts["hide_empty"]; $opts['use_desc_for_title'] = $new_opts["use_desc_for_title"]; $opts['depth'] = $new_opts["depth"]; $opts['child_of'] = strip_tags(stripslashes($new_opts["child_of"])); $opts['feed'] = strip_tags(stripslashes($new_opts["feed"])); $opts['feed_image'] = addslashes($new_opts["feed_image"]); $opts['exclude'] = stripslashes($new_opts["exclude"]); $opts['hierarchical'] = $new_opts["hierarchical"]; WidgetForm::clean_default_opts($opts, $new_opts); return $opts; }
/** Update a particular instance. * * This function should check that $new_opts is set correctly. * The newly calculated value of $opts should be returned. * If "false" is returned, the instance won't be saved/updated. * * @param array $new_opts New settings for this instance as input by the user via form() * @param array $old_opts Old settings for this instance * @return array Settings to save or bool false to cancel saving */ function update($new_opts, $old_opts) { $opts = $old_opts; # use setting from json import if available $new_opts = !empty($new_opts["import"]) ? king_import_json($new_opts["import"]) : $new_opts; $opts['use_php'] = isset($new_opts["use_php"]); $opts['text'] = $new_opts["text"]; WidgetForm::clean_default_opts($opts, $new_opts); return $opts; }
/** Update a particular instance. * * This function should check that $new_opts is set correctly. * The newly calculated value of $opts should be returned. * If "false" is returned, the instance won't be saved/updated. * * @param array $new_opts New settings for this instance as input by the user via form() * @param array $old_opts Old settings for this instance * @return array Settings to save or bool false to cancel saving */ function update($new_opts, $old_opts) { $opts = $old_opts; # use setting from json import if availsable $new_opts = !empty($new_opts["import"]) ? king_import_json($new_opts["import"]) : $new_opts; # save new form values $opts['orderby'] = $new_opts["orderby"]; $opts['order'] = $new_opts["order"]; $opts['depth'] = $new_opts["depth"]; $opts['exclude'] = stripslashes($new_opts["exclude"]); $opts['show_date'] = $new_opts["show_date"]; $opts['show_date'] = $new_opts["date_format"]; $opts['child_of'] = $new_opts["child_of"]; WidgetForm::clean_default_opts($opts, $new_opts); return $opts; }