本文整理汇总了PHP中Links类的典型用法代码示例。如果您正苦于以下问题:PHP Links类的具体用法?PHP Links怎么用?PHP Links使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Links类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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('[email protected]', '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
示例16: getHref
public static function getHref($page_name, array $url_params_ar = array())
{
// set page parameter
$url_params_ar['page'] = strtolower(trim($page_name));
// build file path
$module_root_path = TS_Module_HRM_PresencePlanning_Constants::MODULE_ROOT_PATH;
$full_path = $module_root_path;
// Build and return full link
return $full_path . Links::getParametersString($url_params_ar);
}
开发者ID:nm191,项目名称:test_tristar,代码行数:10,代码来源:links.class.php
示例17: one
/**
* format just one item
*
* @param array attributes of one item
* @return array of ($url => array($prefix, $label, $suffix, ...))
*
* @see articles/edit.php
**/
function one(&$item)
{
global $context;
// initialize variables
$prefix = $suffix = $icon = '';
// flag sections that are created or updated very recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// details
$details = array();
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// info on related comments
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
}
// append details to the suffix
if (count($details)) {
$suffix .= "\n" . '<span class="details">(' . implode(', ', $details) . ')</span>';
}
// introduction
if ($item['introduction']) {
$suffix .= ' ' . Codes::beautify_introduction($item['introduction']);
}
// add a head list of related links
$subs = array();
// put the actual icon in the left column
if (isset($item['thumbnail_url'])) {
$icon = $item['thumbnail_url'];
}
// url to select this article
$url = 'articles/edit.php?template=' . $item['id'];
// use the title to label the link
$label = Skin::strip($item['title'], 50);
// list all components for this item
$output = array($url => array($prefix, $label, $suffix, 'article', $icon, i18n::s('Select this model')));
return $output;
}
开发者ID:rair,项目名称:yacs,代码行数:63,代码来源:layout_articles_as_select.php
示例18: actionIndex
public function actionIndex()
{
$this->pageTitle = $this->dataSystem->title;
// Dang ky Internet
$criInternet = new CDBCriteria();
$criInternet->addCondition("category_news_id = 1");
$criInternet->order = "id DESC";
$criInternet->limit = 3;
$arrInternet = News::model()->findAll($criInternet);
//Dang ky cap quang
$criOptical = new CDBCriteria();
$criOptical->addCondition("category_news_id = 2");
$criOptical->order = "id DESC";
$criOptical->limit = 3;
$arrOptical = News::model()->findAll($criOptical);
//Store
$criStore = new CDBCriteria();
$criStore->addCondition("category_news_id = 6");
$criStore->order = "id DESC";
$criStore->limit = 3;
$arrStore = News::model()->findAll($criStore);
//CA
$criCa = new CDBCriteria();
$criCa->addCondition("category_news_id = 3");
$criCa->order = "id DESC";
$criCa->limit = 3;
$arrCa = News::model()->findAll($criCa);
//Sim - Card
$criSimCard = new CDBCriteria();
$criSimCard->addCondition("category_news_id = 4");
$criSimCard->order = "id DESC";
$criSimCard->limit = 3;
$arrSimCard = News::model()->findAll($criSimCard);
//TV
$criTv = new CDBCriteria();
$criTv->addCondition("category_news_id = 7");
$criTv->order = "id DESC";
$criTv->limit = 3;
$arrTv = News::model()->findAll($criTv);
/*Pictures*/
$criPic = new CDbCriteria();
$criPic->addCondition("album_id = 2");
$criPic->order = "id DESC";
$criPic->limit = 10;
$arrPic = Images::model()->findAll($criPic);
/*Slider*/
$criBanner = new CDbCriteria();
$criBanner->order = "id DESC";
$criBanner->limit = 5;
$arrBanner = Slides::model()->findAll($criBanner);
/*Links web*/
$arrLink = Links::model()->find();
$this->render("index", array('arrBanner' => $arrBanner, 'arrInternet' => $arrInternet, 'arrOptical' => $arrOptical, 'arrStore' => $arrStore, 'arrCa' => $arrCa, 'arrSimCard' => $arrSimCard, 'arrTv' => $arrTv, 'arrLink' => $arrLink));
}
开发者ID:phiphi1992,项目名称:fpthue,代码行数:54,代码来源:HomeController.php
示例19: createFromArray
/**
* @param array $error
* @return $this
*/
public static function createFromArray(array $error)
{
$id = empty($error["id"]) === false ? $error["id"] : "";
$meta = isset($error["meta"]) && is_array($error["meta"]) ? $error["meta"] : [];
$links = Links::createFromArray(isset($error["links"]) && is_array($error["links"]) ? $error["links"] : []);
$status = empty($error["status"]) === false ? $error["status"] : "";
$code = empty($error["code"]) === false ? $error["code"] : "";
$title = empty($error["title"]) === false ? $error["title"] : "";
$detail = empty($error["detail"]) === false ? $error["detail"] : "";
$source = ErrorSource::fromArray(isset($error["source"]) && is_array($error["source"]) ? $error["source"] : []);
return new self($id, $meta, $links, $status, $code, $title, $detail, $source);
}
开发者ID:woohoolabs,项目名称:yang,代码行数:16,代码来源:Error.php
示例20: actionIndex
public function actionIndex()
{
$model = Links::model()->find();
if (!empty($_POST['Links'])) {
$model->attributes = $_POST['Links'];
if ($model->save()) {
Yii::app()->user->setFlash('success', translate('Cập nhật thành công.'));
$this->redirect(PIUrl::createUrl('/admin/links'));
}
}
$this->render('index', array('model' => $model));
}
开发者ID:phiphi1992,项目名称:fpthue,代码行数:12,代码来源:LinksController.php
注:本文中的Links类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论