本文整理汇总了PHP中Includes\Utils\FileManager::replace方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::replace方法的具体用法?PHP FileManager::replace怎么用?PHP FileManager::replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Includes\Utils\FileManager
的用法示例。
在下文中一共展示了FileManager::replace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enableModule
/**
* Set module enabled flag fo "false"
*
* @param string $key Module actual name (key)
*
* @return boolean
*/
public static function enableModule($key)
{
$installed = static::getModulesList();
if (!isset(static::$activeModules[$key]) && isset($installed[$key]) && !static::callModuleMethod($key, 'isSystem')) {
// Short names
$data = $installed[$key];
$path = static::getModulesFilePath();
// Check if "xlite_modules" table exists
if (\Includes\Utils\FileManager::isFileReadable($path)) {
// Set flag in .ini-file
$pattern = '/(\\[' . $data['author'] . '\\][^\\[]+\\s*' . $data['name'] . '\\s*=)\\s*\\S+/Ss';
\Includes\Utils\FileManager::replace($path, '$1 1', $pattern);
} else {
// Set flag in DB.
// This operation is highly NOT recommended in the usual workflow!
// All info for this module must be stored before that!
$query = 'UPDATE ' . static::getTableName() . ' SET enabled = ? WHERE moduleID = ?';
\Includes\Utils\Database::execute($query, array(1, $data['moduleID']));
}
// Move the registry entry info into ENABLED registry to prevent LOST information
static::moveModuleToEnabledRegistry($data['author'] . '\\' . $data['name']);
// add to local cache
static::$activeModules[$key] = $data;
}
}
示例2: correctTagsOnElement
/**
* Correct (if needed) class doc block comment. Works for one element from the queue
*
* @param \Includes\Decorator\DataStructure\Graph\Classes $node Current node
*
* @return void
*/
protected function correctTagsOnElement(\Includes\Decorator\DataStructure\Graph\Classes $node)
{
\Includes\Utils\FileManager::replace(\Includes\Decorator\ADecorator::getCacheClassesDir() . $node->getPath(), '@$1 ' . $this->getRepositoryCustomClassParameter($node), \Includes\Decorator\Utils\Operator::getTagPattern(array('Entity', 'MappedSuperClass')));
}