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


PHP Site::find方法代码示例

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


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

示例1: testAutoloading

 public function testAutoloading()
 {
     $kirby = new Kirby(array('debug' => true));
     $kirby->roots->content = TEST_ROOT_ETC . DS . 'content';
     $kirby->roots->site = TEST_ROOT_ETC . DS . 'site';
     // autoload all models
     $kirby->models();
     $site = new Site($kirby);
     $a = $site->find('a');
     $this->assertInstanceOf('Page', $a);
     $this->assertInstanceOf('APage', $a);
     $this->assertEquals('test', $a->customTestMethod());
     $b = $site->find('b');
     $this->assertInstanceOf('Page', $b);
     $this->assertFalse(is_a($b, 'APage'));
     $this->assertFalse('test' == $b->customTestMethod());
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:17,代码来源:ModelsTest.php

示例2: update

 public function update()
 {
     $site = Site::find(Input::get('site_id'));
     $selected_zone = Input::get('selected_zone');
     if ($selected_zone) {
         $site->zone_id = $selected_zone;
         $site->save();
     }
     return Redirect::to('siteZone/' . $site->id);
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:10,代码来源:SiteZoneController.php

示例3: update

 public function update()
 {
     $site = Site::find(Input::get('site_id'));
     $users = User::all();
     foreach ($users as $key => $value) {
         $user_access = Input::get('user_access_' . $value->rfid);
         if ($user_access) {
             if ($site->GivesAccessToUser($value->rfid) == 'Denied') {
                 DB::table('site_user')->insert(array('user_id' => $value->rfid, 'site_id' => $site->id));
             } else {
                 DB::table('site_user')->where('user_id', '=', $value->rfid)->where('site_id', '=', $site->id)->delete();
             }
         }
     }
     return Redirect::to('siteUser/' . $site->id);
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:16,代码来源:SiteUserController.php

示例4: save

 public static function save()
 {
     $params = $_POST;
     $v = new Valitron\Validator($params);
     $v->rule('required', 'content');
     $v->rule('lengthMin', 'content', 1);
     $v->rule('required', 'site-id');
     $v->rule('numeric', 'site-id');
     if ($v->validate()) {
         $kommentti = new Kommentti(array('comment_content' => $params['content'], 'site_id' => $params['site-id'], 'kayttaja_id' => $_SESSION['user']));
         $kommentti->save();
         Redirect::to('/site/show_site/' . $params['site-id'], array('message' => 'Kommentti lisätty'));
     } else {
         $site = Site::find($params['site-id']);
         $kommentit = Kommentti::getAllComments($params['site-id']);
         View::make('site/show_site.html', array('site' => $site, 'kommentit' => $kommentit, 'errors' => $v->errors()));
     }
 }
开发者ID:rohamo,项目名称:Tsoha-Bootstrap,代码行数:18,代码来源:comments_controller.php

示例5: startCreateWebsiteApp

 public function startCreateWebsiteApp()
 {
     $start['User'] = Auth::user();
     //$start['Site'] = new Site();
     $start['Website'] = new Website();
     $start['Template'] = new Template();
     if (!Session::has('siteId')) {
         return response()->json($start);
     }
     if ($site = Site::find(Session::get('siteId'))) {
         $siteInfo = $this->setup->getWebsiteInfoFrom($site->website_type);
         if (isset($site->all_template_id)) {
             $start['Template'] = AllTemplate::find($site->all_template_id);
         }
         if (isset($site->website_id)) {
             $class = $site->website_type;
             $start['Website'] = $siteInfo['website']::find($site->website_id);
         }
     }
     $start['Site'] = $site;
     return Response::json($start);
 }
开发者ID:clay-spfmlp,项目名称:claymalven,代码行数:22,代码来源:SiteController.php

示例6: actionRefresh

 public function actionRefresh()
 {
     $request = Yii::app()->getRequest();
     $sid = trim($request->getParam("sid"));
     if ($sid) {
         try {
             //获取url
             $site = new Site();
             $row = $site->find('sid=:sid', array(':sid' => $sid));
             $domain = new Domain();
             $row = $domain->find('id=:id', array(':id' => $row['dmid']));
             $url = 'www.' . $row['name'];
             //获取seo信息
             $seo = new Seotool($url);
             $info['alexa'] = (int) $seo->getAlexaRank();
             $info['google'] = (int) $seo->getIndexedGoogle();
             $info['baidu'] = (int) $seo->getIndexedBaidu();
             $info['pr'] = (int) $seo->getPagerank();
             $info['sid'] = $sid;
             //更新数据
             $res = new Seo();
             $row = $res->find('sid=:sid', array(':sid' => $sid));
             if ($row) {
                 $res = new Seo();
                 $res->_pk = $row['id'];
                 $res->_attributes = $info;
                 $res->setIsNewRecord(false);
                 $res->update();
             } else {
                 $res = new Seo();
                 $res->_attributes = $info;
                 $res->insert();
             }
             $this->redirect(array('list'));
         } catch (CDbException $e) {
             throw CDbException($e);
         }
     }
 }
开发者ID:humor-zo,项目名称:woc-yii,代码行数:39,代码来源:SeoController.php

示例7: testHABTMKeepExisting

 /**
  * test HABM operations without clobbering existing records #275
  *
  * @return void
  */
 public function testHABTMKeepExisting()
 {
     $this->loadFixtures('Site', 'Domain', 'DomainsSite');
     $Site = new Site();
     $results = $Site->find('count');
     $expected = 3;
     $this->assertEquals($expected, $results);
     $data = $Site->findById(1);
     // include api.cakephp.org
     $data['Domain'] = array('Domain' => array(1, 2, 3));
     $Site->save($data);
     $Site->id = 1;
     $results = $Site->read();
     $expected = 3;
     // 3 domains belonging to cakephp
     $this->assertEquals($expected, count($results['Domain']));
     $Site->id = 2;
     $results = $Site->read();
     $expected = 2;
     // 2 domains belonging to markstory
     $this->assertEquals($expected, count($results['Domain']));
     $Site->id = 3;
     $results = $Site->read();
     $expected = 2;
     $this->assertEquals($expected, count($results['Domain']));
     $results['Domain'] = array('Domain' => array(7));
     $Site->save($results);
     // remove association from domain 6
     $results = $Site->read();
     $expected = 1;
     // only 1 domain left belonging to rchavik
     $this->assertEquals($expected, count($results['Domain']));
     // add deleted domain back
     $results['Domain'] = array('Domain' => array(6, 7));
     $Site->save($results);
     $results = $Site->read();
     $expected = 2;
     // 2 domains belonging to rchavik
     $this->assertEquals($expected, count($results['Domain']));
     $Site->DomainsSite->id = $results['Domain'][0]['DomainsSite']['id'];
     $Site->DomainsSite->saveField('active', true);
     $results = $Site->Domain->DomainsSite->find('count', array('conditions' => array('DomainsSite.active' => true)));
     $expected = 5;
     $this->assertEquals($expected, $results);
     // activate api.cakephp.org
     $activated = $Site->DomainsSite->findByDomainId(3);
     $activated['DomainsSite']['active'] = true;
     $Site->DomainsSite->save($activated);
     $results = $Site->DomainsSite->find('count', array('conditions' => array('DomainsSite.active' => true)));
     $expected = 6;
     $this->assertEquals($expected, $results);
     // remove 2 previously active domains, and leave $activated alone
     $data = array('Site' => array('id' => 1, 'name' => 'cakephp (modified)'), 'Domain' => array('Domain' => array(3)));
     $Site->create($data);
     $Site->save($data);
     // tests that record is still identical prior to removal
     $Site->id = 1;
     $results = $Site->read();
     unset($results['Domain'][0]['DomainsSite']['updated']);
     unset($activated['DomainsSite']['updated']);
     $this->assertEquals($activated['DomainsSite'], $results['Domain'][0]['DomainsSite']);
 }
开发者ID:agashish,项目名称:test_new,代码行数:67,代码来源:ModelIntegrationTest.php

示例8: edit

 public static function edit($id)
 {
     $site = Site::find($id);
     View::make('site/edit_site.html', array('site' => $site));
 }
开发者ID:rohamo,项目名称:Tsoha-Bootstrap,代码行数:5,代码来源:sites_controller.php

示例9: updateSiteRelay

 public function updateSiteRelay($site_id, $relay_id, $status)
 {
     $site = Site::find($site_id);
     if (!$site->Zone) {
         $site_relays = $site->Relays;
         if (!$site_relays->count()) {
             for ($i = 0; $i < 6; $i++) {
                 Relay::create(array('site_id' => $site_id, 'relay_id' => $i, 'status' => 'False'));
             }
         }
         $site_relay = Relay::withSiteAndRelay($site_id, $relay_id)->get()->first();
         $relay = Relay::find($site_relay->id);
         if ($status == 0) {
             $statusCommand = 0;
             $statusString = 'Off';
             $status = 'False';
         } else {
             $statusCommand = 1;
             $statusString = 'On';
             $status = 'True';
         }
         $relay->status = $status;
         $relay->save();
         $entry = new Record();
         $entry->site_id = $site_id;
         $entry->site_name = $site->name;
         $entry->switch = $relay->relay_id;
         $entry->status = $statusString;
         $entry->command = $statusCommand;
         $entry->save();
     } else {
         $message = 'This site is zoned. Please update changes to the zone!';
         Session::put('message', $message);
     }
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:35,代码来源:SiteController.php

示例10: relays

 public function relays($site_id)
 {
     $site = Site::find($site_id);
     $relays = $site->Relays->toJson();
     return $relays;
     // Response::json($relays);
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:7,代码来源:HomeController.php

示例11: updatePermissions

 public function updatePermissions()
 {
     $user = User::find(Input::get('rfid'));
     $sites = Site::all();
     foreach ($sites as $key => $value) {
         $selected_site = Input::get('selected_site_' . $value->id);
         if ($selected_site) {
             $site = Site::find($selected_site);
             if ($site->GivesAccessToUser($user->rfid) == 'Denied') {
                 DB::table('site_user')->insert(array('site_id' => $value->id, 'user_id' => $user->rfid));
             } else {
                 DB::table('site_user')->where('user_id', '=', $user->rfid)->where('site_id', '=', $value->id)->delete();
             }
         }
     }
     $zones = Zone::all();
     foreach ($zones as $key => $value) {
         $selected_zone = Input::get('selected_zone_' . $value->id);
         if ($selected_zone) {
             if ($value->GivesAccessToUser($user->rfid) == 'Denied') {
                 DB::table('user_zone')->insert(array('zone_id' => $value->id, 'user_id' => $user->rfid));
                 foreach ($sites as $site) {
                     if ($value->ContainsSite($site->id)) {
                         DB::table('site_user')->insert(array('site_id' => $site->id, 'user_id' => $user->rfid));
                     }
                 }
             } else {
                 DB::table('user_zone')->where('user_id', '=', $user->rfid)->where('zone_id', '=', $value->id)->delete();
                 foreach ($sites as $site) {
                     if ($value->ContainsSite($site->id)) {
                         DB::table('site_user')->where('user_id', '=', $user->rfid)->where('site_id', '=', $site->id)->delete();
                     }
                 }
             }
         }
     }
     return Redirect::to('user/' . $user->id);
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:38,代码来源:UserController.php

示例12: site

 public function site($siteId)
 {
     $search = Input::get('search', false);
     $timeTypeFilter = Input::get('timeTypeFilter', Webpage::CHANGED_OR_CREATED_FILTER);
     $timeFilter = Input::get('timeFilter', false);
     $typeFilter = Input::get('typeFilter', false);
     $site = Site::find($siteId);
     $webpages = Webpage::makeList($siteId, $search, $timeFilter, $typeFilter, $timeTypeFilter);
     return View::make('site', compact('site', 'webpages', 'search', 'timeFilter', 'typeFilter', 'timeTypeFilter'));
 }
开发者ID:SimZal,项目名称:laracrawl,代码行数:10,代码来源:CrawlerController.php


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