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


PHP QString类代码示例

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


在下文中一共展示了QString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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) &nbsp; <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') . '&nbsp;s<br/>';
         print 'max_input_time: ' . ini_get('max_input_time') . '&nbsp;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


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