server/src/app/Libraries/CocoonUtils.php
changeset 108 be2d3b30b2e0
parent 20 a9b98b16b053
child 122 b37fde30dd4a
equal deleted inserted replaced
107:16e1473a6a99 108:be2d3b30b2e0
     1 <?php
     1 <?php
     2 namespace CorpusParole\Libraries;
     2 namespace CorpusParole\Libraries;
       
     3 
       
     4 use EasyRdf\Resource;
     3 
     5 
     4 class CocoonUtils {
     6 class CocoonUtils {
     5 
     7 
     6     const OLAC_ROLES = [
     8     const OLAC_ROLES = [
     7         'http://www.language-archives.org/OLAC/1.1/annotator',
     9         'http://www.language-archives.org/OLAC/1.1/annotator',
    59 
    61 
    60     public static function getCocoonPubUrl($id) {
    62     public static function getCocoonPubUrl($id) {
    61         return rtrim(config('corpusparole.cocoon_doc_pub_base_uri'), '/')."/$id";
    63         return rtrim(config('corpusparole.cocoon_doc_pub_base_uri'), '/')."/$id";
    62     }
    64     }
    63 
    65 
       
    66     public static function isResourceCollection($res) {
       
    67         return $res instanceof Resource &&
       
    68             (strpos(strtolower($res->getUri()), "collection", strlen(config('corpusparole.cocoon_doc_id_base_uri'))) !== FALSE);
       
    69     }
       
    70 
    64 }
    71 }