<commit_before><?php

/*
 * This file is part of the Sonata Project package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\MediaBundle\Extra;

use Sonata\MediaBundle\Model\MediaInterface;
use Sonata\MediaBundle\Model\MediaManagerInterface;
use Sonata\MediaBundle\Provider\Pool;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Templating\EngineInterface;

class Pixlr
{
    /**
     * @var string
     */
    protected $referrer;

    /**
     * @var string
     */
    protected $secret;

    /**
     * @var MediaManagerInterface
     */
    protected $mediaManager;

    /**
     * @var RouterInterface
     */
    protected $router;

    /**
     * @var Pool
     */
    protected $pool;

    /**
     * @var EngineInterface
     */
    protected $templating;

    /**
     * @var ContainerInterface
     */
    protected $container;

    /**
     * @var string[]
     */
    protected $validFormats;

    /**
     * @var string
     */
    protected $allowEreg;

    /**
     * @param string                $referrer
     * @param string                $secret
     * @param Pool                  $pool
     * @param MediaManagerInterface $mediaManager
     * @param RouterInterface       $router
     * @param EngineInterface       $templating
     * @param ContainerInterface    $container
     */
    public function __construct($referrer, $secret, Pool $pool, MediaManagerInterface $mediaManager, RouterInterface $router, EngineInterface $templating, ContainerInterface $container)
    {
        $this->referrer = $referrer;
        $this->secret = $secret;
        $this->mediaManager = $mediaManager;
        $this->router = $router;
        $this->pool = $pool;
        $this->templating = $templating;
        $this->container = $container;

        $this->validFormats = array('jpg', 'jpeg', 'png');
        $this->allowEreg = '@https://([a-zA-Z0-9]*).pixlr.com/_temp/[0-9a-z]{24}\.[a-z]*@';
    }

    /**
     * @throws NotFoundHttpException
     *
     * @param string $id
     * @param string $mode
     *
     * @return RedirectResponse
     */<commit_msg>Allow non SSL pixlr url return (#1249)<commit_after><?php

/*
 * This file is part of the Sonata Project package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\MediaBundle\Extra;

use Sonata\MediaBundle\Model\MediaInterface;
use Sonata\MediaBundle\Model\MediaManagerInterface;
use Sonata\MediaBundle\Provider\Pool;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Templating\EngineInterface;

class Pixlr
{
    /**
     * @var string
     */
    protected $referrer;

    /**
     * @var string
     */
    protected $secret;

    /**
     * @var MediaManagerInterface
     */
    protected $mediaManager;

    /**
     * @var RouterInterface
     */
    protected $router;

    /**
     * @var Pool
     */
    protected $pool;

    /**
     * @var EngineInterface
     */
    protected $templating;

    /**
     * @var ContainerInterface
     */
    protected $container;

    /**
     * @var string[]
     */
    protected $validFormats;

    /**
     * @var string
     */
    protected $allowEreg;

    /**
     * @param string                $referrer
     * @param string                $secret
     * @param Pool                  $pool
     * @param MediaManagerInterface $mediaManager
     * @param RouterInterface       $router
     * @param EngineInterface       $templating
     * @param ContainerInterface    $container
     */
    public function __construct($referrer, $secret, Pool $pool, MediaManagerInterface $mediaManager, RouterInterface $router, EngineInterface $templating, ContainerInterface $container)
    {
        $this->referrer = $referrer;
        $this->secret = $secret;
        $this->mediaManager = $mediaManager;
        $this->router = $router;
        $this->pool = $pool;
        $this->templating = $templating;
        $this->container = $container;

        $this->validFormats = array('jpg', 'jpeg', 'png');
        $this->allowEreg = '@https?://([a-zA-Z0-9]*).pixlr.com/_temp/[0-9a-z]{24}\.[a-z]*@';
    }

    /**
     * @throws NotFoundHttpException
     *
     * @param string $id
     * @param string $mode
     *
     * @return RedirectResponse
     */
{'fraction_non_alphanumeric': 0.12170542635658915, 'fraction_numerical': 0.0031007751937984496, 'mean_word_length': 2.5617667356797793, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5473574', 'n_tokens_mistral': 1504, 'n_tokens_neox': 1476, 'n_words': 324}