• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP parseUrl函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中parseUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP parseUrl函数的具体用法?PHP parseUrl怎么用?PHP parseUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parseUrl函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: postRequest

function postRequest($url, $data)
{
    $url = parseUrl($url);
    $eol = "\r\n";
    $headers = "POST " . $url['path'] . " HTTP/1.1" . $eol . "Host: " . $url['host'] . ":" . $url['port'] . $eol . "Referer: " . $url['protocol'] . $url['host'] . ":" . $url['port'] . $url['path'] . $eol . "Content-Type: application/x-www-form-urlencoded" . $eol . "Content-Length: " . strlen($data) . $eol . $eol . $data;
    return makeRequest($url, $headers);
}
开发者ID:neuroidss,项目名称:virtuoso-opensource,代码行数:7,代码来源:users.php


示例2: filter

 public function filter(array &$data)
 {
     $data['createdTime'] = date('c', $data['createdTime']);
     if (isset($data['thumb']) && !empty($data['thumb'])) {
         $data['thumb'] = parseUrl($data['thumb']);
         $data['originalThumb'] = parseUrl($data['originalThumb']);
     }
     if (isset($data['detail_thumb']) && !empty($data['detail_thumb'])) {
         $data['detail_thumb'] = parseUrl($data['detail_thumb']);
         $data['detail_originalThumb'] = parseUrl($data['detail_originalThumb']);
     }
     if (isset($data['carousel01_thumb']) && !empty($data['carousel01_thumb'])) {
         $data['carousel01_thumb'] = parseUrl($data['carousel01_thumb']);
         $data['carousel01_originalThumb'] = parseUrl($data['carousel01_originalThumb']);
     }
     if (isset($data['carousel02_thumb']) && !empty($data['carousel02_thumb'])) {
         $data['carousel02_thumb'] = parseUrl($data['carousel02_thumb']);
         $data['carousel02_originalThumb'] = parseUrl($data['carousel02_originalThumb']);
     }
     if (isset($data['carousel03_thumb']) && !empty($data['carousel02_thumb'])) {
         $data['carousel03_thumb'] = parseUrl($data['carousel03_thumb']);
         $data['carousel03_originalThumb'] = parseUrl($data['carousel03_originalThumb']);
     }
     return $data;
 }
开发者ID:latticet,项目名称:huiyou,代码行数:25,代码来源:ActivityFilter.php


示例3: getRequest

function getRequest($url)
{
    $url = parseUrl($url);
    $eol = "\r\n";
    $headers = "GET " . $url['path'] . "?" . $url['query'] . " HTTP/1.1" . $eol . "Host: " . $url['host'] . ":" . $url['port'] . $eol . "Connection: close" . $eol . $eol;
    return makeRequest($url, $headers);
}
开发者ID:neuroidss,项目名称:virtuoso-opensource,代码行数:7,代码来源:webid_demo.php


示例4: getContent

/**
 * Get HTML content
 * failed first time would try to convert URL to fetch content
 * @param $url
 * @return string|false
 */
function getContent($url)
{
    $content = @file_get_contents($url);
    if (strlen($content) < 100) {
        $content = @file_get_contents(parseUrl($url));
    }
    return $content;
}
开发者ID:meergod,项目名称:tumblr-images,代码行数:14,代码来源:fetch_before_2015.php


示例5: link

 /**
  * LINK()
  *
  * Cria uma âncora HTML automaticamente.
  *
  * @param string $linkText Texto a ser mostrado na tela.
  * @param mixed $linkDestination Endereço de envio (string ou array).
  * @param array $options Opções extras de amostragem e configuração.
  * @return bool
  */
 public function link($linkText, $linkDestination, array $options = array())
 {
     $inlineProperties = "";
     /*
      * Opções reservadas. Todas $options serão elementos inline da tag,
      * exceto os índices abaixo.
      */
     $reservedOptions = array('current_if');
     /*
      * current_if
      * Caso o usuário deseje configurar automaticamente uma classe 'current'
      * para links, caso seja o endereço atual
      */
     if (!empty($options['current_if']) || in_array('current_if', $options) || in_array('current_controller', $options)) {
         if (in_array('current_if', $options)) {
             $options['current_if'] = $linkDestination;
         }
         if (in_array('current_controller', $options)) {
             $parsedUrl = parseUrl($linkDestination);
             $options['current_if'] = $parsedUrl['controller'];
         }
         $wanted = parseUrl($options['current_if']);
         $current = false;
         if ($this->params['controller'] == $wanted['controller']) {
             if (empty($wanted['action']) || $wanted['action'] == $this->params['action']) {
                 $current = true;
             }
         }
         if ($current) {
             if (!empty($options['class'])) {
                 $options['class'] .= ' current';
             } else {
                 $options['class'] = 'current';
             }
         }
     }
     /**
      * Analisa cada valor de $options
      */
     foreach ($options as $chave => $valor) {
         if (is_numeric($chave)) {
             continue;
         }
         if (!in_array($chave, $reservedOptions)) {
             $inlineProperties .= ' ' . $chave . '="' . $valor . '"';
         }
     }
     return '<a href="' . translateUrl($linkDestination) . '" ' . $inlineProperties . '>' . $linkText . '</a>';
 }
开发者ID:kurko,项目名称:acidphp,代码行数:59,代码来源:Html.php


示例6: init

 /**
  * Initialize a fsock session.
  *
  * @return Recipe_HTTP_Session_Fsock
  */
 protected function init()
 {
     // Split the url
     $this->parsedURL = parseUrl($this->webpage);
     if (empty($this->parsedURL["host"])) {
         throw new Recipe_Exception_Generic("The supplied url is not valid.");
     }
     if (empty($this->parsedURL["port"])) {
         $this->parsedURL["port"] = 80;
     }
     if (empty($this->parsedURL["path"])) {
         $this->parsedURL["path"] = "/";
     }
     if (!empty($this->parsedURL["query"])) {
         $this->parsedURL["path"] .= "?" . $this->parsedURL["query"];
     } else {
         if (count($this->getGetArgs()) > 0) {
             $this->parsedURL["path"] .= "?" . $this->getGetArgs(false);
         }
     }
     $this->resource = fsockopen($this->parsedURL["host"], $this->parsedURL["port"], $this->errorNo, $this->error, self::TIMEOUT);
     if (!$this->resource) {
         throw new Recipe_Exception_Generic("Connection faild via fsock request: (" . $this->errorNo . ") " . $this->error);
     }
     @stream_set_timeout($this->resource, self::TIMEOUT);
     Hook::event("HttpRequestInitFirst", array($this));
     // Set headers
     $headers[] = $this->getRequestType() . " " . $this->parsedURL["path"] . " HTTP/1.1";
     $headers[] = "Host: " . $this->parsedURL["host"];
     $headers[] = "Connection: Close";
     $headers[] = "\r\n";
     $headers = implode("\r\n", $headers);
     $body = "";
     if ($this->getRequestType() == "POST" && count($this->getPostArgs()) > 0) {
         $body = $this->getPostArgs(false);
     }
     // Send request
     if (!@fwrite($this->resource, $headers . $body)) {
         throw new Recipe_Exception_Generic("Couldn't send request.");
     }
     // Read response
     while (!feof($this->resource)) {
         $this->response .= fgets($this->resource, 12800);
     }
     $this->response = explode("\r\n\r\n", $this->response, 2);
     $this->response = $this->response[1];
     Hook::event("HttpRequestInitLast", array($this));
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:54,代码来源:Fsock.php


示例7: FT_load

function FT_load()
{
    $config = (require_once PATH_APPLICATION . '/config/init.php');
    autoDeleteFile();
    $arrayUrl = parseUrl();
    if (!empty($_SESSION['name'])) {
        process();
    } else {
        if (!empty($_COOKIE['name'])) {
            $_SESSION['name'] = $_COOKIE['name'];
            $_SESSION['id'] = $_COOKIE['id'];
            $_SESSION['avatar'] = $_COOKIE['avatar'];
        } else {
            if ($arrayUrl[0] == 'user' && $arrayUrl[1] == 'login') {
                $controllerObject = new User_Controller();
                $controllerObject->login();
            } else {
                headerUrl('/user/login');
            }
        }
    }
}
开发者ID:anhnt36,项目名称:duan,代码行数:22,代码来源:FT_Common.php


示例8: U


//.........这里部分代码省略.........
            $url = trim($url, $depr);
            $path = explode($depr, $url);
            $var = array();
            $var[C('VAR_ACTION')] = !empty($path) ? array_pop($path) : ACTION_NAME;
            $var[C('VAR_MODULE')] = !empty($path) ? array_pop($path) : MODULE_NAME;
            if (C('URL_CASE_INSENSITIVE')) {
                $var[C('VAR_MODULE')] = parse_name($var[C('VAR_MODULE')]);
            }
            if (!C('APP_SUB_DOMAIN_DEPLOY') && C('APP_GROUP_LIST')) {
                if (!empty($path)) {
                    $group = array_pop($path);
                    $var[C('VAR_GROUP')] = $group;
                } else {
                    if (GROUP_NAME != C('DEFAULT_GROUP')) {
                        $var[C('VAR_GROUP')] = GROUP_NAME;
                    }
                }
                if (C('URL_CASE_INSENSITIVE') && isset($var[C('VAR_GROUP')])) {
                    $var[C('VAR_GROUP')] = strtolower($var[C('VAR_GROUP')]);
                }
            }
        }
    }
    $flag = true;
    if (C('URL_MODEL') == 0) {
        // 普通模式URL转换
        $ap = pathinfo(__APP__);
        if ($ap['extension'] != 'php') {
            //临时解决
            $url = __APP__ . '/?' . http_build_query(array_reverse($var));
        } else {
            $url = __APP__ . '?' . http_build_query(array_reverse($var));
        }
        if (!empty($vars)) {
            $vars = urldecode(http_build_query($vars));
            $url .= '&' . $vars;
        }
        $flag = false;
    }
    if (C('URL_MODEL') == 2) {
        $routes = C('URL_ROUTE_RULES');
        if (false === strpos('/', $url)) {
            $url = implode($depr, array_reverse($var));
        }
        $_url = array_merge(parseUrl($url), $vars);
        foreach ($routes as $rule => $r_route) {
            $r_route = str_replace('/', $depr, $r_route);
            $_route = parseUrl(str_replace(':', '~', $r_route));
            if (url_compare($_url, $_route)) {
                break;
            }
        }
        if (url_compare($_url, $_route)) {
            foreach ($_route as $key => $val) {
                if ($key == 'm' || $key == 'a') {
                    continue;
                }
                if (preg_match("/~/", $val)) {
                    $rule = preg_replace("/(\\(\\\\[\\w]\\+\\))/", $_url[$key], $rule, 1);
                }
            }
            //去掉最后的"/"
            $url = __APP__ . '/' . ltrim(rtrim(trim($rule, '/'), '$'), '^');
            $url = str_replace('\\', '', $url);
            $flag = false;
        }
    }
    if ($flag) {
        // PATHINFO模式或者兼容URL模式
        if (isset($route)) {
            $url = __APP__ . '/' . rtrim($url, $depr);
        } else {
            $url = __APP__ . '/' . implode($depr, array_reverse($var));
        }
        if (!empty($vars)) {
            // 添加参数
            foreach ($vars as $var => $val) {
                $url .= $depr . $var . $depr . $val;
            }
        }
        if ($suffix) {
            $suffix = $suffix === true ? C('URL_HTML_SUFFIX') : $suffix;
            if ($pos = strpos($suffix, '|')) {
                $suffix = substr($suffix, 0, $pos);
            }
            if ($suffix && $url[1]) {
                $url .= '.' . ltrim($suffix, '.');
            }
        }
    }
    if ($domain) {
        $url = (is_ssl() ? 'https://' : 'http://') . $domain . $url;
    }
    if ($redirect) {
        // 直接跳转URL
        redirect($url);
    } else {
        return $url;
    }
}
开发者ID:dlpc,项目名称:wxshoppingmall,代码行数:101,代码来源:functions.php


示例9: dispatch

function dispatch($config)
{
    if (empty($config)) {
        throw new Exception('Need a configuration file to dispatch application.');
    }
    $domain = getBaseDomain($config);
    if (empty($domain)) {
        return render($config, 'views/errors/500.php', ['message' => 'Unable to identify request domain.']);
    }
    $url = assembleUrl($domain);
    $tokens = parseUrl($url);
    if (empty($tokens)) {
        return render($config, 'views/errors/500.php', ['message' => 'Unable to process request.']);
    }
    /**
     *  We're just concerned with the path.
     **/
    $controller = '';
    $routeParameters = [];
    if (!isset($tokens['path']) || empty($tokens['path'])) {
        /**
         *  Use the default controller instead.
         **/
        $controller = findDefaultController($config);
        if (empty($controller)) {
            return render($config, 'views/errors/404.php', ['message' => 'No fallback controller to load.']);
        }
        $action = findDefaultControllerAction($config);
    } else {
        $route = $tokens['path'];
        $routeTokens = explode('/', $route);
        foreach ($routeTokens as $index => $value) {
            if (empty($value)) {
                unset($routeTokens[$index]);
            }
        }
        $routeTokens = array_values($routeTokens);
        $controller = $routeTokens[0];
        if (1 == count($routeTokens)) {
            $action = findDefaultControllerAction($config);
        } else {
            $action = $routeTokens[1];
        }
        if (2 < count($routeTokens)) {
            $configRoutes = getConfigRoute($config);
            if (empty($configRoutes)) {
                /**
                 *  Just discard the given parameters.
                 **/
                unset($routeTokens);
            }
            $routeParameters = extractRouteParameters($configRoutes, $routeTokens);
        }
    }
    $result = loadController($config, $controller);
    if (false === $result['status']) {
        return render($config, 'views/errors/404.php', ['message' => $result['message']]);
    }
    $controllerFile = $result['controller'];
    require $controllerFile;
    $controllerAction = normalizeAction($action);
    if (!function_exists($controllerAction)) {
        return render($config, 'views/errors/404.php', ['message' => 'Default controller action is not found.']);
    }
    $result = $controllerAction($config, $routeParameters);
    if (false === $result['status']) {
        return render($config, 'views/errors/500.php', ['message' => $result['message']]);
    }
    /**
     *  View directory should be in structure: views/<controller-name>/<action-name>.php
     **/
    $viewFile = 'views' . DIRECTORY_SEPARATOR . $controller . DIRECTORY_SEPARATOR . $action . '.php';
    unset($result['status'], $result['message']);
    $viewRender = render($config, $viewFile, $result);
    if (false === $viewRender) {
        render($config, 'views/errors/500.php', ['message' => 'View template not found.']);
    }
}
开发者ID:redspade-redspade,项目名称:academetrics,代码行数:78,代码来源:dispatcher.php


示例10: parseUrl

<?php

// require_once("vendor/jpgraph/jpgraph/lib/JpGraph/src")
require_once "function.php";
parseUrl();
function parseUrl()
{
    // print_r ($_GET);
    //    $relation[] = checkRelation();
    //    var_dump($relation);
    if (array_key_exists('graph', $_GET)) {
        switch ($_GET['graph']) {
            case 'graph1':
                //$_GET['research'] = 'stat-1';
                //drawGraph1();
                //dependingDefenition();
                drawGraph($_GET['tableName']);
                break;
                //default: {echo "error"; break; }
        }
    }
    if (array_key_exists('data', $_GET)) {
        switch ($_GET['data']) {
            case 'insertGraphics':
                insertGraphics();
                break;
            case 'showTable':
                showTableDependings($_GET['research']);
                break;
                //default: {echo "error"; break; }
        }
开发者ID:NUOG,项目名称:PetroCollector,代码行数:31,代码来源:data.php


示例11: translateText

function translateText(&$body, $wrap_at, $charset)
{
    global $where, $what;
    /* from searching */
    global $color;
    /* color theme */
    // require_once(SM_PATH . 'functions/url_parser.php');
    $body_ary = explode("\n", $body);
    for ($i = 0; $i < count($body_ary); $i++) {
        $line = rtrim($body_ary[$i], "\r");
        if (strlen($line) - 2 >= $wrap_at) {
            sqWordWrap($line, $wrap_at, $charset);
        }
        $line = charset_decode($charset, $line);
        $line = str_replace("\t", '        ', $line);
        parseUrl($line);
        $quotes = 0;
        $pos = 0;
        $j = strlen($line);
        while ($pos < $j) {
            if ($line[$pos] == ' ') {
                $pos++;
            } else {
                if (strpos($line, '&gt;', $pos) === $pos) {
                    $pos += 4;
                    $quotes++;
                } else {
                    break;
                }
            }
        }
        if ($quotes % 2) {
            $line = '<span class="quote1">' . $line . '</span>';
        } elseif ($quotes) {
            $line = '<span class="quote2">' . $line . '</span>';
        }
        $body_ary[$i] = $line;
    }
    $body = '<pre>' . implode("\n", $body_ary) . '</pre>';
}
开发者ID:teammember8,项目名称:roundcube,代码行数:40,代码来源:mime.php


示例12: array_merge

<?php

// benötigte Funktionen werden eingebunden
require_once APP_PATH . 'model/createUrl.php';
require_once APP_PATH . 'model/parseUrl.php';
// Das $_GET array mit den Daten aus der URL kombinieren,
// $_GET für Formulardaten, gehen sonst verloren
// $_SERVER['REQUEST_URI'] entspricht der Action (Seite die angeklickt wurde)
// entspricht im alten Format: ?action=irgendwas
// die URL in GET PARAMETER umwandeln
// array_merge führt ein oder mehrere Arrays zusammen
// parseUrl request seo-freundlich umformen
$_GET = array_merge($_GET, parseUrl($_SERVER['REQUEST_URI']));
// NORMAL ROUTING
// wenn action fehlt (keine Seite angeklickt (Startseite) oder initialier Aufruf der Seite)
if (!isset($_GET['action']) || strlen($_GET['action']) == 0) {
    // einen sinnvollen Standardwert vergeben
    // bzw. in diesem Fall IMMER die Startseite anzeigen
    $action = 'start';
    $url = createUrl(array('action' => 'home'));
    header('Location: ' . $url);
    // handle search request and redirect to search result page
} else {
    $action = $_GET['action'];
    if (isset($_GET['do'])) {
        $do = $_GET['do'];
    }
    if (isset($_GET['detail'])) {
        $detail = $_GET['detail'];
    }
}
开发者ID:bassels,项目名称:was-du-brauchst,代码行数:31,代码来源:route.php


示例13: array

            $fields[] = 'id';
            $fields[] = 'title';
            $fields[] = 'categoryId';
            $fields[] = 'userId';
            //添加报名人数
            $ArticleService = ServiceKernel::instance()->createService('Article.ArticleService');
            $parts = array();
            $parts[] = 'id';
            $parts[] = 'title';
            $parts[] = 'categoryId';
            $parts[] = 'enroll';
            $parts[] = 'detail_thumb';
            $parts[] = 'detail_originalThumb';
            $parts[] = 'activity_type';
            if (!empty($articles)) {
                foreach ($articles as $key => $article) {
                    $temp_count = $ArticleService->getArticleLikesCountByArticleId($article['id']);
                    $article['enroll'] = $temp_count;
                    $article['detail_thumb'] = parseUrl($article['detail_thumb']);
                    $article['detail_originalThumb'] = parseUrl($article['detail_originalThumb']);
                    $articles[$key] = ArrayToolkit::parts($article, $parts);
                }
            }
        }
    }
    $data = array();
    $data['articles'] = $articles;
    $data['count'] = count($articles);
    return $data;
});
return $api;
开发者ID:latticet,项目名称:huiyou,代码行数:31,代码来源:activity.php


示例14: exit

        exit(0);
    }
    // Delay between connections
    if (is_numeric($dbc) || $dbc != "" || !empty($dbc)) {
    } else {
        // error
        echo "   [!]  ERROR: Delay between connections is invalid. Default is 0.5 seconds. \n";
        exit(0);
    }
} else {
    // display help
    displayHelp();
    exit(0);
}
// parse target url return a parsed array
$target_url = parseUrl($target_url);
// check if query empty or not empty
$request_url = checkQuery($target_url);
if ($k == "y") {
    // check if server supports keep-alive make sure its a parsed target url
    $keepAlive = keepAlive($target_url);
    // Switch to check results if server keeps alive
    switch ($keepAlive) {
        case "NO:KEEP-ALIVE":
            $mpc = 1;
            break;
        case "KEEP-ALIVE":
            $mpc = 100;
            break;
    }
}
开发者ID:ex-mi,项目名称:phpstress,代码行数:31,代码来源:phpstress.php


示例15: urlsMatch

 public static function urlsMatch($url1, $url2)
 {
     $u1 = parseUrl($url1);
     $u2 = parseUrl($url2);
     foreach (array_merge(array_keys($u1), array_keys($u2)) as $component) {
         if (!array_key_exists($component, $u1) or !array_key_exists($component, $u1)) {
             return false;
         }
         if ($u1[$component] != $u2[$component]) {
             return false;
         }
     }
     return true;
 }
开发者ID:davidized,项目名称:wp-indieweb-post-kinds,代码行数:14,代码来源:class-mf2-cleaner.php


示例16: translateText

function translateText(&$body, $wrap_at, $charset)
{
    global $where, $what;
    /* from searching */
    global $color;
    /* color theme */
    require_once SM_PATH . 'functions/url_parser.php';
    $body_ary = explode("\n", $body);
    for ($i = 0; $i < count($body_ary); $i++) {
        $line = $body_ary[$i];
        if (strlen($line) - 2 >= $wrap_at) {
            sqWordWrap($line, $wrap_at, $charset);
        }
        $line = charset_decode($charset, $line);
        $line = str_replace("\t", '        ', $line);
        parseUrl($line);
        $quotes = 0;
        $pos = 0;
        $j = strlen($line);
        while ($pos < $j) {
            if ($line[$pos] == ' ') {
                $pos++;
            } else {
                if (strpos($line, '&gt;', $pos) === $pos) {
                    $pos += 4;
                    $quotes++;
                } else {
                    break;
                }
            }
        }
        if ($quotes % 2) {
            if (!isset($color[13])) {
                $color[13] = '#800000';
            }
            $line = '<font color="' . $color[13] . '">' . $line . '</font>';
        } elseif ($quotes) {
            if (!isset($color[14])) {
                $color[14] = '#FF0000';
            }
            $line = '<font color="' . $color[14] . '">' . $line . '</font>';
        }
        $body_ary[$i] = $line;
    }
    $body = '<pre>' . implode("\n", $body_ary) . '</pre>';
}
开发者ID:jin255ff,项目名称:company_website,代码行数:46,代码来源:mime.php


示例17: getUrlContent

function getUrlContent($url)
{
    $content = '';
    if (!parseUrl($url)) {
        $content = @file_get_contents($url);
    } else {
        if (function_exists('curl_init')) {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_TIMEOUT, 30);
            curl_setopt($ch, CURLOPT_USERAGENT, _USERAGENT_);
            curl_setopt($ch, CURLOPT_REFERER, _REFERER_);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $content = curl_exec($ch);
            curl_close($ch);
        } else {
            $content = @file_get_contents($url);
        }
    }
    return $content;
}
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:21,代码来源:global.func.php


示例18: getIndex

 /**
  * [getIndex description]
  * @return [type] [description]
  */
 public function getIndex()
 {
     $exploded_url = parseUrl();
     $token = count($exploded_url) === 2 ? $exploded_url[1] : false;
     // not logged in
     if (is_user_logged_in() && $token) {
         wp_logout();
         $url = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}/{$_SERVER['REQUEST_URI']}";
         $_SESSION['token'] = null;
         wp_redirect($url);
     } elseif (!is_user_logged_in() && $token) {
         $exploded_url = parseUrl();
         if (count($exploded_url) < 2) {
             return View::make('survey.error', array('error' => 'You need a token to participate in this survey'));
         }
         $token = $exploded_url[1];
         if (!$token) {
             return View::make('survey.error', array('error' => 'You need a token to participate in this survey'));
         }
         // get corresponding survey
         $survey = SurveyModel::getByAuthToken($token);
         if (!$survey) {
             return View::make('survey.error', array('error' => 'Could not find a matching survey for your token'));
         }
         // check if survey is complete
         $user = get_post_meta($survey['ID'], 'user', true);
         if (!$user) {
             return View::make('survey.error', array('error' => 'Could not match your token to a user'));
         }
         // login the user
         wp_set_current_user($user['ID'], $user['user_login']);
         wp_set_auth_cookie($user['ID']);
         do_action('wp_login', $user['user_login']);
         $_SESSION['token'] = $token;
         wp_redirect(get_bloginfo('url') . '/reporting');
     } elseif (!is_user_logged_in() && !$token) {
         return View::make('survey.error', array('error' => 'Error: Failed to log you in'));
     } else {
         if (!isset($_SESSION['token'])) {
             return View::make('survey.error', array('error' => 'You need a token to access reporting'));
         }
         $survey_pod = pods('survey', SurveyModel::getByAuthToken($_SESSION['token'])['ID']);
         if (!$survey_pod) {
             return View::make('survey.error', array('error' => 'Could not match your token'));
         } else {
             // check for relevant user roles
             $current_user = wp_get_current_user();
             $user_role = $current_user->roles[0];
             $roles = LimesurveyModel::relevantUserRoles();
             // relevant user roles
             $user_survey_role_match = in_array($user_role, $roles) ? $user_role : null;
             if (!$user_survey_role_match) {
                 return View::make('survey.error', array('error' => 'We have no survey for your role ' . $user_role));
             }
             $evaluation = $survey_pod->field('evaluation');
             $evaluation_pod = pods('evaluation', $evaluation['ID']);
             $evaluation_type = $evaluation_pod->field('180_360');
             $relation = $evaluation_pod->field('relation');
             $relation_pod = pods('relation', $relation['ID']);
             $company = $relation_pod->field('company');
             $company_pod = pods('company', $company['ID']);
             $logo = $company_pod->field('logo');
             return View::make('reporting.index', ['evaluation' => $evaluation['ID'], 'company_logo' => $logo ? $logo['guid'] : false]);
         }
     }
 }
开发者ID:strikles,项目名称:php,代码行数:70,代码来源:ReportingController.php


示例19: getResult

 public function getResult()
 {
     if (!$this->trail) {
         logDebugMessages("No trail found");
         return false;
     }
     $autorotate = !empty($this->settings->autorotate) && $this->settings->autorotate ? 'True' : 'False';
     $speed = !empty($this->settings->speed) ? $this->settings->speed : '1.0';
     //$row = $this - scene
     //broken compass workaround
     if (empty($this->scene->getScene()->name3) && strpos($this->scene->getScene()->name2, 'pointer')) {
         $this->scene->getScene()->name3 = $this->scene->getScene()->name2;
         $this->scene->getScene()->name2 = str_replace('_pointer', '', $this->scene->getScene()->name2);
     }
     // START OUTPUT
     $output_json = array();
     $current_scene = $this->scene->getScene();
     $output_json['ID'] = !empty($this->trail->ID) ? $this->trail->ID : null;
     $output_json['trail_name'] = !empty($this->trail->post_title) ? $this->trail->post_title : null;
     $output_json['trail_description'] = !empty($this->trail->post_content) ? $this->trail->post_content : null;
     $output_json['mapbox_style'] = !empty($this->mapbox_style->mapbox_style_id) ? $this->mapbox_style->mapbox_style_id : null;
     $output_json['prev_scene'] = !empty($this->scene->getPrevScene()->scene_name) ? $this->scene->getPrevScene()->scene_name : null;
     $output_json['curr_scene'] = $current_scene->scene_name;
     $output_json['next_scene'] = $this->scene->getNextScene()->scene_name;
     $output_json['elevation'] = $current_scene->elevation;
     $output_json['latitude'] = $current_scene->latitude;
     $output_json['longitude'] = $current_scene->longitude;
     $output_json['bearing'] = $current_scene->bearing;
     $output_json['hlookat'] = $current_scene->view_hlookat;
     $output_json['vlookat'] = $current_scene->view_vlookat;
     $output_json['mobile_url'] = $current_scene->mobile;
     $output_json['nexttrail_id'] = '';
     $output_json['prevtrail_id'] = '';
     if (is_object($this->next_trail) && !empty($this->next_trail->guid)) {
         //workaround for using wp posts table with mixed domain prefixes - .terrain360, www.terrain360, wp.terrain360
         if ($_SERVER['HTTP_HOST'] == 'wp.terrain360.com') {
             $this->next_trail->guid = str_replace('www.terrain360', 'wp.terrain360', $this->next_trail->guid);
         } else {
             $this->next_trail->guid = str_replace('wp.terrain360', 'www.terrain360', $this->next_trail->guid);
         }
         $next_url = parseUrl($this->next_trail->guid);
         $output_json['nexttrail_id'] = $next_url[1];
     }
     if (is_object($this->prev_trail) && !empty($this->prev_trail->guid)) {
         if ($_SERVER['HTTP_HOST'] == 'wp.terrain360.com') {
             $this->prev_trail->guid = str_replace('www.terrain360', 'wp.terrain360', $this->prev_trail->guid);
         } else {
             $this->prev_trail->guid = str_replace('wp.terrain360', 'www.terrain360', $this->prev_trail->guid);
         }
         $prev_url = parseUrl($this->prev_trail->guid);
         $output_json['prevtrail_id'] = $prev_url[1];
     }
     $output_json['zip'] = $this->weather->location->zip;
     $output_json['weather_data'] = $this->weather->weather_data;
     $output_json['t360shortURL'] = "http://t360.it/" . shortURL::encode($this->params->trailid) . $current_scene->title;
     $parks = new parksModel($this->params);
     if (!empty($parks)) {
         $output_json['parks'] = $parks->getAssignedParks();
     }
     $rivers = new riversModel($this->params);
     if (!empty($rivers)) {
         $output_json['rivers'] = $rivers->getAssignedRivers();
     }
     if (!empty($this->settings->series)) {
         $at_array = (object) explode(', ', $this->settings->series);
         $output_json['series'] = $at_array;
     }
     return $output_json;
 }
开发者ID:ktincheva,项目名称:simpleAPI,代码行数:69,代码来源:tours.model.class.php


示例20: array

    if (isset($options["deleteOriginFile"]) && $options["deleteOriginFile"] == 0) {
        $fields[] = array("type" => "origin", "id" => $record['id']);
    } else {
        $FileService->deleteFileByUri($record["uri"]);
    }
    //保存图片地址到个人信息
    $UserService = ServiceKernel::instance()->createService('User.UserService');
    $user = $UserService->changeAvatar($userId, $fields);
    if (isset($user['smallAvatar'])) {
        $user['smallAvatar'] = parseUrl($user['smallAvatar']);
    }
    if (isset($user['mediumAvatar'])) {
        $user['mediumAvatar'] = parseUrl($user['mediumAvatar']);
    }
    if (isset($user['largeAvatar'])) {
        $user['largeAvatar'] = parseUrl($user['largeAvatar']);
    }
    return $user;
});
//上传图片
$api->post('/picture/post', function (Request $request) {
    $groupCode = 'default';
    $file = $request->files->get('file');
    if (!FileToolkit::isImageFile($file)) {
        throw new \RuntimeException("您上传的不是图片文件,请重新上传。");
    }
    $FileService = ServiceKernel::instance()->createService('Content.FileService');
    $record = $FileService->uploadFile($groupCode, $file);
    return $record;
});
//添加收藏
开发者ID:latticet,项目名称:huiyou,代码行数:31,代码来源:me.php



注:本文中的parseUrl函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP parseXml函数代码示例发布时间:2022-05-15
下一篇:
PHP parseToXML函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap