当前位置: 首页>>代码示例>>PHP>>正文


PHP Setting::find方法代码示例

本文整理汇总了PHP中Setting::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::find方法的具体用法?PHP Setting::find怎么用?PHP Setting::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Setting的用法示例。


在下文中一共展示了Setting::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getKey

 static function getKey($key)
 {
     if (self::$cache === null) {
         self::$cache = Model::pluck(Setting::find('1=1'), 'value', 'key');
     }
     return self::$cache[$key];
 }
开发者ID:xJakub,项目名称:LCE,代码行数:7,代码来源:Setting.php

示例2: postreg

 public function postreg()
 {
     //if($slug == Setting::find(3)->value){
     if (Auth::check()) {
         return View::make('admin.index');
     } else {
         $input = Input::all();
         $validator = Validator::make($input, array('username' => 'required|unique:Users,username|between:5,20', 'email' => 'required|email', 'password' => 'required|between:5,50', 'code' => 'required'));
         if ($validator->fails()) {
             $messages = $validator->messages();
             $out = '';
             foreach ($messages->all() as $message) {
                 $out .= $message . '<Br>';
             }
             return View::make('admin.register')->with('error', $out);
         } else {
             if (Input::get('code') !== Setting::find(5)->value) {
                 return View::make('admin.register')->with('error', 'Invalid Code');
             }
             $user = new User();
             $user->email = Input::get('email');
             $user->username = Input::get('username');
             $user->password = Hash::make(Input::get('password'));
             $user->status = 'active';
             $user->save();
             Auth::login($user);
             return Redirect::to('/admin/' . Setting::find(3)->value);
         }
     }
     //}else{
     //App::abort('404');
     //}
 }
开发者ID:sgehly,项目名称:Old-Ugly-Abandoned-Stuff,代码行数:33,代码来源:AdminController.php

示例3: sendEmail

 public function sendEmail()
 {
     App::import('Model', 'Setting');
     $setting_model = new Setting();
     $setting = $setting_model->find('first', array('fields' => 'email_contact'));
     $email_contact = empty($setting['Setting']['email_contact']) ? '' : $setting['Setting']['email_contact'];
     if (!empty($this->data['Contato'])) {
         $contato = $this->data['Contato'];
         App::uses('CakeEmail', 'Network/Email');
         $Email = new CakeEmail();
         $Email->config('smtp');
         $Email->template('contato', null);
         $Email->viewVars(array('contato' => $contato));
         $Email->to($email_contact);
         $Email->emailFormat('html');
         $Email->subject("Cartório NET - Contato: " . $contato['subject']);
         $success = false;
         try {
             if ($Email->send()) {
                 $success = true;
             } else {
                 $success = false;
             }
         } catch (Exception $e) {
             //                pr($e);die;
             $success = false;
         }
         return $success;
     }
     return false;
 }
开发者ID:Dowingows,项目名称:cartorio_net,代码行数:31,代码来源:Contato.php

示例4: update

    public function update($id)
    {
        $data = Setting::find($id);
        $data->email_sender = Input::get('email');
        $data->protokol = Input::get('protokol');
        $data->port = Input::get('port');
        $data->host = Input::get('host');
        $data->user_email = Input::get('user');
        $data->pass_email = Input::get('pass');
        $data->save();
        if ($data->save()) {
            Session::flash('messages', '
					<div class="alert alert-info alert-dismissable" id="notif">
                    		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    		<strong>Keterangan</strong><br>
                    			Setting berhasil disimpan
                		</div>
				');
        } else {
            Session::flash('messages', '
					<div class="alert alert-danger alert-dismissable" id="notif">
                    		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    		<strong>Peringatan...</strong><br>
                    			Settig gagal disimpan
                		</div>
				');
        }
        return Redirect::to('admin/setting/email');
    }
开发者ID:komaltech,项目名称:RPPv2,代码行数:29,代码来源:SettingController.php

示例5: edit

 /**
  * Show the form for editing the specified resource.
  * GET /settings/{id}/edit
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id = NULL)
 {
     parent::show();
     $banner = $this->banner;
     $path = "/img/settings";
     $setting = Setting::find($id);
     return View::make('settings.edit', compact('setting', 'path', 'banner'));
 }
开发者ID:jboz62,项目名称:cms,代码行数:15,代码来源:SettingsController.php

示例6: getSettings

 public static function getSettings()
 {
     static $static_cache = NULL;
     if (!$static_cache) {
         $static_cache = Setting::find(1);
     }
     return $static_cache;
 }
开发者ID:lutherpros,项目名称:snipe-it,代码行数:8,代码来源:Setting.php

示例7: get_index

 public function get_index()
 {
     $articles = cmsHelper::getAllArticles($message, true);
     //get the article limit size
     $articles = $articles->where('status', '=', 1)->paginate(Setting::find(2)->value);
     $dbquery = $articles;
     $articles = cmsHelper::bakeArticleForViewers($articles->results);
     return View::make('visitor.index', array("articles" => $articles, 'dbquery' => $dbquery));
 }
开发者ID:gischen,项目名称:PHP-CMS,代码行数:9,代码来源:home.php

示例8: get_index

 public function get_index($authorname)
 {
     $user = User::where('username', '=', $authorname)->first();
     //get the article limit size
     $articles = Article::where('author_id', '=', $user->id)->paginate(Setting::find(2)->value);
     $dbquery = $articles;
     $articles = cmsHelper::bakeArticleForViewers($articles->results);
     return View::make('visitor.index', array("articles" => $articles, 'dbquery' => $dbquery, 'message' => 'Showing all articles by ' . $user->displayname));
 }
开发者ID:gischen,项目名称:PHP-CMS,代码行数:9,代码来源:authorArticles.php

示例9: updateSetting

 /**
  * update() Update a database setting
  * @var string, Current setting name to update
  * @var string, setting name
  * @var string, New value for the setting
  *
  * @return boolean
  */
 public static function updateSetting($name, $newvalue)
 {
     //All clear now, now to the fun stuff. We are going to pull our current setting
     $setting = Setting::find($name);
     //Declare our new property values
     $setting->value = $newvalue;
     //Finally update the db
     $setting->save();
     //The response everyone is looking for :)
     return true;
 }
开发者ID:A-Lawrence,项目名称:VASOPS,代码行数:19,代码来源:Setting.php

示例10: getAdjustedArticleContent

 public function getAdjustedArticleContent()
 {
     $trim = Setting::find(1)->value;
     if ($trim != 0 && strlen($this->content) > $trim) {
         $text = substr($this->content, 0, $trim) . '...';
     } else {
         $text = $this->content;
     }
     $tidy = new tidy();
     $tidy->parseString($text, array('show-body-only' => true), 'utf8');
     $tidy->cleanRepair();
     return $tidy . '<a href="' . $this->getArticleUrl() . '">[ Continue reading ]</a>';
 }
开发者ID:gischen,项目名称:PHP-CMS,代码行数:13,代码来源:Article.php

示例11: massUpdate

 /**
  * Update the settings in mass
  *
  * @param  array   $settingsToUpdate Setting name => value array
  *
  * @return integer Number of settings that were affected
  */
 public static function massUpdate($settingsToUpdate)
 {
     $affected = 0;
     foreach ($settingsToUpdate as $name => $value) {
         $setting = Setting::find($name);
         if (!$setting) {
             continue;
         }
         // Only update if there is a difference
         if ($setting->value != $value && $setting->save()) {
             $affected++;
         }
     }
     return $affected;
 }
开发者ID:ganesht8686,项目名称:OpenHotelBooking,代码行数:22,代码来源:Setting.php

示例12: post_index

 public function post_index($category, $title, $id, $idparent = null)
 {
     $id = !is_null($idparent) ? $idparent : $id;
     Input::flash();
     //check if unregistered users' are allowed to post
     if (Setting::find(5)->value != 1 && Auth::guest()) {
         echo " Only Registered user's can post comments";
         die;
     }
     if (Setting::find(6)->value < strlen(Input::get('content'))) {
         echo " Comment size cannot be greater than " . Setting::find(6)->value . ' characters ';
         die;
     }
     //Add rules here
     $rules = array('name' => 'required|max:100', 'email' => 'required|email', 'content' => 'required');
     //Get all inputs fields
     $input = Input::all();
     //Apply validaiton rules
     $validation = Validator::make($input, $rules);
     if ($validation->fails()) {
         return Redirect::to($_SERVER['PATH_INFO'] . '#commentheading')->with_errors($validation);
     }
     $newComment = new Comment();
     $newComment->name = Input::get('name');
     $newComment->email = Input::get('email');
     $newComment->content = Input::get('content');
     $newComment->article_id = $id;
     $newComment->approved = 1;
     $blacklists = explode(',', Setting::find(8)->value);
     foreach ($blacklists as $blword) {
         if (false !== strpos($newComment->content, $blword)) {
             $newComment->approved = 0;
             break;
         }
     }
     $newComment->save();
     Input::flush();
     return Redirect::to($_SERVER['PATH_INFO'] . '#comment-' . $newComment->id);
 }
开发者ID:gischen,项目名称:PHP-CMS,代码行数:39,代码来源:articlecontent.php

示例13: send_email

 public function send_email($id)
 {
     $solicitacao = $this->getSolicitacao($id);
     App::import('Model', 'Setting');
     $settingModel = new Setting();
     $setting = $settingModel->find('first', array('fields' => 'email_contact'));
     $email_contact = empty($setting['Setting']['email_contact']) ? '' : $setting['Setting']['email_contact'];
     App::uses('CakeEmail', 'Network/Email');
     $Email = new CakeEmail();
     $Email->config('smtp');
     $Email->template('servicos', null);
     $Email->viewVars(array('solicitacao' => $solicitacao));
     $Email->to($email_contact);
     $Email->emailFormat('html');
     $Email->subject('Cartório NET - Solicitação de Serviço');
     /*#### DEBUG ####*/
     //        $Email->transport('Debug');
     //        $response = $Email->send();
     //
     //        echo $response['message'];
     //        die;
     /*#### END DEBUG ####*/
     $success = false;
     try {
         if ($Email->send()) {
             $success = true;
         } else {
             $success = false;
         }
     } catch (Exception $e) {
         //            pr($e);
         //            die;
         $success = false;
     }
     $this->id = $id;
     $this->saveField('email_send', $success);
     return $success;
 }
开发者ID:Dowingows,项目名称:cartorio_net,代码行数:38,代码来源:SolicitacaoServico.php

示例14: editSetting

 public function editSetting()
 {
     $setting = Setting::find(Input::get('id'));
     $setting->setting_value = Input::get('value');
     $setting->save();
     return Redirect::route('get.admin.settings');
 }
开发者ID:apetrailmukesh,项目名称:bootstrap,代码行数:7,代码来源:AdminController.php

示例15: firstword

 /**
  * Ugly and wrong, but thi will get the word when user open an app for a first time
  *
  * @param  $id user_id
  * @return Response
  */
 public function firstword($id)
 {
     $word = Setting::find(1)->word_id;
     return $this->respond($word);
 }
开发者ID:SenhorBardell,项目名称:wordotheday,代码行数:11,代码来源:UsersController.php


注:本文中的Setting::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。