Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. /**
  2. * @param int $id
  3. * To fetch all options for the custom ID
  4. * @param string $key
  5. * String in a format accepted name of key in options table to find it
  6. **/
  7. function plugin_option($id, $key, $type)
  8. {
  9. $get_option_val = row_one("plugins_options", "op_key='".$key."' and the_id='".$id."' and the_type='".$type."' " , "");
  10. if(!empty($get_option_val))
  11. {
  12. return $get_option_val['op_value'];
  13. }else {
  14. return "";
  15. }
  16. }
  17.  
  18. /**
  19. * @param string $key
  20. * String in a format accepted name of key in options table to find it
  21. * @param string $val
  22. * String in a format accepted the new value of key in options table to update it
  23. **/
  24. function update_plugin_option($id, $key, $val, $type)
  25. {
  26. $check_option_name = row_one("plugins_options", "op_key='".$key."' and the_id='".$id."' and the_type='".$type."' ", "");
  27. if(!empty($check_option_name))
  28. {
  29. $value = array();
  30. $value["op_value"] = $val;
  31. update("plugins_options", $value,"op_key='".$key."' and the_id='".$id."' and the_type='".$type."' ","");
  32. }else {
  33. $value = array();
  34. $value['the_id'] = $id;
  35. $value['the_type'] = $type;
  36. $value['op_key'] = $key;
  37. $value['op_value'] = $val;
  38. Insertdb("plugins_options", $value);
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement