本文整理匯總了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')));
}