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


PHP Links类代码示例

本文整理汇总了PHP中Links的典型用法代码示例。如果您正苦于以下问题:PHP Links类的具体用法?PHP Links怎么用?PHP Links使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: actionDelete

 /**
  * 删除
  */
 public function actionDelete($id)
 {
     $id = (int) $id;
     $Links = new Links();
     $Links->delete(array('lid' => $id));
     $this->Common->exportResult(true, '成功!');
 }
开发者ID:mamtou,项目名称:wavephp,代码行数:10,代码来源:LinksController.php

示例2: deleteLinkAction

 public function deleteLinkAction(Users $user, Links $link)
 {
     if ($this->request->isPost()) {
         $link->delete();
         return $this->redirectByRoute(['for' => 'users.showLinks', 'user' => $user->id]);
     }
 }
开发者ID:huoybb,项目名称:movie,代码行数:7,代码来源:UsersController.php

示例3: get_link_categories

 function get_link_categories()
 {
     $Links = new Links();
     $conditon = array('user_id' => $_SESSION['user']['id'], 'is_active' => 1);
     $link_categories_array = $Links->load_category($conditon);
     return $link_categories_array;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:7,代码来源:LinksModule.php

示例4: addLinkBy

 public function addLinkBy(Users $byUser, $url)
 {
     $data = array('url' => $url, 'linkable_id' => $this->id, 'linkable_type' => get_class($this), 'site_id' => Sites::findByUrl($url)->id, 'user_id' => $byUser->id);
     $link = new Links();
     $link->save($data);
     return $this;
 }
开发者ID:huoybb,项目名称:movie,代码行数:7,代码来源:linkableTrait.php

示例5: __construct

 public function __construct()
 {
     parent::__construct();
     $this->Common = new Common();
     $Links = new Links();
     $this->links = $Links->order('lid', 'desc')->getAll();
 }
开发者ID:mamtou,项目名称:wavephp,代码行数:7,代码来源:CommonController.php

示例6: Links

 public function &OtherSiteLinks()
 {
     $ret = new Links();
     $links =& $this->Links();
     foreach ($links as $link) {
         if ($link->Type() == 'o') {
             $ret->Add($link);
         }
     }
     return $ret;
 }
开发者ID:jhogan,项目名称:nplay,代码行数:11,代码来源:Person.php

示例7: postCreate

 public function postCreate()
 {
     $validator = Validator::make(Input::all(), Links::$rules);
     if ($validator->passes()) {
         $link = new Links();
         $link->message = Input::get('message');
         $link->recipient_id = Input::get('recipient_id');
         $link->sender_id = Auth::user()->id;
         $link->save();
         return Redirect::back()->with('message', 'Your link was sent successfully!');
     } else {
         return Redirect::back()->with('message', 'Sorry! The following errors occured')->withErrors($validator)->withInput();
     }
 }
开发者ID:nicholedwight,项目名称:LinkMe2,代码行数:14,代码来源:LinksController.php

示例8: layout

 /**
  * list links
  *
  * @param resource the SQL result
  * @return array of resulting items, or NULL
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return an array of ($url => $attributes)
     $items = array();
     // empty list
     if (!SQL::count($result)) {
         return $items;
     }
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // url is the link itself -- hack for xhtml compliance
         $url = str_replace('&', '&', $item['link_url']);
         // initialize variables
         $prefix = $suffix = '';
         // flag links that are dead, or created or updated very recently
         if ($item['edit_date'] >= $context['fresh']) {
             $suffix = NEW_FLAG;
         }
         // make a label
         $label = Links::clean($item['title'], $item['link_url']);
         // the main anchor link
         if (is_object($anchor)) {
             $suffix .= ' - <span class="details">' . sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()))) . '</span>';
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'basic', NULL);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:42,代码来源:layout_links_as_simple.php

示例9: render

 public static function render($page, array $query_params = array())
 {
     if (substr($page, 0, 1) !== "/") {
         $page = "/" . $page;
     }
     ////
     // Fix for actions, look for '.php' in the referer
     //
     // There may be a better way to do this. Do you know?
     ////
     if (Links::$pretty === false && isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'] !== "/" && isset($_SERVER['HTTP_REFERER']) && isset($_SERVER['HTTP_HOST'])) {
         //Remove http or https from $_SERVER['HTTP_REFERER']
         $referer = rtrim(str_replace(array("http://", "https://"), "", $_SERVER['HTTP_REFERER']), "/");
         if ($referer !== $_SERVER['HTTP_HOST'] && strpos($_SERVER['HTTP_REFERER'], ".php") === false) {
             Links::$pretty = true;
         }
     }
     if (Links::$pretty) {
         if (count($query_params) > 0) {
             return $page . "/" . implode("/", $query_params);
         }
         return $page;
     } else {
         if (count($query_params) > 0) {
             $params = array();
             for ($i = 0; $i < count($query_params); $i++) {
                 $params['param' . ($i + 1)] = $query_params[$i];
             }
             return $page . ".php?" . http_build_query($params);
         }
         return $page . ".php";
     }
 }
开发者ID:ralexandru,项目名称:commando,代码行数:33,代码来源:Links.php

示例10: layout

 /**
  * list links
  *
  * @param resource the SQL result
  * @return array of resulting items, or NULL
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return an array of ($url => $attributes)
     $items = array();
     // empty list
     if (!SQL::count($result)) {
         return $items;
     }
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // url is the link itself
         $url = $item['link_url'];
         // initialize variables
         $prefix = $suffix = '';
         // flag links that are dead, or created or updated very recently
         if ($item['edit_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         }
         // make a label
         $label = Links::clean($item['title'], $item['link_url'], 30);
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'basic', NULL);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:36,代码来源:layout_links_as_compact.php

示例11: store

 public function store()
 {
     Notes::where('email', Auth::user()->email)->update(array('notes' => Input::get('notes')));
     TBD::where('email', Auth::user()->email)->update(array('tbd' => Input::get('tbd')));
     $input = Input::all();
     for ($i = 0; $i < count($input); $i++) {
         if (!Links::where('links', '=', Input::get("link{$i}"))->exists()) {
             if (Input::get("link{$i}") != "") {
                 Links::insert(array('email' => Auth::user()->email, 'links' => Input::get("link{$i}")));
             }
         }
     }
     if (Input::hasFile('photo')) {
         $count = Image::where('email', Auth::user()->email)->count();
         if ($count >= 4) {
             echo "USER CAN ONLY HAVE 4 PHOTOS MAX";
             return Redirect::back();
         }
         $extension = Input::file('photo')->getClientOriginalExtension();
         if ($extension == "gif" || $extension == "jpeg") {
             Image::insert(array('email' => Auth::user()->email, 'image' => file_get_contents(Input::file('photo'))));
         } else {
             echo "CAN ONLY DO GIF OR JPEG";
         }
     }
     $imageCount = Image::where('email', Auth::user()->email)->count();
     for ($i = 0; $i < $imageCount - 1; $i++) {
         if (Input::get("delete{$i}") != null) {
             $imageTable = Image::where('email', Auth::user()->email)->get();
             //echo $imageTable[$i+1]["id"];
             Image::where('id', $imageTable[$i]["id"])->delete();
         }
     }
     return Redirect::to('profile');
 }
开发者ID:Ycasas-Jan,项目名称:NoteToMyself,代码行数:35,代码来源:profileController.php

示例12: __construct

 /**
  * @param string $name
  * @param array $array
  * @param \WoohooLabs\Yang\JsonApi\Schema\ResourceObjects $resources
  */
 public function __construct($name, array $array, ResourceObjects $resources)
 {
     $this->name = $name;
     $this->meta = $this->isArrayKey($array, "meta") ? $array["meta"] : [];
     $this->links = Links::createFromArray($this->isArrayKey($array, "links") ? $array["links"] : []);
     if ($this->isArrayKey($array, "data")) {
         if ($this->isAssociativeArray($array["data"])) {
             $this->isToOneRelationship = true;
             if (empty($array["data"]["type"]) === false && empty($array["data"]["id"]) === false) {
                 $this->resourceMap = [["type" => $array["data"]["type"], "id" => $array["data"]["id"]]];
             }
         } else {
             $this->isToOneRelationship = false;
             $this->resourceMap = [];
             foreach ($array["data"] as $item) {
                 if (empty($item["type"]) === false && empty($item["id"]) === false) {
                     $this->resourceMap[] = ["type" => $item["type"], "id" => $item["id"]];
                 }
             }
         }
     } else {
         $this->isToOneRelationship = null;
     }
     $this->resources = $resources;
 }
开发者ID:woohoolabs,项目名称:yang,代码行数:30,代码来源:Relationship.php

示例13: store

 public function store()
 {
     if (!Input::has('email', 'password', 'confirmPassword')) {
         $this->failure("Must fill in the values");
     }
     if (Input::get('password') != Input::get('confirmPassword')) {
         $this->failure("PASSWORDS NOT THE SAME");
     }
     $rules = array('email' => 'unique:users,email');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         $this->failure('That email address is already registered. You sure you don\'t have an account?');
     }
     if (!filter_var(Input::get('email'), FILTER_VALIDATE_EMAIL)) {
         $this->failure("username must be an email");
     }
     $verificationCode = md5(time());
     User::insert(array('email' => Input::get('email'), 'password' => Hash::make(Input::get('password')), 'verification' => $verificationCode));
     Image::insert(array('email' => Input::get('email'), 'image' => ''));
     Notes::insert(array('email' => Input::get('email'), 'notes' => ''));
     TBD::insert(array('email' => Input::get('email'), 'tbd' => ''));
     Links::insert(array('email' => Input::get('email'), 'links' => ''));
     Mail::send('emails.emailMessage', array('code' => $verificationCode, 'email' => Input::get('email')), function ($message) {
         $message->to('ycasas.jan@gmail.com', 'Jan Ycasas')->subject('Welcome!');
     });
     echo "Go Log In";
     return Redirect::to('/');
 }
开发者ID:Ycasas-Jan,项目名称:NoteToMyself,代码行数:28,代码来源:registerController.php

示例14: render

    public static function render($current_page = "")
    {
        echo '<div class="navbar navbar-fixed-top">
			      <div class="navbar-inner">
			        <div class="container">
			          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
			      	 	<span class="icon-bar"></span>
			      	 	<span class="icon-bar"></span>
			      	 	<span class="icon-bar"></span>
			          </a>
			          <a class="brand" href="/">Commando.io</a>
			          <div class="nav-collapse">
			            <ul class="nav">';
        foreach (Navigation::$pages as $page => $icon) {
            if ($page === strtolower($current_page)) {
                echo '<li class="active">';
            } else {
                echo '<li>';
            }
            echo '<a href="' . Links::render($page) . '"><i class="' . $icon . '"></i> ' . ucfirst($page) . '</a></li>';
        }
        echo '</ul>';
        if (!empty(Navigation::$right)) {
            echo '<ul class="nav pull-right">' . Navigation::$right . '</ul>';
        }
        echo '</div>
			        </div>
			      </div>
			    </div>';
    }
开发者ID:tsing,项目名称:commando,代码行数:30,代码来源:Navigation.php

示例15: get_user_links

 function get_user_links()
 {
     $condition = array('user_id' => $this->uid, 'is_active' => 1);
     $Links = new Links();
     $category_list = $Links->load_category($condition);
     if (count($category_list) > 0) {
         $links_data_array = array();
         for ($counter = 0; $counter < count($category_list); $counter++) {
             $links_data_array[$counter]['category_id'] = $category_list[$counter]->category_id;
             $links_data_array[$counter]['category_name'] = $category_list[$counter]->category_name;
             $Links->user_id = $this->uid;
             $condition = array('category_id' => $category_list[$counter]->category_id, 'is_active' => 1);
             $links_array = $Links->load_link($condition);
             $links_data_array[$counter]['links'] = $links_array;
         }
         return $links_data_array;
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:18,代码来源:MyLinksModule.php


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