本文整理汇总了PHP中Meta::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Meta::search方法的具体用法?PHP Meta::search怎么用?PHP Meta::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Meta
的用法示例。
在下文中一共展示了Meta::search方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
/**
* @before _session
* @after _csrfToken
*/
public function register()
{
$this->seo(array("title" => "Publisher Register", "description" => "Register"));
$view = $this->getActionView();
$view->set('errors', []);
$afields = Meta::search('customField', $this->org);
$view->set('afields', $afields ?? []);
$token = RM::post("token", '');
if (RM::post("action") == "register" && $this->verifyToken($token)) {
$this->_publisherRegister($this->org, $view);
}
}
示例2: customFields
public static function customFields($user, $org)
{
$afields = \Meta::search('customField', $org);
if (count($afields) > 0) {
$meta = $user->meta ?? [];
$extraFields = [];
foreach ($afields as $value) {
$key = $value['name'];
$type = $value['type'];
$message = $value['label'] . " is required!!";
switch ($type) {
case 'file':
$v = Utils::media($key, 'upload', ['extension' => 'jpe?g|gif|bmp|png|tif|pdf']);
if (!$v) {
$message = "Please Upload a valid image or pdf file";
}
break;
case 'text':
$v = RequestMethods::post($key);
break;
case 'date':
$d = RequestMethods::post($key, date('Y-m-d'));
$v = Db::convertType($d, 'date');
break;
default:
$v = '';
break;
}
if (!$v && $value['required']) {
return ["message" => $message, "success" => false];
}
$extraFields[$key] = $v;
}
$meta['afields'] = $extraFields;
$user->meta = $meta;
}
$user->save();
return ["success" => true];
}
示例3: resetpassword
/**
* @before _session
*/
public function resetpassword($token)
{
$this->seo(array("title" => "Forgot Password", "view" => $this->getLayoutView()));
$view = $this->getActionView();
$meta = Meta::search('resetpass', (object) ['value' => $token]);
if (!$meta) {
$this->redirect("/");
}
// @todo install reCaptcha
if (RM::post("action") == "change") {
$pass = RM::post("password");
$user = User::first(array("id = ?" => $meta->propid));
if ($pass == RM::post("npassword")) {
$user->password = sha1($pass);
$user->save();
$meta->delete();
$view->set("message", 'Password changed successfully now <a href="/login.html">Login</a>');
} else {
$view->set("message", 'Password Does not match');
}
}
}