本文整理汇总了PHP中fallback函数的典型用法代码示例。如果您正苦于以下问题:PHP fallback函数的具体用法?PHP fallback怎么用?PHP fallback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fallback函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: title
public function title($post)
{
$return = $post->name;
fallback($return, $post->title_from_excerpt());
fallback($return, $post->source);
return $return;
}
示例2: submit
public function submit()
{
if (empty($_POST['video'])) {
error(__("Error"), __("Video can't be blank."));
}
fallback($_POST['slug'], sanitize($_POST['title']));
return Post::add(array("title" => $_POST['title'], "embed" => $this->embed_tag($_POST['video']), "video" => $_POST['video'], "caption" => $_POST['caption']), $_POST['slug'], Post::check_url($_POST['slug']));
}
示例3: updateCategory
static function updateCategory($post = array())
{
$show_on_home = isset($post['show_on_home']) ? 1 : 0;
$clean = sanitize(fallback($_POST['clean'], $_POST['name']));
$name = $post['name'];
$id = $post['id'];
SQL::current()->update("categorize", "`id` = :id", array("name" => ":name", "clean" => ":clean", "show_on_home" => ":show_on_home"), array(":id" => $id, ":name" => $name, ":clean" => $clean, ":show_on_home" => $show_on_home));
}
示例4: submit
public function submit()
{
if (empty($_POST['body'])) {
error(__("Error"), __("Body can't be blank."));
}
fallback($_POST['slug'], sanitize($_POST['title']));
return Post::add(array("title" => $_POST['title'], "body" => $_POST['body']), $_POST['slug'], Post::check_url($_POST['slug']));
}
示例5: setAttributesToFallback
function setAttributesToFallback($default)
{
global $langColumns;
for ($i = 0; $i < count($langColumns); $i++) {
$id = $langColumns[$i];
$this->m[$id] = fallback($this->m[$id], $default->m[$id]);
}
}
示例6: delete_link
public function delete_link($text = null, $before = null, $after = null, $classes = "")
{
if (!$this->deletable()) {
return false;
}
fallback($text, __("Delete"));
$name = strtolower(get_class($this));
echo $before . '<a href="' . url("delete_attachment/" . $this->id, MainController::current()) . '" title="Delete" class="' . ($classes ? $classes . " " : '') . $name . '_delete_link delete_link" id="' . $name . '_delete_' . $this->id . '">' . $text . '</a>' . $after;
}
示例7: dj_info_box
function dj_info_box($id = "0", $info = "Keine Infos", $feld_id, $name = "")
{
global $sp_settings, $userdata, $locale;
$ausgabe = "";
if (!isnum($id)) {
fallback("index.php");
}
if ($id > 0) {
$info_result = dbquery("SELECT * FROM " . DB_USERS . " WHERE user_id='" . $id . "'");
if (dbrows($info_result) != 0) {
$user_info = dbarray($info_result);
if (sp_check($sp_settings['grss_sgroup'], $user_info['user_groups'])) {
$mod = "<b>" . $locale['grsp124'] . "</b><br />" . $locale['grsp125'] . "<br /><br />";
} elseif (sp_check($sp_settings['grss_ggroup'], $user_info['user_groups'])) {
$mod = "<b>" . $locale['grsp124'] . "</b><br />" . $locale['grsp126'] . "<br /><br />";
} else {
$mod = "";
}
if ($user_info['user_avatar'] != "") {
$avatar = IMAGES . "avatars/" . $user_info['user_avatar'];
} else {
$avatar = IMAGES . "avatars/nopic.gif";
}
$infos = "<div align=\\'center\\'><img src=\\'" . $avatar . "\\' /><br /><br /></div><b>" . $locale['grsp122'] . "</b><br /><span class=\\'info2\\'>" . $user_info['user_name'] . "</span><br /><br />" . $mod . "<b>" . $locale['grsp123'] . "</b><br />" . $info . "<br /><br />";
$ausgabe .= '<a onmouseover="return overlib(\'' . $infos . '\', STICKY, FGCLASS, \'sp1\', BGCLASS, \'sp2\', CAPTIONFONTCLASS, \'a\', CLOSEFONTCLASS, \'a\', CAPTION, \'' . $locale['grsp139'] . '\', RIGHT, CLOSETEXT, \' \');" onmouseout="return nd(\'true\');" href="' . BASEDIR . 'profile.php?lookup=' . $user_info['user_id'] . '">' . ($sp_settings['grss_djpic'] == 1 ? "<img src=\"" . $avatar . "\" height=\"40\" border=\"0\" /><br />" : "") . $user_info['user_name'] . '</a>';
if ((sp_group($sp_settings['grss_sgroup']) || sp_group($sp_settings['grss_ggroup'])) && $userdata['user_id'] == $user_info['user_id'] || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
if ($sp_settings['grss_djedit'] == 1 || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
$ausgabe .= "<br /><input type='submit' value='" . $locale['grsp130'] . "' class='button' style='width:80px;' onclick='popup=window.open(\"" . INFUSIONS . "gr_sendeplan/gr_sendeplan_popup.php?status=edit&id=" . $feld_id . "\",\"DJ_Admin\",\"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=220,left=250,top=250\"); return false;' />";
}
if ($sp_settings['grss_djoff'] == 1 || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
$ausgabe .= '<br /><form method="post" action="' . FUSION_SELF . '?id=' . $feld_id . '"><input type="submit" name="sp_delete" value="' . $locale['grsp131'] . '" class="button" style="width:80px;" /></form>';
}
}
}
} elseif ($id == 0 && $name != "") {
$infos = "<div align=\\'center\\'><img src=\\'" . IMAGES . "avatars/nopic.gif\\' /><br /><br /></div><b>" . $locale['grsp122'] . "</b><br /><span class=\\'info2\\'>" . $name . "</span><br /><br /><b>" . $locale['grsp123'] . "</b><br />" . $info . "<br /><br />";
$ausgabe .= '<a onmouseover="return overlib(\'' . $infos . '\', STICKY, FGCLASS, \'sp1\', BGCLASS, \'sp2\', CAPTIONFONTCLASS, \'a\', CLOSEFONTCLASS, \'a\', CAPTION, \'' . $locale['grsp139'] . '\', RIGHT, CLOSETEXT, \' \');" onmouseout="return nd(\'true\');">' . ($sp_settings['grss_djpic'] == 1 ? "<img src=\"" . IMAGES . "avatars/nopic.gif\" height=\"40\" border=\"0\" /><br />" : "") . $name . '</a>';
if (sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
$ausgabe .= "<br /><input type='submit' value='" . $locale['grsp130'] . "' class='button' style='width:80px;' onclick='popup=window.open(\"" . INFUSIONS . "gr_sendeplan/gr_sendeplan_popup.php?status=edit&id=" . $feld_id . "\",\"DJ_Admin\",\"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=220,left=250,top=250\"); return false;' />";
$ausgabe .= '<br /><form method="post" action="' . FUSION_SELF . '?id=' . $feld_id . '"><input type="submit" name="sp_delete" value="' . $locale['grsp131'] . '" class="button" style="width:80px;" /></form>';
}
}
if ($ausgabe == "") {
if ($sp_settings['grss_djon'] == 1 && !($sp_settings['grss_week'] == 1 && $feld_id < 169) && (sp_group($sp_settings['grss_sgroup']) || sp_group($sp_settings['grss_ggroup'])) || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
$ausgabe .= "<a href='javascript:;' onclick='popup=window.open(\"" . INFUSIONS . "gr_sendeplan/gr_sendeplan_popup.php?status=add&id=" . $feld_id . "\",\"DJ_Admin\",\"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=220,left=250,top=250\"); return false;'>" . $locale['grsp121'] . "</a>";
} else {
$ausgabe .= ($sp_settings['grss_djpic'] == 1 && $sp_settings['grss_autodjpic'] == 1 ? "<img src=\"" . INFUSIONS . "gr_sendeplan/autodj.gif\" height=\"40\" border=\"0\" /><br />" : "") . $locale['grsp120'];
}
}
if ($sp_settings['grss_replay'] == 1 && $feld_id > 168 && (sp_group($sp_settings['grss_agroup']) || iSUPERADMIN)) {
$info_result = dbquery("SELECT * FROM " . DB_GR_SENDEPLAN_REPLAY . " WHERE grsr_re_id='" . $feld_id . "'");
if (dbrows($info_result) != 0) {
$ausgabe .= '<form method="post" action="' . FUSION_SELF . '?id=' . $feld_id . '"><input type="submit" name="sp_re_delete" value="' . $locale['grsp140'] . '" class="button" style="width:80px;" /></form>';
}
}
return $ausgabe;
}
示例8: __construct
/**
* Function: __construct
* Loads the configuration YAML file.
*/
private function __construct()
{
if (!file_exists(INCLUDES_DIR . "/config.yaml.php")) {
return false;
}
$contents = str_replace("<?php header(\"Status: 403\"); exit(\"Access denied.\"); ?>\n", "", file_get_contents(INCLUDES_DIR . "/config.yaml.php"));
$this->yaml = YAML::load($contents);
$arrays = array("enabled_modules", "enabled_feathers", "routes");
foreach ($this->yaml as $setting => $value) {
if (in_array($setting, $arrays) and empty($value)) {
$this->{$setting} = array();
} elseif (!is_int($setting)) {
$this->{$setting} = is_string($value) ? stripslashes($value) : $value;
}
}
fallback($this->url, $this->chyrp_url);
}
示例9: submit
public function submit()
{
if (!isset($_POST['filename'])) {
if (isset($_FILES['photo']) and $_FILES['photo']['error'] == 0) {
$filename = upload($_FILES['photo'], array("jpg", "jpeg", "png", "gif", "bmp"));
} elseif (!empty($_POST['from_url'])) {
$filename = upload_from_url($_POST['from_url'], array("jpg", "jpeg", "png", "gif", "bmp"));
} else {
error(__("Error"), __("Couldn't upload photo."));
}
} else {
$filename = $_POST['filename'];
}
// Prepend scheme if a URL is detected
if (preg_match('~^((([a-z]|[0-9]|\\-)+)\\.)+([a-z]){2,6}/~', @$_POST['option']['source'])) {
$_POST['option']['source'] = "http://" . $_POST['option']['source'];
}
fallback($_POST['slug'], sanitize($_POST['title']));
return Post::add(array("title" => $_POST['title'], "filename" => $filename, "caption" => $_POST['caption']), $_POST['slug'], Post::check_url($_POST['slug']));
}
示例10: fallback
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
require_once '../include/admin.php';
if (!iPDP_ADMIN) {
fallback('../index.php');
}
/****************************************************************************
* ACTION
*/
if (isset($_GET['reset_visitors'])) {
$ok = dbquery("UPDATE " . DB_PDP_DOWNLOADS . "\n\t\tSET\n\t\tcount_visitors='0'");
if ($ok) {
fallback(FUSION_SELF . '?done');
}
}
/****************************************************************************
* GUI
*/
opentable($locale['PDP016']);
pdp_admin_menu();
if (isset($_GET['done'])) {
show_info($locale['pdp_done']);
}
/*
* IMPORT
*/
echo '
<p>
示例11: dbquery
if ($entry_count > 0) {
$entry_error = $locale["PR08"];
} else {
$entry_insert = dbquery("INSERT INTO {$db_prefix}secsys_proxy_whitelist (proxy_ip, proxy_datestamp) VALUES('{$newproxy}','" . time() . "')");
if ($entry_insert) {
$entry_ok = $locale["PR07"];
} else {
$entry_error = $locale["PR06"];
}
}
} else {
$entry_error = $locale["PR05"];
}
}
}
opentable($locale["PR01"]);
echo "<center><a href='" . FUSION_SELF . "?lng=de'><img src='" . SEC_INFDIR . "images/flag-deu.png' border='0' alt='Deutsch' title='Deutsch'></a> <a href='" . FUSION_SELF . "?lng=en'><img src='" . SEC_INFDIR . "images/flag-eng.png' border='0' alt='English' title='English'></a></center><br>";
if (!empty($_POST) && $entry_error != "") {
echo "<div class='quote'>" . $entry_error . "</div><br>";
}
if (!isset($_POST['pentry'])) {
echo $locale["PR02"];
echo "<form action='" . FUSION_SELF . (FUSION_QUERY != "" ? "?" . rawurldecode(FUSION_QUERY) : "") . "' method='post'>\n<input type='hidden' name='newproxy' value='" . USER_IP . "'>" . $locale['PR09'] . ": " . USER_IP . "<br>\n<input type='checkbox' name='reaccept' value='1'>" . $locale['PR03'] . "<br>\n <input type='submit' value='" . $locale['PR04'] . "' name='pentry' class='button'></form>";
} elseif (empty($entry_error)) {
echo $entry_ok;
}
closetable();
} else {
fallback(BASEDIR . "index.php");
}
require_once THEMES . "templates/footer.php";
示例12: fallback_download
function fallback_download()
{
fallback(INFUSIONS . 'pro_download_panel/download.php?did=' . $this->id);
}
示例13: prp_count_cats
if ($data['parentcat'] != $catid) {
continue;
}
if (!checkgroup($data['access']) && $prp->settings['hide_cats']) {
continue;
}
$cnt_cats = prp_count_cats($id);
$cnt_downs = prp_count_dl($all_cats, $id);
$cats[$id] = array("name" => $data['name'], "cnt_downs" => $cnt_downs, "cnt_cats" => $cnt_cats, "desc" => parseubb($data['desc']));
}
}
prp_render_cats($catid, $review->id, $path, $cats);
unset($path, $cats);
if (!is_null($access_group)) {
if ($prp->settings['hide_cats']) {
fallback("error.php?type=access");
}
show_info('<img src="icons/lock.png" alt="' . $locale['prp_locked'] . '" /> ' . str_replace('%s', getgroupname($access_group), $locale['PRP215']));
}
}
/***************************************************************************
* DOWNLOADS *
***************************************************************************/
if (is_null($access_group) && !$review->id && (!isset($catid) || $catid != 0)) {
$rowstart = 0;
if (isset($_GET['rowstart']) && isNum($_GET['rowstart'])) {
$rowstart = $_GET['rowstart'];
}
$downs = array();
if (isset($catid)) {
$get = array('type' => 'cat', 'data' => $catid);
示例14: relative_time
/**
* Function: relative_time
* Returns the difference between the given timestamps or now.
*
* Parameters:
* $time - Timestamp to compare to.
* $from - Timestamp to compare from. If not specified, defaults to now.
*
* Returns:
* A string formatted like "3 days ago" or "3 days from now".
*/
function relative_time($when, $from = null)
{
fallback($from, time());
$time = is_numeric($when) ? $when : strtotime($when);
$difference = $from - $time;
if ($difference < 0) {
$word = "from now";
$difference = -$difference;
} elseif ($difference > 0) {
$word = "ago";
} else {
return "just now";
}
$units = array("second" => 1, "minute" => 60, "hour" => 60 * 60, "day" => 60 * 60 * 24, "week" => 60 * 60 * 24 * 7, "month" => 60 * 60 * 24 * 30, "year" => 60 * 60 * 24 * 365, "decade" => 60 * 60 * 24 * 365 * 10, "century" => 60 * 60 * 24 * 365 * 100, "millennium" => 60 * 60 * 24 * 365 * 1000);
$possible_units = array();
foreach ($units as $name => $val) {
if ($name == "week" and $difference >= $val * 2 or $name != "week" and $difference >= $val) {
$unit = $possible_units[] = $name;
}
}
$precision = (int) in_array("year", $possible_units);
$amount = round($difference / $units[$unit], $precision);
return $amount . " " . pluralize($unit, $amount) . " " . $word;
}
示例15: selected
<select name="adapter" id="adapter">
<?php
if (class_exists("PDO") and in_array("mysql", PDO::getAvailableDrivers()) or class_exists("MySQLi") or function_exists("mysql_query")) {
?>
<option value="mysql"<?php
selected("mysql", fallback($_POST['adapter'], "mysql"));
?>
>MySQL</option>
<?php
}
?>
<?php
if (class_exists("PDO") and in_array("sqlite", PDO::getAvailableDrivers())) {
?>
<option value="sqlite"<?php
selected("sqlite", fallback($_POST['adapter'], "mysql"));
?>
>SQLite 3</option>
<?php
}
?>
<?php
if (class_exists("PDO") and in_array("pgsql", PDO::getAvailableDrivers())) {
?>
<option value="pgsql"<?php
selected("pgsql", oneof(@$_POST['adapter'], "mysql"));
?>
>PostgreSQL</option>
<?php
}
?>