本文整理汇总了PHP中QString类的典型用法代码示例。如果您正苦于以下问题:PHP QString类的具体用法?PHP QString怎么用?PHP QString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test_clear
function test_clear()
{
$s1 = new QString("hello");
$s1->clear();
$this->assertEquals($s1->__toString(), "", "Could not clear()!");
echo "\ntesting QString::clear() passed";
}
开发者ID:Shadrackn,项目名称:php-qt,代码行数:7,代码来源:QStringTestCase.php
示例2: SanitizeForToken
/**
* Given a string, this will create a sanitized token for it
* @param string $strTokenCandidate
* @return string
*/
public static function SanitizeForToken($strTokenCandidate)
{
$strTokenCandidate = trim(strtolower($strTokenCandidate));
$intLength = strlen($strTokenCandidate);
$strToReturn = '';
for ($intChar = 0; $intChar < $intLength; $intChar++) {
$strChar = $strTokenCandidate[$intChar];
$intOrd = ord($strChar);
if ($intOrd >= ord('a') && $intOrd <= ord('z')) {
$strToReturn .= $strChar;
} else {
if ($intOrd >= ord('0') && $intOrd <= ord('9')) {
$strToReturn .= $strChar;
} else {
if ($strChar == ' ' || $strChar == '.' || $strChar == ':' || $strChar == '-' || $strChar == '/' || $strChar == '(' || $strChar == ')' || $strChar == '_') {
$strToReturn .= '_';
}
}
}
}
// Cleanup leading and trailing underscores
while (QString::FirstCharacter($strToReturn) == '_') {
$strToReturn = substr($strToReturn, 1);
}
while (QString::LastCharacter($strToReturn) == '_') {
$strToReturn = substr($strToReturn, 0, strlen($strToReturn) - 1);
}
// Cleanup Dupe Underscores
while (strpos($strToReturn, '__') !== false) {
$strToReturn = str_replace('__', '_', $strToReturn);
}
return $strToReturn;
}
开发者ID:klucznik,项目名称:qcodo-website,代码行数:38,代码来源:Package.class.php
示例3: DisplayAsHtml
public static function DisplayAsHtml($strContent)
{
// Let's get started
$strResult = null;
// Normalize all linebreaks and tabs
$strContent = str_replace("\r\n", "\n", $strContent);
$strContent = str_replace("\t", " ", $strContent);
while ($strContent) {
// See if we are declaring a special block
$strMatches = array();
// Any Blank Lines get processed as such
if (QString::FirstCharacter($strContent) == "\n") {
$strContent = substr($strContent, 1);
$strResult .= "<br/>\n";
// Any Blocks matched by the PatternBlock regexp should be processed as a block
} else {
if (preg_match(self::PatternBlock, $strContent, $strMatches) && count($strMatches) >= 3 && ($strProcessorResult = QTextStyleBlock::Process($strMatches, $strContent)) !== false) {
$strResult .= $strProcessorResult;
// Any ListBlocks matched by the PatternListBlock regexp should be processed as a listblock (uses the same QTSBP::Process method)
} else {
if (preg_match(self::PatternListBlock, $strContent, $strMatches) && count($strMatches) >= 3 && ($strProcessorResult = QTextStyleBlock::Process($strMatches, $strContent)) !== false) {
$strResult .= $strProcessorResult;
// Finally, anything that doesn't match any of the above will be processed as "Default"
} else {
$strContent = QTextStyle::KeyDefault . '. ' . $strContent;
}
}
}
}
// Return the resulting HTML
return $strResult;
}
开发者ID:qcodo,项目名称:qcodo-website,代码行数:32,代码来源:QTextStyle.class.php
示例4: setupUi
public function setupUi($Dialog)
{
if ($Dialog->objectName()->isEmpty()) {
$Dialog->setObjectName(QString::fromUtf8("Dialog"));
}
$size = new QSize(394, 311);
$size = $size->expandedTo($Dialog->minimumSizeHint());
$Dialog->resize($size);
$this->buttonBox = new QDialogButtonBox($Dialog);
$buttonBox = $this->buttonBox;
// scope
$buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
$buttonBox->setGeometry(new QRect(40, 270, 341, 32));
$buttonBox->setOrientation(Qt::Horizontal);
$buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::NoButton | QDialogButtonBox::Ok);
$this->textBrowser = new QTextBrowser($Dialog);
$textBrowser = $this->textBrowser;
// scope
$textBrowser->setObjectName(QString::fromUtf8("textBrowser"));
$textBrowser->setGeometry(new QRect(10, 10, 371, 211));
$this->lineEdit = new QLineEdit($Dialog);
$lineEdit = $this->lineEdit;
// scope
$lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
$lineEdit->setGeometry(new QRect(10, 230, 371, 25));
$this->retranslateUi($Dialog);
QObject::connect($buttonBox, SIGNAL('accepted()'), $Dialog, SLOT('accept()'));
QObject::connect($buttonBox, SIGNAL('rejected()'), $Dialog, SLOT('reject()'));
QMetaObject::connectSlotsByName($Dialog);
}
开发者ID:0xd34df00d,项目名称:Qross,代码行数:30,代码来源:ui_designer.php
示例5: Validate
public function Validate()
{
if (parent::Validate()) {
if (trim($this->strText) != "") {
$this->strText = trim($this->strText);
$strOriginal = $this->strText;
$strFinal = '';
while (strlen($strOriginal)) {
if (is_numeric(QString::FirstCharacter($strOriginal))) {
$strFinal .= QString::FirstCharacter($strOriginal);
}
if (strtolower(QString::FirstCharacter($strOriginal)) == 'x') {
$strFinal .= 'x';
}
$strOriginal = substr($strOriginal, 1);
}
if (strlen($strFinal) == 10 && strpos($strFinal, 'x') === false) {
$this->strText = substr($strFinal, 0, 3) . '-' . substr($strFinal, 3, 3) . '-' . substr($strFinal, 6);
$this->strValidationError = null;
return true;
}
if (strlen($strFinal) > 11 && strpos($strFinal, 'x') == 10 && strpos($strFinal, 'x', 11) === false && strlen($strFinal) <= 17) {
$this->strText = substr($strFinal, 0, 3) . '-' . substr($strFinal, 3, 3) . '-' . substr($strFinal, 6, 4) . ' ' . substr($strFinal, 10);
$this->strValidationError = null;
return true;
}
$this->strValidationError = 'For example "213-555-1212" or "213-555-1212 x123"';
return false;
}
} else {
return false;
}
$this->strValidationError = null;
return true;
}
开发者ID:alcf,项目名称:chms,代码行数:35,代码来源:PhoneTextBox.class.php
示例6: GetControlHtml
/**
* Get the HTML for this Control.
* @return string
*/
public function GetControlHtml()
{
// Pull any Attributes
$strAttributes = $this->GetAttributes();
// Pull any styles
if ($strStyle = $this->GetStyleAttributes()) {
$strStyle = 'style="' . $strStyle . '"';
}
// Return the HTML
$strHtml = null;
if (!$this->strFilePath) {
$strHtml .= sprintf('<input type="button" class="button" id="%s_button" value="Browse"/>', $this->strControlId);
$strHtml .= sprintf('<span id="%s_ospan"><iframe id="%s_iframe" scrolling="no" style="display: none;"></iframe></span>', $this->strControlId, $this->strControlId);
$strHtml .= sprintf('<div class="progress" id="%s_progress" style="display: none;">', $this->strControlId);
$strHtml .= sprintf('<div class="size" id="%s_size">n/a</div>', $this->strControlId);
$strHtml .= '<div class="bar">';
$strHtml .= sprintf('<div class="status" id="%s_status">Uploading...</div>', $this->strControlId);
$strHtml .= sprintf('<div class="fill" id="%s_fill"></div>', $this->strControlId);
$strHtml .= '</div>';
$strHtml .= '<div class="cancel"><a href="#">Cancel</a></div>';
$strHtml .= '</div>';
} else {
$strHtml .= sprintf('<strong>%s</strong> (%s) <a href="#" %s>Remove</a>', $this->strFileName, QString::GetByteSize($this->intFileSize), $this->pxyRemoveFile->RenderAsEvents(null, false));
}
return sprintf('<div id="%s" %s%s>%s</div>', $this->strControlId, $strAttributes, $strStyle, $strHtml);
}
开发者ID:sigeal,项目名称:qcodo,代码行数:30,代码来源:QFileUploader.class.php
示例7: btnFirstSubmit_Click
protected function btnFirstSubmit_Click($strFormId, $strControlId, $strParameter)
{
if ($objPublicLogin = PublicLogin::LoadByUsername(trim(strtolower($this->txtUsername->Text)))) {
} else {
$this->txtUsername->Warning = 'Username does not exist';
$this->txtUsername->Blink();
$this->txtUsername->Focus();
return;
}
$this->txtUsername->Visible = false;
$this->btnFirstSubmit->Visible = false;
$this->lblFirstMessage->Visible = true;
$this->lblFirstMessage->HtmlEntities = false;
$this->lblFirstMessage->Text = '<p>Before we can proceed, please answer the following security question that you specified when you registered for <strong>my.alcf</strong>.</p>';
$this->lblQuestion->Visible = true;
$this->lblQuestion->Name = 'Security Question';
$this->lblQuestion->Text = $objPublicLogin->LostPasswordQuestion;
if (QString::LastCharacter($objPublicLogin->LostPasswordQuestion) != '?') {
$this->lblQuestion->Text .= '?';
}
$this->txtAnswer->Visible = true;
$this->txtAnswer->Name = 'Your Answer';
$this->txtAnswer->Required = true;
$this->txtAnswer->CausesValidation = $this->txtAnswer;
$this->txtAnswer->Focus();
$this->btnFinalSubmit->Visible = true;
$this->btnFinalSubmit->Text = 'Reset My Password';
$this->btnFinalSubmit->CausesValidation = $this->txtAnswer;
$this->txtAnswer->AddAction(new QEnterKeyEvent(), new QAjaxAction('btnFinalSubmit_Click'));
$this->txtAnswer->AddAction(new QEnterKeyEvent(), new QTerminateAction());
$this->btnFinalSubmit->AddAction(new QClickEvent(), new QAjaxAction('btnFinalSubmit_Click'));
$this->objPublicLogin = $objPublicLogin;
}
开发者ID:alcf,项目名称:chms,代码行数:33,代码来源:forgot_password.php
示例8: StripDollar
public static function StripDollar($strText)
{
if (QString::FirstCharacter($strText) == '$') {
return substr($strText, 1);
} else {
return $strText;
}
}
开发者ID:qcodo,项目名称:qcodo-api,代码行数:8,代码来源:QBuildMaker.class.php
示例9: UnderscoreFromCamelCase
public static function UnderscoreFromCamelCase($strName)
{
if (strlen($strName) == 0) {
return '';
}
$strToReturn = QString::FirstCharacter($strName);
for ($intIndex = 1; $intIndex < strlen($strName); $intIndex++) {
$strChar = substr($strName, $intIndex, 1);
if (strtoupper($strChar) == $strChar) {
$strToReturn .= '_' . $strChar;
} else {
$strToReturn .= $strChar;
}
}
return strtolower($strToReturn);
}
开发者ID:heshuai64,项目名称:einv2,代码行数:16,代码来源:QConvertNotationBase.class.php
示例10: Render
public function Render($blnPrint = true, $blnRenderAsAjax = false)
{
//Render Actions first if applicable
$strRendered = parent::Render();
if (!$blnRenderAsAjax) {
$strText = $this->strText;
} else {
$strText = QString::XmlEscape(trim($this->strText));
}
$strRendered .= sprintf("<a id='%s' name='%s' %s>%s</a>", $this->strControlId, $this->strControlId, $this->GetAttrString(), $strText);
if ($blnPrint) {
_p($strRendered, false);
} else {
return $strRendered;
}
}
开发者ID:schematical,项目名称:MJax2.0,代码行数:16,代码来源:MJaxLinkButton.class.php
示例11: Render
public function Render($blnPrint = true, $blnRenderAsAjax = false)
{
if ($blnRenderAsAjax) {
$strElementOverride = 'control';
$this->Attr('transition', $this->strTransition);
} else {
$strElementOverride = 'div';
}
$strRendered = parent::Render();
$strHeader = sprintf("<%s id='%s' name='%s' %s>\n", $strElementOverride, $this->strControlId, $this->strControlId, $this->GetAttrString());
//If template is set render template
if (!is_null($this->strTemplate)) {
if (!file_exists($this->strTemplate)) {
throw new QCallerException("Template file (" . $this->strTemplate . ") does not exist");
}
global $_CONTROL;
$objPrevControl = $_CONTROL;
$_CONTROL = $this;
$_FORM = $this->objForm;
$strRendered .= $this->objForm->EvaluateTemplate($this->strTemplate);
$_CONTROL = $objPrevControl;
}
//Render Text
$strRendered .= $this->strText;
//Check/Do autorender children
if ($this->blnAutoRenderChildren) {
foreach ($this->arrChildControls as $objChildControl) {
$strRendered .= $objChildControl->Render(false);
}
}
$strFooter = sprintf("</%s>", $strElementOverride);
if (!$blnRenderAsAjax) {
$strRendered = $strHeader . $strRendered . $strFooter;
} else {
$strRendered = $strHeader . QString::XmlEscape(trim($strRendered)) . $strFooter;
}
$this->blnModified = false;
if ($blnPrint) {
_p($strRendered, false);
} else {
return $strRendered;
}
}
开发者ID:schematical,项目名称:MJax2.0,代码行数:43,代码来源:MJaxPanel.class.php
示例12: __construct
public function __construct()
{
parent::__construct();
$this->layout = new QVBoxLayout($this);
// Load the test xml
$unicodeXml = new DOMDocument();
$unicodeXml->load("unicode.xml");
$xpath = new DOMXPath($unicodeXml);
$dataNodes = $xpath->query("/test/data");
// Loop on all data node and create buttons
foreach ($dataNodes as $data) {
$this->buttons[] = new QLineEdit(QString::fromUtf8($data->nodeValue, -1), $this);
foreach ($data->attributes as $attribute) {
$this->layout->addWidget(new QLabel($attribute->name . ": " . $attribute->value));
}
$this->layout->addWidget($this->buttons[count($this->buttons) - 1]);
}
$this->buttons[] = new QLineEdit("Test", $this);
$this->layout->addWidget($this->buttons[count($this->buttons) - 1]);
$this->buttons[] = new QLineEdit("second Test", $this);
$this->layout->addWidget($this->buttons[count($this->buttons) - 1]);
}
开发者ID:Shadrackn,项目名称:php-qt,代码行数:22,代码来源:unicode.php
示例13: SetProperty
public function SetProperty($strName, $intState)
{
if (QString::FirstCharacter($strName) == '"' && QString::LastCharacter($strName) == '"') {
$strName = substr($strName, 1, strlen($strName) - 2);
} else {
if (QString::FirstCharacter($strName) == "'" && QString::LastCharacter($strName) == "'") {
$strName = substr($strName, 1, strlen($strName) - 2);
}
}
if (array_key_exists($strName, $this->PropertyArray)) {
$objProperty = $this->PropertyArray[$strName];
} else {
$objProperty = new QScriptParserProperty();
$objProperty->Name = $strName;
$this->PropertyArray[$strName] = $objProperty;
}
if ($intState == STATE_GET) {
$objProperty->Read = true;
} else {
if ($intState == STATE_SET) {
$objProperty->Write = true;
}
}
}
开发者ID:qcodo,项目名称:qcodo-api,代码行数:24,代码来源:QScriptParser.class.php
示例14: DisplayProfilingInfo
/**
* This function displays helpful development info like queries sent to database and memory usage.
* By default it shows only if database profiling is enabled in any configured database connections.
*
* If forced to show when profiling is disabled you can monitor qcodo memory usage more accurately,
* as collecting database profiling information tends to noticeable bigger memory consumption.
*
* @param boolean $blnForceDisplay optional parameter, set true to always display info even if DB profiling is disabled
* @return void
*/
public static function DisplayProfilingInfo($blnForceDisplay = false)
{
if (QDatabaseBase::IsAnyDatabaseProfilingEnabled() || $blnForceDisplay) {
print '<br clear="all"/><div style="padding: 5px; text-align: left; margin: 1em auto; border: 1px solid #888888; width: 800px;">';
// Output DB Profiling Data
foreach (QApplication::$Database as $objDb) {
if ($objDb->EnableProfiling == true) {
$objDb->OutputProfiling();
}
}
// Output runtime statistics
if (function_exists('memory_get_peak_usage')) {
print 'memory_get_peak_usage: ' . QString::GetByteSize(memory_get_peak_usage(true)) . ' / ' . ini_get('memory_limit') . '<br/>';
}
print 'max_execution_time: ' . ini_get('max_execution_time') . ' s<br/>';
print 'max_input_time: ' . ini_get('max_input_time') . ' s<br/>';
print 'upload_max_filesize: ' . ini_get('upload_max_filesize') . '<br/>';
// Output any other PHPINI issues
if (ini_get('safe_mode')) {
print '<font color="red">safe_mode need to be disabled</font><br/>';
}
if (ini_get('magic_quotes_gpc')) {
print '<font color="red">magic_quotes_gpc need to be disabled</font><br/>';
}
if (ini_get('magic_quotes_runtime')) {
print '<font color="red">magic_quotes_runtime need to be disabled</font><br/>';
}
print '</div>';
}
}
开发者ID:alcf,项目名称:chms,代码行数:40,代码来源:QApplicationBase.class.php
示例15: RenderOutput
protected function RenderOutput($strOutput, $blnDisplayOutput, $blnForceAsBlockElement = false)
{
// First, let's mark this control as being rendered and is ON the Page
$this->blnRendering = false;
$this->blnRendered = true;
$this->blnOnPage = true;
// Determine whether or not $strOutput is considered a XHTML "Block" Element
if ($blnForceAsBlockElement || $this->blnIsBlockElement) {
$blnIsBlockElement = true;
} else {
$blnIsBlockElement = false;
}
// Check for Visibility
if (!$this->blnVisible) {
$strOutput = '';
}
$strStyle = '';
if ($this->strPosition && $this->strPosition != QPosition::NotSet) {
$strStyle .= sprintf('position:%s;', $this->strPosition);
}
if (!$this->blnDisplay) {
$strStyle .= 'display:none;';
} else {
if ($blnIsBlockElement) {
$strStyle .= 'display:inline;';
}
}
if (strlen(trim($this->strLeft)) > 0) {
$strLeft = null;
try {
$strLeft = QType::Cast($this->strLeft, QType::Integer);
} catch (QInvalidCastException $objExc) {
}
if (is_null($strLeft)) {
$strStyle .= sprintf('left:%s;', $this->strLeft);
} else {
$strStyle .= sprintf('left:%spx;', $this->strLeft);
}
}
if (strlen(trim($this->strTop)) > 0) {
$strTop = null;
try {
$strTop = QType::Cast($this->strTop, QType::Integer);
} catch (QInvalidCastException $objExc) {
}
if (is_null($strTop)) {
$strStyle .= sprintf('top:%s;', $this->strTop);
} else {
$strStyle .= sprintf('top:%spx;', $this->strTop);
}
}
switch ($this->objForm->CallType) {
case QCallType::Ajax:
// If we have a ParentControl and the ParentControl has NOT been rendered, then output
// as standard HTML
if ($this->objParentControl && ($this->objParentControl->Rendered || $this->objParentControl->Rendering)) {
if ($strStyle) {
$strStyle = sprintf('style="%s"', $strStyle);
}
if ($blnIsBlockElement) {
$strOutput = sprintf('<div id="%s_ctl" %s>%s</div>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
} else {
$strOutput = sprintf('<span id="%s_ctl" %s>%s</span>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
}
// $strOutput = sprintf('<ins id="%s_ctl" style="%stext-decoration:inherit;">%s</ins>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
// $strOutput = sprintf('<q id="%s_ctl" style="%s">%s</q>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
} else {
// Otherwise, we are rendering as a top-level AJAX response
// Surround Output HTML around CDATA tags
$strOutput = QString::XmlEscape($strOutput);
$strOutput = sprintf('<control id="%s">%s</control>', $this->strControlId, $strOutput);
// QApplication::ExecuteJavaScript(sprintf('qcodo.registerControl("%s"); ', $this->strControlId), true);
// QApplication::ExecuteJavaScript(sprintf('qc.regC("%s"); ', $this->strControlId), true);
// $strScript = $this->GetEndScript();
// if ($strScript)
// QApplication::ExecuteJavaScript($strScript);
if ($this->blnWrapperModified && $this->blnVisible) {
// QApplication::ExecuteJavaScript(sprintf('qcodo.getWrapper("%s").style.cssText = "%s"; ', $this->strControlId, $strStyle));
QApplication::ExecuteJavaScript(sprintf('qc.getW("%s").style.cssText = "%stext-decoration:inherit;"; ', $this->strControlId, $strStyle));
}
}
break;
default:
if ($strStyle) {
$strStyle = sprintf('style="%s"', $strStyle);
}
// $strOutput = sprintf('<div id="%s_ctl" style="%s">%s</div>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
// $strOutput = sprintf('<ins id="%s_ctl" style="%stext-decoration:inherit;">%s</ins>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
if ($blnIsBlockElement) {
$strOutput = sprintf('<div id="%s_ctl" %s>%s</div>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
} else {
$strOutput = sprintf('<span id="%s_ctl" %s>%s</span>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
}
break;
}
// Output or Return
if ($blnDisplayOutput) {
print $strOutput;
} else {
return $strOutput;
//.........这里部分代码省略.........
开发者ID:qcodo,项目名称:qcodo,代码行数:101,代码来源:QControlBase.class.php
示例16: RenderControlRegisterJS
public function RenderControlRegisterJS($blnPrint = true, $blnAjaxFormating = false)
{
$strRendered = '';
if (!$blnAjaxFormating) {
$strRendered .= "<script language='javascript'>\n\t";
}
$strRendered .= "\$(document).ready(function(){\n\t";
$strRendered .= "MJax.ClearRegisteredControls();\n\t";
foreach ($this->arrControls as $objControl) {
$strRendered .= sprintf("MJax.RegisterControl('%s');\n\t", $objControl->ControlId);
}
$strRendered .= "});\n\t";
if (!$blnAjaxFormating) {
$strRendered .= "</script>";
}
if ($blnAjaxFormating) {
$strRendered = QString::XmlEscape(trim($strRendered));
}
if ($blnPrint) {
_p($strRendered, false);
} else {
return $strRendered;
}
}
开发者ID:schematical,项目名称:MJax-Includes,代码行数:24,代码来源:MJaxFormBase.class.php
示例17: GetEmailAddresses
/**
* Uses regular expression matching to return an array of valid e-mail addresses
*
* @param string $strAddresses Single string containing e-mail addresses and anything else
* @return string[] An array of e-mail addresses only, or NULL if none
*/
public static function GetEmailAddresses($strAddresses)
{
$strAddressArray = null;
// Define the ATEXT-based DOT-ATOM pattern which defines the LOCAL-PART of
// an ADDRESS-SPEC in RFC 2822
$strDotAtomPattern = "[a-zA-Z0-9\\!\\#\\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\.]+";
// Define the Domain pattern, defined by the allowable domain names in the DNS Root Zone of the internet
// Note that this is stricter than what RFC 2822 allows in DCONTENT, because we assume developers are
// wanting to send email over the internet, and not using it for a completely closed intranet with a
// non-DNS Root Zone compliant domain name infrastructure.
$strDomainPattern = '(?:[a-zA-Z0-9](?:[a-zA-Z0-9\\-]*[a-zA-Z0-9])?\\.)*[a-zA-Z0-9](?:[a-zA-Z0-9\\-]*[a-zA-Z0-9])?';
// The RegExp Pattern to Use
$strPattern = sprintf('/%s@%s/', $strDotAtomPattern, $strDomainPattern);
// See how many address candidates we have
$strCandidates = explode(',', $strAddresses);
foreach ($strCandidates as $strCandidate) {
if (preg_match($strPattern, $strCandidate, $strCandidateArray) && count($strCandidateArray) == 1) {
$strCandidate = $strCandidateArray[0];
$strParts = explode('@', $strCandidate);
// Validate String Lengths, and add to AddressArray if Valid
if (QString::IsLengthBeetween($strCandidate, 3, 256) && QString::IsLengthBeetween($strParts[0], 1, 64) && QString::IsLengthBeetween($strParts[1], 1, 255)) {
$strAddressArray[] = $strCandidate;
}
}
}
if (count($strAddressArray)) {
return $strAddressArray;
} else {
return null;
}
}
开发者ID:harshanurodh,项目名称:qcodo,代码行数:37,代码来源:QEmailServer.class.php
示例18: ProcessDirectory
/**
* Given the path of a directory, process all the directories and files in it that have NOT been seen in SeenRealPath.
* Assumes: the path is a valid directory that exists and has NOT been SeenRealPath
* @param string $strPath
* @return void
*/
protected function ProcessDirectory($strPath, QDirectoryToken $objDirectoryToken)
{
$strRealPath = realpath($strPath);
$this->strSeenRealPath[$strRealPath] = true;
$objDirectory = opendir($strPath);
while ($strName = readdir($objDirectory)) {
// Only Process Files/Folders that do NOT start with a single "."
if (QString::FirstCharacter($strName) != '.') {
// Put Together the Entire Full Path of the File in Question
$strFullPath = $strPath . '/' . $strName;
// Process if it's a file
if (is_file($strFullPath)) {
$this->ProcessFile($strFullPath, $objDirectoryToken);
// Process if it's a directory
} else {
if (is_dir($strFullPath)) {
// Only continue if we haven't visited it and it's not a folder that we are ignoring
$strRealPath = realpath($strFullPath);
if (!array_key_exists($strRealPath, $this->strSeenRealPath) && !array_key_exists(strtolower($strName), $this->blnIgnoreFolderArray)) {
$this->ProcessDirectory($strFullPath, $objDirectoryToken);
}
// It's neither a file nor a directory?!
} else {
throw new Exception('Not a valid file or folder: ' . $strFullPath);
}
}
}
}
}
开发者ID:klucznik,项目名称:qcodo-website,代码行数:35,代码来源:QPackageManagerUpload.class.php
示例19: TypeTokenFromTypeName
protected function TypeTokenFromTypeName($strName)
{
$strToReturn = '';
for ($intIndex = 0; $intIndex < strlen($strName); $intIndex++) {
if (ord($strName[$intIndex]) >= ord('a') && ord($strName[$intIndex]) <= ord('z') || ord($strName[$intIndex]) >= ord('A') && ord($strName[$intIndex]) <= ord('Z') || ord($strName[$intIndex]) >= ord('0') && ord($strName[$intIndex]) <= ord('9') || $strName[$intIndex] == '_') {
$strToReturn .= $strName[$intIndex];
}
}
if (is_numeric(QString::FirstCharacter($strToReturn))) {
$strToReturn = '_' . $strToReturn;
}
return $strToReturn;
}
开发者ID:kmcelhinney,项目名称:qcodo,代码行数:13,代码来源:QCodeGenBase.class.php
示例20: Run
public static function Run($strClassName, $strNamespace = null)
{
QApplication::$EncodingType = 'UTF-8';
$objWsdlCache = new QCache('soap', QApplication::$ScriptName, 'wsdl', QApplication::$ScriptFilename);
$objDiscoCache = new QCache('soap', QApplication::$ScriptName, 'disco', QApplication::$ScriptFilename);
$objClassWrapperCache = new QCache('soap', QApplication::$ScriptName, 'class.php', QApplication::$ScriptFilename);
// Reflect through this QSoapService
$strDisco = $objDiscoCache->GetData();
if ($strDisco === false || !$strNamespace) {
$objReflection = new ReflectionClass($strClassName);
}
// Figure Out Namespace
if (!$strNamespace) {
$objReflectionProperties = $objReflection->getStaticProperties();
$strNamespace = $objReflectionProperties['DefaultNamespace'];
}
$strNamespace = trim($strNamespace);
if (QString::LastCharacter($strNamespace) == '/') {
$strNamespace = substr($strNamespace, 0, strlen($strNamespace) - 1);
}
// Check for Cached Disco
if ($strDisco === false) {
// Instantiate Service and Setup new Soap Methods
$objService = new $strClassName($strClassName, $strNamespace);
// Setup SOAP Methods
try {
$objService->SetupSoapMethods($objReflection);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
// Get Disco, Wsdl and Wrapper, and cache them!
$objWsdlCache->SaveData($objService->GetWsdl());
$objDiscoCache->SaveData($objService->GetDisco());
$objClassWrapperCache->SaveData($objService->GetClassWrapper());
}
// Process Service Browse (e.g. if accessed via GET)
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
if (array_key_exists('QUERY_STRING', $_SERVER)) {
switch (strtolower($_SERVER['QUERY_STRING'])) {
case 'disco':
header('Content-Type: text/xml');
_p('<?xml version="1.0" encoding="' . QApplication::$EncodingType . '"?>', false);
_p($objDiscoCache->GetData(), false);
return;
case 'wsdl':
header('Content-Type: text/xml');
_p('<?xml version="1.0" encoding="' . QApplication::$EncodingType . '"?>', false);
_p($objWsdlCache->GetData(), false);
return;
}
}
printf('<link rel="alternate" type="text/xml" href="%s?disco"/><a href="%s?disco">Web Service Discovery File</a> | <a href="%s?wsdl">Web Service Description File (WSDL)</a>', QApplication::$ScriptName, QApplication::$ScriptName, QApplication::$ScriptName);
return;
}
// Process Service Execution (e.g. accessed via a POST)
$objService = new $strClassName($strClassName, $strNamespace);
// Get the Request
$strRequest = file_get_contents("php://input");
// Create the Service Class Wrapper
require $objClassWrapperCache->GetFilePath();
// Use PHP 5.1+'s SoapServer class to handle the actual work
$objService->objSoapServer = new SoapServer($objWsdlCache->GetFilePath());
$objService->objSoapServer->setClass($strClassName . 'Wrapper', $strClassName, $strNamespace);
$objService->objSoapServer->handle($strRequest);
}
开发者ID:qcodo,项目名称:qcodo-api,代码行数:66,代码来源:QSoapService.class.php
注:本文中的QString类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论