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


PHP Convert::xml2raw方法代码示例

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


在下文中一共展示了Convert::xml2raw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendHTML

 public function sendHTML($to, $from, $subject, $html, $attachments = false, $headers = false, $plain = false, $inlineImages = false)
 {
     if ($inlineImages) {
         user_error('The SES mailer does not support inlining images', E_USER_NOTICE);
     }
     $htmlPart = new Mime\Part($html);
     $htmlPart->type = Mime\Mime::TYPE_HTML;
     $htmlPart->charset = 'utf-8';
     $htmlPart->encoding = Mime\Mime::ENCODING_QUOTEDPRINTABLE;
     $plainPart = new Mime\Part($plain ?: \Convert::xml2raw($html));
     $plainPart->type = Mime\Mime::TYPE_TEXT;
     $plainPart->charset = 'utf-8';
     $plainPart->encoding = Mime\Mime::ENCODING_QUOTEDPRINTABLE;
     $alternatives = new Mime\Message();
     $alternatives->setParts(array($plainPart, $htmlPart));
     $alternativesPart = new Mime\Part($alternatives->generateMessage());
     $alternativesPart->type = Mime\Mime::MULTIPART_ALTERNATIVE;
     $alternativesPart->boundary = $alternatives->getMime()->boundary();
     $body = new Mime\Message();
     $body->addPart($alternativesPart);
     if ($attachments) {
         $this->addAttachments($body, $attachments);
     }
     $this->sendMessage($to, $from, $subject, $body, $headers);
 }
开发者ID:owindsor,项目名称:silverstripe-ses,代码行数:25,代码来源:SESMailer.php

示例2: testXml2Raw

 /**
  * Tests {@link Convert::xml2raw()}
  */
 function testXml2Raw()
 {
     $val1 = '<input type="text">';
     $this->assertEquals('<input type="text">', Convert::xml2raw($val1), 'Special characters are escaped');
     $val2 = 'This is some normal text.';
     $this->assertEquals('This is some normal text.', Convert::xml2raw($val2), 'Normal text is not escaped');
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:10,代码来源:ConvertTest.php

示例3: loadData

 /**
  * This method loads the content of the given array $data into the current
  * dataobject. Similar to the DataObject-merge function, but 
  * without iterating through the relationships.
  * 
  * @param $data array of attributes (keys should match to the $db fields).
  */
 public function loadData($data)
 {
     if ($data == null) {
         return;
     }
     if (!is_array($data)) {
         return;
     }
     foreach ($data as $k => $v) {
         $this->{$k} = Convert::xml2raw($v);
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-geocatalogue,代码行数:19,代码来源:MDDataObject.php

示例4: loadData

 /**
  * This method loads a provided array into the data structure.
  * It also creates dependencies, such as contact data objects
  * and populate the values into those objects.
  *
  * @param $data array of db-values.
  */
 public function loadData($data)
 {
     if ($data == null) {
         return;
     }
     if (!is_array($data)) {
         return;
     }
     foreach ($data as $k => $v) {
         // store data into this object (no ':" in the string)
         if (strpos($k, ':') === false) {
             $this->{$k} = Convert::xml2raw($v);
         } else {
             // A ':' is used as a namespace marker. It is used to
             // create the related data objects, such as MDContacts.
             $relations = explode(':', $k);
             $fieldName = array_pop($relations);
             $relObj = $this;
             // iterate through the relationships. At the moment, this
             // loading process just works for 1 level hierarchies.
             foreach ($relations as $relation) {
                 if ($relation == 'MDVoice') {
                     // load the sub-array into the MDContact object
                     foreach ($v as $mdVoiceEntry) {
                         $item = new MDPhoneNumber();
                         $item->loadData($mdVoiceEntry);
                         // add object to list
                         $relObj->MDVoice()->add($item);
                     }
                 }
             }
             foreach ($relations as $relation) {
                 if ($relation == 'MDElectronicMailAddress') {
                     // load the sub-array into the MDContact object
                     foreach ($v as $mdEmail) {
                         $item = new MDEmail();
                         $item->loadData($mdEmail);
                         // add object to list
                         $relObj->MDElectronicMailAddress()->add($item);
                     }
                 }
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-geocatalogue,代码行数:52,代码来源:MDContact.php

示例5: testSiteTreeHints

 function testSiteTreeHints()
 {
     $cache = SS_Cache::factory('CMSMain_SiteTreeHints');
     // Login as user with root creation privileges
     $user = $this->objFromFixture('Member', 'rootedituser');
     $user->logIn();
     $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
     $rawHints = singleton('CMSMain')->SiteTreeHints();
     $this->assertNotNull($rawHints);
     $rawHints = preg_replace('/^"(.*)"$/', '$1', Convert::xml2raw($rawHints));
     $hints = Convert::json2array($rawHints);
     $this->assertArrayHasKey('Root', $hints);
     $this->assertArrayHasKey('Page', $hints);
     $this->assertArrayHasKey('All', $hints);
     $this->assertArrayHasKey('CMSMainTest_ClassA', $hints['All'], 'Global list shows allowed classes');
     $this->assertArrayNotHasKey('CMSMainTest_HiddenClass', $hints['All'], 'Global list does not list hidden classes');
     $this->assertNotContains('CMSMainTest_ClassA', $hints['Root']['disallowedChildren'], 'Limits root classes');
     $this->assertContains('CMSMainTest_NotRoot', $hints['Root']['disallowedChildren'], 'Limits root classes');
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:19,代码来源:CMSMainTest.php

示例6: testSiteTreeHints

 function testSiteTreeHints()
 {
     $cache = SS_Cache::factory('CMSMain_SiteTreeHints');
     $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
     $rawHints = singleton('CMSMain')->SiteTreeHints();
     $this->assertNotNull($rawHints);
     $rawHints = preg_replace('/^"(.*)"$/', '$1', Convert::xml2raw($rawHints));
     $hints = Convert::json2array($rawHints);
     $this->assertArrayHasKey('Root', $hints);
     $this->assertArrayHasKey('Page', $hints);
     $this->assertArrayHasKey('All', $hints);
     $this->assertArrayHasKey('CMSMainTest_ClassA', $hints['All'], 'Global list shows allowed classes');
     $this->assertArrayNotHasKey('CMSMainTest_HiddenClass', $hints['All'], 'Global list does not list hidden classes');
     $this->assertNotContains('CMSMainTest_ClassA', $hints['Root']['disallowedChildren'], 'Limits root classes');
     $this->assertContains('CMSMainTest_NotRoot', $hints['Root']['disallowedChildren'], 'Limits root classes');
     $this->assertNotContains('CMSMainTest_ClassA', (array) @$hints['Page']['disallowedChildren'], 'Does not limit types on unlimited parent');
     $this->assertContains('Page', $hints['CMSMainTest_ClassA']['disallowedChildren'], 'Limited parent lists disallowed classes');
     $this->assertNotContains('CMSMainTest_ClassB', $hints['CMSMainTest_ClassA']['disallowedChildren'], 'Limited parent omits explicitly allowed classes in disallowedChildren');
 }
开发者ID:fanggu,项目名称:loveyourwater_ss_v3.1.6,代码行数:19,代码来源:CMSMainTest.php

示例7: RAW_val

 /**
  * Return the value of the given field without any escaping.
  * @param string $fieldName The field name.
  * @param array $args The arguments.
  * @return string
  */
 public function RAW_val($fieldName, $args = null)
 {
     return Convert::xml2raw($this->XML_val($fieldName, $args));
 }
开发者ID:ramziammar,项目名称:websites,代码行数:10,代码来源:ViewableData.php

示例8: getNumWordsContent

 /**
  * getNumWordsContent.
  * get the number of words in the Page Content
  * 
  * @param none
  * @return Integer Number of words in content
  */
 public function getNumWordsContent()
 {
     return str_word_count(Convert::xml2raw($this->getPageContent()));
 }
开发者ID:hubertusanton,项目名称:silverstripe-seo,代码行数:11,代码来源:SeoObjectExtension.php

示例9: getpagecount

 /**
  * Helper function to get page count
  */
 function getpagecount()
 {
     ini_set('max_execution_time', 0);
     $excludePages = split(" *, *", $_GET['exclude']);
     $pages = DataObject::get("SiteTree", "\"ParentID\" = 0");
     foreach ($pages as $page) {
         $pageArr[] = $page;
     }
     while (list($i, $page) = each($pageArr)) {
         if (!in_array($page->URLSegment, $excludePages)) {
             if ($children = $page->AllChildren()) {
                 foreach ($children as $child) {
                     $pageArr[] = $child;
                 }
             }
             if (!$_GET['onlywithcontent'] || strlen(Convert::xml2raw($page->Content)) > 100) {
                 echo "<li>" . $page->Breadcrumbs(null, true) . "</li>";
                 $count++;
             } else {
                 echo "<li style=\"color: #777\">" . $page->Breadcrumbs(null, true) . " - " . _t('CMSMain.NOCONTENT', "no content") . "</li>";
             }
         }
     }
     echo '<p>' . _t('CMSMain.TOTALPAGES', "Total pages: ") . "{$count}</p>";
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:28,代码来源:CMSMain.php

示例10: sendHTML

 /**
  * Encrypting HTML emails does not work so this method triggers a warning and sends using sendPlain() and plaintext 
  * version of the HTML content.
  *
  * @param  string  $to            To address RFC 2822 format
  * @param  string  $from          From address RFC 2822 format
  * @param  string  $subject       Subject line for email
  * @param  string  $plainContent  Content for email
  * @param  boolean $attachedFiles Indicate whether files are attached
  * @param  array   $customheaders Custom email headers
  * @return mixed                  Array if successful or false if unsuccessful
  */
 public function sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false)
 {
     // HTML emails cannot be encrypted and create a number of issues, sendPlain() should be used instead
     trigger_error('HTML email content cannot be encrypted, only the plain text component of this email will be generated.', E_USER_WARNING);
     if (!$plainContent) {
         $plainContent = Convert::xml2raw($htmlContent);
     }
     return $this->sendPlain($to, $from, $subject, $plainContent, $attachedFiles, $customheaders);
 }
开发者ID:edlinklater,项目名称:silverstripe-gpgmailer,代码行数:21,代码来源:GPGMailer.php

示例11: Plain

 /**
  * Get plain-text version
  *
  * @return string
  */
 public function Plain()
 {
     // Preserve line breaks
     $text = preg_replace('/\\<br(\\s*)?\\/?\\>/i', "\n", $this->RAW());
     // Convert paragraph breaks to multi-lines
     $text = preg_replace('/\\<\\/p\\>/i', "\n\n", $text);
     // Strip out HTML tags
     $text = strip_tags($text);
     // Implode >3 consecutive linebreaks into 2
     $text = preg_replace('~(\\R){2,}~', "\n\n", $text);
     // Decode HTML entities back to plain text
     return trim(\Convert::xml2raw($text));
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:18,代码来源:DBHTMLText.php

示例12: loadData

 /**
  * This method loads a provided array into the data structure.
  * It also creates dependencies, such as contact data objects
  * and populate the values into those objects.
  *
  * @param $data array of db-values.
  */
 public function loadData($data)
 {
     if ($data == null) {
         return;
     }
     if (!is_array($data)) {
         return;
     }
     foreach ($data as $k => $v) {
         // store data into this object (no ':" in the string)
         if (strpos($k, ':') === false) {
             $this->{$k} = Convert::xml2raw($v);
         } else {
             // A ':' is used as a namespace marker. It is used to
             // create the related data objects, such as MDContacts.
             $relations = explode(':', $k);
             $fieldName = array_pop($relations);
             $relObj = $this;
             // iterate through the relationships. At the moment, this
             // loading process just works for 1 level hierarchies.
             foreach ($relations as $relation) {
                 if ($relation == 'PointOfContacts') {
                     // load the sub-array into the MDContact object
                     $item = new MDContact();
                     $item->loadData($v);
                     // add the new MDContect to the collection class of this
                     // object.
                     $relObj->PointOfContacts()->add($item);
                 }
                 if ($relation == 'MDContacts') {
                     // load the sub-array into the MDContact object
                     $item = new MDContact();
                     $item->loadData($v);
                     // add the new MDContect to the collection class of this
                     // object.
                     $relObj->MDContacts()->add($item);
                 }
                 if ($relation == 'MDResourceConstraints') {
                     // load the sub-array into the MDResourceConstraints object
                     if (is_array($v)) {
                         foreach ($v as $vitem) {
                             $item = new MDResourceConstraint();
                             $item->loadData($vitem);
                             // add the new MDContect to the collection class of this
                             // object.
                             $relObj->MDResourceConstraints()->add($item);
                         }
                     }
                 }
                 if ($relation == 'MDResourceFormats') {
                     if (is_array($v)) {
                         foreach ($v as $vitem) {
                             // load the sub-array into the MDResourceFormats object
                             $item = new MDResourceFormat();
                             $item->loadData($vitem);
                             // add the new MDContect to the collection class of this
                             // object.
                             $relObj->MDResourceFormats()->add($item);
                         }
                     }
                 }
                 if ($relation == 'MDTopicCategory') {
                     if (is_array($v)) {
                         foreach ($v as $vitem) {
                             // load the sub-array into the MDResourceFormats object
                             $item = new MDTopicCategory();
                             $item->loadData($vitem);
                             // add the new MDTopicCategory to the collection class of this
                             // object.
                             $relObj->MDTopicCategory()->add($item);
                         }
                     }
                 }
                 if ($relation == 'MDCitationDates') {
                     if (is_array($v)) {
                         foreach ($v as $vitem) {
                             // load the sub-array into the MDResourceFormats object
                             $item = new MDCitationDate();
                             $item->loadData($vitem);
                             // add the new MDContect to the collection class of this
                             // object.
                             $relObj->MDCitationDates()->add($item);
                         }
                     }
                 }
                 if ($relation == 'MCPMDCreativeCommons') {
                     if (is_array($v)) {
                         foreach ($v as $vitem) {
                             // load the sub-array into the MDContact object
                             $item = new MCPMDCreativeCommons();
                             $item->loadData($vitem);
                             // add the new MCPMDCreativeCommons to the collection class of this
                             // object.
//.........这里部分代码省略.........
开发者ID:helpfulrobot,项目名称:silverstripe-geocatalogue,代码行数:101,代码来源:MDMetadata.php

示例13: testSendHTML

    /**
     * Test HTML messages
     */
    public function testSendHTML()
    {
        $mailer = new MailerTest_MockMailer();
        // Test with default encoding
        $testMessageHTML = "<p>The majority of the <i>answers</i> so far are saying that private methods are " . "implementation details which don&#39;t (<a href=\"http://www.google.com\">or at least shouldn&#39;t</a>) " . "matter so long as the public interface is well-tested &amp; working</p> " . "<p>That&#39;s absolutely correct if your only purpose for testing is to guarantee that the " . "public interface works.</p>";
        $testMessagePlain = Convert::xml2raw($testMessageHTML);
        $this->assertTrue(stripos($testMessagePlain, '&#') === false);
        list($to, $subjectEncoded, $fullBody, $headersEncoded, $bounceAddress) = $mailer->sendHTML('<email@silverstripe.com>', 'tom@jones <tom@silverstripe.com>', "What is the <purpose> of testing?", $testMessageHTML, null, array('CC' => 'admin@silverstripe.com', 'bcc' => 'andrew@thing.com'));
        $this->assertEquals('email@silverstripe.com', $to);
        $this->assertEquals('=?UTF-8?B?V2hhdCBpcyB0aGUgPHB1cnBvc2U+IG9mIHRlc3Rpbmc/?=', $subjectEncoded);
        $this->assertEquals('=?UTF-8?B?' . base64_encode('What is the <purpose> of testing?') . '?=', $subjectEncoded);
        $this->assertEquals(Convert::nl2os(<<<PHP

This is a multi-part message in MIME format.

------=_NextPart_000000000000
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

The majority of the answers so far are saying that private methods are impl=
ementation details which don't (or at least shouldn't[http://www.google.com=
]) matter so long as the public interface is well-tested & working=0A=0A=0A=
=0AThat's absolutely correct if your only purpose for testing is to guarant=
ee that the public interface works.

------=_NextPart_000000000000
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">=0A<HTML><HEA=
D>=0A<META http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-=
8">=0A<STYLE type=3D"text/css"></STYLE>=0A=0A</HEAD>=0A<BODY bgColor=3D"#ff=
ffff">=0A<p>The majority of the <i>answers</i> so far are saying that priva=
te methods are implementation details which don&#39;t (<a href=3D"http://ww=
w.google.com">or at least shouldn&#39;t</a>) matter so long as the public i=
nterface is well-tested &amp; working</p> <p>That&#39;s absolutely correct =
if your only purpose for testing is to guarantee that the public interface =
works.</p>=0A</BODY>=0A</HTML>
------=_NextPart_000000000000--
PHP
), Convert::nl2os($this->normaliseDivisions($fullBody)));
        // Check that the messages exist in the output
        $this->assertTrue(stripos($fullBody, quoted_printable_encode($testMessagePlain)) !== false);
        $this->assertEquals(<<<PHP
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_NextPart_000000000000"
Content-Transfer-Encoding: 7bit
From: tomjones <tom@silverstripe.com>
X-Mailer: SilverStripe Mailer - version 2006.06.21
X-Priority: 3
Bcc: andrew@thing.com
Cc: admin@silverstripe.com

PHP
, Convert::nl2os($this->normaliseDivisions($headersEncoded)));
        $this->assertEquals('tom@silverstripe.com', $bounceAddress);
        // Test override bounce email and alternate encoding
        $mailer->setBounceEmail('bounce@silverstripe.com');
        $mailer->setMessageEncoding('base64');
        list($to, $subjectEncoded, $fullBody, $headersEncoded, $bounceAddress) = $mailer->sendHTML('<email@silverstripe.com>', 'tom@jones <tom@silverstripe.com>', "What is the <purpose> of testing?", $testMessageHTML, null, array('CC' => 'admin@silverstripe.com', 'bcc' => 'andrew@thing.com'));
        $this->assertEquals('bounce@silverstripe.com', $bounceAddress);
        $this->assertEquals(<<<PHP

This is a multi-part message in MIME format.

------=_NextPart_000000000000
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64

VGhlIG1ham9yaXR5IG9mIHRoZSBhbnN3ZXJzIHNvIGZhciBhcmUgc2F5aW5n
IHRoYXQgcHJpdmF0ZSBtZXRob2RzIGFyZSBpbXBsZW1lbnRhdGlvbiBkZXRh
aWxzIHdoaWNoIGRvbid0IChvciBhdCBsZWFzdCBzaG91bGRuJ3RbaHR0cDov
L3d3dy5nb29nbGUuY29tXSkgbWF0dGVyIHNvIGxvbmcgYXMgdGhlIHB1Ymxp
YyBpbnRlcmZhY2UgaXMgd2VsbC10ZXN0ZWQgJiB3b3JraW5nCgoKClRoYXQn
cyBhYnNvbHV0ZWx5IGNvcnJlY3QgaWYgeW91ciBvbmx5IHB1cnBvc2UgZm9y
IHRlc3RpbmcgaXMgdG8gZ3VhcmFudGVlIHRoYXQgdGhlIHB1YmxpYyBpbnRl
cmZhY2Ugd29ya3Mu


------=_NextPart_000000000000
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64

PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMCBU
cmFuc2l0aW9uYWwvL0VOIj4KPEhUTUw+PEhFQUQ+CjxNRVRBIGh0dHAtZXF1
aXY9IkNvbnRlbnQtVHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0
PXV0Zi04Ij4KPFNUWUxFIHR5cGU9InRleHQvY3NzIj48L1NUWUxFPgoKPC9I
RUFEPgo8Qk9EWSBiZ0NvbG9yPSIjZmZmZmZmIj4KPHA+VGhlIG1ham9yaXR5
IG9mIHRoZSA8aT5hbnN3ZXJzPC9pPiBzbyBmYXIgYXJlIHNheWluZyB0aGF0
IHByaXZhdGUgbWV0aG9kcyBhcmUgaW1wbGVtZW50YXRpb24gZGV0YWlscyB3
aGljaCBkb24mIzM5O3QgKDxhIGhyZWY9Imh0dHA6Ly93d3cuZ29vZ2xlLmNv
bSI+b3IgYXQgbGVhc3Qgc2hvdWxkbiYjMzk7dDwvYT4pIG1hdHRlciBzbyBs
b25nIGFzIHRoZSBwdWJsaWMgaW50ZXJmYWNlIGlzIHdlbGwtdGVzdGVkICZh
bXA7IHdvcmtpbmc8L3A+IDxwPlRoYXQmIzM5O3MgYWJzb2x1dGVseSBjb3Jy
ZWN0IGlmIHlvdXIgb25seSBwdXJwb3NlIGZvciB0ZXN0aW5nIGlzIHRvIGd1
YXJhbnRlZSB0aGF0IHRoZSBwdWJsaWMgaW50ZXJmYWNlIHdvcmtzLjwvcD4K
PC9CT0RZPgo8L0hUTUw+
//.........这里部分代码省略.........
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:101,代码来源:MailerTest.php

示例14: Plain

 /**
  * Get plain-text version.
  *
  * Note: unlike DBHTMLText, this doesn't respect line breaks / paragraphs
  *
  * @return string
  */
 public function Plain()
 {
     // Strip out HTML
     $text = strip_tags($this->RAW());
     // Convert back to plain text
     return trim(\Convert::xml2raw($text));
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:14,代码来源:DBHTMLVarchar.php

示例15: getChildrenAsUL

 /** 
  * 
  * Custom getChildrenAsUL - specific for Pages/Tabsets/Tabs/Fields
  * TODO this is very slow - improve it!
  * TODO could load branches via AJAX instead
  */
 public static function getChildrenAsUL($fields, $level = 0, $ulExtraAttributes = null, $parentPage, &$itemCount = 0)
 {
     $output = "";
     $hasNextLevel = false;
     //Set to true to remove any node from being displayed. Its children still will be.
     $removeNode = false;
     //Remove Root, as its not really needed and confuses this tree
     if (is_a($fields, "FieldSet") && is_a($fields->First(), "TabSet")) {
         $firstField = $fields->First();
         $firstField = method_exists($firstField, "Name") ? $firstField->Name() : "";
         if ($firstField == "Root") {
             $removeNode = true;
         }
     }
     if (!$removeNode) {
         $output = "<ul {$ulExtraAttributes}>\n";
     }
     $ulExtraAttributes = null;
     foreach ($fields as $field) {
         $css = '';
         $display = '';
         $recurse = false;
         $name = '';
         $type = '';
         //Handle Page classes and children (getCMSFields)
         if (is_a($field, "Page")) {
             $css .= "tree-page ";
             $recurse = true;
             $name = $field->class;
             $display = $field->class;
             $parentPage = $field->class;
             $children = $field->getCMSFields(null);
         } else {
             //Handle TabSet classes and children (Tabs)
             if (is_a($field, "TabSet")) {
                 $css .= "tree-tabset ";
                 $recurse = true;
                 $display = method_exists($field, "Name") ? $field->Name() : $field->class;
                 $name = $display;
                 $children = $field->Tabs();
             } else {
                 //Handle Tab classes and children (Fields)
                 if (is_a($field, "Tab")) {
                     $css .= "tree-tab ";
                     $recurse = true;
                     $display = method_exists($field, "Name") ? $field->Name() : $field->class;
                     $name = $display;
                     $children = $field->Fields();
                 } else {
                     //Handle all FormField subclasses - excluding LiteralField
                     //If the class doesn't have a Title, display the class instead
                     //If the class has a Name, display that in brackets afterwards (maybe, comm for now)
                     if (is_subclass_of($field, "FormField") and !is_a($field, "LiteralField")) {
                         $title = method_exists($field, "Title") ? $field->Title() : $field->class;
                         $name = method_exists($field, "Name") ? $field->Name() : $field->class;
                         if (!$title) {
                             $title = $field->class;
                         }
                         $css .= "tree-field ";
                         $display = $title . "(" . $field->class . ")";
                     } else {
                         //Handle LiteralField classes - the content is HTML, so convert to raw first
                         if (is_a($field, "LiteralField")) {
                             $css .= "tree-literal ";
                             $name = method_exists($field, "Name") ? $field->Name() : $field->class;
                             $display = Convert::xml2raw($field->getContent());
                         } else {
                             //If the item isn't any of the above classes, we don't know what it is...
                             $css .= "tree-unknown ";
                             $name = method_exists($field, "Name") ? $field->Name() : $field->class;
                             $display = $field->class . " is an unknown type...";
                         }
                     }
                 }
             }
         }
         //Find out if this field has a SimplifyPermission entry for the given group
         if (SimplifyPermission::checkField($parentPage, $name, $field->class, self::$group)) {
             $css .= 'selected ';
         }
         //Build the page|field|type|group key
         $code = $parentPage . "|" . $name . "|" . $field->class . "|" . self::$group->ID;
         //Build the node
         if (!$removeNode) {
             $output .= "<li class='{$css}'><a href='#' rel='{$code}'>{$display}</a>\n";
         }
         //Do the recursive call
         if ($recurse) {
             $output .= self::getChildrenAsUL($children, $level + 1, $ulExtraAttributes, $parentPage);
         }
         if (!$removeNode) {
             $output .= "</li>\n";
         }
         $itemCount++;
//.........这里部分代码省略.........
开发者ID:helpfulrobot,项目名称:froog-simplify,代码行数:101,代码来源:SimplifyAction.php


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