Files
2022-12-13 10:33:30 +01:00

125 lines
3.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="splfileobject.fgetss" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileObject::fgetss</refname>
<refpurpose>Gets line from file and strip HTML tags</refpurpose>
</refnamediv>
<refsynopsisdiv>
&warn.deprecated.function-7-3-0.removed-8-0-0;
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="SplFileObject">
<modifier>public</modifier> <type>string</type><methodname>SplFileObject::fgetss</methodname>
<methodparam choice="opt"><type>string</type><parameter>allowable_tags</parameter></methodparam>
</methodsynopsis>
<para>
Identical to <methodname>SplFileObject::fgets</methodname>, except that
<methodname>SplFileObject::fgetss</methodname> attempts to strip any HTML and PHP tags from
the text it reads.
The function retains the parsing state from call to call, and as such is not
equivalent to calling <function>strip_tags</function> on the return value of
<methodname>SplFileObject::fgets</methodname>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>allowable_tags</parameter></term>
<listitem>
<para>
Optional parameter to specify tags which should not be stripped.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a string containing the next line of the file with HTML and PHP
code stripped, or &false; on error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><methodname>SplFileObject::fgetss</methodname> example</title>
<programlisting role="php">
<![CDATA[
<?php
$str = <<<EOD
<html><body>
<p>Welcome! Today is the <?php echo(date('jS')); ?> of <?= date('F'); ?>.</p>
</body></html>
Text outside of the HTML block.
EOD;
file_put_contents("sample.php", $str);
$file = new SplFileObject("sample.php");
while (!$file->eof()) {
echo $file->fgetss();
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Welcome! Today is the of .
Text outside of the HTML block.
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>fgetss</function></member>
<member><methodname>SplFileObject::fgets</methodname></member>
<member><methodname>SplFileObject::fgetc</methodname></member>
<member><methodname>SplFileObject::current</methodname></member>
<member>The <link linkend="filters.string.strip_tags">string.strip_tags</link> filter</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->