Example #1
0
                                    }
                                    break;
                                case 'operator':
                                    if ($conditionVal === "") {
                                        throw new Exception("Search operator cannot be empty", Z_ERROR_INVALID_INPUT);
                                    }
                                    $maxLen = 25;
                                    if (strlen($conditionVal) > $maxLen) {
                                        throw new Exception("Search operator cannot be longer than {$maxLen} characters", Z_ERROR_INVALID_INPUT);
                                    }
                                    break;
                                case 'value':
                                    $maxLen = 255;
                                    if (strlen($conditionVal) > $maxLen) {
                                        throw new Exception("Search operator cannot be longer than {$maxLen} characters", Z_ERROR_INVALID_INPUT);
                                    }
                                    break;
                                default:
                                    throw new Exception("Invalid property '{$conditionKey}' for search condition", Z_ERROR_INVALID_INPUT);
                            }
                        }
                    }
                    break;
                default:
                    throw new Exception("Invalid property '{$key}'", Z_ERROR_INVALID_INPUT);
            }
        }
    }
}
Zotero_Searches::init();