public function videopostsAction() { $page = isset($_GET["page"]) ? $_GET["page"] : 1; $pageSize = 5; $widgets = Kaltura_WPModel::getLastPublishedPostWidgets($page, $pageSize); $totalCount = Kaltura_WPModel::getLastPublishedPostWidgetsCount(); $viewData['lastPage'] = false; $viewData['firstPage'] = false; if ($page * $pageSize >= $totalCount) { $viewData['lastPage'] = true; } if ($page == 1) { $viewData['firstPage'] = true; } $viewData['page'] = $page; $viewData['widgets'] = $widgets; $viewData['totalCount'] = $totalCount; $this->renderView('sidebar-widget/videoposts.php', $viewData); die; }
public function findCommentWidgets($args) { $wid = isset($args["wid"]) ? $args["wid"] : null; $entryId = isset($args["entryid"]) ? $args["entryid"] : null; if (!$wid && !$entryId) { return; } if (!$wid) { $wid = "_" . get_option("kaltura_partner_id"); } global $kaltura_comment_id; $comment = get_comment($kaltura_comment_id); // add new widget $widget = array(); $widget["id"] = $wid; $widget["entry_id"] = $entryId; $widget["type"] = Kaltura_WPModel::WIDGET_TYPE_COMMENT; $widget["post_id"] = $comment->comment_post_ID; $widget["comment_id"] = $kaltura_comment_id; $widget["status"] = Kaltura_WPModel::WIDGET_STATUS_PUBLISHED; Kaltura_WPModel::insertOrUpdateWidget($widget); }
protected function videopostsStep3() { $entries = $_POST['entries']; $createdPosts = 0; $uiConfId = $_POST['uiconf_id']; $width = $_POST['width']; $height = $_POST['height']; foreach ($entries as $entryCat) { $arr = unserialize(base64_decode($entryCat)); $entryId = $arr[0]; $entryName = $arr[1]; $categoryName = $arr[2]; // do we need to create new category? if (!Kaltura_WPModel::isCategoryExists($categoryName)) { $newCat = array('cat_name' => $categoryName); wp_insert_category($newCat); wp_cache_set('last_changed', microtime(true), 'terms'); // otherwise the category won't return when retrieving it later in the code } $category = Kaltura_WPModel::getCategoryByName($categoryName); // create the post for the video $shortCode = "[kaltura-widget uiconfid=\"{$uiConfId}\" entryid=\"{$entryId}\" width=\"{$width}\" height=\"{$height}\" /]"; $newPost = array('post_title' => $entryName, 'post_content' => $shortCode); $postId = wp_insert_post($newPost); if ($postId) { $createdPosts++; } // link the post to the category $categories = wp_get_post_categories($postId); $categories[] = $category->cat_ID; wp_set_post_categories($postId, $categories); } $params['numOfCreatedPosts'] = $createdPosts; $this->renderView('library/video-posts-screen-3.php', $params); }
public static function getLastPublishedCommentWidgetsCount() { return Kaltura_WPModel::getPublishedWidgetsByTypeCount(Kaltura_WPModel::WIDGET_TYPE_COMMENT); }