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


PHP lib函数代码示例

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


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

示例1: __construct

 /**
  * Construct the class.
  *
  * @return void
  */
 public function __construct($name = null)
 {
     $name = is_null($name) ? 'cart' : $name;
     $this->session = session('cart.' . $name);
     $this->collection = lib('items');
     $this->setCart($name);
 }
开发者ID:schpill,项目名称:standalone,代码行数:12,代码来源:cart.php

示例2: getAffiliation

 public function getAffiliation($reseller_id, $array = true)
 {
     $metiers = Model::Segmentreseller()->where(['reseller_id', '=', (int) $reseller_id])->with('segment');
     $out = $marches = [];
     foreach ($metiers as $metier) {
         if (isset($metier['segment'])) {
             switch ($metier['segment']['id']) {
                 case 413:
                     $marches[413] = ['id' => 413, 'name' => $metier['segment']['name']];
                     $opt_data = lib('forms')->getOptionsMacroData(413);
                     if (isAke($opt_data, 'affiliation_resto', null) == 1) {
                         $marches[413]['name'] = $marches[413]['name'] . ' ' . 'resto';
                     } elseif (isAke($opt_data, 'affiliation_snack', null) == 1) {
                         $marches[413]['name'] = $marches[413]['name'] . ' ' . 'snack';
                     } elseif (isAke($opt_data, 'affiliation_vin', null) == 1) {
                         $marches[413]['name'] = $marches[413]['name'] . ' ' . 'vin';
                     }
                     break;
                 default:
                     $seg = repo('segment')->getFamilyFromItem($metier['segment']['id']);
                     if (isset($seg[0]['id'])) {
                         $marches[$seg[0]['id']] = $seg[0];
                     }
             }
         }
     }
     $out['txt'] = '';
     $vir = '';
     foreach ($marches as $marche) {
         $out['txt'] = $vir . $marche['name'];
         $vir = ', ';
     }
     $out['tab'] = $marches;
     return $array ? $out['tab'] : $out['txt'];
 }
开发者ID:schpill,项目名称:standalone,代码行数:35,代码来源:segment.php

示例3: render

    function render(){
        $dom = lib('htmldom')->str_get_dom($this->inner);
        
        $head = '';
        $tabs = '';
        $iterator = 1;
        foreach ( $dom->find('tab') as $tab){
            $display = ($iterator==$this->selected)?'block':'none';
            $class = ($iterator==$this->selected)?'selected':'';

            $head .= "<a class='$class' href='javascript:;' onclick='
                $(this).parent().find(\"a\").removeClass(\"selected\");
                $(this).addClass(\"selected\");
                $(this).parent().parent().find(\".tabs_body\ .tab\").hide();
                $(this).parent().parent().find(\".tabs_body\ .tab:nth-child($iterator)\").show();
            '>$tab->title</a>";
            $tabs .= "<div style='display:$display;' class='tab'>$tab</div>";
            $iterator++;
        }
        ?>
        <div class="tabs">
            <div class="tabs_head"><?=$head?></div>
            <div class="tabs_body"><?=$tabs?></div>
        </div>
        <?
    }
开发者ID:nirgavish,项目名称:Framework--Apex,代码行数:26,代码来源:tabs.php

示例4: offreout

 public function offreout($reseller_id)
 {
     $collection = [];
     $advices = Model::Advice()->where(['table', '=', 'offreout'])->where(['reseller_id', '=', (int) $reseller_id])->where(['created_at', '>', strtotime(Config::get('advice.maxperiod', '-3 month'))])->cursor();
     foreach ($advices as $advice) {
         $account = Model::Account()->find((int) $advice['account_id']);
         if ($account) {
             $row = [];
             $row['id'] = $advice['id'];
             $row['positive'] = $advice['positive'];
             $row['negative'] = $advice['negative'];
             $row['account_id'] = $account->id;
             $row['firstname'] = $account->firstname;
             $rates = Model::Advicerate()->where(['advice_id', '=', (int) $advice['id']])->cursor();
             $row['rates'] = [];
             foreach ($rates as $rate) {
                 $category = Model::Adviceratecategory()->find((int) $rate['adviceratecategory_id']);
                 if ($category) {
                     $row['rates'][] = ['rate' => $rate['rate'], 'name' => $category['name'], 'order' => $category['order'], 'ponderation' => $category['ponderation']];
                 }
             }
             if (!empty($row['rates'])) {
                 $row['rates'] = array_values(lib('collection', [$row['rates']])->sortBy('order')->toArray());
             }
             $collection[] = $row;
         }
     }
     // return $collection;
     return empty($collection) ? [['id' => 1, 'account_id' => 28, 'firstname' => 'Pierre-Emmanuel', 'positive' => "Un accueil digne d'un 4 étoiles.", 'negative' => "Ma table était en plein courant d'air. Pas de pain en rab...", 'rates' => [['name' => 'Qualité', 'rate' => 6, 'ponderation' => 1], ['name' => 'Accueil', 'rate' => 8, 'ponderation' => 1], ['name' => 'Service', 'rate' => 8, 'ponderation' => 1]]], ['id' => 2, 'account_id' => 30, 'firstname' => 'Nicolas', 'positive' => "Très bon sommelier.", 'negative' => "Pas de parking à proximité.", 'rates' => [['name' => 'Qualité', 'rate' => 8, 'ponderation' => 1], ['name' => 'Accueil', 'rate' => 10, 'ponderation' => 1], ['name' => 'Service', 'rate' => 6, 'ponderation' => 1]]]] : $collection;
 }
开发者ID:schpill,项目名称:standalone,代码行数:30,代码来源:advice.php

示例5: boot

 public function boot()
 {
     spl_autoload_register(function ($class) {
         lib('middleware')->listen($class);
     });
     return $this;
 }
开发者ID:schpill,项目名称:standalone,代码行数:7,代码来源:middleware.php

示例6: user_create

function user_create($Username, $Password)
{
    global $pdo;
    if (user_exists($Username)) {
        return false;
    }
    $stmt = $pdo->prepare('
		INSERT INTO `users`
		(
			`username`
			, `password`
		) VALUES (
			:username
			, :password
		)');
    $stmt->bindValue(':username', s($Username));
    $stmt->bindValue(':password', user_hash($Password, $Username));
    $stmt->execute();
    $uid = $pdo->lastInsertId();
    $stmt->closeCursor();
    // Create a group for the new user
    lib('Group');
    $gid = group_create(s($Username), 'user');
    group_add($gid, $uid);
    return $uid;
}
开发者ID:ss23,项目名称:Pass-Store,代码行数:26,代码来源:User.php

示例7: __callStatic

 public static function __callStatic($m, $a)
 {
     if (!isset(self::$i)) {
         self::$i = lib('redys', ['blazz.store']);
     }
     return call_user_func_array([static::$i, $m], $a);
 }
开发者ID:schpill,项目名称:standalone,代码行数:7,代码来源:Staticstore.php

示例8: start

    function start($lifespan, $name=''){
        if ($this->fragment_name!=''){die('Nested fragment cache not supported.');}
        $x = debug_backtrace();

        if($name==''){
            $this->fragment_name = md5(lib('uri')->_selfURL().'||'.$x[0]['line']);
        }else{
            $this->fragment_name = $name;
        }
        ?><!-- START Fragment <?=$this->fragment_name?>--><?

        // if file does not exist, make preparations to cache and return true, so segment is executed
        if(!file_exists($this->fragment_path . $this->fragment_name)){
            $this->newly_cached = true;
            ob_start();
            return true;
        }else{
            // cache exists, let's see if it is still valid by checking it's age against the $lifespan variable
            $fModify = filemtime($this->fragment_path . $this->fragment_name);
            $fAge = time() - $fModify;
            if ($fAge > ($lifespan * 60)){
                // file is old, let's re-cache
                $this->newly_cached = true;
                ob_start();
                return true;
            }
            // no need to redo
            return false;
        }
    }
开发者ID:nirgavish,项目名称:Framework--Apex,代码行数:30,代码来源:cache.php

示例9: getInstance

 public static function getInstance($ns)
 {
     if (!isset(self::$collections[$ns])) {
         self::$collections[$ns] = lib('myiterator');
     }
     return self::$collections[$ns];
 }
开发者ID:schpill,项目名称:standalone,代码行数:7,代码来源:itemcollection.php

示例10: background

 public function background()
 {
     $file = realpath(APPLICATION_PATH . DS . '..' . DS . 'public' . DS . 'scripts' . DS . 'later.php');
     if (File::exists($file)) {
         $cmd = 'php ' . $file;
         lib('utils')->backgroundTask($cmd);
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:8,代码来源:later.php

示例11: instance

 public static function instance($ns = 'core')
 {
     $i = isAke(self::$instances, $ns, false);
     if (!$i) {
         self::$instances[$ns] = $i = lib('now', [$ns]);
     }
     return $i;
 }
开发者ID:schpill,项目名称:standalone,代码行数:8,代码来源:nowstatic.php

示例12: __callStatic

 public static function __callStatic($f, $a)
 {
     $f = strtolower($f);
     if (!empty($a)) {
         return lib($f, $a);
     }
     return lib($f);
 }
开发者ID:schpill,项目名称:thin,代码行数:8,代码来源:Lib.php

示例13: session

function session($name = 'core', $adapter = 'session', $ttl = 3600)
{
    switch ($adapter) {
        case 'session':
            return lib('session', [$name]);
        case 'redis':
            return RedisSession::instance($name, $ttl);
    }
}
开发者ID:schpill,项目名称:jsoncms,代码行数:9,代码来源:helpers.php

示例14: SignUp

function SignUp($data)
{
    lib("users");
    if (is_string($res = CreateUser($data['username'], $data['password'], $data['email']))) {
        echo "<div class='error'>{$res}</div>" . PHP_EOL;
    } else {
        echo "Done. <a href='./'>Login</a> now." . PHP_EOL;
    }
}
开发者ID:p2004a,项目名称:CTF,代码行数:9,代码来源:signup.php

示例15: config

 private static function config()
 {
     Config::set('app.module.dir', __DIR__);
     Config::set('app.module.dirstorage', __DIR__ . DS . 'storage');
     lib('app');
     Alias::facade('Run', 'AppLib', 'Thin');
     Run::makeInstance();
     Config::set('directory.store', STORAGE_PATH);
 }
开发者ID:schpill,项目名称:blog,代码行数:9,代码来源:Bootstrap.php


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