Skip to content

Commit

Permalink
[TASK] fix youtube.com/watch links => only video ID will be saved
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanti committed Feb 10, 2015
1 parent 82dff17 commit 5d6ec84
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions system/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function edit_post($title, $tag, $url, $content, $oldfile, $destination = null,

$post_title = $title;
$post_fi = $fi;
$post_vid = $vid;
$post_vid = str_replace(["http://", "https://", "www.", "youtube", ".com", "/watch?v=", "/embed/"], "", $vid);
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
Expand Down Expand Up @@ -157,11 +157,11 @@ function edit_page($title, $url, $content, $oldfile, $destination = null, $descr
// Add blog post
function add_post($title, $tag, $url, $content, $user, $description = null, $fi, $vid)
{

$post_date = date('Y-m-d-H-i-s');
$post_title = $title;
$post_fi = $fi;
$post_vid = $vid;
$post_vid = str_replace(["http://", "https://", "www.", "youtube", ".com", "/watch?v=", "/embed/"], "", $vid);
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
Expand All @@ -170,7 +170,7 @@ function add_post($title, $tag, $url, $content, $user, $description = null, $fi,
$post_description = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . "\n\n" . $content;
$post_content = '<!--fi ' . $post_fi . ' fi-->' . "\n\n" . '<!--vid ' . $post_vid . ' vid-->' . "\n\n" . $post_content;
$post_content = '<!--fi ' . $post_fi . ' fi-->' . "\n\n" . '<!--vid ' . $post_vid . ' vid-->' . "\n\n" . $post_content;

if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
Expand Down

0 comments on commit 5d6ec84

Please sign in to comment.