当前位置: 首页>>代码示例>>PHP>>正文


PHP basePath函数代码示例

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


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

示例1: parseItems

    function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{openWin\\('(/images/material-thumb/.+?)'.+?<img src="(/images/material-thumb/.+?)".+?
class="ProdName" [^>]+>(.+?)</a>}s
PATTERN;
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Ошибка при выделении элементов.");
        }
        foreach ($matches as $m) {
            $url = $this->url;
            $img = getRealUrl(basePath($this->url), $m[1]);
            $imgSmall = getRealUrl(basePath($this->url), $m[2]);
            if (preg_match('{".+"}s', $m[3], $matches) || strpos($m[3], "-") === false) {
                $name = $m[3];
                $art = "";
            } else {
                if (preg_match('{(.*?) ([^0-9]+)}s', $m[3], $mArtName)) {
                    $art = $mArtName[1];
                    $name = $mArtName[2];
                } else {
                    $art = $m[3];
                    $name = "";
                }
            }
            $items[] = array("url" => $url, "image_large" => $img, "image_small" => $imgSmall, "art" => $art, "name" => $name);
        }
        return $items;
    }
开发者ID:rivetweb,项目名称:old-auto-catalog,代码行数:31,代码来源:SaluteclockContentGrabber.php

示例2: renderBody

 /**
  * Render response body
  * @param  array      $env
  * @param  \Exception $exception
  * @return string
  */
 protected function renderBody(&$env, $exception)
 {
     $title = 'Oops! Exception detected';
     $code = $exception->getCode();
     $message = $exception->getMessage();
     $file = $exception->getFile();
     $line = $exception->getLine();
     $trace = str_replace(array('#', '\\n'), array('<div>#', '</div>'), $exception->getTraceAsString());
     $html = sprintf('<h1>%s</h1>', $title);
     $html .= '<p>Something is broken, the application could not run, Pulse has detected the following error:</p>';
     $html .= '<h2>Details</h2>';
     $html .= sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception));
     if ($code) {
         $html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
     }
     if ($message) {
         $html .= sprintf('<div><strong>Message:</strong> %s</div>', $message);
     }
     if ($file) {
         $html .= sprintf('<div><strong>File:</strong> %s</div>', $file);
     }
     if ($line) {
         $html .= sprintf('<div><strong>Line:</strong> %s</div>', $line);
     }
     if ($trace) {
         $html .= '<h2>Trace</h2>';
         $html .= sprintf('<pre>%s</pre>', $trace);
     }
     return sprintf("<!doctype html><html lang=\"es\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><link rel=\"stylesheet\" href=\"" . asset('bootstrap.min.css') . "\"><link rel=\"stylesheet\" href=\"" . asset('styles.css') . "\"><title>%s</title><link rel=\"icon\" type=\"image/png\" href=\"" . asset('pulseLogo.png') . "\" /></head><body><nav class=\"navbar navbar-inverse navbar-fixed-top\"> <div class=\"container\"><div class=\"navbar-header\"><button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\"><span class=\"sr-only\">Toggle navigation</span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button><a class=\"navbar-brand\" href=\"" . basePath() . "\"><img src=\"" . asset('pulseLogo.png') . "\" width=\"25\"> PULSE Framework</a></div><div id=\"navbar\" class=\"collapse navbar-collapse\"><ul class=\"nav navbar-nav\"><li><a href=\"" . basePath() . "\">Página principal</a></li><li><a href=\"" . uri('documentationUrl') . "\">Documentation</a></li><li><a href=\"" . uri('communityUrl') . "\">Pulse Community</a></li><li><a href=\"" . uri('tutosUrl') . "\">Tutorials</a></li></ul></div></div></nav><div class=\"container\"><div class=\"starter-template\">%s</div></div><script src=\"" . asset('jquery.min.js') . "\"></script><script src=\"" . asset('bootstrap.min.js') . "\"></script></body></html>", $title, $html);
 }
开发者ID:ferdinandmartin,项目名称:pulse,代码行数:36,代码来源:ErrorReporting.php

示例3: parseItems

    function parseItems()
    {
        $items = array();
        $pattern = '{<img src="(/photo/.+?)".+?
<b>(.+?)</b> : (.+?)</b>.+?Цена : (.+?) у.е. <br> <br>
(.+?) <br> <br> <b> Материал: </b>(.+?)<br>
<b> Цвета корпуса: </b>(.+?)<br> <b> Цвета деталей: (.*?)</b> <br>}s';
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Ошибка при выделении элементов.");
        }
        foreach ($matches as $m) {
            $item = array();
            $item["image_large"] = getRealUrl(basePath($this->url), $m[1]);
            $item["art"] = strip_tags($m[2]);
            $item["name"] = $m[3];
            $item["price"] = strip_tags($m[4]);
            $item["descr"] = strip_tags($m[5]);
            $item["material"] = $m[6];
            $item["colors"] = $m[7];
            $item["url"] = $this->url;
            $items[] = $item;
        }
        return $items;
    }
开发者ID:rivetweb,项目名称:old-auto-catalog,代码行数:25,代码来源:SenatorPenContentGrabber.php

示例4: parseItems

    function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{<tr>
<td align="center"> <h2 class="context">(.+?)</h2> </td>
<td align="center"> <span class="context">(.+?)</span> </td>
<td align="center"> <span class="context">(.+?)</span> </td>
<td align="center"> <a.+?href="(prod/zapis/[^"]+)" target="_blank">
<img.+?src="(prod/zapis/[^"]+)".+?> </a> </td>}s
PATTERN;
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Items not found.");
        }
        foreach ($matches as $m) {
            $name = trim($m[1]);
            $art = trim($m[2]);
            $size = trim($m[3]);
            $img = getRealUrl(basePath($this->url), $m[4]);
            $imgSmall = getRealUrl(basePath($this->url), $m[5]);
            $items[] = array("url" => $this->url, "image_large" => $img, "image_small" => $imgSmall, "name" => $name, "art" => $art, "size" => $size);
        }
        return $items;
    }
开发者ID:rivetweb,项目名称:old-auto-catalog,代码行数:25,代码来源:MezaContentGrabber.php

示例5: parseItems

 function parseItems()
 {
     $items = array();
     $pattern = '{<div id="text">
       <h1>(.+?)</h1>
       <p>(.+?)</p>}s';
     $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
     if (!preg_match($pattern, $this->pageContent, $matches)) {
         return new PEAR_Error("Items not found.");
     }
     $name = strip_tags($matches[1]);
     $descr = strip_tags($matches[2]);
     $pattern = '{<img border="0" src="((images/[^"]+_)small(_[^"]+))"}s';
     if (!preg_match($pattern, $this->pageContent, $matches)) {
         $imgSmall = "";
         $img = "";
     } else {
         $imgSmall = getRealUrl(basePath($this->url), $matches[1]);
         $img = getRealUrl(basePath($this->url), $matches[2] . "big" . $matches[3]);
     }
     $pattern = '{<td><p class="pnavbar2"><b>(.+?)</b></p></td>}s';
     if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_PATTERN_ORDER)) {
         $colors = "";
     } else {
         $colors = implode(", ", $matches[1]);
     }
     $items[] = array("image_large" => $img, "image_small" => $imgSmall, "url" => $this->url, "name" => $name, "descr" => $descr, "colors" => $colors);
     return $items;
 }
开发者ID:rivetweb,项目名称:old-auto-catalog,代码行数:29,代码来源:EliteLineContentGrabber.php

示例6: parseItems

    function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{<TABLE[^>]+>
<TR[^>]+>
<TD[^>]+> <IMG src="(resize.php\\?name=[^"]+)".+?
onclick="javascript:window\\.open\\('catalogPrev.php\\?catalogId=(\\d+)'[^"]+\\);"> </TD>
<TD[^>]+>
<h3>(.+?)</h3>
(.+?)<TABLE
}si
PATTERN;
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Items not found.");
        }
        foreach ($matches as $m) {
            $imgSmall = getRealUrl(basePath($this->url), $m[1]);
            $img = getRealUrl(basePath($this->url), "ItemImages/" . $m[2] . ".jpg");
            $art = trim($m[3]);
            $descr = trim(html_entity_decode(strip_tags($m[4])));
            $pattern = "{Размеры\\s*\\(XxYxZ\\):(.+)}s";
            if (preg_match($pattern, $descr, $mSize)) {
                $size = trim($mSize[1]);
            } else {
                $size = "";
            }
            $items[] = array("url" => $this->url, "image_large" => $img, "image_small" => $imgSmall, "descr" => $descr, "size" => $size, "art" => $art);
        }
        return $items;
    }
开发者ID:rivetweb,项目名称:old-auto-catalog,代码行数:32,代码来源:ElisirContentGrabber.php

示例7: parseItems

    function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{<img src='((images/catalogue/[^']+?)_s(\\.jpg))'.+?
\t\t\t<a href='(/\\?action=OnShowGood\\&ID=(.+?))'>
\t\t\t\t<b>(.+?)(\\(склад\\))*</b></a>}s
PATTERN;
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Ошибка при выделении элементов.");
        }
        foreach ($matches as $m) {
            $item = array();
            $item["image_small"] = getRealUrl(basePath($this->url), $m[1]);
            $item["image_large"] = getRealUrl(basePath($this->url), $m[2] . "_b" . $m[3]);
            $item["url"] = getRealUrl(basePath($this->url), $m[4]);
            $name = trim($m[6]);
            $art = "";
            $p = strrpos($name, " ");
            if ($p !== false && $p > 0) {
                $art = substr($name, $p + 1);
                $name = substr($name, 0, $p);
            }
            $item["name"] = $name;
            $item["art"] = $art;
            $items[] = $item;
        }
        return $items;
    }
开发者ID:rivetweb,项目名称:old-auto-catalog,代码行数:30,代码来源:ChasartContentGrabber.php

示例8: validate

function validate()
{
    $email = sanitize($_POST['email'], "email");
    $password = sanitize($_POST['password'], "string");
    $password = sha1(SALT . $password . $email);
    $sql = "select * from users where email = '" . escape($email) . "' and password = '" . escape($password) . "'";
    $query = mysql_query($sql);
    $user = mysql_fetch_array($query);
    $basePath = basePath();
    if ($user['id'] > 0) {
        $_SESSION['userid'] = $user['id'];
        $_SESSION['name'] = $user['name'];
        $_SESSION['email'] = $user['email'];
        $_SESSION['password'] = $user['password'];
        $_SESSION['points'] = $user['points'];
        if (!empty($_POST['returnurl'])) {
            $url = sanitize($_POST['returnurl'], "url");
            header("Location: {$url}");
        } else {
            header("Location: {$basePath}");
        }
    } else {
        header("Location: {$basePath}/users/login");
    }
}
开发者ID:jerome42,项目名称:Qwench,代码行数:25,代码来源:users.php

示例9: actionIndex

 public function actionIndex($propertyId)
 {
     $this->updateActiveProperty($propertyId);
     $tutorial = $this->getTutorialState('guest_book');
     if ($this->access >= UserAccessTable::GUEST) {
         Yii::app()->request->redirect(basePath(''));
     }
     if (!UserAccessTable::checkUser2PropertyAccess(Yii::app()->user->getState('id'), $propertyId, UserAccessTable::BASIC_ACCESS)) {
         Yii::app()->request->redirect(basePath('app/properties'));
     }
     //check login
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     $this->updateActiveProperty($propertyId);
     //register js file
     Yii::app()->clientScript->registerScriptFile(basePath('js/pages/base.js'), CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile(basePath('js/pages/baseMemberGuest.js'), CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile(basePath('js/pages/member.js'), CClientScript::POS_END);
     //get db information
     $users2properties = User2property::model()->with('user')->findAll('propertyId=:propertyId AND access != :access', array(':propertyId' => $propertyId, ':access' => UserAccessTable::GUEST));
     $users = array();
     foreach ($users2properties as $key => $u2p) {
         $users[$key] = $this->createViewItem($u2p);
     }
     $accessList = UserAccessTable::allAccessLevels();
     $statusList = UserAccessTable::allStatuses();
     $currentUser = User2property::model()->with('user')->findByAttributes(array('propertyId' => $propertyId, 'userId' => Yii::app()->user->getState('id')));
     $this->render('index', array('users' => $users, 'accessList' => $accessList, 'tutorial' => $tutorial, 'statusList' => $statusList, 'isCanEdit' => $this->access < UserAccessTable::BASIC_ACCESS, 'propertyId' => $propertyId));
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:30,代码来源:MemberController.php

示例10: actionSubmit

 public function actionSubmit()
 {
     $data = array('email' => YII::app()->request->getParam('email', null), 'name' => YII::app()->request->getParam('name', null), 'message' => YII::app()->request->getParam('message', null));
     $model = new ContactusForm();
     $model->setAttributes($data);
     $isValid = $model->validate();
     $emails = array(Yii::app()->params['contactusEmail']);
     if (Yii::app()->user->isGuest) {
         if ($model->validate()) {
             $this->_send($model);
             //redirect
             Yii::app()->request->redirect(basePath('contactus/confirm'));
         } else {
             //render errors
             $this->layout = "main";
             $this->render('guest', array('email' => $data['email'], 'name' => $data['name'], 'contact' => Yii::app()->params['contactusEmail'], 'message' => $data['message'], 'errors' => $model->getErrors()));
         }
     } else {
         $model->email = Yii::app()->user->getState('email');
         if ($model->validate()) {
             $this->_send($model);
             //redirect
             Yii::app()->request->redirect(basePath('contactus/confirm'));
         } else {
             //render errors
             $this->layout = "app";
             $this->render('user', array('email' => $data['email'], 'name' => $data['name'], 'contact' => Yii::app()->params['contactusEmail'], 'message' => $data['message'], 'errors' => $model->getErrors()));
         }
     }
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:30,代码来源:ContactusController.php

示例11: actionIndex

 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     $this->layout = 'app';
     $this->render('index');
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:8,代码来源:WelcomeController.php

示例12: doUserCheck

 protected function doUserCheck()
 {
     $allowUsers = array("chris2thrall@gmail.com", "thrall@buddhaboard.com", "sunni@createmethod.com", "adlina@createmethod.com");
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     if (!in_array(Yii::app()->user->email, $allowUsers)) {
         Yii::app()->request->redirect(basePath('app/gallery'));
     }
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:10,代码来源:StatsBaseController.php

示例13: addPageUrls

 /**
  * Добавление урлов на страницы с данными в список
  */
 function addPageUrls($urls)
 {
     if (sizeof($urls) <= 0) {
         return;
     }
     foreach ($urls as $url) {
         $url = getRealUrl(basePath($this->url), $url);
         if (!in_array($url, $this->pagesUrls)) {
             $this->pagesUrls[] = $url;
         }
     }
 }
开发者ID:rivetweb,项目名称:old-auto-catalog,代码行数:15,代码来源:IContentGrabber.php

示例14: actionEdit

 public function actionEdit()
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     if ($this->access > UserAccessTable::FULL_ACCESS) {
         Yii::app()->request->redirect(basePath(''));
     }
     $isUpload = isset($_GET['action']) ? true : false;
     $tutorial = Yii::app()->user->getState('tutorial_gallery');
     $images = $this->getImages();
     $property = Properties::model()->findByPk(Yii::app()->user->getState('property_id'));
     $this->render('edit', array('images' => $images, 'tutorial' => $tutorial, 'isUpload' => $isUpload, 'welcomeMessage' => $property->welcomeMessage));
     $this->renderPartial('deletePrint');
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:15,代码来源:GalleryController.php

示例15: actionIndex

 public function actionIndex()
 {
     $flag = UserAccessTable::GUEST;
     foreach ($this->properties as $property) {
         if ((int) $flag > (int) $property['access']) {
             $flag = (int) $property['access'];
         }
     }
     if ((int) $flag < (int) UserAccessTable::GUEST) {
         $this->ShowMessage = true;
         $this->render('Index');
     } else {
         Yii::app()->request->redirect(basePath(''));
     }
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:15,代码来源:HelpController.php


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