Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //If title is set and not empty
- if (isset($array['source'][0])) {
- //If source isn't set to default
- if ($array['source'] !== 'default') {
- //If the ID isset
- if (isset($array['id'][0])) {
- //If the ID is numeric
- if (is_numeric($array['id'])) {
- //Set title limiting characters to 154
- $offers[$i]["offersource"] = substr($array['source'], 0, 154);
- //Also se the ID, limiting to 11 characters
- $offers[$i]["offerid"] = substr($array['id'], 0, 11);
- //If ID not numeric throw error
- } else {
- $message = array("error" => 1, "message" => "Incorrect format on row " . ($i + 1) . ", the ID must be a numerical value.");
- return $message;
- }
- //If ID not set, throw error
- } else {
- $message = array("error" => 1, "message" => "In order to set the nework of an offer on row " . ($i + 1) . ", the ID must also be set.");
- return $message;
- }
- //If source is default
- } else {
- $message = array("error" => 1, "message" => "You cannot set source to default on row " . ($i + 1) . ". If you would like it as default please leave source blank.");
- return $message;
- }
- //If not set
- } else {
- $offers[$i]["source"] = 'default';
- //source set to default, if the ID is set throw error
- if (isset($array['id'][0])) {
- $message = array("error" => 1, "message" => "Incorrect format on row " . ($i + 1) . ", to set ID the and source must also be set.");
- return $message;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement