downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the Git repository for this website on git.php.net.

Source of: /manual/ro/tidynode.istext.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/class.tidynode.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'ro',
  ),
 
'this' =>
  array (
   
0 => 'tidynode.istext.php',
   
1 => 'tidyNode::isText',
  ),
 
'up' =>
  array (
   
0 => 'class.tidynode.php',
   
1 => 'tidyNode',
  ),
 
'prev' =>
  array (
   
0 => 'tidynode.isphp.php',
   
1 => 'tidyNode::isPhp',
  ),
 
'next' =>
  array (
   
0 => 'ref.tidy.php',
   
1 => 'Funcții Tidy',
  ),
 
'alternatives' =>
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="tidynode.istext" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">tidyNode::isText</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.0.1)</p><p class="refpurpose"><span class="refname">tidyNode::isText</span> &mdash; <span class="dc-title">Checks if a node represents text (no markup)</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-tidynode.istext-description">
  <h3 class="title">Descrierea</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>tidyNode::isText</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Tells if the node represents a text (without any markup).
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-tidynode.istext-returnvalues">
  <h3 class="title">Valorile întoarse</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> if the node represent a text, <strong><code>FALSE</code></strong> otherwise.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-tidynode.istext-examples">
  <h3 class="title">Exemple</h3>
  <p class="para">
   <div class="example" id="example-3958">
    <p><strong>Example #1 Extract text from a mixed HTML document</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$html&nbsp;</span><span style="color: #007700">=&nbsp;&lt;&lt;&lt;&nbsp;HTML<br /></span><span style="color: #DD0000">&lt;html&gt;&lt;head&gt;<br />&lt;?php&nbsp;echo&nbsp;'&lt;title&gt;title&lt;/title&gt;';&nbsp;?&gt;<br />&lt;#&nbsp;<br />&nbsp;&nbsp;/*&nbsp;JSTE&nbsp;code&nbsp;*/<br />&nbsp;&nbsp;alert('Hello&nbsp;World');&nbsp;<br />#&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br /><br />&lt;?php<br />&nbsp;&nbsp;//&nbsp;PHP&nbsp;code<br />&nbsp;&nbsp;echo&nbsp;'hello&nbsp;world!';<br />?&gt;<br /><br />&lt;%<br />&nbsp;&nbsp;/*&nbsp;ASP&nbsp;code&nbsp;*/<br />&nbsp;&nbsp;response.write("Hello&nbsp;World!")<br />%&gt;<br /><br />&lt;!--&nbsp;Comments&nbsp;--&gt;<br />Hello&nbsp;World<br />&lt;/body&gt;&lt;/html&gt;<br />Outside&nbsp;HTML<br /></span><span style="color: #007700">HTML;<br /><br /><br /></span><span style="color: #0000BB">$tidy&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">tidy_parse_string</span><span style="color: #007700">(</span><span style="color: #0000BB">$html</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$num&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">get_nodes</span><span style="color: #007700">(</span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">html</span><span style="color: #007700">());<br /><br />function&nbsp;</span><span style="color: #0000BB">get_nodes</span><span style="color: #007700">(</span><span style="color: #0000BB">$node</span><span style="color: #007700">)&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;check&nbsp;if&nbsp;the&nbsp;current&nbsp;node&nbsp;is&nbsp;of&nbsp;requested&nbsp;type<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if(</span><span style="color: #0000BB">$node</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isText</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"\n\n#&nbsp;text&nbsp;node&nbsp;#"&nbsp;</span><span style="color: #007700">.&nbsp;++</span><span style="color: #0000BB">$GLOBALS</span><span style="color: #007700">[</span><span style="color: #DD0000">'num'</span><span style="color: #007700">]&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$node</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">value</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;check&nbsp;if&nbsp;the&nbsp;current&nbsp;node&nbsp;has&nbsp;childrens<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if(</span><span style="color: #0000BB">$node</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">hasChildren</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach(</span><span style="color: #0000BB">$node</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">child&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$child</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">get_nodes</span><span style="color: #007700">(</span><span style="color: #0000BB">$child</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>
Exemplul de mai sus va afișa:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
# text node #1
Hello World

# text node #2
Outside HTML
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-tidynode.istext-notes">
  <h3 class="title">Note</h3> 
  <blockquote class="note"><p><strong class="note">Notă</strong>:
   <p class="para">
    This function was named  <span class="function"><strong>tidy_node::is_text()</strong></span> in
    PHP 4/Tidy 1.
   </p>
  </p></blockquote>
 </div>

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites