mirror of
https://github.com/danpros/htmly.git
synced 2026-04-17 19:26:08 +05:30
PHP 8.x compatibility
Remove deprecated warning for PHP 8.x
This commit is contained in:
parent
fe9d4914d6
commit
c3c37b1f37
9 changed files with 60 additions and 131 deletions
|
|
@ -1,11 +1,4 @@
|
||||||
{
|
{
|
||||||
"repositories": [
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://github.com/Youpie/simple-html-dom"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
"config": {
|
"config": {
|
||||||
"vendor-dir": "system/vendor/",
|
"vendor-dir": "system/vendor/",
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
|
|
@ -18,8 +11,7 @@
|
||||||
"michelf/php-markdown": "1.*",
|
"michelf/php-markdown": "1.*",
|
||||||
"suin/php-rss-writer": "1.*",
|
"suin/php-rss-writer": "1.*",
|
||||||
"kanti/hub-updater": "0.*",
|
"kanti/hub-updater": "0.*",
|
||||||
"jbroadway/urlify": "^1.0",
|
"jbroadway/urlify": "^1.0"
|
||||||
"simple-html-dom/simple-html-dom": "*"
|
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": [
|
"files": [
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ function remove_accent($str)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add content
|
// Add content
|
||||||
function add_content($title, $tag, $url, $content, $user, $description = null, $media = null, $draft, $category, $type)
|
function add_content($title, $tag, $url, $content, $user, $draft, $category, $type, $description = null, $media = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$tag = explode(',', preg_replace("/\s*,\s*/", ",", rtrim($tag, ',')));
|
$tag = explode(',', preg_replace("/\s*,\s*/", ",", rtrim($tag, ',')));
|
||||||
|
|
@ -218,7 +218,7 @@ function add_content($title, $tag, $url, $content, $user, $description = null, $
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit content
|
// Edit content
|
||||||
function edit_content($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $media = null, $revertPost, $publishDraft, $category, $type)
|
function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, $type, $destination = null, $description = null, $date = null, $media = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$tag = explode(',', preg_replace("/\s*,\s*/", ",", rtrim($tag, ',')));
|
$tag = explode(',', preg_replace("/\s*,\s*/", ",", rtrim($tag, ',')));
|
||||||
|
|
@ -775,7 +775,6 @@ function migrate($title, $time, $tags, $content, $url, $user, $source)
|
||||||
} else {
|
} else {
|
||||||
$post_content = '<!--t ' . $post_title . ' t-->' . "\n" . '<!--tag' . $post_tagmd . 'tag-->' . "\n\n" . $content;
|
$post_content = '<!--t ' . $post_title . ' t-->' . "\n" . '<!--tag' . $post_tagmd . 'tag-->' . "\n\n" . $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
|
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
|
||||||
|
|
||||||
$post_content = stripslashes($post_content);
|
$post_content = stripslashes($post_content);
|
||||||
|
|
@ -789,31 +788,8 @@ function migrate($title, $time, $tags, $content, $url, $user, $source)
|
||||||
file_put_contents($dir . $filename, print_r($post_content, true));
|
file_put_contents($dir . $filename, print_r($post_content, true));
|
||||||
}
|
}
|
||||||
save_tag_i18n($post_tag, $post_tagmd);
|
save_tag_i18n($post_tag, $post_tagmd);
|
||||||
// import images
|
|
||||||
if(count($images) > 0) {
|
|
||||||
foreach ($images as $image_url) {
|
|
||||||
$imagefile = basename($image_url);
|
|
||||||
if(!@copy($image_url,'content/images/'.$imagefile))
|
|
||||||
{
|
|
||||||
$errors= error_get_last();
|
|
||||||
echo "COPY ERROR: ".$errors['type'];
|
|
||||||
echo "<br />\n".$errors['message'];
|
|
||||||
} else {
|
|
||||||
echo "$imagefile copied from remote!<br>\n";
|
|
||||||
// $images_imported++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$redirect = site_url() . 'admin/clear-cache';
|
$redirect = site_url() . 'admin/clear-cache';
|
||||||
header("Location: $redirect");
|
header("Location: $redirect");
|
||||||
} else {
|
|
||||||
echo "<h1>Found empty Fields:</h1>\r\n";
|
|
||||||
echo "post title: $post_title <br>\n";
|
|
||||||
echo "post tag: $post_tag <br>\n";
|
|
||||||
echo "post url: $post_url <br>\n";
|
|
||||||
echo "post content: ".substr($post_content, 0, 50)."<br>\n";
|
|
||||||
echo "<h2>I WILL NOT IMPORT THIS !!!</h2>\r\n<hr>\r\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -846,44 +822,7 @@ function get_feed($feed_url, $credit)
|
||||||
} else {
|
} else {
|
||||||
$source = null;
|
$source = null;
|
||||||
}
|
}
|
||||||
|
migrate($title, $time, $tags, $content, $url, $user, $source);
|
||||||
$images = array();
|
|
||||||
// identify the host-name of the rss feed we are parsing
|
|
||||||
$source_host = parse_url($feed_url);
|
|
||||||
if(empty($source_host['host'])) {
|
|
||||||
$source_host['host'] = $_SERVER['SERVER_NAME']; // seems like we are parsing a local feed
|
|
||||||
}
|
|
||||||
|
|
||||||
$cnt_images = 0;
|
|
||||||
$html = new \SimpleHtmlDom\simple_html_dom($content);
|
|
||||||
foreach ($html->find('img') as $img) {
|
|
||||||
$src = $img->src;
|
|
||||||
// identify host of img url
|
|
||||||
$img_host = parse_url($src, PHP_URL_HOST);
|
|
||||||
$img_path = parse_url($src, PHP_URL_PATH);
|
|
||||||
if(empty($img_host)) {
|
|
||||||
$img_host = $source_host['host'];
|
|
||||||
}
|
|
||||||
// we only import images if they match the host of the rss feed,
|
|
||||||
// otherwise legal consequences (copyright breach) may occur
|
|
||||||
if($img_host == $source_host['host']) {
|
|
||||||
$cnt_images ++;
|
|
||||||
$images[] = $source_host['scheme'].'://'.$img_host.$img_path;
|
|
||||||
// alter the path of the image, point to local src after import
|
|
||||||
$img->src = '/content/images/'.basename($src);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// debug
|
|
||||||
/**
|
|
||||||
if($cnt_images > 0) {
|
|
||||||
echo "<h2>IMAGES and bent content</h2>";
|
|
||||||
echo var_export($images, true);
|
|
||||||
echo "<hr>" . htmlspecialchars($html) . "<hr>";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
migrate($title, $time, $tags, $html, $url, $user, $images, $source);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return $str = '<li>Unsupported feed.</li>';
|
return $str = '<li>Unsupported feed.</li>';
|
||||||
|
|
|
||||||
|
|
@ -66,45 +66,45 @@
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format1" value="%d %B %Y" <?php if (config('date.format') === '%d %B %Y'):?>checked<?php endif;?>>
|
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format1" value="dd MMMM yyyy" <?php if (config('date.format') === 'dd MMMM yyyy'):?>checked<?php endif;?>>
|
||||||
<label class="form-check-label" for="date.format1">
|
<label class="form-check-label" for="date.format1">
|
||||||
<?php echo strftime('%d %B %Y', strtotime($date)); ?>
|
<?php echo format_date(strtotime($date), 'dd MMMM yyyy'); ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format2" value="%B %d, %Y" <?php if (config('date.format') === '%B %d, %Y'):?>checked<?php endif;?>>
|
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format2" value="MMMM dd, yyyy" <?php if (config('date.format') === 'MMMM dd, yyyy'):?>checked<?php endif;?>>
|
||||||
<label class="form-check-label" for="date.format2">
|
<label class="form-check-label" for="date.format2">
|
||||||
<?php echo strftime('%B %d, %Y', strtotime($date)); ?>
|
<?php echo format_date(strtotime($date), 'MMMM dd, yyyy'); ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format3" value="%d %b %Y" <?php if (config('date.format') === '%d %b %Y'):?>checked<?php endif;?>>
|
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format3" value="dd MMM yyyy" <?php if (config('date.format') === 'dd MMM yyyy'):?>checked<?php endif;?>>
|
||||||
<label class="form-check-label" for="date.format3">
|
<label class="form-check-label" for="date.format3">
|
||||||
<?php echo strftime('%d %b %Y', strtotime($date)); ?>
|
<?php echo format_date(strtotime($date), 'dd MMM yyyy'); ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format4" value="%b %d, %Y" <?php if (config('date.format') === '%b %d, %Y'):?>checked<?php endif;?>>
|
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format4" value="MMM dd, yyyy" <?php if (config('date.format') === 'MMM dd, yyyy'):?>checked<?php endif;?>>
|
||||||
<label class="form-check-label" for="date.format4">
|
<label class="form-check-label" for="date.format4">
|
||||||
<?php echo strftime('%b %d, %Y', strtotime($date)); ?>
|
<?php echo format_date(strtotime($date), 'MMM dd, yyyy'); ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format5" value="%d/%m/%Y" <?php if (config('date.format') === '%d/%m/%Y'):?>checked<?php endif;?>>
|
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format5" value="dd/MM/yyyy" <?php if (config('date.format') === 'dd/MM/yyyy'):?>checked<?php endif;?>>
|
||||||
<label class="form-check-label" for="date.format5">
|
<label class="form-check-label" for="date.format5">
|
||||||
<?php echo strftime('%d/%m/%Y', strtotime($date)); ?>
|
<?php echo format_date(strtotime($date), 'dd/MM/yyyy'); ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format6" value="%m/%d/%Y" <?php if (config('date.format') === '%m/%d/%Y'):?>checked<?php endif;?>>
|
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format6" value="MM/dd/yyyy" <?php if (config('date.format') === 'MM/dd/yyyy'):?>checked<?php endif;?>>
|
||||||
<label class="form-check-label" for="date.format6">
|
<label class="form-check-label" for="date.format6">
|
||||||
<?php echo strftime('%m/%d/%Y', strtotime($date)); ?>
|
<?php echo format_date(strtotime($date), 'MM/dd/yyyy'); ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format6" value="%Y-%m-%d" <?php if (config('date.format') === '%Y-%m-%d'):?>checked<?php endif;?>>
|
<input class="form-check-input" type="radio" name="-config-date.format" id="date.format6" value="yyyy-MM-dd" <?php if (config('date.format') === 'yyyy-MM-dd'):?>checked<?php endif;?>>
|
||||||
<label class="form-check-label" for="date.format6">
|
<label class="form-check-label" for="date.format6">
|
||||||
<?php echo strftime('%Y-%m-%d', strtotime($date)); ?>
|
<?php echo format_date(strtotime($date), 'yyyy-MM-dd'); ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -474,45 +474,45 @@ post('/add/content', function () {
|
||||||
|
|
||||||
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
|
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
|
||||||
if (!empty($url)) {
|
if (!empty($url)) {
|
||||||
add_content($title, $tag, $url, $content, $user, $description, null, $draft, $category, 'post');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'post', $description, null);
|
||||||
} else {
|
} else {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
add_content($title, $tag, $url, $content, $user, $description, null, $draft, $category, 'post');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'post', $description, null);
|
||||||
}
|
}
|
||||||
} elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
|
} elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
|
||||||
if (!empty($url)) {
|
if (!empty($url)) {
|
||||||
add_content($title, $tag, $url, $content, $user, $description, $image, $draft, $category, 'image');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'image', $description, $image);
|
||||||
} else {
|
} else {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
add_content($title, $tag, $url, $content, $user, $description, $image, $draft, $category, 'image');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'image', $description, $image);
|
||||||
}
|
}
|
||||||
} elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
|
} elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
|
||||||
if (!empty($url)) {
|
if (!empty($url)) {
|
||||||
add_content($title, $tag, $url, $content, $user, $description, $video, $draft, $category, 'video');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'video', $description, $video);
|
||||||
} else {
|
} else {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
add_content($title, $tag, $url, $content, $user, $description, $video, $draft, $category, 'video');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'video', $description, $video);
|
||||||
}
|
}
|
||||||
} elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
|
} elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
|
||||||
if (!empty($url)) {
|
if (!empty($url)) {
|
||||||
add_content($title, $tag, $url, $content, $user, $description, $audio, $draft, $category, 'audio');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'audio', $description, $audio);
|
||||||
} else {
|
} else {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
add_content($title, $tag, $url, $content, $user, $description, $audio, $draft, $category, 'audio');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'audio', $description, $audio);
|
||||||
}
|
}
|
||||||
} elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
|
} elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
|
||||||
if (!empty($url)) {
|
if (!empty($url)) {
|
||||||
add_content($title, $tag, $url, $content, $user, $description, $quote, $draft, $category, 'quote');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'quote', $description, $quote);
|
||||||
} else {
|
} else {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
add_content($title, $tag, $url, $content, $user, $description, $quote, $draft, $category, 'quote');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'quote', $description, $quote);
|
||||||
}
|
}
|
||||||
} elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
|
} elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
|
||||||
if (!empty($url)) {
|
if (!empty($url)) {
|
||||||
add_content($title, $tag, $url, $content, $user, $description, $link, $draft, $category, 'link');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'link', $description, $link);
|
||||||
} else {
|
} else {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
add_content($title, $tag, $url, $content, $user, $description, $link, $draft, $category, 'link');
|
add_content($title, $tag, $url, $content, $user, $draft, $category, 'link', $description, $link);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$message['error'] = '';
|
$message['error'] = '';
|
||||||
|
|
@ -2070,9 +2070,9 @@ get('/archive/:req', function ($req) {
|
||||||
$date = strtotime($req);
|
$date = strtotime($req);
|
||||||
|
|
||||||
if (isset($time[0]) && isset($time[1]) && isset($time[2])) {
|
if (isset($time[0]) && isset($time[1]) && isset($time[2])) {
|
||||||
$timestamp = strftime('%d %B %Y', $date);
|
$timestamp = format_date($date, 'dd MMMM yyyy');
|
||||||
} elseif (isset($time[0]) && isset($time[1])) {
|
} elseif (isset($time[0]) && isset($time[1])) {
|
||||||
$timestamp = strftime('%B %Y', $date);
|
$timestamp = format_date($date, 'MMMM yyyy');
|
||||||
} else {
|
} else {
|
||||||
$timestamp = $req;
|
$timestamp = $req;
|
||||||
}
|
}
|
||||||
|
|
@ -2442,37 +2442,37 @@ post('/post/:name/edit', function () {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $image, $revertPost, $publishDraft, $category, 'image');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'image', $destination, $description, $dateTime, $image);
|
||||||
|
|
||||||
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
|
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $video, $revertPost, $publishDraft, $category, 'video');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'video', $destination, $description, $dateTime, $video);
|
||||||
|
|
||||||
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
|
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $link, $revertPost, $publishDraft, $category, 'link');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'link', $destination, $description, $dateTime, $link);
|
||||||
|
|
||||||
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
|
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $quote, $revertPost, $publishDraft, $category, 'quote');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'quote', $destination, $description, $dateTime, $quote);
|
||||||
|
|
||||||
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
|
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $audio, $revertPost, $publishDraft, $category, 'audio');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'audio', $destination, $description, $dateTime, $audio);
|
||||||
|
|
||||||
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
|
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, null, $revertPost, $publishDraft, $category, 'post');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'post', $destination, $description, $dateTime, null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$message['error'] = '';
|
$message['error'] = '';
|
||||||
|
|
@ -3435,37 +3435,37 @@ post('/:year/:month/:name/edit', function () {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $image, $revertPost, $publishDraft, $category, 'image');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'image', $destination, $description, $dateTime, $image);
|
||||||
|
|
||||||
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
|
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $video, $revertPost, $publishDraft, $category, 'video');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'video', $destination, $description, $dateTime, $video);
|
||||||
|
|
||||||
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
|
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $link, $revertPost, $publishDraft, $category, 'link');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'link', $destination, $description, $dateTime, $link);
|
||||||
|
|
||||||
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
|
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $quote, $revertPost, $publishDraft, $category, 'quote');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'quote', $destination, $description, $dateTime, $quote);
|
||||||
|
|
||||||
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
|
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $audio, $revertPost, $publishDraft, $category, 'audio');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'audio', $destination, $description, $dateTime, $audio);
|
||||||
|
|
||||||
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
|
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
$url = $title;
|
$url = $title;
|
||||||
}
|
}
|
||||||
edit_content($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, null, $revertPost, $publishDraft, $category, 'post');
|
edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, 'post', $destination, $description, $dateTime, null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$message['error'] = '';
|
$message['error'] = '';
|
||||||
|
|
|
||||||
|
|
@ -570,7 +570,7 @@ function get_category_info($category)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strtolower($category) == 'uncategorized') {
|
if (strtolower($category ?? '') == 'uncategorized') {
|
||||||
return default_category();
|
return default_category();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1432,7 +1432,7 @@ EOF;
|
||||||
echo '<ul class="month">';
|
echo '<ul class="month">';
|
||||||
|
|
||||||
foreach ($by_month as $month => $count) {
|
foreach ($by_month as $month => $count) {
|
||||||
$name = strftime('%B', mktime(0, 0, 0, $month, 1, 2010));
|
$name = format_date(mktime(0, 0, 0, $month, 1, 2010), 'MMMM');
|
||||||
echo '<li class="item"><a href="' . site_url() . 'archive/' . $year . '-' . $month . '">' . $name . '</a>';
|
echo '<li class="item"><a href="' . site_url() . 'archive/' . $year . '-' . $month . '">' . $name . '</a>';
|
||||||
echo ' <span class="count">(' . $count . ')</span></li>';
|
echo ' <span class="count">(' . $count . ')</span></li>';
|
||||||
}
|
}
|
||||||
|
|
@ -1596,7 +1596,7 @@ function has_pagination($total, $perpage, $page = 1)
|
||||||
}
|
}
|
||||||
$totalPage = ceil($total / $perpage);
|
$totalPage = ceil($total / $perpage);
|
||||||
$number = i18n('Page') . ' ' . $page . ' ' . i18n('of') . ' ' . $totalPage;
|
$number = i18n('Page') . ' ' . $page . ' ' . i18n('of') . ' ' . $totalPage;
|
||||||
$pager = get_pagination($page, $total, $perpage, 2);
|
$pager = get_pagination($total, $page, $perpage, 2);
|
||||||
return array(
|
return array(
|
||||||
'prev' => $page > 1,
|
'prev' => $page > 1,
|
||||||
'next' => $total > $page * $perpage,
|
'next' => $total > $page * $perpage,
|
||||||
|
|
@ -1608,7 +1608,7 @@ function has_pagination($total, $perpage, $page = 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
//function to return the pagination string
|
//function to return the pagination string
|
||||||
function get_pagination($page = 1, $totalitems, $perpage = 10, $adjacents = 1, $pagestring = '?page=')
|
function get_pagination($totalitems, $page = 1, $perpage = 10, $adjacents = 1, $pagestring = '?page=')
|
||||||
{
|
{
|
||||||
//defaults
|
//defaults
|
||||||
if(!$adjacents) $adjacents = 1;
|
if(!$adjacents) $adjacents = 1;
|
||||||
|
|
@ -2152,7 +2152,7 @@ function menu($class = null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return preg_replace('~<(?:!DOCTYPE|/?(?:html|head|body))[^>]*>\s*~i', '', utf8_decode($doc->saveHTML($doc->documentElement)));
|
return preg_replace('~<(?:!DOCTYPE|/?(?:html|head|body))[^>]*>\s*~i', '', mb_convert_encoding($doc->saveHTML($doc->documentElement), 'UTF-8'));
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -3225,11 +3225,11 @@ function replace_href($string, $tag, $class, $url)
|
||||||
if ($_tag->getAttribute('class') == $class) {
|
if ($_tag->getAttribute('class') == $class) {
|
||||||
// If match class get the href value
|
// If match class get the href value
|
||||||
$old = $_tag->getAttribute('href');
|
$old = $_tag->getAttribute('href');
|
||||||
$new = $_tag->setAttribute('href', $url . utf8_decode($old));
|
$new = $_tag->setAttribute('href', $url . mb_convert_encoding($old, 'UTF-8'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return preg_replace('~<(?:!DOCTYPE|/?(?:html|head|body))[^>]*>\s*~i', '', utf8_decode($doc->saveHTML($doc->documentElement)));
|
return preg_replace('~<(?:!DOCTYPE|/?(?:html|head|body))[^>]*>\s*~i', '', mb_convert_encoding($doc->saveHTML($doc->documentElement), 'UTF-8'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3251,16 +3251,14 @@ function get_language()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function format_date($date)
|
function format_date($date, $date_format = null)
|
||||||
{
|
{
|
||||||
|
if (empty($date_format)) {
|
||||||
$date_format = config('date.format');
|
$date_format = config('date.format');
|
||||||
|
|
||||||
if (!isset($date_format) || empty($date_format)) {
|
|
||||||
return strftime('%e %B %Y', $date);
|
|
||||||
} else {
|
|
||||||
return strftime($date_format, $date);
|
|
||||||
}
|
}
|
||||||
|
$formatter = new IntlDateFormatter(config('language'), IntlDateFormatter::LONG, IntlDateFormatter::NONE, config('timezone'), IntlDateFormatter::GREGORIAN, $date_format);
|
||||||
|
|
||||||
|
return $formatter->format($date);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Kanti;
|
namespace Kanti;
|
||||||
|
#[\AllowDynamicProperties]
|
||||||
class CacheOneFile
|
class CacheOneFile
|
||||||
{
|
{
|
||||||
protected $fileName = "";
|
protected $fileName = "";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Kanti;
|
namespace Kanti;
|
||||||
|
#[\AllowDynamicProperties]
|
||||||
class HubUpdater
|
class HubUpdater
|
||||||
{
|
{
|
||||||
protected $options = array(
|
protected $options = array(
|
||||||
|
|
|
||||||
|
|
@ -1898,7 +1898,7 @@ class MarkdownExtra extends \Michelf\Markdown {
|
||||||
# in: text ~~deleted~~ from doc
|
# in: text ~~deleted~~ from doc
|
||||||
# out: text <del>deleted</del> from doc
|
# out: text <del>deleted</del> from doc
|
||||||
#
|
#
|
||||||
$parts = preg_split('/(?<![~])(~~)(?![~])/', $text, null, PREG_SPLIT_DELIM_CAPTURE);
|
$parts = preg_split('/(?<![~])(~~)(?![~])/', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
|
|
||||||
//don't bother if nothing to do...
|
//don't bother if nothing to do...
|
||||||
if(count($parts) <= 1)
|
if(count($parts) <= 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue