/** * Attribute getter method * * @return the relatedPostsURL of the component */ function get_relatedPostsURL_attr() { $url = ''; if (!empty($this->image->relatedPost)) { $url = wiziapp_buildPostLink($this->image->relatedPost); } if (empty($url)) { // Try to get a page link $GLOBALS['WiziappLog']->write('info', "The image is: " . print_r($this->image, TRUE), 'imageGalleryCellItem.get_relatedPostsURL_attr'); $url = wiziapp_buildPageLink($this->image->relatedPost); } $GLOBALS['WiziappLog']->write('info', "The url for the related posts is: {$url}", 'imageGalleryCellItem.get_relatedPostsURL_attr'); return $url; }
function wiziapp_buildPagesListPage() { $screen_conf = $GLOBALS['WiziappScreens']->getScreenLayout('pages'); $page = array(); $pageNumber = isset($_GET['wizipage']) ? $_GET['wizipage'] : 0; $linkLimit = WiziappConfig::getInstance()->links_list_limit; $limitForRequest = $linkLimit * 2; $offset = $linkLimit * $pageNumber; $pages = get_pages(array('number' => $limitForRequest, 'offset' => $offset, 'sort_column' => 'post_date')); $section = array('section' => array('title' => '', 'id' => "allPages", 'items' => array())); //$pagesConfig = get_option('wiziapp_pages'); //$allowedPages = implode(',', $pagesConfig['pages']); /** * @todo replace this algorithm all together... * The admin should send the rules and not the allowed */ //var_dump($allowedPages); foreach ($pages as $p) { $title = str_replace('&', '&', $p->post_title); //if ( stripos($allowedPages, $title) !== FALSE ){ if (true) { $link = array('link_name' => $title, 'link_url' => wiziapp_buildPageLink($p->ID), 'link_id' => $p->ID); wiziapp_appendComponentByLayout($section['section']['items'], $screen_conf['items'], (object) $link); } } $linkCount = count($section['section']['items']); $pager = new WiziappPagination($linkCount, $linkLimit); $pager->setOffset(0); $page = $pager->extractCurrentPage($section['section']['items']); $pager->addMoreCell(__("Load %s more items", 'wiziapp'), $page); echo json_encode(wiziapp_prepareScreen($page, __(WiziappConfig::getInstance()->getScreenTitle('pages'), 'wiziapp'), 'List', false, false, false)); }
function wiziapp_buildBlogPageLink($page_name) { $page = get_page_by_title($page_name); return wiziapp_buildPageLink($page->ID); }