本文整理汇总了PHP中F3类的典型用法代码示例。如果您正苦于以下问题:PHP F3类的具体用法?PHP F3怎么用?PHP F3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了F3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get
/**
* returns items
*
* @return mixed items as array
* @param mixed $options search, offset and filter params
*/
public function get($options = array())
{
$options = array_merge(array('starred' => false, 'offset' => 0, 'search' => false, 'items' => \F3::get('items_perpage')), $options);
$items = $this->backend->get($options);
// remove private posts with private tags
if (!\F3::get('auth')->showPrivateTags()) {
foreach ($items as $idx => $item) {
$tags = explode(',', $item['tags']);
foreach ($tags as $tag) {
if (strpos(trim($tag), '@') === 0) {
unset($items[$idx]);
break;
}
}
}
$items = array_values($items);
}
// remove posts with hidden tags
if (!isset($options['tag']) || strlen($options['tag']) === 0) {
foreach ($items as $idx => $item) {
$tags = explode(',', $item['tags']);
foreach ($tags as $tag) {
if (strpos(trim($tag), '#') === 0) {
unset($items[$idx]);
break;
}
}
}
$items = array_values($items);
}
return $items;
}
开发者ID:andrel,项目名称:selfoss,代码行数:38,代码来源:Items.php
示例2: logout
function logout()
{
if (F3::get('SESSION.onlineUser')) {
F3::clear('SESSION.onlineUser');
F3::reroute('/');
}
}
开发者ID:pshreez,项目名称:PHP,代码行数:7,代码来源:user_login.php
示例3: home
function home()
{
$this->view->title = 'Open Postbox | India';
$this->view->caption = 'Latest postboxes added.';
$q = 'select * from post_box order by cast(created_time as int) desc limit 14';
$POSTBOX_DB = \F3::get('POSTBOX_DB');
$result = $POSTBOX_DB->exec($q);
$array_all_postboxes = array();
foreach ($result as $row) {
$single_postbox = array();
$single_postbox['post_id'] = $row["post_id"];
$single_postbox['lat'] = $row["lat"];
$single_postbox['lan'] = $row["lan"];
$single_postbox['pincode'] = $row["pincode"];
$single_postbox['caption'] = $row["caption"];
$single_postbox['img'] = $row["img"];
$single_postbox['picture_url'] = $row["picture_url"];
$array_all_postboxes[$row["post_id"]] = $single_postbox;
}
$this->view->set('array_all_postboxes', $array_all_postboxes);
$q = 'select * from stats order by sl desc limit 1';
$result = $POSTBOX_DB->exec($q);
foreach ($result as $row) {
$post_count = $row["post_count"];
$user_count = $row["user_count"];
$this->view->set('is_home', 1);
$this->view->set('post_count', $post_count);
$this->view->set('user_count', $user_count);
}
$out = Template::instance()->render('basic/sub_home.html');
$this->view->set('sub_out_put', $out);
$this->view->set('enable_maps', 1);
echo Template::instance()->render('basic/main.html');
}
开发者ID:datameet,项目名称:openpostbox,代码行数:34,代码来源:main.php
示例4: add
/**
* add new source
*
* @return int new id
* @param string $title
* @param string $tags
* @param string $spout the source type
* @param mixed $params depends from spout
*/
public function add($title, $tags, $spout, $params)
{
// sanitize tag list
$tags = implode(',', preg_split('/\\s*,\\s*/', trim($tags), -1, PREG_SPLIT_NO_EMPTY));
$res = \F3::get('db')->exec('INSERT INTO sources (title, tags, spout, params) VALUES (:title, :tags, :spout, :params) RETURNING id', array(':title' => trim($title), ':tags' => $tags, ':spout' => $spout, ':params' => htmlentities(json_encode($params))));
return $res[0]['id'];
}
开发者ID:gabor-udvari,项目名称:selfoss,代码行数:16,代码来源:Sources.php
示例5: yukle
function yukle($hedef = NULL, $alan = 'file')
{
$yuklenen = F3::get("FILES.{$alan}.tmp_name");
// hedef ve yüklenen dosyanın boş olmasına izin veriyoruz
// herhangi biri boşsa mesele yok, çağırana dön
if (empty($hedef) || empty($yuklenen)) {
return true;
}
// bu bir uploaded dosya olmalı, fake dosyalara izin yok
if (is_uploaded_file($yuklenen)) {
// boyutu sınırla, değeri öylesine seçtim
if (filesize($yuklenen) > 600000) {
F3::set('error', 'Resim çok büyük');
} else {
if (exif_imagetype($yuklenen) != IMAGETYPE_JPEG) {
F3::set('error', 'Resim JPEG değil');
} else {
if (file_exists($hedef)) {
F3::set('error', 'Resim zaten kaydedilmiş');
} else {
if (!move_uploaded_file($yuklenen, $hedef)) {
F3::set('error', 'Dosya yükleme hatası');
}
}
}
}
// yok başka bir ihtimal!
} else {
// bu aslında bir atak işareti
F3::set('error', 'Dosya geçerli bir yükleme değil');
}
return false;
}
开发者ID:seyyah,项目名称:uzkay,代码行数:33,代码来源:kaydet.php
示例6: is_table_exists
function is_table_exists($table, $db = NULL)
{
if (is_null($db)) {
$db = F3::get('DB.name');
}
return $db && F3::sql(array("SELECT COUNT(*) AS found " . "FROM information_schema.tables " . "WHERE table_schema='{$db}' " . "AND table_name='{$table}';"));
}
开发者ID:seyyah,项目名称:uzkay,代码行数:7,代码来源:db.php
示例7: set_venue_data_from_POST
function set_venue_data_from_POST()
{
F3::set('name', F3::scrub($_POST['name']));
F3::set('address', F3::scrub($_POST['address']));
F3::set('postcode', F3::scrub($_POST['postcode']));
F3::set('info', F3::scrub($_POST['info']));
}
开发者ID:jelek92,项目名称:echo,代码行数:7,代码来源:Venue.php
示例8: get
public function get()
{
if ($this->flag['search']) {
if (isset($_GET['q']) && $_GET['q'] != '') {
// Fetch Search Query
$query = F3::scrub($_GET['q']);
$search = new SearchModel();
// Fetch Search Results
if ($this->results = $search->items($query)) {
// Reroute if one match
if (count($this->results) == 1 && $this->redirect) {
F3::reroute('/loot/' . $this->results[0]['urlname']);
}
$this->title = "Search: \"" . $query . "\" - Diablo 2 Database";
$this->heading = "Search: \"" . $query . "\"";
F3::set('NOTIFY.success', "Rejoice! " . count($this->results) . " matches found!");
$this->render('search.php');
} else {
$this->heading = "Search: \"" . $query . "\"";
F3::set('NOTIFY.warning', "Nothing found in the database. Try the <a href=/loot/>Loot Directory</a>.");
$this->render('blank.php');
}
} else {
F3::reroute('/');
}
} else {
F3::set('NOTIFY.warning', "Search is temporarily disabled. Please try again later.");
$this->render('blank.php');
}
}
开发者ID:huckfinnaafb,项目名称:leviatha,代码行数:30,代码来源:SearchController.php
示例9: item
public function item($identifier, $options = array())
{
try {
// Configurations
$this->options = array_merge($this->options, $options);
// Initialize Item Object
$item = new ItemModel();
// Fetch Shared Item Data
DB::sql($this->query['item'], array("item" => $identifier));
$shared = F3::get('DB')->result[0];
// Presumably, no item data found
if (empty($shared)) {
throw new Exception("No item found.");
}
// Assign Class Attributes
foreach ($shared as $key => $attribute) {
$item->{$key} = $attribute;
}
// Fetch Parent
// Fetch Flags
// Property Collection
if ($this->options['properties']) {
switch ($item->rarity) {
case "normal":
$item->properties['normal'] = DB::sql($this->query['properties'], array("item" => $item->name));
break;
case "unique":
$item->properties['magic'] = DB::sql($this->query['properties_magic'], array("item" => $item->name));
break;
case "set":
$item->properties['magic'] = DB::sql($this->query['properties_magic'], array("item" => $item->name));
$item->properties['set'] = DB::sql($this->query['properties_set'], array("item" => $item->name));
break;
default:
throw new Exception("Unknown rarity.");
}
// Translate Item Properties
$tokens = array("@param", "@min", "@max");
foreach ($item->properties as $type_key => $type) {
if ($type_key != 'normal') {
foreach ($type as $row_key => $row) {
// Determine which string to use
$field = $row['minimum'] == $row['maximum'] ? "translation" : "translation_varies";
// Order must line up with $tokens
$values = array($row['parameter'], $row['minimum'], $row['maximum']);
// Replace database tokens with values
$item->properties[$type_key][$row_key]['translation'] = str_replace($tokens, $values, $row[$field]);
// Unset unecessary string
unset($item->properties[$type_key][$row_key]['translation_varies']);
}
}
}
}
} catch (Excecption $e) {
error_log($e->getMessage());
return false;
}
// Return JSON string
return json_encode($item);
}
开发者ID:huckfinnaafb,项目名称:leviatha,代码行数:60,代码来源:LootModel.php
示例10: pull_data
function pull_data()
{
$this->view->set('title', 'PostBox - Instagram Data Pull');
$instagram_api_clinet_id = 'b9d4b604105648168c671293d10cc67e';
$instagram_api_url = 'https://api.instagram.com/v1/tags/openpostboxindia/media/recent?client_id=' . $instagram_api_clinet_id;
$data_pull_messages = array();
$ch = curl_init($instagram_api_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$json = curl_exec($ch);
curl_close($ch);
$data = json_decode($json, true);
//var_dump($data);
if ($data['meta']['code'] == 200) {
//echo 'sucess';
$picture_dicts = $data['data'];
foreach ($picture_dicts as $pic) {
$tags = implode(', ', $pic['tags']);
$pincode = 0;
foreach ($pic['tags'] as $tag) {
if ($this->startswith4($tag, 'pin')) {
$pincode = substr($tag, 3, 10);
}
}
$lat = $pic['location']['latitude'];
$lan = $pic['location']['longitude'];
$created_time = $pic['created_time'];
$picture_url = $pic['images']['standard_resolution']['url'];
$post_id = $pic['id'];
$username = 'instagram-' . $pic["user"]["username"];
$website = '';
//$pic["user"]["website"];
$caption = $pic["caption"]["text"];
//check if post_id exists, if yes then go to next one. else insert
$data_pull_messages[] = "Processing the post_id=" . $post_id;
$q = 'select count(*) as count_posts from post_box where post_id="' . $post_id . '"';
$POSTBOX_DB = \F3::get('POSTBOX_DB');
$result = $POSTBOX_DB->exec($q);
//print '\n'.$q;
$count_posts = 0;
foreach ($result as $row) {
$count_posts = $row['count_posts'];
}
if ($count_posts == 0) {
$data_pull_messages[] = "Lets INSERT.";
$i = 'insert into post_box( post_id , picture_url , tags , lat , lan , created_time , username , website,pincode, caption, provider) values(' . '"' . $post_id . '","' . $picture_url . '","' . $tags . '","' . $lat . '","' . $lan . '","' . $created_time . '","' . $username . '","' . $website . '","' . $pincode . '","' . $caption . '"' . ',"Instagram")';
//print $i;
$POSTBOX_DB->exec($i);
} else {
$data_pull_messages[] = "Already exists.";
}
}
}
$this->view->set('data_pull_messages', $data_pull_messages);
$out = Template::instance()->render('basic/sub_data_pull.html');
$this->view->set('sub_out_put', $out);
echo Template::instance()->render('basic/main.html');
}
开发者ID:datameet,项目名称:openpostbox,代码行数:59,代码来源:instagram.php
示例11: jwt_decode
public function jwt_decode($token)
{
try {
return JWT::decode($token, F3::get('custom.SUPER-KEY'));
} catch (Exception $e) {
return false;
}
}
开发者ID:boliviasoftware,项目名称:micro-system-maker,代码行数:8,代码来源:common.php
示例12: load
/**
* loads content for given source
*
* @return void
* @param string $url
*/
public function load($params)
{
$this->apiKey = $params['api'];
if (strlen(trim($this->apiKey)) == 0) {
$this->apiKey = \F3::get('readability');
}
parent::load(array('url' => $params['url']));
}
开发者ID:ZMOM1031,项目名称:selfoss,代码行数:14,代码来源:readability.php
示例13: __call
/**
* pass any method call to the backend.
*
* @return methods return value
* @param string $name name of the function
* @param array $args arguments
*/
public function __call($name, $args)
{
if (method_exists($this->backend, $name)) {
return call_user_func_array(array($this->backend, $name), $args);
} else {
\F3::get('logger')->log('Unimplemented method for ' . \F3::get('db_type') . ': ' . $name, \ERROR);
}
}
开发者ID:andrel,项目名称:selfoss,代码行数:15,代码来源:Tags.php
示例14: get_how_to_use_content
private function get_how_to_use_content($f3)
{
$content = "How to use content.";
$file = F3::instance()->read('help/README.md');
$html = Markdown::instance()->convert($file);
$f3->set('how_to_use_content', $html);
return $content;
}
开发者ID:rivalinx,项目名称:php-file-host,代码行数:8,代码来源:Upload_form.php
示例15: check_configuration
public function check_configuration()
{
$config = new DB\Jig\Mapper($this->db, 'sysconfig.json');
if (!$config->load()) {
echo json_encode(array('message' => 'No config file found'));
F3::error(428);
exit;
}
}
开发者ID:boliviasoftware,项目名称:micro-system-maker,代码行数:9,代码来源:login.php
示例16: cleanup
/**
* cleanup orphaned and old items
*
* @return void
* @param DateTime $date date to delete all items older than this value [optional]
*/
public function cleanup(\DateTime $date = NULL)
{
\F3::get('db')->exec('DELETE FROM items WHERE id IN (
SELECT items.id FROM items LEFT JOIN sources
ON items.source=sources.id WHERE sources.id IS NULL)');
if ($date !== NULL) {
\F3::get('db')->exec('DELETE FROM items WHERE starred=0 AND datetime<:date', array(':date' => $date->format('Y-m-d') . ' 00:00:00'));
}
}
开发者ID:gabor-udvari,项目名称:selfoss,代码行数:15,代码来源:Items.php
示例17: getUserAgent
/**
* get the user agent to use for web based spouts
*
* @return the user agent string for this spout
*/
public static function getUserAgent($agentInfo = null)
{
$userAgent = 'Selfoss/' . \F3::get('version');
if (is_null($agentInfo)) {
$agentInfo = array();
}
$agentInfo[] = '+http://selfoss.aditu.de';
return $userAgent . ' (' . implode('; ', $agentInfo) . ')';
}
开发者ID:sevengage,项目名称:feed-merge,代码行数:14,代码来源:WebClient.php
示例18: resolve_picturl
static function resolve_picturl($id, $size = "md", $type = "png")
{
try {
$pic = new \Model\Imager();
$pic->db = $pic->db->find(array("pid=?", $id))[0];
} catch (\Exception $e) {
return;
}
return \F3::alias('virtualasset', array("link" => $pic->db->link, "size" => $size, "id" => $pic->db->srcx, "type" => $type));
}
开发者ID:Kekesed,项目名称:Kambeng-Blog,代码行数:10,代码来源:App.php
示例19: main
function main()
{
F3::set('name', 'world');
F3::set('buddy', array('Tom', 'Dick', 'Harry'));
F3::set('gender', 'M');
F3::set('loggedin', 'true');
F3::set('div', array('coffee' => array('arabica', 'barako', 'liberica', 'kopiluwak'), 'tea' => array('darjeeling', 'pekoe', 'samovar')));
F3::set('rows', array(1, 2, 3, 4, 5));
echo F3::serve('5template.htm');
}
开发者ID:seyyah,项目名称:f3,代码行数:10,代码来源:5template.php
示例20: normalize_properties_normal
public function normalize_properties_normal($table, $identifier)
{
$all = F3::sql("SELECT * FROM {$table}");
foreach ($all as $row) {
$name = $row[$identifier];
foreach ($row as $key => $column) {
echo "{$name},{$key},{$column}<br>";
}
}
}
开发者ID:huckfinnaafb,项目名称:leviatha,代码行数:10,代码来源:SandboxController.php
注:本文中的F3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论