Exemplo n.º 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $response = $next($request);
     // Apply logic differently based on the nature of $response.
     if ($response instanceof Renderable) {
         $response = obfuscateEmail($response->render());
     } elseif ($response instanceof Response) {
         $content = obfuscateEmail($response->getContent());
         $response->setContent($content);
     }
     return $response;
 }
     $list->setOffset($i * $elementsPerLoop);
     $objects = $list->load();
     foreach ($objects as $object) {
         try {
             $count++;
             \Logger::info("Sending newsletter " . $count . " / " . $elementsTotal . " [" . $newsletter->getName() . "]");
             \Pimcore\Tool\Newsletter::sendMail($newsletter, $object, null, $argv[2]);
             $note = new Model\Element\Note();
             $note->setElement($object);
             $note->setDate(time());
             $note->setType("newsletter");
             $note->setTitle("sent newsletter: '" . $newsletter->getName() . "'");
             $note->setUser(0);
             $note->setData(array());
             $note->save();
             \Logger::info("Sent newsletter to: " . obfuscateEmail($object->getEmail()) . " [" . $newsletter->getName() . "]");
         } catch (\Exception $e) {
             \Logger::err($e);
         }
     }
     // check if pid exists
     if (!file_exists($pidFile)) {
         \Logger::alert("Newsletter PID not found, cancel sending process");
         exit;
     }
     // update pid
     $pidContents["lastUpdate"] = time();
     $pidContents["current"] = $count;
     writePid($pidFile, $pidContents);
     \Pimcore::collectGarbage();
 }
Exemplo n.º 3
0
/**
* Patch file content with plugin data
*
* @param    string  $content    file content to patch
* @param    array   $plgdata    plugin data
* @return   string              patched file content
*
*/
function patch($content, $plgdata)
{
    $headers = createHeaderTemplates();
    foreach ($headers as $name => $comment) {
        $newComment = '';
        switch ($name) {
            case 'authors':
                if (empty($plgdata['email'])) {
                    $newComment = formattedComment('Authors: ' . $plgdata['author']);
                } else {
                    $newComment = formattedComment('Authors: ' . $plgdata['author'] . ' - ' . obfuscateEmail($plgdata['email']));
                }
                break;
            case 'copyright':
                $newComment = formattedComment('Copyright (C) ' . strftime('%Y') . ' by the following authors:');
                break;
            case 'pi_name':
                $newComment = formattedComment($plgdata['pi_display_name'] . ' Plugin ' . $plgdata['pi_version']);
                break;
            default:
                break;
        }
        // echo "$name:\n$comment$newComment";
        if (!empty($newComment)) {
            $content = str_replace($comment, $newComment, $content);
        }
    }
    $idfield = substr($plgdata['pi_name'], 0, 1) . 'id';
    $content = str_replace(array('foobar', 'Foo Bar', 'FooBar', 'FOOBAR', 'fbid'), array($plgdata['pi_name'], $plgdata['pi_display_name'], preg_replace('/[^a-zA-Z0-9\\-_]/', '', $plgdata['pi_display_name']), strtoupper($plgdata['pi_name']), $idfield), $content);
    $content = str_replace('0.0.0', $plgdata['pi_version'], $content);
    $content = str_replace('http://www.example.com/', $plgdata['pi_homepage'], $content);
    return $content;
}
Exemplo n.º 4
0
    <link rel="manifest" href="/images/favicon/manifest.json">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="/images/favicon/ms-icon-144x144.png">
    <meta name="theme-color" content="#ffffff">
    <link href="/css/style.css" type="text/css" rel="stylesheet" />
    <script src="/vendor/propaganistas/email-obfuscator/assets/EmailObfuscator.js"></script>
</head>
<body>
    <section id="wrapper">
        <div class="profile">
            <header id="header">
                <img id="avatar" src="/images/avatar.jpg"/>
                <h1>Sebastian Kenk</h1>
                <h2>Looking for me?</h2>
            </header>
        </div>

        <div class="home">
            <p>I am a highly passionate web developer based in Freiburg, Germany. One day I will have a website, and that day is coming soon.<br />For now you can <?php 
echo obfuscateEmail('<a href="mailto:hey@sebastiankenk.de">drop me a line</a>');
?>
.</p>
        </div>

        <footer id="footer">
            <p class="small">© Copyright 2016 Sebastian Kenk</p>
        </footer>
    </section>
</body>
</html>
Exemplo n.º 5
0
 /**
  * Twig filter callback.
  *
  * @return string Filtered content
  */
 public function parse($content)
 {
     return obfuscateEmail($content);
 }