@@ -29,7 +29,7 @@ public function __construct(string $content)
2929 /**
3030 * Append all the advertising
3131 */
32- public function appendAdvertising (): string
32+ public function appendAdvertising (array $ params = [] ): string
3333 {
3434 $ thresholds = config ('ads-post-parser.thresholds ' );
3535 $ items = $ this ->dom ->find ('#adv__parsed__content > * ' );
@@ -54,7 +54,7 @@ public function appendAdvertising(): string
5454 }
5555
5656 try {
57- $ currentElement ->outertext .= Blade::render ('ads-post-parser::ads ' .array_keys ($ thresholds )[$ adsCount ]);
57+ $ currentElement ->outertext .= Blade::render ('ads-post-parser::ads ' .array_keys ($ thresholds )[$ adsCount ], [ ' params ' => $ params ] );
5858 } catch (\Exception $ e ) {
5959 // Content without ADV
6060 }
@@ -82,7 +82,7 @@ public function oldappendAdvertising(): string
8282 /**
8383 * Append a single advertising
8484 */
85- public function appendSingleAdvertising (int $ index , int $ advIndex ): string
85+ public function appendSingleAdvertising (int $ index , int $ advIndex, array $ params = [] ): string
8686 {
8787 $ items = $ this ->dom ->find ('#adv__parsed__content > * ' );
8888 $ maxLoop = count ($ items );
@@ -98,7 +98,7 @@ public function appendSingleAdvertising(int $index, int $advIndex): string
9898 ! preg_match ($ this ->blacklistBefore , $ beforeItem ->outertext ) && ($ nextItem === null || ! preg_match ($ this ->blacklistAfter , $ nextItem ->outertext ))
9999 ) {
100100 try {
101- $ beforeItem ->outertext .= Blade::render ('ads-post-parser::ads ' .$ advIndex );
101+ $ beforeItem ->outertext .= Blade::render ('ads-post-parser::ads ' .$ advIndex, [ ' params ' => $ params ] );
102102 } catch (\Exception $ e ) {
103103 // Content without ADV
104104 }
0 commit comments