Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions reference/sodium/functions/sodium-base642bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,81 @@
</simpara>
</refsect1>

<refsect1 role="examples"><!-- {{{ -->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove all the comments in this file? <!-- {{{ -->, etc. In the past this was used more often but nowadays we try to avoid it as it makes the XML harder to read.

&reftitle.examples;
<example xml:id="sodium-base642bin.example.basic"><!-- {{{ -->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On top of the comment, no need to include xml:id for (all of the) examples.

<title><function>sodium_base642bin</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$string = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo sodium_base642bin($string, SODIUM_BASE64_VARIANT_ORIGINAL);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
This is an encoded string
]]>
</screen>
</example><!-- }}} -->

<example xml:id="sodium-base642bin.example.id"><!-- {{{ -->
<title>Example of the <parameter>id</parameter> parameter</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump(sodium_bin2hex(sodium_base642bin('rrZ5j+9OUYT/O1WWr3U0hw==', SODIUM_BASE64_VARIANT_ORIGINAL)));
var_dump(sodium_bin2hex(sodium_base642bin('rrZ5j+9OUYT/O1WWr3U0hw', SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING)));
var_dump(sodium_bin2hex(sodium_base642bin('rrZ5j-9OUYT_O1WWr3U0hw==', SODIUM_BASE64_VARIANT_URLSAFE)));
var_dump(sodium_bin2hex(sodium_base642bin('rrZ5j-9OUYT_O1WWr3U0hw', SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING)));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(32) "aeb6798fef4e5184ff3b5596af753487"
string(32) "aeb6798fef4e5184ff3b5596af753487"
string(32) "aeb6798fef4e5184ff3b5596af753487"
string(32) "aeb6798fef4e5184ff3b5596af753487"
]]>
</screen>
</example><!-- }}} -->

<example xml:id="sodium-base642bin.example.ignore"><!-- {{{ -->
<title>Example of the <parameter>ignore</parameter> parameter</title>
<programlisting role="php">
<![CDATA[
<?php
$string = <<<'STR'
VGhpcyBpcy
BhbiBlbmNv
ZGVkIHN0cm
luZw==
STR;
var_dump(sodium_base642bin($string, SODIUM_BASE64_VARIANT_ORIGINAL, " \r\n"));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(25) "This is an encoded string"
]]>
</screen>
</example><!-- }}} -->
</refsect1><!-- }}} -->

<refsect1 role="seealso"><!-- {{{ -->
&reftitle.seealso;
<simplelist>
<member><function>base64_decode</function></member>
<member><function>sodium_bin2base64</function></member>
<member><function>sodium_bin2hex</function></member>
</simplelist>
</refsect1><!-- }}} -->

</refentry>
<!-- Keep this comment at the end of the file
Expand Down
53 changes: 53 additions & 0 deletions reference/sodium/functions/sodium-bin2base64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,59 @@
</simpara>
</refsect1>

<refsect1 role="examples"><!-- {{{ -->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as base642bin:

Can you please remove all the comments in this file? , etc. In the past this was used more often but nowadays we try to avoid it as it makes the XML harder to read.

&reftitle.examples;
<example xml:id="sodium-bin2base64.example.basic"><!-- {{{ -->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On top of the comment, no need to include xml:id for (all of the) examples.

<title><function>sodium_bin2base64</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$string = 'This is an encoded string';
echo sodium_bin2base64($string, SODIUM_BASE64_VARIANT_ORIGINAL);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
]]>
</screen>
</example><!-- }}} -->

<example xml:id="sodium-bin2base64.example.id"><!-- {{{ -->
<title>Example of the <parameter>id</parameter> parameter</title>
<programlisting role="php">
<![CDATA[
<?php
$binaryString = sodium_hex2bin('aeb6798fef4e5184ff3b5596af753487');
var_dump(sodium_bin2base64($binaryString, SODIUM_BASE64_VARIANT_ORIGINAL));
var_dump(sodium_bin2base64($binaryString, SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING));
var_dump(sodium_bin2base64($binaryString, SODIUM_BASE64_VARIANT_URLSAFE));
var_dump(sodium_bin2base64($binaryString, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(24) "rrZ5j+9OUYT/O1WWr3U0hw=="
string(22) "rrZ5j+9OUYT/O1WWr3U0hw"
string(24) "rrZ5j-9OUYT_O1WWr3U0hw=="
string(22) "rrZ5j-9OUYT_O1WWr3U0hw"
]]>
</screen>
</example><!-- }}} -->
</refsect1><!-- }}} -->

<refsect1 role="seealso"><!-- {{{ -->
&reftitle.seealso;
<simplelist>
<member><function>base64_encode</function></member>
<member><function>sodium_base642bin</function></member>
<member><function>sodium_hex2bin</function></member>
</simplelist>
</refsect1><!-- }}} -->

</refentry>
<!-- Keep this comment at the end of the file
Expand Down
1 change: 1 addition & 0 deletions reference/url/functions/base64-decode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ This is an encoded string
<para>
<simplelist>
<member><function>base64_encode</function></member>
<member><function>sodium_base642bin</function></member>
<member><link xlink:href="&url.rfc;2045">RFC 2045</link> section 6.8</member>
</simplelist>
</para>
Expand Down
1 change: 1 addition & 0 deletions reference/url/functions/base64-encode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
<para>
<simplelist>
<member><function>base64_decode</function></member>
<member><function>sodium_bin2base64</function></member>
<member><function>chunk_split</function></member>
<member><function>convert_uuencode</function></member>
Comment on lines +79 to 81

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<member><function>sodium_bin2base64</function></member>
<member><function>chunk_split</function></member>
<member><function>convert_uuencode</function></member>
<member><function>chunk_split</function></member>
<member><function>convert_uuencode</function></member>
<member><function>sodium_bin2base64</function></member>

<member><link xlink:href="&url.rfc;2045">RFC 2045</link> section 6.8</member>
Expand Down
Loading