本文整理汇总了PHP中strleft函数的典型用法代码示例。如果您正苦于以下问题:PHP strleft函数的具体用法?PHP strleft怎么用?PHP strleft使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strleft函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_comment
function add_comment($moderator_email)
{
$caller = strtolower($_POST["url"]);
//$_SERVER['HTTP_REFERER'];
$filename = md5($caller);
$abs_comment_file = realpath('.') . '/' . $filename . '.xml';
$date_value = time();
$comment_id = $date_value . '-' . rand(1, 100000000);
$author_value = processText($_POST["name"]);
$subject_value = trim(processText($_POST["subject"]));
$msg_value = processText($_POST["message"]);
$email = processText($_POST["email"]);
$site = processText($_POST["site"]);
$title = processText($_POST["title"]);
$parent_id = processText($_POST["id"]);
$dom_id = processText($_POST["domid"]);
$moderate = processText($_POST["moderate"]);
// 0 No moderate, 1: waiting for moderate 2: trash 3: spamn 4: approved
$max_reply = intval(processText($_POST["max"]));
$secured = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $secured;
$ec_path = $protocol . '://' . $_SERVER['HTTP_HOST'] . processText($_POST["path"]);
if (empty($parent_id)) {
$parent_id = null;
}
$ip = $_SERVER["REMOTE_ADDR"];
$ret = addComment($abs_comment_file, $caller, $title, $dom_id, $comment_id, $date_value, $author_value, $subject_value, $email, $site, $msg_value, $ip, $moderate, $parent_id, $max_reply);
$msg_value = str_replace(array("\r", "\n"), "<br />", $msg_value);
echo json_encode(array("id" => $comment_id, "comment" => '<li class="ec-comment" id="' . $comment_id . '">' . ' <div class="avatar"></div>' . ' <span class="user-name author">' . $author_value . '</span> <br/>' . ' <span class="comment-html">' . (empty($subject_value) ? '' : ' <strong>' . $subject_value . '</strong><br /><br />') . $msg_value . ' </span><br/>' . ' <span class="comment-time">' . ago(time() - $date_value * 1) . '</span><br/>' . ($ret ? ' <button name="reply" id="reply_' . $comment_id . '">Reply</button>' : "") . '</li>'));
// send email to moderator
if ($moderate == "1") {
$body = 'A new comment is waiting for your approval:<br /><br />' . 'Author:' . $author_value . '(IP: ' . $ip . ')<br/>' . 'Email:' . $email . '<br/>' . 'URL:' . $site . '<br/>' . 'Subject:' . $subject_value . '<br/>' . 'Whois:<a href="http://whois.arin.net/rest/ip/' . $ip . '" target="_blank">http://whois.arin.net/rest/ip/' . $ip . '</a><br/>' . 'Comment:<br/>' . '<blockquote>' . $msg_value . '</blockquote><br/>' . 'To moderate this message, click <a href="' . $ec_path . 'ec-dashboard.html">' . $ec_path . 'ec-dashboard.html</a><br/>' . '<br/>' . 'Thanks for choosing EastComment<br/><br/>' . '<a href="http://www.jswidget.com/lab/easy-comment.html" target="_blank">http://www.jswidget.com/lab/easy-comment.html</a>';
sendEmail($moderator_email, $body);
}
}
示例2: GetServerURL
function GetServerURL()
{
$s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port;
}
示例3: selfURL
function selfURL()
{
$s = empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != "on" ? '' : 's';
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}
示例4: baseURL
function baseURL()
{
$s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
return implode("/", explode("/", $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'], -1));
}
示例5: selfURL
function selfURL()
{
$s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?'));
}
示例6: get_current_URL
function get_current_URL()
{
$s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}
示例7: selfURL
function selfURL()
{
$s = empty($_SERVER['HTTPS']) ? '' : $_SERVER['HTTPS'] == 'on' ? 's' : '';
$protocol = strleft(strtolower($_SERVER['SERVER_PROTOCOL']), '/') . $s;
$port = $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
return $protocol . '://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}
示例8: selfURL
function selfURL()
{
// get complete url for current page
// http://www.weberdev.com/get_example-4291.html
$s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}
示例9: selfURL
function selfURL()
{
if (!isset($_SERVER['REQUEST_URI'])) {
$serverrequri = $_SERVER['PHP_SELF'];
} else {
$serverrequri = $_SERVER['REQUEST_URI'];
}
$s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
$_SESSION['ref'] = $protocol . "://>/" . $_SERVER['SERVER_NAME'] . $port . $serverrequri;
}
示例10: getCurrentPath
function getCurrentPath()
{
$path = "";
$path .= strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/");
$path .= (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? "s" : "") . "://";
$path .= $_SERVER['SERVER_NAME'];
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
if ($_SERVER['SERVER_PORT'] != '443') {
$path .= ":" . $_SERVER['SERVER_PORT'];
}
} else {
if ($_SERVER['SERVER_PORT'] != '80') {
$path .= ":" . $_SERVER['SERVER_PORT'];
}
}
$path .= $_SERVER['REQUEST_URI'];
return dirname($path) . "/";
}
示例11: hostURL
function hostURL()
{
$s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
$scriptname = isset($_SERVER['ORIG_SCRIPT_NAME']) ? $_SERVER['ORIG_SCRIPT_NAME'] : $_SERVER['SCRIPT_NAME'];
$location = substr($scriptname, 0, strpos($scriptname, "/index.php"));
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $location;
}
示例12: selfURL
function selfURL()
{
global $_GET;
$url = $_SERVER['PHP_SELF'];
if ($_GET) {
$url .= "?";
}
$x = 1;
foreach ($_GET as $key => $value) {
$url .= "{$key}={$value}";
if ($x < count($_GET)) {
$url .= "&";
}
$x++;
}
$s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
return $protocol . "://" . $_SERVER['HTTP_HOST'] . $port . $url;
}
示例13: current_url
function current_url($skip_ajax = false, $no_get = false)
{
$u = false;
if ($skip_ajax == true) {
$is_ajax = is_ajax();
if ($is_ajax == true) {
if ($_SERVER['HTTP_REFERER'] != false) {
$u = $_SERVER['HTTP_REFERER'];
}
}
}
if ($u == false) {
if (!isset($_SERVER['REQUEST_URI'])) {
$serverrequri = $_SERVER['PHP_SELF'];
} else {
$serverrequri = $_SERVER['REQUEST_URI'];
}
$s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = 'http';
$port = 80;
if (isset($_SERVER["SERVER_PROTOCOL"])) {
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
}
if (isset($_SERVER["SERVER_PORT"])) {
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
}
if (isset($_SERVER["HTTP_HOST"])) {
$u = $protocol . "://" . $_SERVER['HTTP_HOST'] . $port . $serverrequri;
} else {
if (isset($_SERVER["SERVER_PORT"])) {
$u = $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $serverrequri;
}
}
}
if ($no_get == true) {
$u = strtok($u, '?');
}
return $u;
}
示例14: dirname
}
require_once dirname(__FILE__) . '/common/rememberme.php';
if (!isset($_SESSION['userId']) || !is_numeric($_SESSION['userId'])) {
addError("Access denied");
redirect('./index.php');
}
if (!is_numeric($_REQUEST['diagramId'])) {
print "Wrond Diagram";
exit;
}
$delegate = new Delegate();
$loggedUser = $delegate->userGetById($_SESSION['userId']);
$diagram = $delegate->diagramGetById($_REQUEST['diagramId']);
$selfUrl = selfURL();
//find full URL to this script
$url = strleft($selfUrl, '/exportDiagram.php');
//find the URL of the application
$WEBADDRESS = $delegate->settingsGetByKeyNative('WEBADDRESS');
//$svgLink = $WEBADDRESS . '/editor/raster.php?type=svg&diagramId=' . $diagram->id;
$pngLink = $WEBADDRESS . '/editor/png.php?type=png&diagramId=' . $diagram->id;
//$jpgLink = $WEBADDRESS . '/editor/raster.php?type=jpg&diagramId=' . $diagram->id;
$dmoLink = $WEBADDRESS . '/editor/dmo.php?diagramId=' . $diagram->id;
$page = 'export';
$rawLicense = $delegate->settingsGetByKeyNative('LICENSE');
$l = new License();
if (trim($rawLicense) != '') {
$l->load($rawLicense);
}
$currentHost = $_SERVER['HTTP_HOST'];
if (strpos($currentHost, ':')) {
$currentHost = substr($currentHost, 0, strpos($currentHost, ':'));
示例15: getCurrentURL
function getCurrentURL()
{
$s = empty($_SERVER["HTTPS"]) ? "" : $_SERVER["HTTPS"] == "on" ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
$port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . str_replace(basename(cleanurl($_SERVER['PHP_SELF'])), "", $_SERVER['REQUEST_URI']);
}