Exemplo n.º 1
0
 if (empty($_POST['title']) || empty($_POST['title_pos_x']) && !is_numeric($_POST['title_pos_x']) || empty($_POST['title_pos_y']) && !is_numeric($_POST['title_pos_y'])) {
     header('HTTP/1.0 400 Bad Request');
     header('Content-Type: application/json');
     echo json_encode(array('error' => __('You have not supplied all of the required data.', 'total-slider')));
     die;
 }
 if (!empty($_POST['background'])) {
     if (is_numeric($_POST['background'])) {
         if ((int) $_POST['background'] != $_POST['background']) {
             header('HTTP/1.0 400 Bad Request');
             header('Content-Type: application/json');
             echo json_encode(array('error' => __('Invalid attachment ID for the specified background.', 'total-slider')));
             die;
         }
     } else {
         if (!$g->validate_url($_POST['background'])) {
             header('HTTP/1.0 400 Bad Request');
             header('Content-Type: application/json');
             echo json_encode(array('error' => __('Invalid URL format for the specified background URL.', 'total-slider')));
             die;
         }
     }
 }
 if (!empty($_POST['link'])) {
     if (is_numeric($_POST['link'])) {
         $_POST['link'] = (int) $_POST['link'];
         if ($_POST['link'] < 1) {
             header('HTTP/1.0 400 Bad Request');
             header('Content-Type: application/json');
             echo json_encode(array('error' => __('The post ID for the specified slide link is not valid.', 'total-slider')));
             die;