本文整理汇总了PHP中publish函数的典型用法代码示例。如果您正苦于以下问题:PHP publish函数的具体用法?PHP publish怎么用?PHP publish使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了publish函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_us_online
function check_us_online()
{
global $dbConn, $dbconn;
$sql = "select * from ow_stock where out_mark=1";
//$sql = "select * from ow_stock ";
$sql = $dbConn->execute($sql);
$skuInfo = $dbConn->getResultArray($sql);
foreach ($skuInfo as $item) {
if ($item['count'] <= 0) {
continue;
}
$availableStock = $item['count'] - $item['salensend'];
if ($item['everyday_sale'] == 0 && $availableStock > 10) {
//$availableInventoryDays = $availableStock;
$item['everyday_sale'] = 0.001;
}
$availableInventoryDays = ceil($availableStock / $item['everyday_sale']);
//$outOfStockDays = $availableInventoryDays - $item['reach_days'];
if ($availableInventoryDays > 5 && $availableStock > 10) {
//$days = floor((time() - $item['addReachtime']) / (24*60*60));
$sendData = array("sku" => $item['sku'], "availableStock" => $availableStock, "location" => "US", "availableInventoryDays" => $availableInventoryDays, "outOfStockDays" => 0, "arrivalGoodsDays" => 0, "everyday_sale" => $item['everyday_sale'], "action" => "online");
print_r($sendData);
publish($sendData);
}
}
}
示例2: run
function run()
{
$base = publish(__DIR__ . '/google-code-prettify');
js_file($base . '/prettify.js');
css_file($base . '/theme/' . $this->theme . '.css');
js("prettyPrint();");
}
示例3: publish
public function publish()
{
publish('<form name="' . $this->name . '" action="' . RELPATH . 'form/">');
publish($this->html);
publish('<input type="text" name="sid" style="display:none;" value="' . session_id() . '">');
publish('</form>');
}
示例4: run
function run()
{
$base = publish(dirname(__FILE__) . '/assets');
if ($this->options) {
$opts = CJavaScript::encode($this->options);
}
$tag = $this->tag;
js_code('
$("' . $tag . '").cycle(' . $opts . ');
');
js($base . '/jquery.cycle.all.js');
}
示例5: publishMETA
public function publishMETA()
{
$title = trigger('page_title', $this->pageTitle);
if (empty($title) || !isset($title)) {
publish('<title>' . $this->pageTitle . '</title>');
} else {
publish('<title>' . $title . '</title>');
}
publish('<meta name="description" content="' . $this->pageDesc . '">');
publish('<meta name="keywords" content="' . $this->pageTags . '">');
if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
publish('<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>');
}
publish('<script>var resourceURL = "/' . currentSite()->relativePath . 'res/' . '";</script>');
}
示例6: save
function save($items, $publish)
{
global $mysql;
$table = 't_output_vins_admin';
$fields = 'id_produit, parent, sys_order, type, label';
$values = '';
$mysql->delete_db($table, '1=1');
foreach ($items as $item) {
$id = $item->id;
$parent = $item->parent;
$order = $item->index;
$type = $item->type;
$label = addslashes($item->label);
$values = "{$id}, '{$parent}', {$order}, '{$type}', '{$label}'";
$sql = "INSERT INTO {$table} ({$fields}) values ({$values})";
$mysql->sql_query($sql);
if ($type == 'promo' || $type == 'vins-au-verre' || $type == 'demi-bouteilles') {
$catvin = $item->catvin ? $item->catvin : 0;
$regiondumonde = $item->regiondumonde ? $item->regiondumonde : 0;
$pays = $item->pays ? $item->pays : 0;
$region = $item->region ? $item->region : 0;
$sousregion = $item->sousregion ? $item->sousregion : 0;
switch ($type) {
case 'promo':
$table_promo_verre = 't_promotions_admin';
break;
case 'vins-au-verre':
$table_promo_verre = 't_output_vins_verre_admin';
break;
case 'demi-bouteilles':
$table_promo_verre = 't_output_demi_bouteilles_admin';
break;
}
$set = "id_cat_vin={$catvin}, id_region_du_monde={$regiondumonde}, id_pays={$pays}, id_region={$region}, id_sous_region={$sousregion}";
$where = "id={$id}";
$mysql->update_db($table_promo_verre, $set, $where);
}
}
if ($publish == 'true') {
publish($items);
write('t_output_vins_admin', 1);
}
}
示例7: redirect_to_login
<?php
if (!$_PEFI->crdntls->can('commercials')) {
redirect_to_login($_PEFI->route->page);
}
include_once "{$_PEFI->libPath}/pefi_fileshelper.php";
include_once "{$_PEFI->libPath}/pefi_stringhelper.php";
$todo = $_PEFI->todo;
$_PEFI->view->title = 'Commercials Action Output';
if ($todo == 'clean') {
$_PEFI->view->content .= clean(array_key_exists('clean_tmp', $_REQUEST) ? true : false);
} elseif ($todo == 'publish') {
$_PEFI->view->content .= publish();
} elseif ($todo == 'upload') {
$_PEFI->view->content .= upload();
} elseif ($todo == 'generate') {
$_PEFI->view->content .= generate(array_key_exists('download', $_REQUEST) ? true : false);
}
// actions
function clean($clean_tmp = false)
{
$tmp = '_tmp/Pefi_COMRES/';
$res = 'Cleaning commercials<br>';
// remove commercial files
$files = explode(';', tr('commercials.urls:admin'));
foreach ($files as $fName) {
$fName = '_pages/' . $fName;
if (@unlink($fName)) {
$res .= "Removed file: {$fName} <br>";
} else {
$res .= "Tried to remove file: {$fName} but no success <br>";
示例8: session_destroy
session_destroy();
header('Location:/index.php');
}
echo $logo;
echo 'Welcome, ' . pick_users_data($_SESSION['user_id'], 'FIRSTNAME', $conn) . '!';
echo $profile_menu;
echo '<form action="profile.php" method="post" enctype="multipart/form-data">
<input type="file" accept="image/jpeg" name="picture">
<input type="text" name="name">
<input type="submit" value="Опубликовать" name="upload">
</form>';
echo '<h4>Публикации:</h4>';
if (isset($_POST['upload'])) {
$name = $_POST['name'];
$picture = $_FILES['picture']['tmp_name'];
publish($conn, $_SESSION['user_id'], $name, $picture);
header('Location: published.php');
}
$pub = show_publications($_SESSION['user_id'], $conn);
for ($i = count($pub['PDATE']) - 1; $i >= 0; $i--) {
echo substr($pub['PDATE'][$i], 0, -15) . '</br>' . substr($pub['PDATE'][$i], 9, -7) . ' <b>' . $pub['NAME'][$i] . '</b>
<a href="profile.php?d_p_id=' . $pub['ID'][$i] . '">(удалить)</a></br>';
#$row = show_picture($pub['ID'][$i], $conn);
#$img = $row->load();
#print('<img src="data:image/png;base64,'.base64_encode($img).'" />');
$source = show_picture($pub['ID'][$i], $conn);
$img1 = $source->load();
print '<img src="data:image/png;base64,' . base64_encode($img1) . '" />';
}
if (isset($_GET['d_p_id'])) {
delete_publication($_GET['d_p_id'], $conn);
示例9: publish
<?php
require __DIR__ . '/vendor/autoload.php';
function publish($data)
{
$redis = new Predis\Client();
$redis->publish('demo-channel', json_encode($data));
return $data;
}
if (isset($_GET['name'])) {
publish(['name' => $_GET['name']]);
}
示例10: webpagesDispatch
function webpagesDispatch($op)
{
if (isset($_POST['undo'])) {
$op = 'webpages';
}
switch ($op) {
case "webpages":
webpages();
break;
case "addpages":
editpages();
break;
case "savepages":
savepages();
break;
case "publish":
publish($_GET['id_page'], true);
break;
case "unpublish":
publish($_GET['id_page'], false);
break;
case "movedown":
movepages('down');
break;
case "moveup":
movepages('up');
break;
case "modpages":
editpages(true);
break;
case "delpages":
delpages();
break;
}
}
示例11: print_row
$last_resort_id = $link->id;
$last_resort_karma = $link->karma;
}
}
print_row($link, $changes);
usleep(10000);
$i++;
}
if (!DEBUG && $published == 0 && $links_published_projection < $pub_estimation * 0.9 && $must_publish && $last_resort_id > 0) {
// Publish last resort
$link = new Link();
$link->id = $last_resort_id;
if ($link->read()) {
$link->message = "Last resort: selected with the best karma";
print_row($link, 3);
publish($link);
// Recheck for images, some sites add images after the article has been published
if ($link->thumb_status != 'local' && $link->thumb_status != 'remote' && $link->thumb_status != 'deleted' && !in_array($link->id, $thumbs_queue)) {
echo "Adding {$link->id} to thumb queue\n";
array_push($thumbs_queue, $link->id);
}
}
}
//////////
}
$output .= "</table>\n";
echo $output;
echo "</body></html>\n";
if (!DEBUG) {
$annotation = new Annotation('promote');
$annotation->text = $output;
示例12: edit
edit($option, $id);
break;
case 'save':
save($option);
break;
case 'remove':
removeWarn($cid, $option);
break;
case 'removeReal':
removeReal($cid, $option);
break;
case 'publish':
publish($cid, 1, $option);
break;
case 'unpublish':
publish($cid, 0, $option);
break;
case 'cancel':
cancel($option);
break;
case 'orderup':
order($cid[0], -1, $option);
break;
case 'orderdown':
order($cid[0], 1, $option);
break;
case 'saveorder':
saveOrder($cid);
break;
case 'show':
default:
示例13: create_table
case "create_table":
case "save_table":
create_table($task);
break;
case "list_data":
list_data($task);
break;
case "show_data":
show_data($task);
break;
case "delete_data":
delete_data($task);
break;
case "publish":
case "unpublish":
publish($task);
break;
case "validatelicense":
validatelicense($task);
break;
case "backup_forms":
backup_forms();
break;
case "restore_forms":
restore_forms();
break;
case "action_task":
action_task();
break;
case "admin_form":
admin_form();
示例14: die
}
if (file_exists('functions-product.php')) {
require_once 'functions-product.php';
} else {
die('file "functions-product.php" doesn\'t exist !');
}
$action = '';
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
switch ($action) {
case 'publish':
if (isset($_POST['name']) && isset($_POST['category']) && isset($_POST['campus']) && isset($_POST['type']) && isset($_POST['price']) && isset($_POST['depreciation']) && isset($_POST['description'])) {
if (isset($_SESSION['ewu_username'])) {
$owner = $_SESSION['ewu_username'];
echo publish($_POST['name'], $_POST['category'], $_POST['campus'], $_POST['type'], $_POST['price'], $_POST['depreciation'], $_POST['description'], $owner);
} else {
echo '尚未登录';
}
} else {
echo '信息填写不完整';
}
break;
case 'delete':
if (isset($_GET['id']) && is_numeric($_GET['id']) && isset($_SESSION['ewu_username'])) {
$username = $_SESSION['ewu_username'];
$pid = $_GET['id'];
echo delete_products_by_pid($username, $pid);
} else {
echo '信息填写不完整';
}
示例15: check_offine_us
function check_offine_us()
{
global $dbConn, $dbconn;
//$sql = "select * from ow_stock where out_alert=1 and out_mark=0";
$sql = "select * from ow_stock where out_mark=0";
//$sql = "select * from ow_stock ";
$sql = $dbConn->execute($sql);
$info = $dbConn->getResultArray($sql);
foreach ($info as $item) {
$availableStock = $item['count'] - $item['salensend'];
if ($item['everyday_sale'] == 0) {
$item['everyday_sale'] = 0.001;
}
$availableInventoryDays = ceil($availableStock / $item['everyday_sale']);
if (isset($item['addReachtime']) && $item['reach_days'] != 0 && $item['addReachtime'] != 0) {
$days = floor((time() - $item['addReachtime']) / (24 * 60 * 60));
$arrivalGoodsDays = $item['reach_days'] - $days;
// 可能到货天数
} else {
$arrivalGoodsDays = 5;
}
//var_dump($availableInventoryDays,$arrivalGoodsDays,$item['reach_days'],$item['addReachtime']);
$outOfStockDays = $availableInventoryDays - $arrivalGoodsDays;
if ($outOfStockDays < 0) {
$outOfStockDays = -1 * $outOfStockDays;
$sendData = array("sku" => $item['sku'], "location" => "US", "availableStock" => $availableStock, "availableInventoryDays" => $availableInventoryDays, "outOfStockDays" => $outOfStockDays, "arrivalGoodsDays" => $arrivalGoodsDays, "everyday_sale" => $item['everyday_sale'], "action" => "offline");
//$log = $item['sku']."\n";
$log = json_encode($sendData);
file_put_contents("us.offline.txt", $log, FILE_APPEND);
print_r($sendData);
publish($sendData);
}
}
}