text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>>add('plainPassword', RepeatedType::class, [
'type' => PasswordType::class,
'invalid_message' => 'validator.password_must_match',
'first_options' => ['label' => 'user.form.password_label'],
'second_options' => ['label' => 'user.form.repeat_ne... | fim | wallabag/wallabag | php |
<|fim_suffix|>): void
{
$builder
->add('start')
->add('startOffset')
->add('end')
->add('endOffset')
;
}
}
<|fim_prefix|><?php
namespace Wallabag\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;... | fim | wallabag/wallabag | php |
<|fim_suffix|>holder',
],
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Tag::class,
]);
}
public function getBlockPrefix(): string
{
return 'tag';
}... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
clas<|fim_suffix|>public function buildForm(FormBuilderInterface ... | fim | wallabag/wallabag | php |
<|fim_suffix|>otection' => false,
]);
}
}
<|fim_prefix|><?php
namespace Wallabag\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class Searc... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Com... | fim | wallabag/wallabag | php |
<|fim_suffix|>_submit',
])
;
}
public function getBlockPrefix(): string
{
return 'upload_tagging_rule_file';
}
}
<|fim_prefix|><?php
namespace Wallabag\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\... | fim | wallabag/wallabag | php |
<|fim_suffix|>m\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Wallabag\Entity\TaggingRule;
use Wallabag\Form\DataTransformer\StringToListTransformer;
class TaggingRuleType extends AbstractType
{
public function buildForm(Fo... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Form\Type;
use FOS\UserBundle\Form\Type\RegistrationFormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
us... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Sy... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Helper;
use Graby\Graby;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mime\MimeTypes;
use Symfony\Component\Validator\Constraints\Locale as LocaleConstraint;
use Symfony\Component\Validator\Constraints\Url as UrlConstraint;
use Symfony\Component\Validator\Validator\Validat... | fim | wallabag/wallabag | php |
<|fim_suffix|>etween.
*
* @param string $value Value to mask
*
* @return string
*/
private function mask($value)
{
return \strlen($value) > 0 ? $value[0] . '*****' . $value[\strlen($value) - 1] : 'Empty value';
}
}
<|fim_prefix|><?php
namespace Wallabag\Helper;
use Defuse\... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Helper;
use enshrined\svgSanitize\Sanitizer;
use GuzzleHttp\Psr7\Uri;
use GuzzleHttp\Psr7\UriResolver;
use Psr\Log\LoggerInterface;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Helper;
use Doctrine\ORM\Mapping as ORM;
/**
* Trait to handle created & updated date of an Entity.
*/
trait EntityTimestampsTrait
{
#[ORM\PrePersist]
#[<|fim_suffix|>ew \DateTime();
}
$this->updatedAt = new \DateTime();
}
}
<|fim_middle|>ORM\PreU... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Helper;
use Html2Text\Html2Text;
use JMS\Serializer\SerializationContext;
use JMS\Serializer\SerializerBuilder;
use League\HTMLToMarkdown\HtmlConverter;
use PHPePub\Core\EPub;
use PHPePub\Core\Structure\OPF\DublinCore;
use Symfony\Component\HttpFoundation\Response;
use Symfony\C... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Helper;
use Pagerfanta\Adapter\AdapterInterface;
use Pagerfanta\Adapter\NullAdapter;
use Pagerfanta\Pagerfanta;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\Entity\User;
class PreparePagerForEntries
{
public function _... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Helper;
use GuzzleHttp\Psr7\Uri;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\Entity\Config;
use Wallabag\Entity\User;
/**
* Manage redirections to avoid redi... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Helper;
use Psr\Log\LoggerInterface;
use RulerZ\RulerZ;
use Wallabag\Entity\Entry;
use Wallabag\Repository\IgnoreOriginInstanceRuleRepository;
class RuleBasedIgnoreOriginProcessor
{
public function __construct(
protected RulerZ $rulerz,
protected LoggerInter... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Helper;
use Doctrine\Common\Collections\ArrayCollection;
use Psr\Log\LoggerInterface;
use RulerZ\RulerZ;
use Wallabag\Entity\Entry;
use Wallabag\Entity\Tag;
use Wallabag\Entity\TaggingRule;
use Wallabag\Entity\User;
use Wallabag\Repository\EntryRepository;
use Wallabag\Repository\TagRepositor... | fim | wallabag/wallabag | php |
<|fim_suffix|>Tag();
$tagEntity->setLabel($label);
}
}
// only add the tag on the entry if the relation doesn't exist
if (false === $entry->getTags()->contains($tagEntity)) {
$entry->addTag($tagEntity);
$tagsEntitie... | fim | wallabag/wallabag | php |
<|fim_suffix|> return hash($algorithm, urldecode($url));
}
}
<|fim_prefix|><?php
namespace Wallabag\Helper;
/**
* Hash URLs for privacy and performance.
*/
class UrlHasher
{
/**
* Hash the given url using the given algorithm.
* Hashed url are faster to be retrieved in the database than the ... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\HttpClient;
use GuzzleHttp\Psr7\Uri;
use Psr\Http\Message\UriInterface;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Contracts\HttpClient\ResponseInterface;
use Wallabag\SiteConfig\LoginFormAuthenticator;
use Wallabag\SiteConfig\SiteConfig... | fim | wallabag/wallabag | php |
<|fim_suffix|>face
{
$this->logger->log('debug', 'Restricted access config enabled?', ['enabled' => (int) $this->restrictedAccess]);
if (0 === (int) $this->restrictedAccess) {
return $this->httpClient->request($method, $url, $options);
}
$login = $this->authenticator->l... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Import;
use Doctrine\ORM\EntityManagerInterface;
use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Wallabag\Entity\Entry;
use Wallabag\Entity\User;
use Wallabag\Event\EntrySavedEvent;
use Wa... | fim | wallabag/wallabag | php |
<|fim_suffix|>ryToBeFlushed)) {
foreach ($entryToBeFlushed as $entry) {
$this->eventDispatcher->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME);
}
}
}
/**
* Parse entries and send them to the queue.
* It should just be a simple loop on all ... | fim | wallabag/wallabag | php |
<|fim_suffix|>= $entry['tags'];
}
return $data;
}
}
<|fim_prefix|><?php
namespace Wallabag\Import;
class ChromeImport extends BrowserImport
{
protected $filepath;
public function getName()
{
return 'Chrome';
}
public function getUrl()
{
return 'import_chr... | fim | wallabag/wallabag | php |
<|fim_suffix|>liciousImport: no entries in imported file');
return false;
}
if ($this->producer) {
$this->parseEntriesForProducer($data);
return true;
}
$this->parseEntries($data);
return true;
}
public function validateEntry(arra... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Import;
class ElcuratorImport extends WallabagImport
{
public function getName()
{
return 'elcurator';
}
public function getUrl()
{
return 'import_elcurator';
}
public function getDescription()
{
return 'import.elcurator.description';
... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Import;
class FirefoxImport extends BrowserImport
{
protected $filepath;
public function getName()
{
return 'Firefox';
}
public function getUrl()
{
return 'import_firefox';
}
public function getDescription()
{
return 'import.firef... | fim | wallabag/wallabag | php |
<|fim_suffix|> * @param string $filepath
*/
public function setFilepath($filepath): static
{
$this->filepath = $filepath;
return $this;
}
public function parseEntry(array $importedEntry)
{
$url = $importedEntry['url'];
$existingEntry = $this->em
... | fim | wallabag/wallabag | php |
<|fim_suffix|> }
/**
* Get all imports.
*
* @return array<ImportInterface>
*/
public function getAll()
{
return $this->imports;
}
}
<|fim_prefix|><?php
n<|fim_middle|>amespace Wallabag\Import;
class ImportChain
{
private $imports;
public function __construct()
... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Import;
use Symfony\Component\DependencyInjection\Com<|fim_suffix|>Reference;
class ImportCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition(ImportChain::class)) {
... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Import;
use Psr\Log\LoggerAwareInterface;
use Wallabag\Entity\User;
interface ImportInterface extends LoggerAwareInterface
{
/**
* Name of the import.
*
* @return string
*/
public function getName();
/**
* Url to start the import.
*
* @return s... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Import;
use Wallabag\Entity\Entry;
class InstapaperImport extends AbstractImport
{
private $filepath;
public function getName()
{
return 'Instapaper';
}
public function getUrl()
{
return 'import_instapaper';
}
public function getDescription(... | fim | wallabag/wallabag | php |
<|fim_suffix|>ta['preview_picture']);
$this->em->persist($entry);
++$this->importedEntries;
return $entry;
}
protected function setEntryAsRead(array $importedEntry)
{
return $importedEntry;
}
}
<|fim_prefix|><?php
namespace Wallabag\Import;
use Wallabag\Entity\Entry;... | fim | wallabag/wallabag | php |
<|fim_suffix|>;
}
}
<|fim_prefix|><?php
namespace Wallabag\Import;
use Wallabag\Entity\Entry;
class PinboardImport extends AbstractImport
{
private $filepath;
public function getName()
{
return 'Pinboard';
}
public function getUrl()
{
return 'import_pinboard';
}
... | fim | wallabag/wallabag | php |
<|fim_suffix|>try;
}
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 'archive';
return $importedEntry;
}
}
<|fim_prefix|><?php
namespace Wallabag\Import;
use Wallabag\Entity\Entry;
class PocketCsvImport extends AbstractImport
{
protected... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Import;
use Symfony\Component\DomCrawler\Crawler;
class PocketHtmlImport extends HtmlImport
{
protected $filepath;
public function getName()
{
return 'Pocket HTML';
}
public function getUrl()
{
return 'import_pocket_html';
}
public function ... | fim | wallabag/wallabag | php |
<|fim_suffix|>xceptionInterface $e) {
$this->logger->error(\sprintf('PocketImport: Failed to import: %s', $e->getMessage()), ['exception' => $e]);
return false;
}
}
/**
* Set the Http client.
*/
public function setClient(HttpClientInterface $pocketClient): void
... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Import;
use Wallabag\Entity\Entry;
class ReadabilityImport extends AbstractImport
{
private $filepath;
public function getName()
{
return 'Readability';
}
public function getUrl()
{
return 'import_readability';
}
public function getDescripti... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Import;
class ShaarliImport extends HtmlImport
{
protected $filepath;
public function getName()
{
return 'Shaarli';
}
public function getUrl()
{
return 'import_shaarli';
}
public function getDescription()
{
return 'import.shaarli.... | fim | wallabag/wallabag | php |
<|fim_suffix|>r) {
$this->logger->error('WallabagImport: user is not defined');
return false;
}
if (!file_exists($this->filepath) || !is_readable($this->filepath)) {
$this->logger->error('WallabagImport: unable to read file', ['filepath' => $this->filepath]);
... | fim | wallabag/wallabag | php |
<|fim_suffix|>Read(array $importedEntry)
{
$importedEntry['is_read'] = 1;
return $importedEntry;
}
}
<|fim_prefix|><?php
namespace Wallabag\Import;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Wallaba... | fim | wallabag/wallabag | php |
<|fim_suffix|> 'html' => $entry['content'],
'headers' => [
'content-type' => $entry['mimetype'],
],
'is_archived' => (bool) ($entry['is_archived'] || $this->markAsRead),
'is_starred' => (bool) $entry['is_starred'],
] + $entry;
}
protected ... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Mailer;
use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerI<|fim_suffix|>private readonly Environment $twig,
private $senderEmail,
private $senderName,
private $supportUrl,
) {
}
/**
* Send the auth code to the user via email.
*/
p... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wa<|fim_suffix|>= $subject) {
return false;
}
return false !== stripos((string) $subject, (string) $pattern);
}
}
<|fim_middle|>llabag\Operator\PHP;
/**
* Provides a "matches" operator used for tagging rules.
*
* It asserts that a given pattern is cont... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Operator\PHP;
/**
* Provides a "notmatches" operator used for tagging rules.
*
* It asserts that a given pattern is not contained in a subject, in a
* case-insensitive way.
*
* This operator will be used to compile tagging rules in PHP, usable
* directly on Entry objects ... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Operator\<|fim_suffix|>_invoke($subject, $pattern)
{
$count = preg_match("`$pattern`i", (string) $subject);
return \is_int($count) && $count > 0;
}
}
<|fim_middle|>PHP;
/**
* Provides a "~" operator used for ignore origin rules.
*
* It asserts that a ... | fim | wallabag/wallabag | php |
<|fim_suffix|>nt($this->registry->getManagers())) {
return false;
}
// Check, if option class was set in configuration
if (null === $configuration->getClass()) {
return false;
}
// Get actual entity manager for class
$em = $this->registry->getMan... | fim | wallabag/wallabag | php |
<|fim_suffix|> */
public function publish($msgBody, $routingKey = '', $additionalProperties = []): void
{
$this->queue->sendJob($msgBody);
}
}
<|fim_prefix|><?php
namespace Wallabag\Redis;
use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface;
use Simpleue\Queue\RedisQueue;
/**
* This is a p... | fim | wallabag/wallabag | php |
<|fim_suffix|> the right annotation associated to the right user.
*
* @param string $username
*
* @return Annotation
*/
public function findOneByUsername($username)
{
return $this->createQueryBuilder('a')
->leftJoin('a.user', 'u')
->where('u.username = :u... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Repository\Api;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Wallabag\Entity\Api\Client;
/**
* @method Client[]<|fim_suffix|>registry, Client::class);
}
public function findOneBy(array $criteria, ... | fim | wallabag/wallabag | php |
<|fim_suffix|>tory extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Config::class);
}
}
<|fim_prefix|><?php
namespace Wallabag\Repository;
use Doctrine\Bundle\DoctrineBundle\Re<|fim_middle|>pository\ServiceEntityRepository;
u... | fim | wallabag/wallabag | php |
<|fim_suffix|>ser($userId)
->select('e.id');
switch ($type) {
case 'unread':
$qb->andWhere('e.isArchived = false');
break;
case 'archive':
$qb->andWhere('e.isArchived = true');
break;
case 'starred':... | fim | wallabag/wallabag | php |
<|fim_suffix|>\Persistence\ManagerRegistry;
use Wallabag\Entity\IgnoreOriginInstanceRule;
class IgnoreOriginInstanceRuleRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, IgnoreOriginInstanceRule::class);
}
}
<|fim_pr... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Wallabag\Entity\IgnoreOriginUserRule;
class IgnoreOriginUserRu<|fim_suffix|>ule::class);
}
}
<|fim_middle|>leRepository extends ServiceEntityRepo... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Wallabag\Entity\SiteCredential;
use Wallabag\Entity\User;
use Wallabag\Helper\CryptoProxy;
/**
* SiteCredentialRepository.
*
* @method SiteCredential[] findByUs... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
use Wallabag\Entity\Tag;
/**
* @method Tag|null findOneByLabel(string $la... | fim | wallabag/wallabag | php |
<|fim_suffix|>Rule::class);
}
/**
* Remove all tagging rules for a config.
* Used when a user wants to reset.
*
* @param int $configId
*/
public function removeAllByConfigId($configId): void
{
$this->getEntityManager()
->createQuery('DELETE FROM Wallabag\Ent... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
use Wallabag\Entity\User;
/**
* @method User|null findOneById(int $id)
*/
class UserRepository extends ServiceEntityRepository
{
p... | fim | wallabag/wallabag | php |
<|fim_suffix|>rue)) {
return false;
}
return true;
}
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
{
$user = $token->getUser();
if (!$user instanceof User) {
return false;
}
return matc... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Security\Voter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Wallabag\Entity\Annotation;
use Wallabag\Entity\User;
class AnnotationVoter extends Voter
{
public const EDIT = 'EDIT';
public c... | fim | wallabag/wallabag | php |
<|fim_suffix|>, self::SHARE, self::UNSHARE, self::EXPORT, self::DELETE, self::LIST_ANNOTATIONS, self::CREATE_ANNOTATIONS, self::LIST_TAGS, self::TAG, self::UNTAG], true)) {
return false;
}
return true;
}
protected function voteOnAttribute(string $attribute, $subject, TokenInterface... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Security\Voter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\Security;
use Wallabag\Entity\IgnoreOriginInstanceRule;
class IgnoreOriginInstanceRuleVoter extends Vote... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Security\Voter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Auth<|fim_suffix|>erRule) {
return false;
}
if (!\in_array($attribute, [self::EDIT, self::DELETE], true)) {
retur... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Security\Voter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\Security;
class MainVoter extends Voter
{
public const LIST_ENTRIES = 'LIST_ENTRIES';
... | fim | wallabag/wallabag | php |
<|fim_suffix|>ay($attribute, [self::EDIT, self::DELETE], true)) {
return false;
}
return true;
}
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
{
\assert($subject instanceof SiteCredential);
$user = $token->getUser(... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Security\Voter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\Security;
use Wallabag\Entity\Tag;
use Wallabag\Entity\User;
class TagVoter extends Voter
... | fim | wallabag/wallabag | php |
<|fim_suffix|>bool
{
if (!$subject instanceof TaggingRule) {
return false;
}
if (!\in_array($attribute, [self::EDIT, self::DELETE], true)) {
return false;
}
return true;
}
protected function voteOnAttribute(string $attribute, $subject, Token... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Security\Voter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\Security;
use Wallabag\Entity\User;
class UserVoter extends Voter
{
public const EDIT ... | fim | wallabag/wallabag | php |
<|fim_suffix|>onfig);
}
}
public function buildForHost($host)
{
$host = strtolower($host);
if (str_starts_with($host, 'www.')) {
$host = substr($host, 4);
}
return $this->configs[$host] ?? false;
}
}
<|fim_prefix|><?php
namespace Wallabag\SiteConfi... | fim | wallabag/wallabag | php |
<|fim_suffix|>og
$parameters['username'] = '**masked**';
$parameters['password'] = '**masked**';
$this->logger->debug('Auth: add parameters.', ['host' => $host, 'parameters' => $parameters]);
return $config;
}
/**
* Processes login_extra_fields config, transforming an '='... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\SiteConfig;
use Symfony\Component\BrowserKit\HttpBrowser;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\ExpressionLanguage\Expression<|fim_suffix|> $loggedIn = $crawler->evaluate((string) $siteConfig->getNotLoggedInXpath());
} catch (\Throwable) {... | fim | wallabag/wallabag | php |
<|fim_suffix|>onfig
*/
public function setLoginUri($loginUri)
{
$this->loginUri = $loginUri;
return $this;
}
/**
* @return string
*/
public function getUsernameField()
{
return $this->usernameField;
}
/**
* @param string $usernameField
... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\SiteConfig;
interface SiteConfigBuilder
{
/**
* Builds the SiteConfig for a host.
*
*<|fim_suffix|>
*
* @throws \OutOfRangeException If there is no config for $host
*
* @return SiteConfig|false
*/
public function buildForHost($host... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tools;
class Utils
{
/**
* Generate a token used for Feeds.
*
* @param int $length Length of the token
*
* @return string
*/
public static function generateToken($length = 15)
{
$token = substr(base64_encode(random_bytes($length)... | fim | wallabag/wallabag | php |
<|fim_suffix|>enStorage->getToken()->getUser() : null;
if (!$user instanceof User) {
return 0;
}
return $this->tagRepository->countAllTags($user->getId());
}
/**
* Display a single line about reading stats.
*
* @return string
*/
public function disp... | fim | wallabag/wallabag | php |
<|fim_suffix|>rn `Expected class selector "${selectorValue}" to match BEM CSS pattern https://en.bem.info/methodology/css. Selector validation tool: https://regexr.com/3apms`;
},
},
],
},
};
<|fim_prefix|>module.exports = {
extends: ['stylelint-config-standard-scss'],
customSyntax: 'postcss-scss... | fim | wallabag/wallabag | javascript |
<|fim_prefix|><?php
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\Filesystem\Filesystem;
require dirname(__DIR__) . '/vendor/autoload.php';
if (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
}
if ('unit' === getCurrentTestSuite()) {
return;
}
(n... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Fixtures\Doctrine;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Wallabag\Entity\Annotation;
use Wallabag\Entity\Entry;
use Wallabag\Entity\User;
class AnnotationFixtures extends Fixtu... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Fixtures\Doctrine;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Wallabag\Entity\Config;
use Wallabag\Entity\User;
class<|fim_suffix|>[
UserFixtures::class,
... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Fixtures\Doctrine;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Wallabag\Entity\Entry;
use Wallabag\Entity\Tag;
use Wallabag\Entity\User;
class EntryFixtures extends Fix... | fim | wallabag/wallabag | php |
<|fim_suffix|> $newIgnoreOriginInstanceRule = new IgnoreOriginInstanceRule();
$newIgnoreOriginInstanceRule->setRule($ignoreOriginInstanceRule['rule']);
$manager->persist($newIgnoreOriginInstanceRule);
}
$manager->flush();
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests... | fim | wallabag/wallabag | php |
<|fim_suffix|>DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Wallabag\Entity\IgnoreOriginUserRule;
use Wallabag\Entity\User;
class IgnoreOriginUserRuleFixtures extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager): void
{
$rule = new... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Fixtures\Doctrine;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
use Wallabag\Entity\InternalSetting;
class InternalSettingFixtures extends Fixture
{
public function __construct(
private readonly array $defaultInternalSettings,
) {
... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Fixtures\Doctrine;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Wallabag\Entity\SiteCredential;
use Wallabag\Entity\User;
use Wallabag\Helper\CryptoProxy;
class SiteCredentialFixtures... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Fixtures\Doctrine;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
use Wallabag\Entity\Tag;
class TagFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
$tags = [
'foo-bar-tag' => 'foo bar', // ... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Fixtures\Doctrine;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Wallabag\Entity\Config;
use Wallabag\Entity\TaggingRule;
class TaggingRuleFixtures extends Fixture implem... | fim | wallabag/wallabag | php |
<|fim_suffix|>r->setEnabled(true);
$manager->persist($bobUser);
$this->addReference('bob-user', $bobUser);
$emptyUser = new User();
$emptyUser->setName('Empty');
$emptyUser->setEmail('empty@wallabag.org');
$emptyUser->setUsername('empty');
$emptyUser->setPlainP... | fim | wallabag/wallabag | php |
<|fim_suffix|>dmin');
$entry = $em
->getRepository(Entry::class)
->findOneByUsernameAndNotArchived('admin');
$annotation = new Annotation($user);
$annotation->setEntry($entry);
$annotation->setText('This is my annotation /o/');
$annotation->setQuote('my q... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Api;
class ConfigRestControllerTest extends WallabagApiTestCase
{
public function testGetConfig(): void
{
$this->client->request('GET', '/api/config.json');
$this->assertSame(200, $this->client->getResponse()->getStatusCode());... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Api;
use Doctrine\ORM\EntityManagerInterface;
use Wallabag\Entity\Api\Client;
use Wallabag\Entity\User;
use Wallabag\Tests\Functional\WallabagTestCase;
class DeveloperControllerTest extends WallabagTestCase
{
public function testCreateClient(): v... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Api;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\Container;
use Wallabag\Entity\Entry;
use Wallabag\Entity\Tag;
use Wallabag\Helper\ContentProxy;
class EntryRestControllerTest extends WallabagApiTestCase
{
p... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Api;
class SearchRestControllerTest extends WallabagApiTestCase
{
public function testGetSearchWithFullOptions()<|fim_suffix|>lient->request('GET', '/api/search', [
'term' => 'entry',
]);
$this->assertSame(200, $this->... | fim | wallabag/wallabag | php |
<|fim_suffix|>getLabel() . ',' . $tag2->getLabel()]);
}
$this->assertSame(200, $this->client->getResponse()->getStatusCode());
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertCount(2, $content);
$this->assertArrayHasKey('label', $content... | fim | wallabag/wallabag | php |
<|fim_suffix|>ers->get('Content-Type'));
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Api;
class TaggingRuleRestControllerTest extends WallabagApiTestCase
{
public function testExportEntry(): void
{
$this->client->request('GET', '/api/taggingrule/export');
$this->... | fim | wallabag/wallabag | php |
<|fim_suffix|>ssertSame('This value is already used.', $content['error']['username'][0]);
$this->assertSame('This value is already used.', $content['error']['email'][0]);
$this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
$client->getContainer()->get(C... | fim | wallabag/wallabag | php |
<|fim_suffix|> ->getContainer()
->get(EntityManagerInterface::class)
->getRepository(User::class)
->findOneByUserName($username)
->getId();
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Api;
use Doctrine\ORM\EntityManagerInterface;
use FOS... | fim | wallabag/wallabag | php |
<|fim_suffix|>ET', '/api/info');
$this->assertSame(200, $client->getResponse()->getStatusCode());
$content = json_decode($client->getResponse()->getContent(), true);
$this->assertArrayHasKey('appname', $content);
$this->assertArrayHasKey('version', $content);
$this->assertArra... | fim | wallabag/wallabag | php |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.