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


PHP Index::instance方法代码示例

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


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

示例1: __call

 public function __call($method, $arguments)
 {
     if ($method === 'index' || array_key_exists($method, Column::$TYPES)) {
         if (count($arguments) <= 0) {
             throw new MissingArgumentException($method, __CLASS__);
         }
         $column = $arguments[0];
         $options = !empty($arguments[1]) ? $arguments[1] : array();
         if ($method === 'index') {
             if (!is_array($column)) {
                 $column = array($column);
             }
             $this->indexes = array_merge($this->indexes, array(array('name' => Index::instance()->getName($column, $options), 'keys' => '`' . implode('`,`', $column) . '`')));
         } else {
             $options['id'] = $column;
             $options['type'] = $method;
             $this->columns = array_merge($this->columns, array(Column::instance()->parseToDatabase($options)));
         }
     } else {
         if ($method === 'timestamps') {
             $this->columns = array_merge($this->columns, array(Column::instance()->parseToDatabase(array('id' => 'created_at', 'type' => 'datetime'))));
             $this->columns = array_merge($this->columns, array(Column::instance()->parseToDatabase(array('id' => 'updated_at', 'type' => 'datetime'))));
         } else {
             throw new UndefinedMethodException($method, __CLASS__);
         }
     }
 }
开发者ID:nanjingboy,项目名称:clown,代码行数:27,代码来源:Table.php

示例2: trigger

 /**
  * Is used as error handler
  *
  * @param int			$level	Error level
  * @param null|string	$string	Error message
  */
 function trigger($level, $string = null)
 {
     if (!$this->error) {
         return;
     }
     $string = xap($string);
     $dump = 'null';
     $debug_backtrace = debug_backtrace();
     if (isset($debug_backtrace[0]['file'], $debug_backtrace[0]['file'])) {
         $file = $debug_backtrace[0]['file'];
         $line = $debug_backtrace[0]['line'];
     } else {
         $file = $debug_backtrace[1]['file'];
         $line = $debug_backtrace[1]['line'];
     }
     if (DEBUG) {
         $dump = _json_encode($debug_backtrace);
     }
     unset($debug_backtrace);
     $log_file = LOGS . '/' . date('d-m-Y') . '_' . strtr(date_default_timezone_get(), '/', '_');
     $time = date('d-m-Y h:i:s') . ' [' . microtime(true) . ']';
     switch ($level) {
         case E_USER_ERROR:
         case E_ERROR:
             ++$this->num;
             file_put_contents($log_file, "E {$time} {$string} Occurred: {$file}:{$line} Dump: {$dump}\n", LOCK_EX | FILE_APPEND);
             unset($dump);
             $this->errors_list[] = "E {$time} {$string} Occurred: {$file}:{$line}";
             error_code(500);
             /**
              * If Index instance exists - execution will be stopped there, otherwise in Page instance
              */
             Index::instance(true)->__finish();
             Page::instance()->error();
             break;
         case E_USER_WARNING:
         case E_WARNING:
             ++$this->num;
             file_put_contents($log_file, "W {$time} {$string} Occurred: {$file}:{$line} Dump: {$dump}\n", LOCK_EX | FILE_APPEND);
             unset($dump);
             $this->errors_list[] = "W {$time} {$string} Occurred: {$file}:{$line}";
             break;
         default:
             file_put_contents($log_file, "N {$time} {$string} Occurred: {$file}:{$line} Dump: {$dump}\n", LOCK_EX | FILE_APPEND);
             unset($dump);
             $this->errors_list[] = "N {$time} {$string} Occurred: {$file}:{$line}";
             break;
     }
     /**
      * If too many non-critical errors - also stop execution
      */
     if ($this->num >= 100) {
         /**
          * If Index instance exists - execution will be stopped there, otherwise in Page instance
          */
         Index::instance(true)->__finish();
         Page::instance()->error();
     }
 }
开发者ID:hypnomez,项目名称:opir.org,代码行数:65,代码来源:Error.php

示例3: foreach

<?php

/**
 * @package		CleverStyle CMS
 * @subpackage	System module
 * @category	modules
 * @author		Nazar Mokrynskyi <nazar@mokrynskyi.com>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs;

if (!isset($_POST['mode'])) {
    return;
}
$Index = Index::instance();
$Config = Config::instance();
$update = false;
if ($_POST['mode'] == 'add') {
    foreach ($_POST['db'] as $item => $value) {
        $_POST['db'][$item] = $value;
    }
    unset($item, $value);
    $_POST['db']['mirrors'] = [];
    if ($_POST['db']['mirror'] == -1) {
        $Config->db[] = $_POST['db'];
    } else {
        $Config->db[$_POST['db']['mirror']]['mirrors'][] = $_POST['db'];
    }
    $update = true;
} elseif ($_POST['mode'] == 'edit') {
开发者ID:hypnomez,项目名称:opir.org,代码行数:31,代码来源:save.databases.php

示例4:

 *  ['name'	=> <i>module_name</i>]<br>
 *
 *  admin/System/components/modules/storage/process<br>
 *  ['name'	=> <i>module_name</i>]
 */
namespace cs;

$Cache = Cache::instance();
$Config = Config::instance();
$Core = Core::instance();
$db = DB::instance();
$L = Language::instance();
$Page = Page::instance();
$User = User::instance();
$Permission = Permission::instance();
$a = Index::instance();
if (isset($_POST['update_modules_list'])) {
    /**
     * List of currently presented modules in file system
     */
    $modules_list = array_fill_keys($new_modules = get_files_list(MODULES, false, 'd'), ['active' => -1, 'db' => [], 'storage' => []]);
    /**
     * Already known modules
     */
    $modules =& $Config->components['modules'];
    $old_modules = array_keys($modules);
    /**
     * Deletion of undefined modules permissions
     */
    if ($new_modules != $old_modules) {
        $permissions_ids = [];
开发者ID:hypnomez,项目名称:opir.org,代码行数:31,代码来源:save.modules.php

示例5:

<?php

/**
 * @package		OAuth2
 * @category	modules
 * @author		Nazar Mokrynskyi <nazar@mokrynskyi.com>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs;

Index::instance()->main_sub_menu_auto = true;
开发者ID:hypnomez,项目名称:opir.org,代码行数:12,代码来源:prepare.php

示例6: switch

<?php

/**
 * @package		HybridAuth
 * @category	modules
 * @author		HybridAuth authors
 * @author		Nazar Mokrynskyi <nazar@mokrynskyi.com> (integration with CleverStyle CMS)
 * @copyright	HybridAuth authors
 * @license		MIT License, see license.txt
 */
namespace cs;

if (!isset($_POST['edit_settings'])) {
    return;
}
switch ($_POST['edit_settings']) {
    case 'save':
        Index::instance()->save(Config::instance()->module('HybridAuth')->set(['providers' => $_POST['providers'], 'enable_contacts_detection' => $_POST['enable_contacts_detection']]));
        break;
}
开发者ID:hypnomez,项目名称:opir.org,代码行数:20,代码来源:save.php

示例7:

<?php

/**
 * @package		CleverStyle CMS
 * @subpackage	System module
 * @category	modules
 * @author		Nazar Mokrynskyi <nazar@mokrynskyi.com>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs;

Index::instance()->stop = !User::instance()->admin();
开发者ID:hypnomez,项目名称:opir.org,代码行数:13,代码来源:admin.php

示例8: _include_once

<?php

/**
 * @package		CleverStyle CMS
 * @subpackage	System module
 * @category	modules
 * @author		Nazar Mokrynskyi <nazar@mokrynskyi.com>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs;

_include_once(MFOLDER . '/' . Index::instance()->savefile . '.php', false);
开发者ID:hypnomez,项目名称:opir.org,代码行数:13,代码来源:save.security.php

示例9: foreach

 * @license		MIT License, see license.txt
 */
namespace cs;

if (!isset($_POST['mode'])) {
    return;
}
$Config = Config::instance();
$update = false;
if ($_POST['mode'] == 'add') {
    foreach ($_POST['storage'] as $item => $value) {
        $_POST['storage'][$item] = $value;
    }
    $Config->storage[] = $_POST['storage'];
    unset($item, $value);
    $update = true;
} elseif ($_POST['mode'] == 'edit' && $_POST['storage_id'] > 0) {
    $cstorage =& $Config->storage[$_POST['storage_id']];
    foreach ($_POST['storage'] as $item => $value) {
        $cstorage[$item] = $value;
    }
    unset($cstorage, $item, $value);
    $update = true;
} elseif ($_POST['mode'] == 'delete' && isset($_POST['storage']) && $_POST['storage'] > 0) {
    unset($Config->storage[$_POST['storage']]);
    $update = true;
}
if ($update) {
    Index::instance()->save();
}
unset($update);
开发者ID:hypnomez,项目名称:opir.org,代码行数:31,代码来源:save.storages.php

示例10: file_get_json

<?php

/**
 * @package        Download
 * @category       modules
 * @author         Nazar Mokrynskyi <nazar@mokrynskyi.com>
 * @copyright      Copyright (c) 2014, Nazar Mokrynskyi
 * @license        MIT License, see license.txt
 */
namespace cs;

if (!file_exists(DIR . '/downloads')) {
    $downloads = 0;
} else {
    $downloads = file_get_json(DIR . '/downloads');
}
$downloads++;
file_put_json(DIR . '/downloads', $downloads);
header('Location: https://opir.org/storage/public/opir.org.apk', true, 301);
interface_off();
Index::instance()->stop = true;
开发者ID:hypnomez,项目名称:opir.org,代码行数:21,代码来源:index.php

示例11: path

<?php

/**
 * @package		CleverStyle CMS
 * @subpackage	System module
 * @category	modules
 * @author		Nazar Mokrynskyi <nazar@mokrynskyi.com>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs;

$L = Language::instance();
Index::instance()->title_auto = false;
$rc =& Config::instance()->route;
if (!isset($rc[0])) {
    return;
}
switch ($rc[0]) {
    case path($L->profile):
        $rc[0] = 'profile';
}
if (!isset($rc[1])) {
    return;
}
switch ($rc[1]) {
    case path($L->settings):
        $rc[1] = 'settings';
}
if (!isset($rc[2])) {
    return;
开发者ID:hypnomez,项目名称:opir.org,代码行数:31,代码来源:prepare.php


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