当前位置: 首页>>代码示例>>PHP>>正文


PHP Media::getInstance方法代码示例

本文整理汇总了PHP中Media::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Media::getInstance方法的具体用法?PHP Media::getInstance怎么用?PHP Media::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Media的用法示例。


在下文中一共展示了Media::getInstance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: objectForData

 public static function objectForData($data, $model = null, $className = null)
 {
     if (!$model) {
         $model = Media::getInstance();
     }
     if (!strlen($className) || $className == 'Asset') {
         if (!isset($data['kind'])) {
             $data['kind'] = 'asset';
         }
         switch ($data['kind']) {
             case 'asset':
                 $className = 'Asset';
                 break;
             case 'scheme':
                 require_once dirname(__FILE__) . '/scheme.php';
                 $className = 'Scheme';
                 break;
             case 'resource':
                 require_once dirname(__FILE__) . '/resource.php';
                 $className = 'Resource';
                 break;
             case 'version':
                 require_once dirname(__FILE__) . '/version.php';
                 $className = 'Version';
                 break;
             case 'episode':
             case 'clip':
                 require_once dirname(__FILE__) . '/episode.php';
                 $className = 'Episode';
                 break;
             case 'show':
             case 'series':
                 require_once dirname(__FILE__) . '/show.php';
                 $className = 'Show';
                 break;
             default:
                 if ($cs = $model->locateObject('[scheme:' . $data['kind'] . ']', null, 'scheme')) {
                     require_once dirname(__FILE__) . '/classification.php';
                     $className = 'Classification';
                     break;
                 }
                 trigger_error('Asset::objectForData(): No suitable class for a "' . $data['kind'] . '" asset is available', E_USER_NOTICE);
                 return null;
         }
     }
     return parent::objectForData($data, $model, $className);
 }
开发者ID:nexgenta,项目名称:media,代码行数:47,代码来源:asset.php

示例2: print_favorite_selector_xx


//.........这里部分代码省略.........
                                if ($TEXT_DIRECTION == "ltr") {
                                    $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                } else {
                                    $submenu["label"] .= " ‏(" . $favorite["gid"] . ")‏";
                                }
                            }
                            unset($indilist[$pid]);
                        }
                        if ($favorite["type"] == "FAM") {
                            $submenu["link"] = "family.php?famid=" . $favorite["gid"] . "&ged={$GEDCOM}";
                            $submenu["label"] = PrintReady(get_family_descriptor($favorite["gid"]));
                            if ($SHOW_ID_NUMBERS) {
                                if ($TEXT_DIRECTION == "ltr") {
                                    $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                } else {
                                    $submenu["label"] .= " ‏(" . $favorite["gid"] . ")‏";
                                }
                            }
                            unset($famlist[$pid]);
                        }
                        if ($favorite["type"] == "SOUR") {
                            $submenu["link"] = "source.php?sid=" . $favorite["gid"] . "&ged={$GEDCOM}";
                            $submenu["label"] = PrintReady(get_source_descriptor($favorite["gid"]));
                            if ($SHOW_ID_NUMBERS) {
                                if ($TEXT_DIRECTION == "ltr") {
                                    $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                } else {
                                    $submenu["label"] .= " ‏(" . $favorite["gid"] . ")‏";
                                }
                            }
                            unset($sourcelist[$pid]);
                        }
                        if ($favorite["type"] == "OBJE") {
                            $media = Media::getInstance($pid);
                            if (!is_null($media)) {
                                $submenu["link"] = "mediaviewer.php?mid=" . $favorite["gid"] . "&ged={$GEDCOM}";
                                $submenu["label"] = PrintReady($media->getTitle());
                                if ($SHOW_ID_NUMBERS) {
                                    if ($TEXT_DIRECTION == "ltr") {
                                        $submenu["label"] .= " (" . $favorite["gid"] . ")";
                                    } else {
                                        $submenu["label"] .= " ‏(" . $favorite["gid"] . ")‏";
                                    }
                                }
                                if (isset($medialist[$pid])) {
                                    unset($medialist[$pid]);
                                }
                            }
                        }
                        $submenu["labelpos"] = "right";
                        $submenu["class"] = "favsubmenuitem";
                        $submenu["hoverclass"] = "favsubmenuitem_hover";
                        $menu["items"][] = $submenu;
                    }
                }
            }
            $pid = $mypid;
            $GEDCOM = $mygedcom;
            if (!empty($username) && strpos($_SERVER["SCRIPT_NAME"], "individual.php") !== false) {
                $menu["items"][] = "separator";
                $submenu = array();
                $submenu["label"] = $pgv_lang["add_to_my_favorites"];
                $submenu["labelpos"] = "right";
                $submenu["link"] = "individual.php?action=addfav&gid={$pid}&pid={$pid}";
                $submenu["class"] = "favsubmenuitem";
                $submenu["hoverclass"] = "favsubmenuitem_hover";
开发者ID:bitweaver,项目名称:phpgedview,代码行数:67,代码来源:bit_print.php

示例3: get_REPO_rows

     }
 }
 // Fetch all data, regardless of privacy
 $rows = get_REPO_rows($WT_TREE, $term);
 // Filter for privacy
 foreach ($rows as $row) {
     $repository = Repository::getInstance($row->xref, $WT_TREE, $row->gedcom);
     if ($repository->canShowName()) {
         $data[] = array('value' => $repository->getXref(), 'label' => $repository->getFullName());
     }
 }
 // Fetch all data, regardless of privacy
 $rows = get_OBJE_rows($WT_TREE, $term);
 // Filter for privacy
 foreach ($rows as $row) {
     $media = Media::getInstance($row->xref, $WT_TREE, $row->gedcom);
     if ($media->canShowName()) {
         $data[] = array('value' => $media->getXref(), 'label' => '<img src="' . $media->getHtmlUrlDirect() . '" width="25"> ' . $media->getFullName());
     }
 }
 // Fetch all data, regardless of privacy
 $rows = get_FAM_rows($WT_TREE, $term);
 // Filter for privacy
 foreach ($rows as $row) {
     $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
     if ($family->canShowName()) {
         $marriage_year = $family->getMarriageYear();
         if ($marriage_year) {
             $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName() . ', <i>' . $marriage_year . '</i>');
         } else {
             $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName());
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:autocomplete.php

示例4: find_highlighted_object

/**
 * find the highlighted media object for a gedcom entity
 *
 * Rules for finding the highlighted media object:
 * 1. The first _PRIM Y object will be used regardless of level in gedcom record
 * 2. The first level 1 object will be used if there if it doesn't have _PRIM N (level 1 objects appear on the media tab on the individual page)
 *
 * @param string $pid the individual, source, or family id
 * @param string $indirec the gedcom record to look in
 * @return array an object array with indexes "thumb" and "file" for thumbnail and filename
 */
function find_highlighted_object($pid, $indirec)
{
    global $MEDIA_DIRECTORY, $MEDIA_DIRECTORY_LEVELS, $PGV_IMAGE_DIR, $PGV_IMAGES, $MEDIA_EXTERNAL;
    global $GEDCOMS, $GEDCOM, $TBLPREFIX, $gBitDb;
    if (!showFactDetails("OBJE", $pid)) {
        return false;
    }
    $object = array();
    $media = array();
    //-- handle finding the media of remote objects
    $ct = preg_match("/(.*):(.*)/", $pid, $match);
    if ($ct > 0) {
        require_once '../classes/class_serviceclient.php';
        $client = ServiceClient::getInstance($match[1]);
        if (!is_null($client)) {
            $mt = preg_match_all('/\\n\\d OBJE @(' . PGV_REGEX_XREF . ')@/', $indirec, $matches, PREG_SET_ORDER);
            for ($i = 0; $i < $mt; $i++) {
                $mediaObj = Media::getInstance($matches[$i][1]);
                $mrec = $mediaObj->getGedcomRecord();
                if (!empty($mrec)) {
                    $file = get_gedcom_value("FILE", 1, $mrec);
                    $row = array($matches[$i][1], $file, $mrec, $matches[$i][0]);
                    $media[] = $row;
                }
            }
        }
    }
    //-- find all of the media items for a person
    $media = $gBitDb->query("SELECT m_media, m_file, m_gedrec, mm_gedrec FROM {$TBLPREFIX}media, {$TBLPREFIX}media_mapping WHERE m_media=mm_media AND m_gedfile=mm_gedfile AND m_gedfile=? AND mm_gid=? ORDER BY mm_order", array($GEDCOMS[$GEDCOM]["id"], $pid));
    while ($row = $media->fetchRow()) {
        if (displayDetailsById($row['m_media'], 'OBJE') && !FactViewRestricted($row['m_media'], $row['m_gedrec'])) {
            $level = 0;
            $ct = preg_match("/(\\d+) OBJE/", $row['mm_gedrec'], $match);
            if ($ct > 0) {
                $level = $match[1];
            }
            if (strstr($row['mm_gedrec'], "_PRIM ")) {
                $thum = get_gedcom_value('_THUM', $level + 1, $row['mm_gedrec']);
                $prim = get_gedcom_value('_PRIM', $level + 1, $row['mm_gedrec']);
            } else {
                $thum = get_gedcom_value('_THUM', 1, $row['m_gedrec']);
                $prim = get_gedcom_value('_PRIM', 1, $row['m_gedrec']);
            }
            if ($prim == 'N') {
                continue;
            }
            // Skip _PRIM N objects
            if ($prim == 'Y') {
                // Take the first _PRIM Y object
                $object["file"] = check_media_depth($row['m_file']);
                $object["thumb"] = thumbnail_file($row['m_file'], true, false, $pid);
                //				$object["_PRIM"] = $prim;	// Not sure whether this is needed.
                $object["_THUM"] = $thum;
                // This overrides GEDCOM's "Use main image as thumbnail" option
                $object["level"] = $level;
                $object["mid"] = $row['m_media'];
                break;
                // Stop looking: we found a suitable image
            }
            if ($level == 1 && empty($object)) {
                // Take the first level 1 object, but keep looking for an overriding _PRIM Y
                $object["file"] = check_media_depth($row['m_file']);
                $object["thumb"] = thumbnail_file($row['m_file'], true, false, $pid);
                //				$object["_PRIM"] = $prim;	// Not sure whether this is needed.
                $object["_THUM"] = $thum;
                // This overrides GEDCOM's "Use main image as thumbnail" option
                $object["level"] = $level;
                $object["mid"] = $row['m_media'];
            }
        }
    }
    return $object;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:84,代码来源:functions.php

示例5: init

 function init()
 {
     global $MEDIA_DIRECTORY, $USE_MEDIA_FIREWALL, $GEDCOM, $pgv_changes;
     $filename = decrypt(safe_GET('filename'));
     $this->mid = safe_GET_xref('mid');
     if ($USE_MEDIA_FIREWALL && empty($filename) && empty($this->mid)) {
         // this section used by mediafirewall.php to determine what media file was requested
         if (isset($_SERVER['REQUEST_URI'])) {
             // NOTE: format of this server variable:
             // Apache: /phpGedView/media/a.jpg
             // IIS:    /phpGedView/mediafirewall.php?404;http://server/phpGedView/media/a.jpg
             $requestedfile = $_SERVER['REQUEST_URI'];
             // urldecode the request
             $requestedfile = rawurldecode($requestedfile);
             // make sure the requested file is in the media directory
             if (strpos($requestedfile, $MEDIA_DIRECTORY) !== false) {
                 // strip off the pgv directory and media directory from the requested url so just the image information is left
                 $filename = substr($requestedfile, strpos($requestedfile, $MEDIA_DIRECTORY) + strlen($MEDIA_DIRECTORY) - 1);
                 // if user requested a thumbnail, lookup permissions based on the original image
                 $filename = str_replace('/thumbs', '', $filename);
             }
         }
     }
     //Checks to see if the File Name ($filename) exists
     if (!empty($filename)) {
         //If the File Name ($filename) is set, then it will call the method to get the Media ID ($this->mid) from the File Name ($filename)
         $this->mid = get_media_id_from_file($filename);
         if (!$this->mid) {
             //This will set the Media ID to be false if the File given doesn't match to anything in the database
             $this->mid = false;
             // create a very basic gedcom record for this file so that the functions of the media object will work
             // this is used by the media firewall when requesting an object that exists in the media firewall directory but not in the gedcom
             $this->mediaobject = new Media("0 @" . "0" . "@ OBJE\n1 FILE " . $filename);
         }
     }
     //checks to see if the Media ID ($this->mid) is set. If the Media ID isn't set then there isn't any information avaliable for that picture the picture doesn't exist.
     if ($this->mid) {
         //This creates a Media Object from the getInstance method of the Media Class. It takes the Media ID ($this->mid) and creates the object.
         $this->mediaobject = Media::getInstance($this->mid);
         //This sets the controller ID to be the Media ID
         $this->pid = $this->mid;
     }
     if (is_null($this->mediaobject)) {
         return false;
     }
     $this->mediaobject->ged_id = PGV_GED_ID;
     // This record is from a file
     //-- perform the desired action
     switch ($this->action) {
         case "addfav":
             $this->addFavorite();
             break;
         case "accept":
             $this->acceptChanges();
             break;
         case "undo":
             $this->mediaobject->undoChange();
             break;
     }
     if ($this->mediaobject->canDisplayDetails()) {
         $this->canedit = PGV_USER_CAN_EDIT;
     }
 }
开发者ID:bitweaver,项目名称:phpgedview,代码行数:63,代码来源:media_ctrl.php

示例6: autocomplete_OBJE

/**
* returns OBJEcts matching filter
* @return Array of string
*/
function autocomplete_OBJE($FILTER)
{
    $rows = get_autocomplete_OBJE($FILTER);
    $data = array();
    foreach ($rows as $row) {
        $media = Media::getInstance($row["m_media"]);
        if ($media && $media->canDisplayDetails()) {
            $data[$row["m_media"]] = "<img alt=\"" . $media->getXref() . "\" src=\"" . $media->getThumbnail() . "\" width=\"40\" /> " . $media->getFullName();
        }
    }
    return $data;
}
开发者ID:rathervague,项目名称:phpgedview,代码行数:16,代码来源:autocomplete.php

示例7: autocomplete_OBJE

/**
* returns OBJEcts matching filter
* @return Array of string
*/
function autocomplete_OBJE($FILTER)
{
    global $TBLPREFIX, $gBitDb;
    $sql = "SELECT m_media FROM {$TBLPREFIX}media WHERE (m_titl LIKE ? OR m_media LIKE ?) AND m_gedfile=?";
    $rows = $gBitDb->query($sql, array("%{$FILTER}%", "%{$FILTER}%", PGV_GED_ID), PGV_AUTOCOMPLETE_LIMIT);
    $data = array();
    while ($row = $rows->fetchRows()) {
        $media = Media::getInstance($row['m_media']);
        if ($media && $media->canDisplayDetails()) {
            $data[$row['m_media']] = "<img alt=\"" . $media->getXref() . "\" src=\"" . $media->getThumbnail() . "\" width=\"40\" /> " . $media->getFullName();
        }
    }
    return $data;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:18,代码来源:autocomplete.php

示例8: fetch_linked_obje

function fetch_linked_obje($xref, $link, $ged_id)
{
    global $TBLPREFIX, $gBitDb;
    $rows = $gBitDb->getAll("SELECT 'OBJE' AS type, m_media AS xref, m_gedfile AS ged_id, m_gedrec AS gedrec, m_titl, m_file FROM {$TBLPREFIX}link, {$TBLPREFIX}media m WHERE m_gedfile=l_file AND m_media=l_from AND l_file=? AND l_type=? AND l_to=?", array($ged_id, $link, $xref));
    $list = array();
    foreach ($rows as $row) {
        $list[] = Media::getInstance($row);
    }
    return $list;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:10,代码来源:functions_db.php

示例9: __construct

 public function __construct()
 {
     $this->model = Media::getInstance();
 }
开发者ID:nexgenta,项目名称:media,代码行数:4,代码来源:import.php


注:本文中的Media::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。