本文整理汇总了PHP中Result::ok方法的典型用法代码示例。如果您正苦于以下问题:PHP Result::ok方法的具体用法?PHP Result::ok怎么用?PHP Result::ok使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result::ok方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify_collection
function modify_collection()
{
$peer = new GalleryCollectionPeer();
$do = $peer->updateByParams();
$peer->save($do);
if (is_html()) {
return Redirect::success();
} else {
return Result::ok();
}
}
示例2: delete
function delete()
{
$peer = new ImmaginiPeer();
$do = $peer->find_by_id(Params::get("id"));
$final_path = $do->save_folder . $do->hash_name;
$f = new File($final_path);
$f->delete();
$peer->delete($do);
if (is_html()) {
Flash::ok("Immagine eliminata con successo.");
return Redirect::success();
} else {
return Result::ok();
}
}
示例3: delete_banner_group
function delete_banner_group()
{
$peer = new BannerPeer();
$peer->id_banner_group__EQUAL(Params::get("id_banner_group"));
$all_banners = $peer->find();
foreach ($all_banners as $banner) {
call("sponsor_banner", "delete_banner", array("id_banner" => $banner->id_banner));
}
$peer_group = new BannerGroupPeer();
$peer_group->delete_by_id(Params::get("id_banner_group"));
if (is_html()) {
Flash::ok("Contenuto testuale eliminato con successo!!");
return Redirect::success();
} else {
return Result::ok();
}
}
示例4: import
function import()
{
$data = Params::get("import_data");
$peer = new TestiPeer();
$import_export = DB::newTableDataImportExport();
$import_export->import_data($data);
if (is_html()) {
return Redirect::success();
} else {
return Result::ok();
}
}
示例5: set_current_folder
function set_current_folder()
{
$root_dir = new Dir($this->get_user_root());
$folder = Params::get("folder");
if (!$root_dir->isParentOf($folder)) {
throw new InvalidDataException("La cartella specificata non e' valida!!");
}
Session::set(self::SESSION_GALLERY_CURRENT_FOLDER, Params::get("folder"));
if (is_html()) {
return Redirect::success();
} else {
return Result::ok();
}
}
示例6: __defaultReturn
function __defaultReturn($success_message, $error_messages)
{
if (is_html()) {
if (!$error_messages) {
Flash::ok($success_message);
return Redirect::success();
} else {
foreach ($error_messages as $error_msg) {
Flash::error($error_msg);
}
return Redirect::failure();
}
} else {
if (!$error_messages) {
return Result::ok();
} else {
return Result::error($error_messages);
}
}
}
示例7: remapOk
/**
* @param callable $mapper
* @return Result
*/
public function remapOk(callable $mapper)
{
if ($this instanceof Err) {
return $this;
} else {
return Result::ok($mapper($this->unwrap()));
}
}
示例8: elimina_prodotto_servizio_vetrina
function elimina_prodotto_servizio_vetrina()
{
$peer = new ProdottoServizioVetrinaPeer();
$do = $peer->find_by_id(Params::get("id_prodotto_servizio_vetrina"));
$peer->delete($do);
if (is_html()) {
return Redirect::success();
} else {
return Result::ok();
}
}
示例9: delete
function delete()
{
$peer = new FolderPeer();
$result = $peer->find_by_id(Params::get("id"));
self::delete_attributes($result);
$peer->delete($result);
if (is_html()) {
Flash::ok("Cartella eliminata con successo.");
return Redirect::success();
} else {
return Result::ok();
}
}
示例10: groupValidate
function groupValidate($items)
{
return $this->ifOk(function ($val) use($items) {
return array_reduce($items, function ($total, $field) use($val) {
if (!$field instanceof Storeable) {
return $total;
}
return $field->getSubmissionPart(Result::ok($val))->collapse()->ifSuccess(function ($r) {
return Result::ok(function ($total) use($r) {
return array_merge($r, $total);
});
})->ifError(function ($r) {
return Result::error(function ($total) use($r) {
return array_merge($r, $total);
});
})->ifError(function ($merge) use($total) {
return $total->ifOk(function ($x) {
return Result::error([]);
})->ifError(function ($x) use($merge) {
return Result::error($merge($x));
});
})->ifOk(function ($merge) use($total) {
return $total->ifOk(function ($x) use($merge) {
return Result::ok($merge($x));
});
});
}, Result::ok([]));
});
}
示例11: uploadRequest
/**
* Upload request
*
* @param string $body
* @param string|array $key
* @param array $policy
* @return bool|Result
*/
public function uploadRequest($body, $key, $policy = null)
{
$options = (is_string($key) ? array('key' => $key) : array()) + array('filename' => null);
$policy = (array) $policy + array('scope' => $this->options['bucket'], 'deadline' => time() + 3600, 'callbackUrl' => null, 'callbackBody' => null, 'returnUrl' => null, 'returnBody' => null, 'asyncOps' => null, 'endUser' => null);
foreach ($policy as $k => $v) {
if ($v === null) {
unset($policy[$k]);
}
}
$token = $this->mac->signWithData(json_encode($policy));
$request = Request::create(array('url' => $this->options['upload_url'], 'method' => 'POST', 'headers' => array('content-type' => 'multipart/form-data'), 'form' => array('token' => $token, 'key' => $options['key'])))->file($body, basename($options['filename'] ? $options['filename'] : $options['key']));
$result = new Result($request->send(), $request);
if ($result->ok()) {
$result->data['url'] = $this->options['base_url'] . '/' . $result->data['key'];
}
return $result;
}
示例12: captcha
function captcha()
{
$c = new Captcha();
if ($c->isValid()) {
return Result::ok();
} else {
return Result::error("Il codice captcha inserito non è valido.");
}
}
示例13: delete
function delete()
{
$peer = new FolderPeer();
$result = $peer->find_by_id(Params::get("id"));
$path = $result["path"];
$nome = $result["nome"];
$full_path = $path . $nome . "/";
$tipo = $result["tipo"];
$tipo_tokens = explode("_", $tipo);
$controller_name = $tipo_tokens[1];
call($controller_name, "delete_by_path", array("path" => $full_path));
$peer->delete($result);
if (is_html()) {
Flash::ok("Cartella eliminata con successo.");
return Redirect::success();
} else {
return Result::ok();
}
}
示例14: getSubmissionPart
function getSubmissionPart($val)
{
return Result::ok(['_timestamp' => new DateTimeImmutable()]);
}
示例15: ClientData
# not the URL!
$page = $parser->parseJade($_POST['__form_name']);
$config = Config::get();
$res->header('Content-Type', 'application/json; charset=utf-8');
# Do the form submission and create data that is
# compatible with the frontend.
return $page->form->getSubmissionPart(Result::ok(new ClientData($_POST, $_FILES)))->ifError(function ($val) {
return Result::error(['success' => false, 'errors' => $val]);
})->ifOk(function ($val) use($page, $config) {
ob_start();
$val = $page->outputs->run($val, $page);
var_dump($val);
$out = ob_get_clean();
return Result::ok(['success' => true, 'debugOutput' => $config['debug'] ? $out : '']);
})->ifError(function ($val) {
return Result::ok($val);
})->ifOk(function ($output) {
return json_encode(['data' => $output]);
});
});
# Generate a CSV file for a TableView
# See http://stackoverflow.com/questions/217424/create-a-csv-file-for-a-user-in-php
$klein->respond('GET', '/csv', function ($req, $res) use($parser, $stringifier) {
$res->header('X-Frame-Options', 'DENY');
$page = $parser->parseJade($_GET['form']);
$view = new CSVView($page->getView($_GET['view']));
header("Content-type: text/csv; charset=utf-8");
header("Content-Disposition: attachment; filename=formulaic-" . time() . ".csv");
ob_start();
$view->makeView($view->query(1))->render()->save('php://output');
$result = ob_get_clean();