本文整理汇总了PHP中QString::LongestCommonSubsequence方法的典型用法代码示例。如果您正苦于以下问题:PHP QString::LongestCommonSubsequence方法的具体用法?PHP QString::LongestCommonSubsequence怎么用?PHP QString::LongestCommonSubsequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QString
的用法示例。
在下文中一共展示了QString::LongestCommonSubsequence方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Validate
/**
* @return array an array of QInstallationValidationResult objects
* If no errors were found, the array is empty.
*/
public static function Validate()
{
$result = array();
if (ini_get('safe_mode')) {
$obj = new QInstallationValidationResult();
$obj->strMessage = "Safe Mode is deprecated in PHP 5.3+ and is removed in PHP 6.0+." . "Please disable this setting in php.ini";
$result[] = $obj;
}
if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) {
$obj = new QInstallationValidationResult();
$obj->strMessage = "magic_quotes_gpc and magic_quotes_runtime " . "need to be disabled\r\n";
$result[] = $obj;
}
$docrootOnlyPath = __DOCROOT__;
$docrootWithSubdirPath = __DOCROOT__ . __DEVTOOLS_ASSETS__ . substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/"));
$commonSubsequence = QString::LongestCommonSubsequence($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_FILENAME']);
$root = substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - strlen($commonSubsequence));
$part1 = substr($_SERVER['PHP_SELF'], 1, strpos($_SERVER['PHP_SELF'], "/", 1) - 1);
$part2 = substr($root, strrpos($root, "/") + 1);
$virtualDir = substr($_SERVER['PHP_SELF'], 0, 0 - strlen($commonSubsequence));
// Debugging stuff - there until this code stabilizes across multiple platforms.
/*
print("DOCROOT = " . __DOCROOT__ . "<br>");
print("SUBDIR = " . __SUBDIRECTORY__ . "<br>");
print("DEVTOOLS = " . __DEVTOOLS_ASSETS__ . "<br>");
print("PHP_SELF = " . $_SERVER['PHP_SELF'] . "<br>");
print("SCRIPT_FILENAME = " . $_SERVER['SCRIPT_FILENAME'] . "<br>");
print("commonSubsequence = " . $commonSubsequence . "<br>");
print("root = " . $root . "<br>");
print("rootWithSubdirPath = " . $docrootWithSubdirPath . "<br>");
print("part1 = " . $part1 . "<br>");
print("part2 = " . $part2 . "<br>");
print("virtualDir = " . $virtualDir . "<br>");
//*/
if (!is_dir($docrootOnlyPath)) {
$obj = new QInstallationValidationResult();
$obj->strMessage = 'Set the __DOCROOT__ constant in ' . '/includes/configuration/configuration.inc.php. ' . 'Most likely value: "' . $root . '"';
$result[] = $obj;
} else {
if (strlen(__VIRTUAL_DIRECTORY__) == 0 && !file_exists(__DOCROOT__ . $_SERVER['PHP_SELF'])) {
$obj = new QInstallationValidationResult();
$obj->strMessage = 'Set the __DOCROOT__ constant in ' . '/includes/configuration/configuration.inc.php. ' . 'Most likely value: "' . $root . '"';
$result[] = $obj;
}
}
if (!file_exists($docrootWithSubdirPath)) {
$obj = new QInstallationValidationResult();
$obj->strMessage = 'Set the __SUBDIRECTORY__ constant in ' . '/includes/configuration/configuration.inc.php. ' . 'Most likely value: "/' . $part1 . '"';
$result[] = $obj;
// At this point, we cannot proceed with any more checks - basic config
// is not set up. Just exit.
return $result;
}
if (!file_exists(__INCLUDES__)) {
// Did the user move the __INCLUDES__ directory out of the docroot?
$obj = new QInstallationValidationResult();
$obj->strMessage = 'Set the __INCLUDES__ constant in ' . 'includes/configuration/configuration.inc.php. ';
$result[] = $obj;
// At this point, we cannot proceed with any more checks - basic config
// is not set up. Just exit.
return $result;
}
// Check for trailing slashes
self::checkTrailingSlash("__DOCROOT__", $result);
self::checkTrailingSlash("__SUBDIRECTORY__", $result);
self::checkTrailingSlash("__VIRTUAL_DIRECTORY__", $result);
if (strcmp($commonSubsequence, $_SERVER['PHP_SELF']) != 0 && strlen(__VIRTUAL_DIRECTORY__) == 0) {
$obj = new QInstallationValidationResult();
$obj->strMessage = 'Set the __VIRTUAL_DIRECTORY__ constant in ' . 'includes/configuration/configuration.inc.php. Most likely value: "' . $virtualDir . '"';
$result[] = $obj;
}
// Now that we know that the basic config is correct, we can actually
// initialize the full QCubed framework.
require __CONFIGURATION__ . '/prepend.inc.php';
/*
if (!QFolder::isWritable(QPluginInstaller::PLUGIN_EXTRACTION_DIR)) {
$obj = new QInstallationValidationResult();
$obj->strMessage = "Plugin temporary extraction directory (" .
QPluginInstaller::PLUGIN_EXTRACTION_DIR . ") needs to be writable";
$obj->strCommandToFix = "chmod 777 " . QPluginInstaller::PLUGIN_EXTRACTION_DIR;
$result[] = $obj;
}
// Checks to make sure that everything about plugins is allright
if (!QFile::isWritable(QPluginInstaller::getMasterConfigFilePath())) {
$obj = new QInstallationValidationResult();
$obj->strMessage = "Plugin master configuration file (" .
QPluginInstaller::getMasterConfigFilePath() . ") needs to be writable";
$obj->strCommandToFix = "chmod 777 " . QPluginInstaller::getMasterConfigFilePath();
$result[] = $obj;
}
if (!QFile::isWritable(QPluginInstaller::getMasterExamplesFilePath())) {
$obj = new QInstallationValidationResult();
//.........这里部分代码省略.........
示例2: lcsCheckValueHelper
private function lcsCheckValueHelper($str1, $str2, $strExpectedResult)
{
$strResult = QString::LongestCommonSubsequence($str1, $str2);
$this->assertEquals($strExpectedResult, $strResult, "Longest common subsequence of '" . $str1 . "' and '" . $str2 . "' is '" . $strResult . "'");
}
示例3: Validate
/**
* @return array an array of QInstallationValidationResult objects
* If no errors were found, the array is empty.
*/
public static function Validate()
{
$result = array();
if (ini_get('safe_mode')) {
$obj = new QInstallationValidationResult();
$obj->strMessage = "Safe Mode is deprecated in PHP 5.3+ and is removed in PHP 6.0+." . "Please disable this setting in php.ini";
$result[] = $obj;
}
if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) {
$obj = new QInstallationValidationResult();
$obj->strMessage = "magic_quotes_gpc and magic_quotes_runtime " . "need to be disabled\r\n";
$result[] = $obj;
}
$docrootOnlyPath = __DOCROOT__;
$docrootWithSubdirPath = __DOCROOT__ . __DEVTOOLS__ . substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/"));
$commonSubsequence = QString::LongestCommonSubsequence($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_FILENAME']);
$root = substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - strlen($commonSubsequence));
$part1 = substr($_SERVER['PHP_SELF'], 1, strpos($_SERVER['PHP_SELF'], "/", 1) - 1);
$part2 = substr($root, strrpos($root, "/") + 1);
$virtualDir = substr($_SERVER['PHP_SELF'], 0, 0 - strlen($commonSubsequence));
// Debugging stuff - there until this code stabilizes across multiple platforms.
/*
print("DOCROOT = " . __DOCROOT__ . "<br>");
print("SUBDIR = " . __SUBDIRECTORY__ . "<br>");
print("DEVTOOLS = " . __DEVTOOLS__ . "<br>");
print("PHP_SELF = " . $_SERVER['PHP_SELF'] . "<br>");
print("SCRIPT_FILENAME = " . $_SERVER['SCRIPT_FILENAME'] . "<br>");
print("commonSubsequence = " . $commonSubsequence . "<br>");
print("root = " . $root . "<br>");
print("rootWithSubdirPath = " . $docrootWithSubdirPath . "<br>");
print("part1 = " . $part1 . "<br>");
print("part2 = " . $part2 . "<br>");
print("virtualDir = " . $virtualDir . "<br>");
//*/
if (!is_dir($docrootOnlyPath)) {
$obj = new QInstallationValidationResult();
$obj->strMessage = 'Set the __DOCROOT__ constant in ' . '/includes/configuration/configuration.inc.php. ' . 'Most likely value: "' . $root . '"';
$result[] = $obj;
} else {
if (strlen(__VIRTUAL_DIRECTORY__) == 0 && !file_exists(__DOCROOT__ . $_SERVER['PHP_SELF'])) {
$obj = new QInstallationValidationResult();
$obj->strMessage = 'Set the __DOCROOT__ constant in ' . '/includes/configuration/configuration.inc.php. ' . 'Most likely value: "' . $root . '"';
$result[] = $obj;
}
}
if (!file_exists($docrootWithSubdirPath)) {
$obj = new QInstallationValidationResult();
$obj->strMessage = 'Set the __SUBDIRECTORY__ constant in ' . '/includes/configuration/configuration.inc.php. ' . 'Most likely value: "/' . $part1 . '"';
$result[] = $obj;
// At this point, we cannot proceed with any more checks - basic config
// is not set up. Just exit.
return $result;
}
if (!file_exists(__INCLUDES__)) {
// Did the user move the __INCLUDES__ directory out of the docroot?
$obj = new QInstallationValidationResult();
$obj->strMessage = 'Set the __INCLUDES__ constant in ' . 'includes/configuration/configuration.inc.php. ';
$result[] = $obj;
// At this point, we cannot proceed with any more checks - basic config
// is not set up. Just exit.
return $result;
}
// Check for trailing slashes
self::checkTrailingSlash("__DOCROOT__", $result);
self::checkTrailingSlash("__SUBDIRECTORY__", $result);
self::checkTrailingSlash("__VIRTUAL_DIRECTORY__", $result);
if (strcmp($commonSubsequence, $_SERVER['PHP_SELF']) != 0 && strlen(__VIRTUAL_DIRECTORY__) == 0) {
$obj = new QInstallationValidationResult();
$obj->strMessage = 'Set the __VIRTUAL_DIRECTORY__ constant in ' . 'includes/configuration/configuration.inc.php. Most likely value: "' . $virtualDir . '"';
$result[] = $obj;
}
// Now that we know that the basic config is correct, we can actually
// initialize the full QCubed framework.
require __CONFIGURATION__ . '/prepend.inc.php';
if (!QFolder::isWritable(__INCLUDES__ . QPluginInstaller::PLUGIN_EXTRACTION_DIR)) {
$obj = new QInstallationValidationResult();
$obj->strMessage = "Plugin temporary extraction directory (" . __INCLUDES__ . QPluginInstaller::PLUGIN_EXTRACTION_DIR . ") needs to be writable";
$obj->strCommandToFix = "chmod 777 " . __INCLUDES__ . QPluginInstaller::PLUGIN_EXTRACTION_DIR;
$result[] = $obj;
}
// Checks to make sure that everything about plugins is allright
if (!QFile::isWritable(QPluginInstaller::getMasterConfigFilePath())) {
$obj = new QInstallationValidationResult();
$obj->strMessage = "Plugin master configuration file (" . QPluginInstaller::getMasterConfigFilePath() . ") needs to be writable";
$obj->strCommandToFix = "chmod 777 " . QPluginInstaller::getMasterConfigFilePath();
$result[] = $obj;
}
if (!QFile::isWritable(QPluginInstaller::getMasterExamplesFilePath())) {
$obj = new QInstallationValidationResult();
$obj->strMessage = "Plugin example configuration file (" . QPluginInstaller::getMasterExamplesFilePath() . ") needs to be writable";
$obj->strCommandToFix = "chmod 777 " . QPluginInstaller::getMasterExamplesFilePath();
$result[] = $obj;
}
if (!QFile::isWritable(QPluginInstaller::getMasterIncludeFilePath())) {
//.........这里部分代码省略.........