forked from wallabag/wallabag
@ -43,7 +43,7 @@ class ImportCommand extends ContainerAwareCommand
|
||||
$user = $em->getRepository('WallabagUserBundle:User')->findOneByUsername($input->getArgument('username'));
|
||||
}
|
||||
|
||||
if (!is_object($user)) {
|
||||
if (!\is_object($user)) {
|
||||
throw new Exception(sprintf('User "%s" not found', $input->getArgument('username')));
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ abstract class BrowserController extends Controller
|
||||
$markAsRead = $form->get('mark_as_read')->getData();
|
||||
$name = $this->getUser()->getId() . '.json';
|
||||
|
||||
if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
|
||||
if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
|
||||
$res = $wallabag
|
||||
->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
|
||||
->setMarkAsRead($markAsRead)
|
||||
|
||||
@ -31,7 +31,7 @@ class InstapaperController extends Controller
|
||||
$markAsRead = $form->get('mark_as_read')->getData();
|
||||
$name = 'instapaper_' . $this->getUser()->getId() . '.csv';
|
||||
|
||||
if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
|
||||
if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
|
||||
$res = $instapaper
|
||||
->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
|
||||
->setMarkAsRead($markAsRead)
|
||||
|
||||
@ -31,7 +31,7 @@ class PinboardController extends Controller
|
||||
$markAsRead = $form->get('mark_as_read')->getData();
|
||||
$name = 'pinboard_' . $this->getUser()->getId() . '.json';
|
||||
|
||||
if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
|
||||
if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
|
||||
$res = $pinboard
|
||||
->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
|
||||
->setMarkAsRead($markAsRead)
|
||||
|
||||
@ -31,7 +31,7 @@ class ReadabilityController extends Controller
|
||||
$markAsRead = $form->get('mark_as_read')->getData();
|
||||
$name = 'readability_' . $this->getUser()->getId() . '.json';
|
||||
|
||||
if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
|
||||
if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
|
||||
$res = $readability
|
||||
->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
|
||||
->setMarkAsRead($markAsRead)
|
||||
|
||||
@ -33,7 +33,7 @@ abstract class WallabagController extends Controller
|
||||
$markAsRead = $form->get('mark_as_read')->getData();
|
||||
$name = $this->getUser()->getId() . '.json';
|
||||
|
||||
if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
|
||||
if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
|
||||
$res = $wallabag
|
||||
->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
|
||||
->setMarkAsRead($markAsRead)
|
||||
|
||||
@ -77,7 +77,7 @@ abstract class BrowserImport extends AbstractImport
|
||||
*/
|
||||
public function parseEntry(array $importedEntry)
|
||||
{
|
||||
if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && is_array(reset($importedEntry))) {
|
||||
if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) {
|
||||
if ($this->producer) {
|
||||
$this->parseEntriesForProducer($importedEntry);
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ class InstapaperImport extends AbstractImport
|
||||
}
|
||||
|
||||
$entries = [];
|
||||
$handle = fopen($this->filepath, 'r');
|
||||
$handle = fopen($this->filepath, 'rb');
|
||||
while (false !== ($data = fgetcsv($handle, 10240))) {
|
||||
if ('URL' === $data[0]) {
|
||||
continue;
|
||||
@ -72,7 +72,7 @@ class InstapaperImport extends AbstractImport
|
||||
// BUT it can also be the status (since status = folder in Instapaper)
|
||||
// and we don't want archive, unread & starred to become a tag
|
||||
$tags = null;
|
||||
if (false === in_array($data[3], ['Archive', 'Unread', 'Starred'], true)) {
|
||||
if (false === \in_array($data[3], ['Archive', 'Unread', 'Starred'], true)) {
|
||||
$tags = [$data[3]];
|
||||
}
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ class PocketImport extends AbstractImport
|
||||
// - first call get 5k offset 0
|
||||
// - second call get 5k offset 5k
|
||||
// - and so on
|
||||
if (self::NB_ELEMENTS === count($entries['list'])) {
|
||||
if (self::NB_ELEMENTS === \count($entries['list'])) {
|
||||
++$run;
|
||||
|
||||
return $this->import(self::NB_ELEMENTS * $run);
|
||||
|
||||
@ -56,7 +56,7 @@ class WallabagV1Import extends WallabagImport
|
||||
|
||||
// In case of a bad fetch in v1, replace title and content with v2 error strings
|
||||
// If fetching fails again, they will get this instead of the v1 strings
|
||||
if (in_array($entry['title'], $this->untitled, true)) {
|
||||
if (\in_array($entry['title'], $this->untitled, true)) {
|
||||
$data['title'] = $this->fetchingErrorMessageTitle;
|
||||
$data['html'] = $this->fetchingErrorMessage;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user