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


PHP model::factory方法代码示例

本文整理汇总了PHP中model::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP model::factory方法的具体用法?PHP model::factory怎么用?PHP model::factory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model的用法示例。


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

示例1: delete

 function delete($id)
 {
     // Let the file-model deal with the deletion
     model::factory('file')->delete($id);
     // and send the user back to the filelist
     header('location: ' . model::factory('renderer')->url('/admin/file/'));
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:7,代码来源:file.php

示例2: logout

 function logout()
 {
     // Unset the session!
     unset($_SESSION['user']);
     // And send the user to the frontpage
     header('Location: ' . model::factory('renderer')->url('/'));
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:7,代码来源:login.php

示例3: test

 function test()
 {
     $database = model::factory('database');
     $r = $database->safe_query('select * from user where user_id in :user_id', array('user_id' => array(329, 339)));
     var_Dump($r);
     var_dump($r->fetchAll());
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:7,代码来源:dev.php

示例4: page

 function page($page)
 {
     list($id, $null) = explode(':', $page);
     $sql = 'select * from page where idpage="' . $id . '"';
     list($page) = model::factory('database')->query($sql);
     $page_renderer = model::factory('renderer', 'pages');
     $page_renderer->page = $page;
     model::factory('renderer')->content = $page_renderer->render('template/page.php');
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:9,代码来源:page.php

示例5: get_all

 function get_all()
 {
     $settings = array();
     $r = model::factory('database')->query('select * from conf order by name asc');
     foreach ($r as $s) {
         $settings[] = $s;
     }
     return $settings;
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:9,代码来源:conf.php

示例6: post

 function post($post)
 {
     list($id, $null) = explode(':', $post);
     $sql = 'select * from post where idpost="' . $id . '"';
     $post = model::factory('database')->query($sql)->fetch_assoc();
     $post_renderer = model::factory('renderer', 'post');
     $post_renderer->post = $post;
     model::factory('renderer')->title = $post['title'];
     model::factory('renderer')->content = $post_renderer->render('template/post.php', true);
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:10,代码来源:post.php

示例7: index

 function index()
 {
     if (isset($_POST) && !empty($_POST)) {
         foreach ($_POST as $key => $p) {
             model::factory('conf')->set($key, $p);
         }
     }
     $renderer = model::factory('renderer', 'settings');
     $renderer->settings = model::factory('conf')->get_all();
     return model::factory('renderer')->admin_content = $renderer->render('template/admin/settings/index.php', true);
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:11,代码来源:settings.php

示例8: roll

 function roll()
 {
     $roll = model::factory('kmom2_randomize')->roll_dice(6);
     $rounds = $this->get_data($this->gamename);
     $current_round = count($rounds['players'][$rounds['current_player']]['rounds']);
     if ($current_round == 0 && !isset($rounds['players'][$rounds['current_player']]['rounds'][$current_round])) {
         $rounds['players'][$rounds['current_player']]['rounds'][] = array();
     }
     if ($roll != 1) {
         $rounds['players'][$rounds['current_player']]['rounds'][count($rounds['players'][$rounds['current_player']]['rounds']) - 1][] = $roll;
     } else {
         $rounds['players'][$rounds['current_player']]['rounds'][count($rounds['players'][$rounds['current_player']]['rounds']) - 1] = array();
         $rounds['players'][$rounds['current_player']]['rounds'][count($rounds['players'][$rounds['current_player']]['rounds'])] = array();
     }
     $this->last_roll = $roll;
     $this->set_data($this->gamename, $rounds);
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:17,代码来源:dicegame.php

示例9: safe_query

 function safe_query($sql, $parameters = array())
 {
     if (!is_array($parameters)) {
         $parameters = array($parameters);
     }
     $statement = $this->database->prepare($sql);
     $statement->setFetchMode(PDO::FETCH_ASSOC);
     $statement->execute($parameters);
     if ($statement->errorCode() != '00000') {
         model::debug()->print_backtrace();
         model::factory('log')->warning('PDO errorcode: ' . $statement->errorCode());
         model::factory('log')->warning('PDO errorinfo: ' . json_encode($statement->errorInfo()));
         model::factory('log')->warning('PDO sql: ' . $sql);
         model::factory('log')->warning('PDO parameters: ' . json_encode($parameters));
     }
     return $statement->fetchAll();
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:17,代码来源:database.php

示例10: get

 function get($file)
 {
     if (is_numeric($file)) {
         $sql = "select path, filename, type from file where idfile = '" . $file . "'";
     } else {
         $sql = "select path, filename, type from file where filename = '" . $file . "'";
     }
     list($data) = model::factory('database')->query($sql);
     header('Content-Description: File Transfer');
     header('Content-Type: ' . $data['type']);
     $mime = explode('/', $data['type']);
     if ($mime[0] != 'image') {
         header('Content-Disposition: attachment; filename=' . $data['filename']);
     }
     header('Pragma: public');
     header('Content-Length: ' . filesize(UPLOAD . $data['path']));
     readfile(UPLOAD . $data['path']);
     die;
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:19,代码来源:file.php

示例11: resolv

function resolv($url)
{
    // get_parts splits the url by '/' and returns an array with the parts or a single element array with ''
    $parts = model::factory('url')->get_parts();
    if ($parts[0] == 'admin') {
        // Admin... Always requiring special attention...
        // Set the controller to be used if none is set
        if (!isset($parts[1]) || $parts[1] == '') {
            $parts[1] = 'welcome';
        }
        // Prepare the parameters
        if (isset($parts[3])) {
            $params = explode('/', $parts[3]);
        } else {
            $params = array();
        }
        // Instantiate the class
        $class_name = 'controller_' . $parts[0] . '_' . $parts[1];
        $class = new $class_name();
        // And finish with the method
        $method = isset($parts[2]) && !empty($parts[2]) ? $parts[2] : 'index';
    } else {
        // if parts is empty, use the default welcome-controller
        if ($parts[0] == '') {
            $parts[0] = 'welcome';
        }
        // Prepare the parameters
        if (isset($parts[2])) {
            $params = explode('/', $parts[2]);
        } else {
            $params = array();
        }
        // Instantiate the class
        $class_name = 'controller_' . $parts[0];
        $class = new $class_name();
        // And finish with the method
        $method = isset($parts[1]) && !empty($parts[1]) ? $parts[1] : 'index';
    }
    // Once done. return an array with the stuff
    return array('class' => $class, 'params' => $params, 'method' => $method);
}
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:41,代码来源:init.php

示例12: clear

 function clear()
 {
     $this->gamedata->clear();
     header('Location: ' . model::factory('renderer')->url('/kmom2/'));
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:5,代码来源:kmom2.php

示例13: delete

 function delete($id)
 {
     $sql = 'delete from movie where movie_id=?';
     model::factory('database')->safe_query($sql, $id);
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:5,代码来源:movie.php

示例14: index

 function index()
 {
     model::factory('renderer')->set('admin_content', 'hi');
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:4,代码来源:welcome.php

示例15: check_password

 static function check_password($userid, $password)
 {
     $count = model::factory('database')->safe_query('select user_id from user where user_id = :user_id and where password = :password', array('user_id' => $userid, 'password' => $password));
     if (count($count) == 1) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:tinyMrChaos,项目名称:hephaestus,代码行数:9,代码来源:user.php


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