Do not use article text for description

This commit is contained in:
Alexander Yakovlev 2020-10-01 19:58:17 +07:00
parent 1e9ca1dbd8
commit e23bead9f0
Signed by: oreolek
GPG Key ID: 1CDC4B7820C93BD3
3 changed files with 98 additions and 145 deletions

View File

@ -111,10 +111,12 @@ foreach ($articles as $article) {
$long_description = $description;
$description = substr( $description, 0, strpos($description, '<a name="cut"'));
$description = formatdsc($description);
/*
if (strlen($description) < 50) { // description is too small
$description = $long_description;
$description = formatdsc($description);
}
*/
$limit = 500 - strlen($link) - strlen($title) - 5;
$description = "$title\n\n".ellipse($description, $limit);
$description .= "\n$link";

View File

@ -1,6 +1,6 @@
{
"require": {
"longman/telegram-bot": "^0.44.1",
"longman/telegram-bot": "^0.63.1",
"sabre/xml": "^2.0",
"ryakad/pandoc-php": "^1.0",
"symfony/yaml": "^3.2",

239
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "725c9d0611923400d53ba805e2785e86",
"content-hash": "5e1c177f2e6fc662bee639eb8875918c",
"packages": [
{
"name": "doctrine/inflector",
@ -167,23 +167,23 @@
},
{
"name": "guzzlehttp/promises",
"version": "v1.3.1",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
"reference": "60d379c243457e073cff02bc323a2a86cb355631"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
"url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631",
"reference": "60d379c243457e073cff02bc323a2a86cb355631",
"shasum": ""
},
"require": {
"php": ">=5.5.0"
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.0"
"symfony/phpunit-bridge": "^4.4 || ^5.1"
},
"type": "library",
"extra": {
@ -214,20 +214,20 @@
"keywords": [
"promise"
],
"time": "2016-12-20T10:07:11+00:00"
"time": "2020-09-30T07:37:28+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "1.6.1",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "239400de7a173fe9901b9ac7c06497751f00727a"
"reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
"reference": "239400de7a173fe9901b9ac7c06497751f00727a",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3",
"reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3",
"shasum": ""
},
"require": {
@ -240,15 +240,15 @@
},
"require-dev": {
"ext-zlib": "*",
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
},
"suggest": {
"zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6-dev"
"dev-master": "1.7-dev"
}
},
"autoload": {
@ -285,7 +285,7 @@
"uri",
"url"
],
"time": "2019-07-01T23:21:34+00:00"
"time": "2020-09-30T07:37:11+00:00"
},
{
"name": "illuminate/contracts",
@ -394,29 +394,32 @@
},
{
"name": "longman/telegram-bot",
"version": "0.44.1",
"version": "0.63.1",
"source": {
"type": "git",
"url": "https://github.com/php-telegram-bot/core.git",
"reference": "e522050a5e2ac73a4c0fa47705896da0df37de3a"
"reference": "1cf5d1fd38c81df7650358d1ae85a16957db5d22"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-telegram-bot/core/zipball/e522050a5e2ac73a4c0fa47705896da0df37de3a",
"reference": "e522050a5e2ac73a4c0fa47705896da0df37de3a",
"url": "https://api.github.com/repos/php-telegram-bot/core/zipball/1cf5d1fd38c81df7650358d1ae85a16957db5d22",
"reference": "1cf5d1fd38c81df7650358d1ae85a16957db5d22",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"guzzlehttp/guzzle": "^6.2",
"monolog/monolog": "^1.22",
"php": "^5.5|^7.0"
"guzzlehttp/guzzle": "^6.3",
"php": "^5.5|^7.0",
"psr/log": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.7|^6.1",
"squizlabs/php_codesniffer": "^2.8"
"dms/phpunit-arraysubset-asserts": "^0.1.0",
"monolog/monolog": "^2.0",
"phpunit/phpunit": "^8.4",
"squizlabs/php_codesniffer": "^3.4"
},
"type": "library",
"autoload": {
@ -434,103 +437,51 @@
"email": "akalongman@gmail.com",
"homepage": "http://longman.me",
"role": "Developer"
},
{
"name": "PHP Telegram Bot Team",
"homepage": "https://github.com/php-telegram-bot/core/graphs/contributors",
"role": "Developer"
}
],
"description": "PHP telegram bot",
"description": "PHP Telegram bot",
"homepage": "https://github.com/php-telegram-bot/core",
"keywords": [
"api",
"bot",
"telegram"
],
"time": "2017-04-25T21:28:23+00:00"
},
{
"name": "monolog/monolog",
"version": "1.25.5",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "1817faadd1846cd08be9a49e905dc68823bc38c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/1817faadd1846cd08be9a49e905dc68823bc38c0",
"reference": "1817faadd1846cd08be9a49e905dc68823bc38c0",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"psr/log": "~1.0"
},
"provide": {
"psr/log-implementation": "1.0.0"
},
"require-dev": {
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
"doctrine/couchdb": "~1.0@dev",
"graylog2/gelf-php": "~1.0",
"php-amqplib/php-amqplib": "~2.4",
"php-console/php-console": "^3.1.3",
"php-parallel-lint/php-parallel-lint": "^1.0",
"phpunit/phpunit": "~4.5",
"ruflin/elastica": ">=0.90 <3.0",
"sentry/sentry": "^0.13",
"swiftmailer/swiftmailer": "^5.3|^6.0"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-mongo": "Allow sending log messages to a MongoDB server",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
"php-console/php-console": "Allow sending log messages to Google Chrome",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
"sentry/sentry": "Allow sending log messages to a Sentry server"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
"homepage": "http://github.com/Seldaek/monolog",
"keywords": [
"log",
"logging",
"psr-3"
],
"funding": [
{
"url": "https://github.com/Seldaek",
"url": "https://github.com/php-telegram-bot/core",
"type": "custom"
},
{
"url": "https://github.com/noplanman",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
"url": "https://ko-fi.com/phptelegrambot",
"type": "ko_fi"
},
{
"url": "https://liberapay.com/PHP-Telegram-Bot",
"type": "liberapay"
},
{
"url": "https://opencollective.com/php-telegram-bot",
"type": "open_collective"
},
{
"url": "https://www.patreon.com/phptelegrambot",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/longman/telegram-bot",
"type": "tidelift"
}
],
"time": "2020-07-23T08:35:51+00:00"
"time": "2020-06-24T12:05:37+00:00"
},
{
"name": "mremi/url-shortener",
@ -588,16 +539,16 @@
},
{
"name": "nesbot/carbon",
"version": "2.38.0",
"version": "2.40.1",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "d8f6a6a91d1eb9304527b040500f61923e97674b"
"reference": "d9a76d8b7eb0f97cf3a82529393245212f40ba3b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d8f6a6a91d1eb9304527b040500f61923e97674b",
"reference": "d8f6a6a91d1eb9304527b040500f61923e97674b",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d9a76d8b7eb0f97cf3a82529393245212f40ba3b",
"reference": "d9a76d8b7eb0f97cf3a82529393245212f40ba3b",
"shasum": ""
},
"require": {
@ -610,7 +561,7 @@
"doctrine/orm": "^2.7",
"friendsofphp/php-cs-fixer": "^2.14 || ^3.0",
"kylekatarnls/multi-tester": "^2.0",
"phpmd/phpmd": "^2.8",
"phpmd/phpmd": "^2.9",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.35",
"phpunit/phpunit": "^7.5 || ^8.0",
@ -673,7 +624,7 @@
"type": "tidelift"
}
],
"time": "2020-08-04T19:12:46+00:00"
"time": "2020-09-23T08:17:37+00:00"
},
{
"name": "paragonie/random_compat",
@ -1155,16 +1106,16 @@
},
{
"name": "symfony/console",
"version": "v5.1.3",
"version": "v5.1.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "2226c68009627934b8cfc01260b4d287eab070df"
"reference": "04c3a31fe8ea94b42c9e2d1acc93d19782133b00"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/2226c68009627934b8cfc01260b4d287eab070df",
"reference": "2226c68009627934b8cfc01260b4d287eab070df",
"url": "https://api.github.com/repos/symfony/console/zipball/04c3a31fe8ea94b42c9e2d1acc93d19782133b00",
"reference": "04c3a31fe8ea94b42c9e2d1acc93d19782133b00",
"shasum": ""
},
"require": {
@ -1244,7 +1195,7 @@
"type": "tidelift"
}
],
"time": "2020-07-06T13:23:11+00:00"
"time": "2020-09-18T14:27:32+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -1951,16 +1902,16 @@
},
{
"name": "symfony/service-contracts",
"version": "v2.1.3",
"version": "v2.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "58c7475e5457c5492c26cc740cc0ad7464be9442"
"reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/58c7475e5457c5492c26cc740cc0ad7464be9442",
"reference": "58c7475e5457c5492c26cc740cc0ad7464be9442",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1",
"reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1",
"shasum": ""
},
"require": {
@ -1973,7 +1924,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
"dev-master": "2.2-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -2023,20 +1974,20 @@
"type": "tidelift"
}
],
"time": "2020-07-06T13:23:11+00:00"
"time": "2020-09-07T11:33:47+00:00"
},
{
"name": "symfony/string",
"version": "v5.1.3",
"version": "v5.1.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "f629ba9b611c76224feb21fe2bcbf0b6f992300b"
"reference": "4a9afe9d07bac506f75bcee8ed3ce76da5a9343e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/f629ba9b611c76224feb21fe2bcbf0b6f992300b",
"reference": "f629ba9b611c76224feb21fe2bcbf0b6f992300b",
"url": "https://api.github.com/repos/symfony/string/zipball/4a9afe9d07bac506f75bcee8ed3ce76da5a9343e",
"reference": "4a9afe9d07bac506f75bcee8ed3ce76da5a9343e",
"shasum": ""
},
"require": {
@ -2108,20 +2059,20 @@
"type": "tidelift"
}
],
"time": "2020-07-08T08:27:49+00:00"
"time": "2020-09-15T12:23:47+00:00"
},
{
"name": "symfony/translation",
"version": "v4.4.11",
"version": "v4.4.14",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "a8ea9d97353294eb6783f2894ef8cee99a045822"
"reference": "0b8c4bb49b05b11d2b9dd1732f26049b08d96884"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/a8ea9d97353294eb6783f2894ef8cee99a045822",
"reference": "a8ea9d97353294eb6783f2894ef8cee99a045822",
"url": "https://api.github.com/repos/symfony/translation/zipball/0b8c4bb49b05b11d2b9dd1732f26049b08d96884",
"reference": "0b8c4bb49b05b11d2b9dd1732f26049b08d96884",
"shasum": ""
},
"require": {
@ -2198,20 +2149,20 @@
"type": "tidelift"
}
],
"time": "2020-07-23T08:31:43+00:00"
"time": "2020-09-24T09:40:01+00:00"
},
{
"name": "symfony/translation-contracts",
"version": "v2.1.3",
"version": "v2.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation-contracts.git",
"reference": "616a9773c853097607cf9dd6577d5b143ffdcd63"
"reference": "77ce1c3627c9f39643acd9af086631f842c50c4d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/616a9773c853097607cf9dd6577d5b143ffdcd63",
"reference": "616a9773c853097607cf9dd6577d5b143ffdcd63",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/77ce1c3627c9f39643acd9af086631f842c50c4d",
"reference": "77ce1c3627c9f39643acd9af086631f842c50c4d",
"shasum": ""
},
"require": {
@ -2223,7 +2174,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
"dev-master": "2.2-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -2273,20 +2224,20 @@
"type": "tidelift"
}
],
"time": "2020-07-06T13:23:11+00:00"
"time": "2020-09-07T11:33:47+00:00"
},
{
"name": "symfony/yaml",
"version": "v3.4.43",
"version": "v3.4.45",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "e7fa05917ae931332a42d65b577ece4d497aad81"
"reference": "ec3c2ac4d881a4684c1f0317d2107f1a4152bad9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/e7fa05917ae931332a42d65b577ece4d497aad81",
"reference": "e7fa05917ae931332a42d65b577ece4d497aad81",
"url": "https://api.github.com/repos/symfony/yaml/zipball/ec3c2ac4d881a4684c1f0317d2107f1a4152bad9",
"reference": "ec3c2ac4d881a4684c1f0317d2107f1a4152bad9",
"shasum": ""
},
"require": {
@ -2346,7 +2297,7 @@
"type": "tidelift"
}
],
"time": "2020-07-23T09:37:51+00:00"
"time": "2020-09-18T15:58:55+00:00"
}
],
"packages-dev": [],