ヤミRoot VoidGate
User / IP
:
216.73.216.143
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
logercm
/
dev.loger.cm
/
fixtures
/
assert
/
Viewing: lorenzo.tar
pinky/src/inky-center.xsl 0000644 00000001763 15117742341 0011461 0 ustar 00 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="utf-8" indent="no"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="center/*"> <xsl:variable name="classes"> float-center <xsl:value-of select="@class"/> </xsl:variable> <xsl:copy> <xsl:attribute name="align">center</xsl:attribute> <xsl:attribute name="class"><xsl:value-of select="normalize-space($classes)" /></xsl:attribute> <xsl:apply-templates select="node()|@*" /> </xsl:copy> </xsl:template> <xsl:template match="center/menu/item"> <xsl:copy> <xsl:attribute name="class">float-center <xsl:value-of select="@class"/></xsl:attribute> <xsl:apply-templates select="node()|@*" /> </xsl:copy> </xsl:template> </xsl:stylesheet> pinky/src/inky.xsl 0000644 00000017461 15117742341 0010205 0 ustar 00 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="utf-8" indent="no"/> <xsl:variable name="columnCount" select="12" /> <xsl:strip-space elements="*" /> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="//container"> <table align="center" class="{normalize-space(concat(@class, ' container'))}"> <xsl:copy-of select="@*[name()!='class']"/> <tbody> <tr> <td><xsl:apply-templates/></td> </tr> </tbody> </table> </xsl:template> <xsl:template match="//row"> <table class="{normalize-space(concat(@class, ' row'))}"> <xsl:copy-of select="@*[name()!='class']"/> <tbody> <tr> <xsl:apply-templates/> </tr> </tbody> </table> </xsl:template> <xsl:template match="//columns"> <xsl:variable name="colCount" select="count(../*)"/> <xsl:variable name="first"> <xsl:if test="position() = 1">first</xsl:if> </xsl:variable> <xsl:variable name="last"> <xsl:if test="position() = last()">last</xsl:if> </xsl:variable> <xsl:variable name="smallSize"> <xsl:choose> <xsl:when test="@small"><xsl:value-of select="@small" /></xsl:when> <xsl:otherwise><xsl:value-of select="$columnCount" /></xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="largeSize"> <xsl:choose> <xsl:when test="@large"><xsl:value-of select="@large" /></xsl:when> <xsl:when test="@small"><xsl:value-of select="@small" /></xsl:when> <xsl:otherwise><xsl:value-of select="floor($columnCount div $colCount)" /></xsl:otherwise> </xsl:choose> </xsl:variable> <th class="{normalize-space(concat('small-', $smallSize, ' large-', $largeSize, ' ', $first, ' ', $last, ' ', 'columns', ' ', @class))}"> <xsl:copy-of select="@*[name()!='class' and name()!='large' and name()!='small' and name()!='no-expander']"/> <table> <tr> <th> <xsl:apply-templates/> </th> <xsl:if test="not(row) and not(*[contains(@class, '.row')])"> <xsl:if test="$largeSize = $columnCount and (not(@no-expander) or @no-expander = 'false')"> <th class="expander"></th> </xsl:if> </xsl:if> </tr> </table> </th> </xsl:template> <xsl:template match="//spacer"> <xsl:variable name="showOrHide"> <xsl:choose> <xsl:when test="@size-sm">hide-for-large</xsl:when> <xsl:when test="@size-lg">show-for-large</xsl:when> </xsl:choose> </xsl:variable> <xsl:variable name="size"> <xsl:choose> <xsl:when test="@size-sm"><xsl:value-of select="@size-sm" /></xsl:when> <xsl:when test="@size-lg"><xsl:value-of select="@size-lg" /></xsl:when> <xsl:when test="@size"><xsl:value-of select="@size" /></xsl:when> <xsl:otherwise>16</xsl:otherwise> </xsl:choose> </xsl:variable> <table class="{normalize-space(concat(@class, ' spacer ', $showOrHide))}"> <tbody> <tr> <td height="{$size}" style="font-size:{$size}px;line-height:{$size}px;"> </td> </tr> </tbody> </table> <xsl:if test="@size-lg and @size-sm"> <table class="{normalize-space(concat(@class, ' spacer show-for-large'))}"> <tbody> <tr> <td height="{@size-lg}" style="font-size:{@size-lg}px;line-height:{@size-lg}px;"> </td> </tr> </tbody> </table> </xsl:if> </xsl:template> <xsl:template match="//button"> <table class="{normalize-space(concat(@class, ' button'))}"> <xsl:copy-of select="@*[name()!='class' and name()!='href' and name()!='target']"/> <tr> <td> <table> <tr> <td> <xsl:choose> <xsl:when test="contains(@class,'expand')"> <center> <a align="center" class="float-center"> <xsl:copy-of select="@target"/> <xsl:copy-of select="@href"/> <xsl:apply-templates /> </a> </center> </xsl:when> <xsl:otherwise> <a> <xsl:copy-of select="@target"/> <xsl:copy-of select="@href"/> <xsl:apply-templates /> </a> </xsl:otherwise> </xsl:choose> </td> </tr> </table> </td> <xsl:if test="contains(@class,'expand')"> <td class="expander"></td> </xsl:if> </tr> </table> </xsl:template> <xsl:template match="//menu"> <table class="{normalize-space(concat(@class, ' menu'))}"> <xsl:copy-of select="@*[name()!='class']"/> <tr> <td> <table> <tr> <xsl:apply-templates /> </tr> </table> </td> </tr> </table> </xsl:template> <xsl:template match="//menu/item"> <th class="{normalize-space(concat(@class, ' menu-item'))}"> <a> <xsl:copy-of select="@target"/> <xsl:copy-of select="@href"/> <xsl:apply-templates /> </a> </th> </xsl:template> <xsl:template match="//callout"> <table class="callout"> <xsl:copy-of select="@*[name()!='class']"/> <tr> <th class="{normalize-space(concat('callout-inner ', @class))}"><xsl:apply-templates /></th> <th class="expander"></th> </tr> </table> </xsl:template> <xsl:template match="//wrapper"> <table class="{normalize-space(concat(@class, ' wrapper'))}" align="center"> <xsl:copy-of select="@*[name()!='class']"/> <tr> <td class="wrapper-inner"><xsl:apply-templates /></td> </tr> </table> </xsl:template> <xsl:template match="//block-grid"> <table class="{normalize-space(concat(@class, ' block-grid up-', @up))}"> <xsl:copy-of select="@*[name()!='class' and name()!='up']"/> <tr><xsl:apply-templates /></tr> </table> </xsl:template> <xsl:template match="//h-line"> <table class="{normalize-space(concat(@class, ' h-line'))}"> <xsl:copy-of select="@*[name()!='class']"/> <tr> <th> </th> </tr> </table> </xsl:template> </xsl:stylesheet> pinky/src/pinky.php 0000644 00000010350 15117742341 0010334 0 ustar 00 <?php namespace Pinky; use DOMDocument; use XSLTProcessor; /** * Returns the template processors instances * * @return XSLTProcessor[] */ function createInkyProcessor() { /* * Enable libxml extensions (such as DOM, XMLWriter and XMLReader) to load external entities. * Used to prevent such type of warning: * Warning: DOMDocument::load(): I/O warning : failed to load external entity "/path/to/vendor/lorenzo/pinky/src/inky.xsl" * Deprecated since PHP 8.0 */ if (\PHP_VERSION_ID < 80000) { libxml_disable_entity_loader(false); } $general = new DOMDocument(); $general->load(__DIR__ . "/inky.xsl"); $centering = new DOMDocument(); $centering->load(__DIR__ . "/inky-center.xsl"); $security = \XSL_SECPREF_READ_FILE | \XSL_SECPREF_READ_NETWORK | \XSL_SECPREF_DEFAULT; $centerProcessor = new XSLTProcessor(); $centerProcessor->setSecurityPrefs($security); $centerProcessor->importStylesheet($centering); $generalProcessor = new XSLTProcessor(); $generalProcessor->setSecurityPrefs($security); $generalProcessor->importStylesheet($general); return [$centerProcessor, $generalProcessor]; } /** * Processes the provided document using the passed XSLTProcessor instance. * * @param XSLTProcessor[] $processors A pre-configured list of processors to apply to the document * @param DOMDocument $doc The document to be processed * @return DOMDocument */ function transformWithProcessor(array $processors, DOMDocument $doc) { foreach ($processors as $processor) { $doc = $processor->transformToDoc($doc); } return $doc; } /** * Returns the same document after replacing all the relevant tags from the * Inky templating language * * @param DOMDocument $doc The document to process * @return DOMDocument */ function transformDOM(DOMDocument $doc) { return transformWithProcessor(createInkyProcessor(), $doc); } /** * Returns a DOMDocument after replacing all the relevant tags from the * Inky templating language in the provided file * * @param string $filePath The file containing the template to process * @return DOMDocument */ function transformFile($filePath) { return transformDOM(loadTemplateFile($filePath)); } /** * Returns a DOMDocument after replacing all the relevant tags from the * Inky templating language in the provided string * * @param string $xml The document to process * @return DOMDocument */ function transformString($xml) { return transformDOM(loadTemplateString($xml)); } /** * Returns a DOMDocument after parsing the contents of the specified file * * @param string $filePath The file to parse * @return DOMDocument */ function loadTemplateFile($filePath) { return loadTemplateString(file_get_contents($filePath)); } /** * Returns a DOMDocument after parsing the contents of the specified string * * @param string $html The string to parse * @return DOMDocument */ function loadTemplateString($html) { $document = new DOMDocument('1.0', 'UTF-8'); $internalErrors = libxml_use_internal_errors(true); $document->loadHTML(mb_encode_numericentity($html, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8')); libxml_use_internal_errors($internalErrors); $document->formatOutput = true; return $document; } /** * Yields each of the transformed files as a DOMDocument * * @param string[] $files List of file paths to process * @return \Traversable */ function transformManyFiles($files) { $proc = createInkyProcessor(); foreach ($files as $k => $file) { yield $k => transformWithProcessor($proc, loadTemplateFile($file)); } } /** * Yields each of the transformed strings as a DOMDocument * * @param string[] $xmls List of xml strings to process * @return \Traversable */ function transformManyStrings($xmls) { $proc = createInkyProcessor(); foreach ($xmls as $k => $xml) { yield $k => transformWithProcessor($proc, loadTemplateString($xml)); } } /** * Yields each of the transformed DOMDocument objects * * @param DOMDocument[] $docs List of DOMDocument objects to process * @return \Traversable */ function transformManyDocs($docs) { $proc = createInkyProcessor(); foreach ($docs as $k => $doc) { yield $k => transformWithProcessor($proc, $doc); } } pinky/tests/ComponentsTest.php 0000644 00000027275 15117742341 0012560 0 ustar 00 <?php use PHPUnit\Framework\TestCase; use function Pinky\transformString; class ComponentsTest extends TestCase { public function testCenterAppliesClassToFirstChild() { $doc =<<<doc <center> <div></div> </center> doc; $expected =<<<doc <center> <div align="center" class="float-center"></div> </center> doc; $this->assertSameDocuments($doc, $expected); } public function testCenterDoesRecurse() { $doc =<<<doc <center> <center> <p>Hello</p> </center> </center> doc; $expected =<<<doc <center> <center align="center" class="float-center"> <p align="center" class="float-center">Hello</p> </center> </center> doc; $this->assertSameDocuments($doc, $expected); } public function testCenterWithContainerNested() { $doc =<<<doc <center> <container> <p>Hello</p> </container> </center> doc; $expected =<<<doc <center> <table align="center" class="float-center container"> <tbody> <tr><td><p>Hello</p></td></tr> </tbody> </table> </center> doc; $this->assertSameDocuments($doc, $expected); } public function testCenterWithButtonNested() { $doc =<<<doc <center> <button href="http://zurb.com">Button</button> </center> doc; $expected =<<<doc <center> <table align="center" class="float-center button"> <tr> <td> <table> <tr> <td><a href="http://zurb.com">Button</a></td> </tr> </table> </td> </tr> </table> </center> doc; $this->assertSameDocuments($doc, $expected); } public function testCenterAppliesClassToMenuItems() { $doc =<<<doc <center> <menu> <item href="#"></item> </menu> </center> doc; $expected =<<<doc <center> <table align="center" class="float-center menu"> <tr> <td> <table> <tr> <th class="float-center menu-item"> <a href="#"></a> </th> </tr> </table> </td> </tr> </table> </center> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateSimpleButton() { $doc =<<<doc <button href="http://zurb.com">Button</button> doc; $expected =<<<doc <table class="button"> <tr> <td> <table> <tr> <td><a href="http://zurb.com">Button</a></td> </tr> </table> </td> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateButtonWithTarget() { $doc =<<<doc <button href="http://zurb.com" target="_blank">Button</button> doc; $expected =<<<doc <table class="button"> <tr> <td> <table> <tr> <td><a href="http://zurb.com" target="_blank">Button</a></td> </tr> </table> </td> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateButtonWithClasses() { $doc =<<<doc <button class="small alert" href="http://zurb.com">Button</button> doc; $expected =<<<doc <table class="small alert button"> <tr> <td> <table> <tr> <td><a href="http://zurb.com">Button</a></td> </tr> </table> </td> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateExpandedButton() { $doc =<<<doc <button class="expand" href="http://zurb.com">Button</button> doc; $expected =<<<doc <table class="expand button"> <tr> <td> <table> <tr> <td> <center><a href="http://zurb.com" align="center" class="float-center">Button</a></center> </td> </tr> </table> </td> <td class="expander"></td> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateMenuWithContent() { $doc =<<<doc <menu> <item href="http://zurb.com">Item</item> </menu> doc; $expected =<<<doc <table class="menu"> <tr> <td> <table> <tr> <th class="menu-item"><a href="http://zurb.com">Item</a></th> </tr> </table> </td> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateMenuWithContentAndTarget() { $doc =<<<doc <menu> <item href="http://zurb.com" target="_blank">Item</item> </menu> doc; $expected =<<<doc <table class="menu"> <tr> <td> <table> <tr> <th class="menu-item"><a href="http://zurb.com" target="_blank">Item</a></th> </tr> </table> </td> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateMenuWithClasses() { $doc =<<<doc <menu class="vertical"> <h1>Hey!</h1> </menu> doc; $expected =<<<doc <table class="vertical menu"> <tr> <td> <table> <tr> <h1>Hey!</h1> </tr> </table> </td> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateMemuWithoutItemTag() { $doc =<<<doc <menu> <th class="menu-item"><a href="http://zurb.com">Item 1</a></th> </menu> doc; $expected =<<<doc <table class="menu"> <tr> <td> <table> <tr> <th class="menu-item"><a href="http://zurb.com">Item 1</a></th> </tr> </table> </td> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateCallout() { $doc =<<<doc <callout>Callout</callout> doc; $expected =<<<doc <table class="callout"> <tr> <th class="callout-inner">Callout</th> <th class="expander"></th> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateCalloutWithClasses() { $doc =<<<doc <callout class="primary">Callout</callout> doc; $expected =<<<doc <table class="callout"> <tr> <th class="callout-inner primary">Callout</th> <th class="expander"></th> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateSpacer() { $doc =<<<doc <spacer size="10"></spacer> doc; $expected =<<<doc <table class="spacer"> <tbody> <tr> <td height="10" style="font-size:10px;line-height:10px;"> </td> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateSmallSpacerCorrectly() { $doc =<<<doc <spacer size-sm="10"></spacer> doc; $expected =<<<doc <table class="spacer hide-for-large"> <tbody> <tr> <td height="10" style="font-size:10px;line-height:10px;"> </td> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateSpacerWithDefaultSize() { $doc =<<<doc <spacer></spacer> doc; $expected =<<<doc <table class="spacer"> <tbody> <tr> <td height="16" style="font-size:16px;line-height:16px;"> </td> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateLargeSpacerCorrectly() { $doc =<<<doc <spacer size-lg="10"></spacer> doc; $expected =<<<doc <table class="spacer show-for-large"> <tbody> <tr> <td height="10" style="font-size:10px;line-height:10px;"> </td> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testSpacerGetClassesCopied() { $doc =<<<doc <spacer size="10" class="bgcolor"></spacer> doc; $expected =<<<doc <table class="bgcolor spacer"> <tbody> <tr> <td height="10" style="font-size:10px;line-height:10px;"> </td> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testSpacerElementsWithBothSizes() { $doc =<<<doc <spacer size-sm="10" size-lg="20"></spacer> doc; $expected =<<<doc <table class="spacer hide-for-large"> <tbody> <tr> <td height="10" style="font-size:10px;line-height:10px;"> </td> </tr> </tbody> </table> <table class="spacer show-for-large"> <tbody> <tr> <td height="20" style="font-size:20px;line-height:20px;"> </td> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateWrapper() { $doc =<<<doc <wrapper class="header"></wrapper> doc; $expected =<<<doc <table class="header wrapper" align="center"> <tr> <td class="wrapper-inner"></td> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateHLine() { $doc =<<<doc <h-line class="dotted"> doc; $expected =<<<doc <table class="dotted h-line"> <tr> <th> </th> </tr> </table> doc; $this->assertSameDocuments($doc, $expected); } protected function assertSameDocuments($doc, $expectedS) { $expected = new DOMDocument(); $expected->loadHTML($expectedS); $result = transformString($doc); $result->formatOutput = true; $this->assertXmlStringEqualsXmlString($expected->saveXML(), $result->saveXML()); } } pinky/tests/EncodingTest.php 0000644 00000001701 15117742341 0012143 0 ustar 00 <?php use PHPUnit\Framework\TestCase; use function Pinky\transformString; class EncodingTest extends TestCase { /** * @param string $expected * @param string $input * * @dataProvider provideStrings */ public function testMultiByteContent($expected, $input) { $this->assertEquals($expected, trim(transformString($input)->saveHTML())); } public static function provideStrings() { yield [ '<html><body><p>ASCII only</p></body></html>', 'ASCII only', ]; yield [ '<html><body><p>Twoje zamówienie oczekuje na wpłatę zadatku 🇳🇱</p></body></html>', 'Twoje zamówienie oczekuje na wpłatę zadatku 🇳🇱', ]; yield [ '<html><body><p>Привет мир!</p></body></html>', 'Привет мир!', ]; } } pinky/tests/GridTest.php 0000644 00000020562 15117742341 0011310 0 ustar 00 <?php use PHPUnit\Framework\TestCase; use function Pinky\transformString; class GridTest extends TestCase { public function testFullDocument() { $doc =<<<doc <!doctype html> <html> <head></head> <body> <container class="extra"></container> </body> </html> doc; $expected =<<<doc <!doctype html> <html> <head></head> <body> <table align="center" class="extra container"> <tbody> <tr><td></td></tr> </tbody> </table> </body> </html> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateAContainerTable() { $doc = "<container>Something</container>"; $expected =<<<doc <table align="center" class="container"> <tbody> <tr><td>Something</td></tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateARow() { $doc = "<row></row>"; $expected =<<<doc <table class="row"> <tbody> <tr></tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateSingleColumnHasPositionClasses() { $doc = <<<doc <row> <columns large="12" small="12">One</columns> </row> doc; $expected =<<<doc <table class="row"> <tbody> <tr> <th class="small-12 large-12 first last columns"> <table> <tr> <th>One</th> <th class="expander"></th> </tr> </table> </th> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateColumnNoExpander() { $doc = '<columns large="12" small="12" no-expander>One</columns>'; $expected =<<<doc <th class="small-12 large-12 first last columns"> <table> <tr> <th>One</th> </tr> </table> </th> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateColumnNoExpanderTrue() { $doc = '<columns large="12" small="12" no-expander="true">One</columns>'; $expected =<<<doc <th class="small-12 large-12 first last columns"> <table> <tr> <th>One</th> </tr> </table> </th> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateColumnNoExpanderFalse() { $doc = '<columns large="12" small="12" no-expander="false">One</columns>'; $expected =<<<doc <th class="small-12 large-12 first last columns"> <table> <tr> <th>One</th> <th class="expander"></th> </tr> </table> </th> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateTwoColumns() { $doc =<<<doc <row> <columns large="6" small="12">One</columns> <columns large="6" small="12">Two</columns> </row> doc; $expected =<<<doc <table class="row"> <tbody> <tr> <th class="small-12 large-6 first columns"> <table> <tr> <th>One</th> </tr> </table> </th> <th class="small-12 large-6 last columns"> <table> <tr> <th>Two</th> </tr> </table> </th> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testCreateThreeColumns() { $doc =<<<doc <row> <columns large="4" small="12">One</columns> <columns large="4" small="12">Two</columns> <columns large="4" small="12">Three</columns> </row> doc; $expected =<<<doc <table class="row"> <tbody> <tr> <th class="small-12 large-4 first columns"> <table> <tr> <th>One</th> </tr> </table> </th> <th class="small-12 large-4 columns"> <table> <tr> <th>Two</th> </tr> </table> </th> <th class="small-12 large-4 last columns"> <table> <tr> <th>Three</th> </tr> </table> </th> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testAutomaticLargeSizeWhenMissing() { $doc =<<<doc <columns small="4">One</columns> <columns small="8">Two</columns> doc; $expected =<<<doc <th class="small-4 large-4 first columns"> <table> <tr> <th>One</th> </tr> </table> </th> <th class="small-8 large-8 last columns"> <table> <tr> <th>Two</th> </tr> </table> </th> doc; $this->assertSameDocuments($doc, $expected); } public function testNestedGrid() { $doc =<<<doc <row><columns><row></row></columns></row> doc; $expected =<<<doc <table class="row"> <tbody> <tr> <th class="small-12 large-12 first last columns"> <table> <tr> <th> <table class="row"> <tbody> <tr></tr> </tbody> </table> </th> </tr> </table> </th> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testAttributesAreTransferred() { $doc =<<<doc <row dir="rtl"><columns dir="rtl" valign="middle" align="center">One</columns></row> doc; $expected =<<<doc <table dir="rtl" class="row"> <tbody> <tr> <th class="small-12 large-12 first last columns" dir="rtl" valign="middle" align="center"> <table> <tr> <th>One</th> <th class="expander"></th> </tr> </table> </th> </tr> </tbody> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testBlockGridSyntax() { $doc =<<<doc <block-grid up="4"></block-grid> doc; $expected =<<<doc <table class="block-grid up-4"> <tr></tr> </table> doc; $this->assertSameDocuments($doc, $expected); } public function testBlockCopyClassesToFinalOutput() { $doc =<<<doc <block-grid up="4" class="show-for-large"></block-grid> doc; $expected =<<<doc <table class="show-for-large block-grid up-4"> <tr></tr> </table> doc; $this->assertSameDocuments($doc, $expected); } protected function assertSameDocuments($doc, $expectedS) { $expected = new DOMDocument(); $expected->loadHTML($expectedS); $result = transformString($doc); $this->assertXmlStringEqualsXmlString($expected->saveXML(), $result->saveXML()); } } pinky/.editorconfig 0000644 00000000377 15117742341 0010367 0 ustar 00 ; This file is for unifying the coding style for different editors and IDEs. ; More information at http://editorconfig.org root = true [*] indent_style = space indent_size = 4 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true pinky/.gitattributes 0000644 00000000055 15117742341 0010576 0 ustar 00 .github/ export-ignore .tests/ export-ignore pinky/.gitignore 0000644 00000000053 15117742341 0007671 0 ustar 00 vendor composer.lock .phpunit.result.cache pinky/LICENSE 0000644 00000002103 15117742341 0006704 0 ustar 00 The MIT License (MIT) Copyright (c) 2017 José Lorenzo Rodríguez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. pinky/README.md 0000644 00000001640 15117742341 0007163 0 ustar 00 # Pinky A PHP Transpiler for ([Inky](https://github.com/foundation/inky)), the templating language made for the Foundation for Email framework. ## Installation You can install this bundle using composer composer require lorenzo/pinky ## Usage and Examples ### Basic Usage ```php <?php use Pinky; $transpiled = Pinky\transformFile('path/to/file.html'); // $transpiled is an instance of DOMDocument echo $transpiled->saveHTML(); ``` You can transpile strings directly: ```php <?php use Pinky; $transpiled = Pinky\transformString('<row>Contents</row>'); echo $transpiled->saveHTML(); ``` And you can also transpile many files or strings in batch: ```php <?php use Pinky; $files = [$path1, $path2, $path3]; $transpiled = Pinky\transformManyFiles($files); foreach ($transpiled as $result) { echo $result->saveHTML(); } ``` ## License See the [LICENSE](LICENSE) file for license info (it's the MIT license). pinky/composer.json 0000644 00000001204 15117742341 0010422 0 ustar 00 { "name": "lorenzo/pinky", "description": "A Foundation for Emails (Inky) template transpiler", "type": "library", "keywords": ["inky", "foundation", "zurb", "email", "template"], "license": "MIT", "authors": [ { "name": "Jose Lorenzo Rodriguez", "email": "jose.zap@gmail.com" } ], "autoload": { "files": ["src/pinky.php"] }, "require": { "php": ">=5.6.0", "ext-dom": "*", "ext-libxml": "*", "ext-xsl": "*" }, "require-dev": { "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21 || ^9.5.10" } } pinky/phpunit.xml.dist 0000644 00000000575 15117742341 0011065 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <phpunit bootstrap="./vendor/autoload.php" colors="true"> <testsuites> <testsuite name="Pinky test suite"> <directory suffix="Test.php">./tests</directory> </testsuite> </testsuites> <filter> <whitelist> <directory>./src</directory> </whitelist> </filter> </phpunit>
Coded With 💗 by
0x6ick