mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-23 17:42:15 -05:00
rename pocheTool -> pocheTools
This commit is contained in:
parent
8069e235fd
commit
5ffe5cf541
@ -10,6 +10,7 @@
|
||||
|
||||
define ('POCHE_VERSION', '0.3');
|
||||
define ('MODE_DEMO', FALSE);
|
||||
define ('DEBUG_POCHE', TRUE);
|
||||
define ('CONVERT_LINKS_FOOTNOTES', FALSE);
|
||||
define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
|
||||
define ('DOWNLOAD_PICTURES', FALSE);
|
||||
@ -24,7 +25,7 @@ $storage_type = 'sqlite'; # sqlite or file
|
||||
|
||||
# /!\ Be careful if you change the lines below /!\
|
||||
|
||||
require_once 'poche/pocheTool.class.php';
|
||||
require_once 'poche/pocheTools.class.php';
|
||||
require_once 'poche/pocheCore.php';
|
||||
require_once '3rdparty/Readability.php';
|
||||
require_once '3rdparty/Encoding.php';
|
||||
|
@ -136,10 +136,16 @@ function fetch_url_content($url)
|
||||
|
||||
function display_view($view, $id = 0, $full_head = 'yes')
|
||||
{
|
||||
global $tpl, $store, $msg;
|
||||
global $tpl, $store;
|
||||
|
||||
switch ($view)
|
||||
{
|
||||
case 'install':
|
||||
pocheTool::logm('install mode');
|
||||
break;
|
||||
case 'import';
|
||||
pocheTool::logm('import mode');
|
||||
break;
|
||||
case 'export':
|
||||
$entries = $store->retrieveAll();
|
||||
$tpl->assign('export', pocheTool::renderJson($entries));
|
||||
@ -157,8 +163,8 @@ function display_view($view, $id = 0, $full_head = 'yes')
|
||||
break;
|
||||
case 'view':
|
||||
$entry = $store->retrieveOneById($id);
|
||||
|
||||
if ($entry != NULL) {
|
||||
pocheTool::logm('view link #' . $id);
|
||||
$tpl->assign('id', $entry['id']);
|
||||
$tpl->assign('url', $entry['url']);
|
||||
$tpl->assign('title', $entry['title']);
|
||||
@ -177,12 +183,9 @@ function display_view($view, $id = 0, $full_head = 'yes')
|
||||
else {
|
||||
pocheTool::logm('error in view call : entry is NULL');
|
||||
}
|
||||
|
||||
pocheTool::logm('view link #' . $id);
|
||||
break;
|
||||
default: # home view
|
||||
$entries = $store->getEntriesByView($view);
|
||||
|
||||
$tpl->assign('entries', $entries);
|
||||
|
||||
if ($full_head == 'yes') {
|
||||
@ -192,7 +195,6 @@ function display_view($view, $id = 0, $full_head = 'yes')
|
||||
}
|
||||
|
||||
$tpl->draw('entries');
|
||||
|
||||
if ($full_head == 'yes') {
|
||||
$tpl->draw('js');
|
||||
$tpl->draw('footer');
|
||||
@ -202,11 +204,11 @@ function display_view($view, $id = 0, $full_head = 'yes')
|
||||
}
|
||||
|
||||
/**
|
||||
* Appel d'une action (mark as fav, archive, delete)
|
||||
* Call action (mark as fav, archive, delete, etc.)
|
||||
*/
|
||||
function action_to_do($action, $url, $id = 0)
|
||||
{
|
||||
global $store, $msg;
|
||||
global $store;
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
|
@ -15,11 +15,9 @@ function filtre_picture($content, $url, $id)
|
||||
{
|
||||
$matches = array();
|
||||
preg_match_all('#<\s*(img)[^>]+src="([^"]*)"[^>]*>#Si', $content, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $i => $link)
|
||||
{
|
||||
foreach($matches as $i => $link) {
|
||||
$link[1] = trim($link[1]);
|
||||
if (!preg_match('#^(([a-z]+://)|(\#))#', $link[1]) )
|
||||
{
|
||||
if (!preg_match('#^(([a-z]+://)|(\#))#', $link[1])) {
|
||||
$absolute_path = get_absolute_link($link[2],$url);
|
||||
$filename = basename(parse_url($absolute_path, PHP_URL_PATH));
|
||||
$directory = create_assets_directory($id);
|
||||
@ -36,8 +34,7 @@ function filtre_picture($content, $url, $id)
|
||||
/**
|
||||
* Retourne le lien absolu
|
||||
*/
|
||||
function get_absolute_link($relative_link, $url)
|
||||
{
|
||||
function get_absolute_link($relative_link, $url) {
|
||||
/* return if already absolute URL */
|
||||
if (parse_url($relative_link, PHP_URL_SCHEME) != '') return $relative_link;
|
||||
|
||||
@ -68,7 +65,6 @@ function get_absolute_link($relative_link, $url)
|
||||
/**
|
||||
* Téléchargement des images
|
||||
*/
|
||||
|
||||
function download_pictures($absolute_path, $fullpath)
|
||||
{
|
||||
$rawdata = get_external_file($absolute_path);
|
||||
@ -111,4 +107,4 @@ function remove_directory($directory)
|
||||
}
|
||||
return rmdir($directory);
|
||||
}
|
||||
}
|
||||
}
|
@ -118,7 +118,9 @@ class pocheTools
|
||||
|
||||
public static function logm($message)
|
||||
{
|
||||
$t = strval(date('Y/m/d_H:i:s')).' - '.$_SERVER["REMOTE_ADDR"].' - '.strval($message)."\n";
|
||||
file_put_contents('./log.txt',$t,FILE_APPEND);
|
||||
if (DEBUG_POCHE) {
|
||||
$t = strval(date('Y/m/d_H:i:s')) . ' - ' . $_SERVER["REMOTE_ADDR"] . ' - ' . strval($message) . "\n";
|
||||
file_put_contents('./log.txt', $t, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user