function get_image_related_page_types()
 {
     static $page_types;
     if (!is_array($page_types)) {
         $modules = array('gallery', 'alumni_gallery', 'gallery_horizons', 'gallery_vote', 'image_slideshow', 'gallery2');
         $page_types = array();
         foreach ($modules as $module) {
             $page_types = array_merge($page_types, page_types_that_use_module($module));
         }
     }
     return $page_types;
 }
Example #2
0
/**
 * Find out what page types use the a given module
 *
 * @param mixed $module_name string or array of module names
 * @return array $page_types
 */
function page_types_that_use_module($module_name)
{
    if (is_array($module_name)) {
        $ret = array();
        foreach ($module_name as $name) {
            $ret = array_merge($ret, page_types_that_use_module($name));
        }
        return $ret;
    } else {
        reason_include_once('classes/page_types.php');
        $rpts =& get_reason_page_types();
        $pt_using_module = $rpts->get_page_type_names_that_use_module($module_name);
        return $pt_using_module;
    }
}
Example #3
0
 /**
  * @todo find events page
  */
 public function get_url()
 {
     if (!isset($this->_url)) {
         if ($this->_event->get_value('url')) {
             return $this->_event->get_value('url');
         } elseif ($owner = $this->_event->get_owner()) {
             static $cache = array();
             if (!isset($cache[$owner->id()])) {
                 reason_include_once('classes/module_sets.php');
                 $ms =& reason_get_module_sets();
                 $modules = $ms->get('event_display');
                 if (!empty($modules)) {
                     $page_types = page_types_that_use_module($modules);
                     if (!empty($page_types)) {
                         array_walk($page_types, 'db_prep_walk');
                         $es = new entity_selector($owner->id());
                         $es->add_type(id_of('minisite_page'));
                         $es->add_relation('`custom_page` IN (' . implode(',', $page_types) . ')');
                         $es->set_num(1);
                         $pages = $es->run_one();
                         if (!empty($pages)) {
                             $page = current($pages);
                             $cache[$owner->id()] = build_URL_from_entity($page);
                         }
                     }
                 }
             }
             if (empty($cache[$owner->id()])) {
                 $cache[$owner->id()] = false;
                 $this->_url = '';
             } else {
                 $this->_url = $cache[$owner->id()] . '?event_id=' . $this->_event->id();
             }
         } else {
             $this->_url = '';
         }
     }
     return $this->_url;
 }
 function get_page_types()
 {
     return page_types_that_use_module('images');
 }
 function get_sitewide_media_pages($site)
 {
     $pts = page_types_that_use_module(array('av', 'av_with_filters'));
     $ptq = array();
     foreach ($pts as $pt) {
         if (isset($GLOBALS['_reason_page_types'][$pt])) {
             foreach ($GLOBALS['_reason_page_types'][$pt] as $loc => $mod) {
                 if (is_array($mod) && isset($mod['limit_to_current_page']) && false == $mod['limit_to_current_page']) {
                     $ptq[] = addslashes($pt);
                 }
             }
         }
     }
     if (!empty($ptq)) {
         $es = new entity_selector($this->site->id());
         $es->add_type(id_of('minisite_page'));
         $es->add_relation('custom_page IN("' . implode('","', $ptq) . '")');
         return $es->run_one();
     }
     return NULL;
 }
 function _update_blog_feeds()
 {
     $this->debug('updating blog feeds');
     fputs($this->_fp, "\n# blog feed rewrites\n\n") or trigger_error('Unable to write to htaccess', HIGH);
     // get all assets for this site
     $ms =& reason_get_module_sets();
     $modules = $ms->get('publication_item_display');
     $page_types = array();
     foreach ($modules as $module) {
         $pts = page_types_that_use_module($module);
         if (!empty($pts)) {
             $page_types = array_merge($page_types, $pts);
         }
     }
     array_unique($page_types);
     array_walk($page_types, 'db_prep_walk');
     if (empty($page_types)) {
         return;
     }
     // there are no publication page types in this instance of Reason
     $es = new entity_selector($this->site_id);
     $es->add_type(id_of('minisite_page'));
     $es->add_left_relationship_field('page_to_publication', 'entity', 'id', 'publication_id');
     $es->add_relation('`entity`.`state` = "Live"');
     $es->add_relation('`custom_page` IN (' . implode(',', $page_types) . ')');
     $es->set_sharing('owns');
     $blog_pages = $es->run_one();
     $blog_type_entity = new entity(id_of('publication_type'));
     $news_type_entity = new entity(id_of('news'));
     foreach ($blog_pages as $blog_page) {
         $blog = new entity($blog_page->get_value('publication_id'));
         fputs($this->_fp, 'RewriteRule ^' . MINISITE_FEED_DIRECTORY_NAME . '/' . $blog_type_entity->get_value('feed_url_string') . '/' . $blog->get_value('blog_feed_string') . '$ ' . FEED_GENERATOR_STUB_PATH . '?type_id=' . $news_type_entity->id() . '&site_id=' . $this->site->id() . '&blog_id=' . $blog->id() . '&feed=blog_posts' . "\n") or trigger_error('Unable to write to htaccess file', HIGH);
     }
 }
Example #7
0
	function find_events_page()
	{
		$module_names = $this->_get_events_module_names();
		reason_include_once( 'minisite_templates/nav_classes/default.php' );
		$ps = new entity_selector($this->parent->site_id);
		$ps->add_type( id_of('minisite_page') );
		$rels = array();
		$page_types = $this->events_page_types;
		foreach($module_names as $module_name)
		{
			$page_types = array_merge($page_types, page_types_that_use_module($module_name));
		}
		$page_types = array_map('addslashes',array_unique($page_types));
		$ps->add_relation('page_node.custom_page IN ("'.implode('","', $page_types).'")');
		$page_array = $ps->run_one();
		reset($page_array);
		$this->events_page = current($page_array);
		if (!empty($this->events_page))
		{
			$ret = $this->parent->pages->get_full_url($this->events_page->id());
		}
		$this->events_page_url = '';
		if(!empty($ret))
			$this->events_page_url = $ret;
	}