mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-30 04:51:01 +00:00
store domainName in database
This commit is contained in:
parent
d990dc6f05
commit
c2257428b2
7 changed files with 8 additions and 42 deletions
|
@ -266,6 +266,7 @@ class Entry
|
|||
{
|
||||
$this->content = $content;
|
||||
$this->readingTime = Tools::getReadingTime($content);
|
||||
$this->domainName = parse_url($this->url, PHP_URL_HOST);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
services:
|
||||
wallabag_core.twig.extension:
|
||||
class: Wallabag\CoreBundle\Twig\Extension\WallabagExtension
|
||||
tags:
|
||||
- { name: twig.extension }
|
||||
|
||||
wallabag_core.helper.detect_active_theme:
|
||||
class: Wallabag\CoreBundle\Helper\DetectActiveTheme
|
||||
arguments:
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<li><a title="{% trans %}Toggle mark as read{% endtrans %}" class="tool icon-check icon {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
|
||||
<li><a title="{% trans %}toggle favorite{% endtrans %}" class="tool icon-star icon {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}toggle favorite{% endtrans %}</span></a></li>
|
||||
<li><a title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}delete{% endtrans %}</span></a></li>
|
||||
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.url | e | domainName }}</span></a></li>
|
||||
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.domainName }}</span></a></li>
|
||||
</ul>
|
||||
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{% extends "WallabagCoreBundle::layout.html.twig" %}
|
||||
|
||||
{% block title %}{{ entry.title|raw }} ({{ entry.url | e | domainName }}){% endblock %}
|
||||
{% block title %}{{ entry.title|raw }} ({{ entry.domainName }}){% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="article_toolbar">
|
||||
<ul class="links">
|
||||
<li class="topPosF"><a href="#top" title="{% trans %}Back to top{% endtrans %}" class="tool top icon icon-arrow-up-thick"><span>{% trans %}Back to top{% endtrans %}</span></a></li>
|
||||
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.url | e | domainName }}</span></a></li>
|
||||
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.domainName }}</span></a></li>
|
||||
<li><a title="{% trans %}Mark as read{% endtrans %}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
|
||||
<li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li>
|
||||
<li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}Delete{% endtrans %}</span></a></li>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<span class="bold"><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %}: {{ entry.title|e }}" class="tool original grey-text"><span>{{ entry.url | e | domainName }}</span></a></bold>
|
||||
<span class="bold"><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %}: {{ entry.title|e }}" class="tool original grey-text"><span>{{ entry.domainName }}</span></a></bold>
|
||||
|
||||
<ul class="tools links right">
|
||||
<li>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "WallabagCoreBundle::layout.html.twig" %}
|
||||
|
||||
{% block title %}{{ entry.title|raw }} ({{ entry.url | e | domainName }}){% endblock %}
|
||||
{% block title %}{{ entry.title|raw }} ({{ entry.domainName }}){% endblock %}
|
||||
|
||||
{% block menu %}
|
||||
<nav class="hide-on-large-only">
|
||||
|
@ -123,7 +123,7 @@ main {
|
|||
<div id="article">
|
||||
<header class="mbm">
|
||||
<h1>{{ entry.title|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{% trans %}Edit title{% endtrans %}">✎</a></h1>
|
||||
<a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link"><span>{{ entry.url | e | domainName }}</span></a>
|
||||
<a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link"><span>{{ entry.domainName }}</span></a>
|
||||
</header>
|
||||
<aside class="tags">
|
||||
tags: {% for tag in entry.tags %}<a href="./?view=tag&id={{ tag.id }}">{{ tag.label }}</a> {% endfor %}<a href="./?view=edit-tags&id={{ entry.id }}" title="{% trans %}Edit tags{% endtrans %}">✎</a>
|
||||
|
@ -135,4 +135,4 @@ main {
|
|||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Twig\Extension;
|
||||
|
||||
class WallabagExtension extends \Twig_Extension
|
||||
{
|
||||
public function getFilters()
|
||||
{
|
||||
return array(
|
||||
new \Twig_SimpleFilter('domainName', array($this, 'getDomainName')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the domain name for a URL.
|
||||
*
|
||||
* @param $url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDomainName($url)
|
||||
{
|
||||
return parse_url($url, PHP_URL_HOST);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'wallabag_extension';
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue