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


PHP Backend::get方法代码示例

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


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

示例1: __call

 public function __call($method, $args)
 {
     $id = md5($method . serialize($args) . serialize(get_object_vars($this->object)));
     if (($value = $this->backend->get($id)) === null) {
         $value = call_user_func_array(array($this->object, $method), $args);
         $this->backend->add($id, $value);
     }
     return $value;
 }
开发者ID:maximebf,项目名称:cachecache,代码行数:9,代码来源:ObjectWrapper.php

示例2: __construct

 /**
  * Construct an instance.
  * @param Backend $backend The backend framework.
  */
 public function __construct($backend)
 {
     // set values
     $this->db = $backend->GetDatabase();
     // parse query
     $this->dbname = $backend->get('wiki') ?: $backend->getRouteValue();
     $this->wiki = $backend->db->wikis->GetWiki($this->dbname);
     foreach ($this->presetGroups as $group => $logTypes) {
         if ($backend->get($group)) {
             $this->groups[$group] = $logTypes;
         }
     }
     // set defaults
     if (!$this->groups) {
         $this->groups = array('sysop' => $this->presetGroups['sysop']);
     }
 }
开发者ID:bacoda,项目名称:Wikimedia-contrib,代码行数:21,代码来源:index.php

示例3: get

 /**
  * {@inheritDoc}
  */
 public function get($id, $default = null)
 {
     $id = $this->id($id);
     if (($value = $this->backend->get($id)) === null) {
         return $default;
     }
     return $value;
 }
开发者ID:maximebf,项目名称:cachecache,代码行数:11,代码来源:Cache.php

示例4: getActive

 public static function getActive($refresh = false)
 {
     if (!defined('BACKEND_WITH_DATABASE') || !BACKEND_WITH_DATABASE) {
         //Return the core components
         return self::getCoreComponents();
     }
     $result = $refresh ? false : Backend::get('Component::active', false);
     if ($result) {
         return $result;
     }
     $component = new ComponentObj();
     list($query, $params) = $component->getSelectSQL(array('conditions' => '`active` = 1'));
     if ($query) {
         $query = new CustomQuery($query);
         $result = $query->fetchAll($params);
         Backend::add('Component::active', $result);
     }
     return $result;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:19,代码来源:Component.obj.php

示例5: html_import

 public function html_import($result)
 {
     switch (true) {
         case $result instanceof DBObject:
             if (!Backend::get('Sub Title')) {
                 Backend::add('Sub Title', 'Import');
                 Backend::add('Sub Title', 'Import ' . $result->getMeta('name'));
             }
             $template_file = array($result->getArea() . '.import.tpl.php', $result->getArea() . '/import.tpl.php');
             if (!Render::checkTemplateFile($template_file[0]) && !Render::checkTemplateFile($template_file[1])) {
                 $template_file = 'std_import.tpl.php';
             }
             Backend::addContent(Render::file($template_file, array('db_object' => $result)));
             break;
         case is_numeric($result) && $result >= 0:
             Backend::addSuccess($result . ' records imported');
             Controller::redirect('?q=' . Controller::$area . '/list');
             break;
         default:
             Controller::redirect();
             break;
     }
     return $result;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:24,代码来源:TableCtl.obj.php

示例6: hook_output

 public static function hook_output($output)
 {
     //TODO Attach HTTP Error codes and descriptions to these errors
     if (!is_array($output)) {
         BackendError::add('Google Chart Error', 'Invalid Output');
         return false;
     }
     $type = array_key_exists('type', $output) ? $output['type'] : Backend::get('ChartType', 'simple_line');
     if (!method_exists('GChartView', $type)) {
         BackendError::add('Google Chart Error', 'Invalid Chart Type');
         return false;
     }
     if (!array_key_exists('data', $output)) {
         $output = array('data' => $output);
     }
     if (!is_array($output['data']) || !count($output['data'])) {
         BackendError::add('Google Chart Error', 'Invalid Output Data');
         return false;
     }
     $params = array();
     $title = array_key_exists('title', $output) ? $output['title'] : Backend::get('ChartTitle', false);
     if ($title) {
         $params['chtt'] = $title;
     }
     $url = self::$type($output, $params);
     if (Controller::$debug) {
         echo '<img src="' . $url . '">';
         var_dump($params);
         var_dump($output);
         $dont_kill = Controller::getVar('dont_kill');
         if (empty($dont_kill)) {
             die;
         }
     }
     $recache = Controller::getVar('recache') ? true : false;
     debug_header('Recache - ' . $recache);
     $image = curl_request($url, array(), array('cache' => $recache ? 1 : 60 * 60, 'bypass_ssl' => 1));
     if (Controller::$debug) {
         var_dump('Image:', $image);
     }
     if (!$image) {
         BackendError::add('Google Chart Error', 'Could not get image');
         return false;
     }
     $filename = Backend::get('ChartFilename', false);
     if (!$filename) {
         $filename = class_name(Controller::$area) . class_name(Controller::$action);
         if (Controller::$action == 'read' && !empty(Controller::$parameters[0])) {
             $filename .= Controller::$parameters[0];
         }
     }
     if (Controller::$debug) {
         var_dump('Filename:', $filename);
     }
     header('Content-Disposition: inline; filename="' . $filename . '.png"');
     return $image;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:57,代码来源:GChartView.obj.php

示例7: html_display

 function html_display($content)
 {
     if ($content instanceof DBObject) {
         Backend::add('Sub Title', $content->array['title']);
         if ($content->array['from_file']) {
             //Move this to the object ??
             $filename = 'content/static/' . $content->array['name'] . '.html';
             $template = 'content/' . $content->array['name'] . '.tpl.php';
             if (Render::checkTemplateFile($template)) {
                 $content->object->body = Render::file($template);
             } else {
                 if (file_exists(SITE_FOLDER . '/' . $filename)) {
                     $content->object->body = file_get_contents(APP_FOLDER . '/' . $filename);
                 } else {
                     if (file_exists(APP_FOLDER . '/' . $filename)) {
                         $content->object->body = file_get_contents(APP_FOLDER . '/' . $filename);
                     } else {
                         if (file_exists(BACKEND_FOLDER . '/' . $filename)) {
                             $content->object->body = file_get_contents(BACKEND_FOLDER . '/' . $filename);
                             //SITE FOLDER too?
                         }
                     }
                 }
             }
         }
         $meta_desc = Backend::get('meta_description');
         if (empty($meta_desc)) {
             Backend::add('meta_description', plain(self::createPreview($content->object->body, false)));
         }
         $http_equiv = Backend::get('meta_http_equiv', array());
         $http_equiv['Last-Modified'] = $content->object->modified;
         Backend::add('meta_http_equiv', $http_equiv);
         if (!headers_sent()) {
             $max_age = ConfigValue::get('content.MaxAge', 86400);
             header('Last-Modified: ' . $content->object->modified);
             header('Expires: ' . gmdate('r', strtotime('+1 day')));
             header('Cache-Control: max-age=' . $max_age . ', must-revalidate');
             header('Pragma: cache');
         }
     }
     if (Backend::getDB('default')) {
         //TODO Make some of the content values (such as added and lastmodified) available
         //So you can add Last Modified on #lastmodified# to the content.
         $content = parent::html_display($content);
     }
     return $content;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:47,代码来源:Content.obj.php

示例8: userStats

    public static function userStats()
    {
        $msg = array();
        $query = new SelectQuery('BackendUser');
        $query->field('COUNT(*) AS `Total`, SUM(IF(TO_DAYS(NOW()) - TO_DAYS(`added`) < 7, 1, 0)) AS `New`')->filter('`active` = 1')->filter('`confirmed` = 1');
        if ($stats = $query->fetchAssoc()) {
            $msg[] = 'There are a total of ' . $stats['Total'] . ' **active** users,
of which ' . $stats['New'] . ' signed up in the last 7 days';
        }
        $query = new SelectQuery('BackendUser');
        $query->field('COUNT(*) AS `Total`, SUM(IF(TO_DAYS(NOW()) - TO_DAYS(`added`) < 7, 1, 0)) AS `New`')->filter('`active` = 1')->filter('`confirmed` = 1');
        if ($stats = $query->fetchAssoc()) {
            $msg[] = 'There are a total of ' . $stats['Total'] . ' **unconfirmed** users,
of which ' . $stats['New'] . ' signed up in the last 7 days';
        }
        $msg = implode(PHP_EOL . PHP_EOL, $msg);
        send_email(ConfigValue::get('author.Email', ConfigValue::get('application.Email', 'info@' . SITE_DOMAIN)), 'User stats for ' . Backend::get('Title'), $msg);
        return true;
    }
开发者ID:jrgns,项目名称:backend-php,代码行数:19,代码来源:BackendUser.obj.php

示例9: addLastContent

 public static function addLastContent($to_print)
 {
     //Checking for ob_level > $this->ob_level, so we'll exit on the same number we started on
     $last = '';
     while (ob_get_level() > self::$ob_level) {
         //Ending the ob_start from __construct
         $last .= ob_get_clean();
     }
     $start = Backend::get('start');
     $time = microtime(true) - $start;
     $last = 'Generated on ' . date('Y-m-d H:i:s') . ' in ' . number_format($time, 4) . ' seconds' . $last;
     $to_print = str_replace('#Last Content#', $last, $to_print);
     return $to_print;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:14,代码来源:HtmlView.obj.php

示例10: hook_output

 public static function hook_output($to_print)
 {
     $filename = Backend::get('CsvFilename', false);
     if (!$filename) {
         $filename = class_name(Controller::$area) . class_name(Controller::$action);
         if (Controller::$action == 'read' && !empty(Controller::$parameters[0])) {
             $filename .= Controller::$parameters[0];
         }
     }
     if (!Controller::$debug) {
         header('Content-Disposition: attachment; filename="' . $filename . '.csv"');
         header('Pragma: no-cache');
         header('Expires: 0');
     }
     switch (true) {
         //Output SelectQuery as CSV
         case $to_print instanceof SelectQuery:
         case $to_print instanceof CustomQuery:
             return self::outputQuery($to_print);
             break;
             //Output Array of Arrays as CSV
         //Output Array of Arrays as CSV
         case is_array($to_print):
             if (!($fp = fopen('php://temp', 'r+'))) {
                 Backend::addError('Could not open output file for CSV output');
                 return '';
             }
             $tmp = reset($to_print);
             $first = false;
             foreach ($to_print as $row) {
                 if (!is_array($row)) {
                     $row = array($row);
                 }
                 set_time_limit(30);
                 if (!$first) {
                     //fputcsv($fp, array_keys($row));
                     $first = true;
                 }
                 fputcsv($fp, $row);
             }
             //Get the file contents
             rewind($fp);
             ob_start();
             fpassthru($fp);
             fclose($fp);
             return ob_get_clean();
             break;
             //Output a DBObject. Try the list first, then the array | object
         //Output a DBObject. Try the list first, then the array | object
         case $to_print instanceof DBObject:
             if ($to_print->list) {
                 return self::outputList($to_print->list);
             } else {
                 if ($to_print->array || $to_print->db_object) {
                     $to_print = $to_print->array ? $to_print->array : (array) $to_print->db_object;
                     $to_print = array_filter($to_print, create_function('$var', 'return !is_array($var) && !is_object($var);'));
                     return self::outputList(array($to_print));
                 }
             }
             break;
             //Output a specified file as CSV
         //Output a specified file as CSV
         case is_string($to_print):
             if (is_readable($to_print)) {
                 $fp = fopen($to_print, 'r');
                 fpassthru($fp);
                 break;
             }
             //Output a string as CSV
         //Output a string as CSV
         default:
             return $to_print;
             break;
     }
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:75,代码来源:CsvView.obj.php

示例11: check_reverse_map

 public static function check_reverse_map($what, $value)
 {
     $map = Backend::get($what . '_maps');
     if (is_array($map)) {
         $key = array_search($value, $map);
         if ($key) {
             $value = $key;
         }
     }
     return $value;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:11,代码来源:Controller.obj.php


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