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


PHP glob_compat函数代码示例

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


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

示例1: FlysprayAuth

 function FlysprayAuth()
 {
     $plugins = glob_compat(dirname(__FILE__) . '/class.*');
     foreach ($plugins as $plugin) {
         require_once $plugin;
         $class = substr(basename($plugin), 6, -4);
         // better not include yourself ;)
         if (strcasecmp($class, get_class($this)) == 0) {
             continue;
         }
         $class = new $class();
         $this->authenticators[$class->getOrder()] = $class;
     }
     ksort($this->authenticators);
 }
开发者ID:negram,项目名称:flyspray,代码行数:15,代码来源:class.flysprayauth.php

示例2: TextFormatter

 function TextFormatter()
 {
     global $proj;
     require_once 'class.syntaxplugin.php';
     $plugins = glob_compat(dirname(__FILE__) . '/syntaxplugins/class.*');
     foreach ($plugins as $plugin) {
         require_once $plugin;
         $class = substr(basename($plugin), 6, -4);
         $this->allclasses[] = ucfirst(substr($class, 0, -6)) . 'Syntax';
         // if wanted, exclude some plugins
         if (isset($proj->prefs['syntax_plugins']) && $proj->prefs['syntax_plugins'] && strpos($proj->prefs['syntax_plugins'], stristr($proj->prefs['syntax_plugins'], $class)) === false) {
             continue;
         }
         $class = new $class();
         $this->classes[$class->getOrder()] = $class;
     }
     // needs to be seperated for templating
     foreach ($this->classes as $class) {
         $this->htmlbefore .= $class->getHtmlBefore();
         $this->htmlafter .= $class->getHtmlAfter();
     }
     ksort($this->classes);
 }
开发者ID:negram,项目名称:flyspray,代码行数:23,代码来源:class.textformatter.php

示例3: listLangs

 /**
  * Returns a list of installed languages
  * @access public static
  * @return array
  * @version 1.0
  */
 public static function listLangs()
 {
     return str_replace('.php', '', array_map('basename', glob_compat(BASEDIR . "/lang/[a-zA-Z]*.php")));
 }
开发者ID:korusdipl,项目名称:flyspray,代码行数:10,代码来源:class.flyspray.php

示例4: PopulateDb

 /**
  * Function to populate the database with the sql constructs which is in an sql file
  * @param array $data The actual database configuration values
  * @return boolean
  */
 function PopulateDb($data)
 {
     // Check available upgrade scripts, use the script of very latest  version
     $folders = glob_compat(BASEDIR . '/upgrade/[0-9]*');
     usort($folders, 'version_compare');
     // start with lowest version
     $folders = array_reverse($folders);
     // start with highest version
     $sql_file = APPLICATION_PATH . '/setup/upgrade/' . basename(reset($folders)) . '/flyspray-install.xml';
     $upgradeInfo = APPLICATION_PATH . '/setup/upgrade/' . basename(reset($folders)) . '/upgrade.info';
     $upgradeInfo = parse_ini_file($upgradeInfo, true);
     // Check if the install/upgrade file exists
     if (!is_readable($sql_file)) {
         $_SESSION['page_message'][] = "SQL file required for importing structure and data is missing ({$sql_file}).";
         return false;
     }
     // Extract the variables to local namespace
     extract($data);
     if (!isset($db_prefix)) {
         $db_prefix = '';
     }
     if (is_numeric($db_prefix)) {
         $_SESSION['page_message'][] = 'Database prefix cannot be numeric only';
         return false;
     }
     // Set the prefix for database objects ( before parsing )
     require 'MDB2/Schema.php';
     $this->mDbConnection->setOption('use_transactions', false);
     $this->mDbConnection->setOption('default_table_type', 'MyISAM');
     $this->mXmlSchema =& MDB2_Schema::factory($this->mDbConnection);
     $def = $this->mXmlSchema->parseDatabaseDefinitionFile($sql_file, array('db_prefix' => $db_prefix, 'db_name' => $data['db_name']));
     if (PEAR::isError($def)) {
         var_dump($def);
         exit;
     }
     $op = $this->mXmlSchema->createDatabase($def);
     if (PEAR::isError($op)) {
         var_dump($op);
         exit;
     }
     // global prefs update
     if (isset($upgradeInfo['fsprefs'])) {
         $existing = $this->mDbConnection->x->GetCol("SELECT pref_name FROM {$db_prefix}prefs");
         // Add what is missing
         $stmt = $this->mDbConnection->x->autoPrepare("{$db_prefix}prefs", array('pref_name', 'pref_value'));
         foreach ($upgradeInfo['fsprefs'] as $name => $value) {
             if (!in_array($name, $existing)) {
                 $stmt->execute(array($name, $value === '' ? '0' : $value));
             }
         }
         $stmt->free();
         // Delete what is too much
         $stmt = $this->mDbConnection->prepare("DELETE FROM {$db_prefix}prefs WHERE pref_name = ?");
         foreach ($existing as $name) {
             if (!isset($upgradeInfo['fsprefs'][$name])) {
                 $stmt->execute($name);
             }
         }
         $stmt->free();
     }
     $this->mDbConnection->x->execParam("UPDATE {$db_prefix}prefs SET pref_value = ? WHERE pref_name = 'fs_ver'", $this->version);
     if (PEAR::isError($op)) {
         $_SESSION['page_heading'] = 'Database Processing';
         $_SESSION['page_message'][] = $op->getMessage();
         return false;
     }
     return true;
 }
开发者ID:heptalium,项目名称:flyspray,代码行数:73,代码来源:index.php

示例5: PopulateDb

 /**
  * Function to populate the database with the sql constructs which is in an sql file
  * @param array $data The actual database configuration values
  * @return boolean
  */
 public function PopulateDb($data)
 {
     // Check available upgrade scripts, use the script of very latest  version
     $folders = glob_compat(BASEDIR . '/upgrade/[0-9]*');
     usort($folders, 'version_compare');
     // start with lowest version
     $folders = array_reverse($folders);
     // start with highest version
     $sql_file = APPLICATION_PATH . '/setup/upgrade/' . reset($folders) . '/flyspray-install.xml';
     $upgradeInfo = APPLICATION_PATH . '/setup/upgrade/' . reset($folders) . '/upgrade.info';
     $upgradeInfo = parse_ini_file($upgradeInfo, true);
     // Check if the install/upgrade file exists
     if (!is_readable($sql_file)) {
         $_SESSION['page_message'][] = 'SQL file required for importing structure and data is missing.';
         return false;
     }
     // Extract the variables to local namespace
     extract($data);
     if (!isset($db_prefix)) {
         $db_prefix = '';
     }
     if (is_numeric($db_prefix)) {
         $_SESSION['page_message'][] = 'database prefix cannot be numeric only';
         return false;
     }
     // Set the prefix for database objects ( before parsing)
     $this->mXmlSchema->setPrefix(isset($db_prefix) ? $db_prefix : '', false);
     $this->mXmlSchema->ParseSchema($sql_file);
     $this->mXmlSchema->ExecuteSchema();
     // Last but not least global prefs update
     if (isset($upgradeInfo['fsprefs'])) {
         $existing = $this->mDbConnection->GetCol("SELECT pref_name FROM {$db_prefix}prefs");
         // Add what is missing
         foreach ($upgradeInfo['fsprefs'] as $name => $value) {
             if (!in_array($name, $existing)) {
                 $this->mDbConnection->Execute("INSERT INTO {$db_prefix}prefs (pref_name, pref_value) VALUES (?, ?)", array($name, $value));
             }
         }
         // Delete what is too much
         foreach ($existing as $name) {
             if (!isset($upgradeInfo['fsprefs'][$name])) {
                 $this->mDbConnection->Execute("DELETE FROM {$db_prefix}prefs WHERE pref_name = ?", array($name));
             }
         }
     }
     $this->mDbConnection->Execute("UPDATE {$db_prefix}prefs SET pref_value = ? WHERE pref_name = 'fs_ver'", array($this->version));
     if ($error_no = $this->mDbConnection->MetaError()) {
         $_SESSION['page_heading'] = 'Database Processing';
         switch ($error_no) {
             case '-5':
                 // If there are tables with the same name
                 $_SESSION['page_message'][] = 'Table ' . $this->mDbConnection->MetaErrorMsg($this->mDbConnection->MetaError());
                 $_SESSION['page_message'][] = 'There probably are tables in the database which have the same prefix you provided.';
                 $_SESSION['page_message'][] = 'It is advised to change the prefix provided or you can drop the existing tables if you don\'t need them. Make a backup if you are not certain.';
                 return false;
                 break;
             case '-1':
                 // We are using the unknown error code(-1) because ADOdb library may not have the error defined.
                 $_SESSION['page_message'][] = $this->mDbConnection->ErrorMsg();
                 return false;
                 break;
             default:
                 $_SESSION['page_message'][] = $this->mDbConnection->ErrorMsg() . ': ' . $this->mDbConnection->ErrorNo();
                 $_SESSION['page_message'][] = 'Unknown error, please notify Developer quoting the error number';
                 return false;
                 break;
         }
     }
     return true;
 }
开发者ID:korusdipl,项目名称:flyspray,代码行数:75,代码来源:index.php

示例6: define

<?php

/*
   This is the main script that everything else is included
   in.  Mostly what it does is check the user permissions
   to see what they have access to.
*/
define('IN_FS', true);
require_once dirname(__FILE__) . '/header.php';
// Get available do-modes
$modes = str_replace('.php', '', array_map('basename', glob_compat(BASEDIR . "/scripts/*.php")));
$do = Req::enum('do', $modes, $proj->prefs['default_entry']);
if ($do == 'admin' && Req::has('switch') && Req::val('project') != '0') {
    $do = 'pm';
} elseif ($do == 'pm' && Req::has('switch') && Req::val('project') == '0') {
    $do = 'admin';
} elseif (Req::has('show') || Req::has('switch') && $do == 'details' || $do == 'newtask' && Req::val('project') == '0') {
    $do = 'index';
} elseif (Req::has('code')) {
    $_SESSION['oauth_provider'] = 'microsoft';
    $do = 'oauth';
} elseif (Req::has('do') && Req::val('do') == 'tasklist') {
    $do = 'index';
}
// supertask_id for add new sub-task
$supertask_id = 0;
if (Req::has('supertask')) {
    $supertask_id = Req::val('supertask');
}
/* permission stuff */
if (Cookie::has('flyspray_userid') && Cookie::has('flyspray_passhash')) {
开发者ID:kandran,项目名称:flyspray,代码行数:31,代码来源:index.php

示例7: Tpl

$page = new Tpl();
$page->assign('title', 'Upgrade ');
$page->assign('short_version', UPGRADE_VERSION);
if (!isset($conf['general']['syntax_plugin']) || !$conf['general']['syntax_plugin'] || $conf['general']['syntax_plugin'] == 'none') {
    $page->assign('ask_for_conversion', true);
} else {
    $page->assign('ask_for_conversion', false);
}
//cleanup
//the cache dir
@rmdirr(sprintf('%s/cache/dokuwiki', APPLICATION_PATH));
// ---------------------------------------------------------------------
// Now the hard work
// ---------------------------------------------------------------------
// Find out which upgrades need to be run
$folders = glob_compat(BASEDIR . '/upgrade/[0-9]*');
usort($folders, 'version_compare');
// start with lowest version
if (Post::val('upgrade')) {
    $uplog = array();
    $uplog[] = "Start database transaction";
    $db->dblink->StartTrans();
    fix_duplicate_list_entries(true);
    foreach ($folders as $folder) {
        if (version_compare($installed_version, $folder, '<=')) {
            $uplog[] = "Start {$installed_version} to {$folder}";
            $uplog[] = execute_upgrade_file($folder, $installed_version);
            $installed_version = $folder;
            $uplog[] = "End {$installed_version} to {$folder}";
        }
    }
开发者ID:canneverbe,项目名称:flyspray,代码行数:31,代码来源:upgrade.php


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