Sharing_Service::delete_service PHP Method

delete_service() public method

public delete_service ( $service_id )
    public function delete_service($service_id)
    {
        $options = get_option('sharing-options');
        if (isset($options[$service_id])) {
            unset($options[$service_id]);
        }
        $key = array_search($service_id, $options['global']['custom']);
        if ($key !== false) {
            unset($options['global']['custom'][$key]);
        }
        update_option('sharing-options', $options);
        return true;
    }

Usage Example

示例#1
0
 public function ajax_delete_service()
 {
     if (isset($_POST['_wpnonce']) && isset($_POST['service']) && wp_verify_nonce($_POST['_wpnonce'], 'sharing-options_' . $_POST['service'])) {
         $sharer = new Sharing_Service();
         $sharer->delete_service($_POST['service']);
     }
 }
All Usage Examples Of Sharing_Service::delete_service