sub_categories_array = array(); foreach ($pt->sub_categories as $cat_key => $subs) { $pt->sub_categories_array["'".$cat_key."'"] = ''; foreach ($subs as $sub_key => $sub_value) { $selected = ''; if (!empty($_GET['sub_category_id'])) { $selected = ($_GET['sub_category_id'] == $sub_key) ? 'selected' : ''; } $pt->sub_categories_array["'".$cat_key."'"] .= ''; } } $query = ''; $multi_query = ''; $limit = 50; $respond_error = 0; $search_made = 0; $page_id = 1; if (!empty($_GET['query']) || !empty($_GET['multi-query'])) { if (!empty($_GET['query'])) { $query = PT_Secure($_GET['query']); } else if ($_GET['multi-query']) { $query = PT_Secure($_GET['multi-query']); $multi_query = $query; $explode = explode(',', $query); if (!isset($_SESSION['keyword-id']) && empty($_GET['finished'])) { $query = $_SESSION['keyword-id'] = 0; $query = $explode[0]; } else { $query = $explode[$_SESSION['keyword-id']]; } } if (!empty($_GET['limit']) && $limit < 101) { $limit = (int) PT_Secure($_GET['limit']); } $search_made = 1; $page_id = 1; if (!empty($_GET['page-query'])) { if (is_numeric($_GET['page-query'])) { $page_id = PT_Secure($_GET['page-query']); } } $query = urlencode($query); $call_url = "https://api.dailymotion.com/videos/?search=$query&page=$page_id&limit=$limit&fields=thumbnail_1080_url,thumbnail_large_url,title,duration,description,tags,id"; $get_videos = connect_to_url($call_url); $get_videos = json_decode($get_videos); if (!empty($get_videos)) { if (!empty($get_videos->total)) { $ids = array(); foreach ($get_videos->list as $key => $video) { $check_if_exists = $db->where('daily', $video->id)->getValue(T_VIDEOS, 'count(*)'); if ($check_if_exists == 0) { $ids[] = $video->id; } } } } else { $respond_error = 1; $error_text = 'Error connecting to Dailmotion API, you might reached your daily limit, please try again later.'; } } if (empty($ids) && empty($respond_error)) { $keyword_id = (isset($_SESSION['keyword-id'])) ? $_SESSION['keyword-id'] : null; if (!empty($explode[$keyword_id + 1])) { $_SESSION['keyword-id'] = $_SESSION['keyword-id'] + 1; } else { unset($_SESSION['keyword-id']); if (empty($_GET['finished']) && $search_made == 1) { header("Location: " . PT_LoadAdminLinkSettings('import-from-dailymotion?finished=1')); } } } $user_id = 0; $username = ''; if (!empty($_GET['username']) && isset($_GET['username'])) { $username = PT_Secure($_GET['username']); $user = $db->where('username', $username)->getOne(T_USERS); if (!empty($user)) { $user_id = $user->id; } else{ $respond_error = 1; $error_text = 'user not found'; } } $category_filter = array_keys(ToArray($pt->categories))[0]; if (!empty($_GET['category_id'])) { if (in_array($_GET['category_id'], array_keys(ToArray($pt->categories)))) { $category_filter = $_GET['category_id']; } } $get_ini = ini_get('max_input_vars'); $auto_import = 0; if (!empty($_GET['auto_import'])) { $auto_import = 1; } ?>
If you want to import more than 180 videos by one click, you need to increase max_input_vars in your php.ini file.

Import From Dailymotion

Import Videos From Dailymotion
sub_categories_array["'1'"])) { ?> style="display: none;" id="sub_category_div">

Videos

list as $key => $video) { $thumb = PT_GetMedia('upload/photos/thumbnail.jpg'); if (!empty($video->thumbnail_1080_url)) { $thumb = $video->thumbnail_1080_url; } else if (!empty($video->thumbnail_large_url)) { $thumb = $video->thumbnail_large_url; } $thumb = str_replace('http://', 'https://', $thumb); $tags = ''; if (is_array($video->tags)) { $tags_array = array(); $tag_count = 0; foreach ($video->tags as $key => $tag) { if ($tag_count < 11) { $tags_array[] = $tag; } $tag_count++; } $tags = implode(',', $tags_array); } $duration = '00:00'; if (!empty($video->duration)) { $duration = gmdate("i:s", $video->duration); } $array_data = array( 'ID' => $video->id, 'TITLE' => $video->title, 'DESC' => $video->description, 'THUMB' => $thumb, 'TAGS' => $tags, 'DURATION' => $duration ); echo PT_LoadAdminPage('import-from-dailymotion/list', $array_data); } } else { echo '
No videos found, try another page.
'; } ?>

Auto Import Successfully Completed!

videos successfully imported.

Error found while fetching the videos!