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


PHP Document::getPath方法代码示例

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


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

示例1: uploadSignature

/**
 * 
 * @param \Document $doc        Документ
 * @param mixed     $file       Временный файл загруженный на сервер
 * @param mixed     extra       Дополнительные параметры
 */
function uploadSignature($doc, $file, $extra = null)
{
    if ($doc->getParent()->getType() == DOCUMENT_TYPE_FILE) {
        $doc->setSysName($doc->getSysName() . '.p7s');
        $doc->setPath($doc->getPath() . '.p7s');
    }
    copy($file['tmp_name'], urldecode($doc->getPath()));
}
开发者ID:Digt,项目名称:trusted-php,代码行数:14,代码来源:custom.php

示例2: wrap

 /**
  * @static
  * @param Document $hardlink
  * @return Document_PageSnippet
  */
 public static function wrap(Document $doc)
 {
     if ($doc instanceof Document_Hardlink) {
         if ($sourceDoc = $doc->getSourceDocument()) {
             $destDoc = self::upperCastDocument($sourceDoc);
             $destDoc->setKey($doc->getKey());
             $destDoc->setPath($doc->getPath());
             $destDoc->initResource(get_class($sourceDoc));
             return $destDoc;
         }
     } else {
         return self::upperCastDocument($doc);
     }
     return;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:20,代码来源:Wrapper.php

示例3: generateFromDir

 /**
  * generate a font from a directory containing svg files (one file per glyph)
  * by naming convention the file name can specify which character should be mapped to the glyph
  * - my-icon.png       => creates a glyph with the name 'my-icon' mapped to a character in the Unicode Private Use Area
  * - my-icon-x263a.png => creates a glyph with the name 'my-icon' mapped to the unicode character U+263A "☺"
  *
  * @param  string  $path              SVG path definition (consider the font coordinate system has an inverted y axis)
  * @param  array   $fontOptions       font options for the Font object
  * @param  boolean $renameSourceFiles if true, files without mapping information will be renamed
  * @return static                     this
  */
 public function generateFromDir($path, $fontOptions = array(), $renameSourceFiles = false)
 {
     $this->font = new Font($fontOptions);
     $this->mapping = array();
     $fontOptions = $this->font->getOptions();
     $files = scandir($path);
     foreach ($files as $fileName) {
         if (strtolower(substr($fileName, -4)) === '.svg') {
             if (preg_match('(^(.*)-x([0-9a-f]{2,6})\\.svg$)i', $fileName, $matches)) {
                 $iconName = strtolower($matches[1]);
                 $iconCode = static::hexToUnicode(strtolower($matches[2]));
                 if (isset($this->mapping[$iconCode])) {
                     throw new \Exception('Duplicate glyph ' . $iconCode . ' ' . $iconName);
                 }
                 $this->mapping[$iconCode] = array('path' => $path . DIRECTORY_SEPARATOR . $fileName, 'name' => $iconName);
             }
         }
     }
     foreach ($files as $fileName) {
         if (strtolower(substr($fileName, -4)) === '.svg') {
             if (!preg_match('(^(.*)-x([0-9a-f]{2,6})\\.svg$)i', $fileName)) {
                 $iconName = strtolower(substr($fileName, 0, -4));
                 $code = hexdec('e001');
                 while (isset($this->mapping[static::hexToUnicode(dechex($code))])) {
                     $code++;
                 }
                 if ($renameSourceFiles) {
                     if (!rename($path . DIRECTORY_SEPARATOR . $fileName, $path . DIRECTORY_SEPARATOR . $iconName . '-x' . dechex($code) . '.svg')) {
                         throw new \Exception('unable to rename "' . $path . DIRECTORY_SEPARATOR . $fileName . '"');
                     }
                     $fileName = $iconName . '-x' . dechex($code) . '.svg';
                 }
                 $this->mapping[static::hexToUnicode(dechex($code))] = array('path' => $path . DIRECTORY_SEPARATOR . $fileName, 'name' => $iconName);
             }
         }
     }
     foreach ($this->mapping as $code => $icon) {
         try {
             $iconDoc = new Document(file_get_contents($icon['path']));
             $viewBox = $iconDoc->getViewBox();
             $this->font->addGlyph($code, $iconDoc->getPath($fontOptions['units-per-em'] / $viewBox['height'], null, 'vertical', true, 0, $fontOptions['descent']), $icon['name'], round($viewBox['width'] * $fontOptions['units-per-em'] / $viewBox['height']));
         } catch (\Exception $e) {
             throw new \Exception(basename($icon['path']) . ': ' . $e->getMessage());
         }
     }
     return $this;
 }
开发者ID:nofilenamed,项目名称:SVG-Icon-Font-Generator,代码行数:58,代码来源:IconFontGenerator.php

示例4: insertDocument

 /**
  * Добавляет новый документ в БД
  * @global \TDataBase $DB
  * @param \Document $doc
  */
 static function insertDocument($doc)
 {
     global $DB;
     $parentId = $doc->getParentId();
     $childId = $doc->getChildId();
     if (is_null($parentId)) {
         $parentId = 'NULL';
     }
     if (is_null($childId)) {
         $childId = 'NULL';
     }
     $sql = 'INSERT INTO ' . TRUSTED_DB_TABLE_DOCUMENTS . '  ' . '(ORIGINAL_NAME, SYS_NAME, PATH, SIGNERS, TYPE, PARENT_ID, CHILD_ID)' . 'VALUES (' . '"' . $DB->EscapeString($doc->getName()) . '", ' . '"' . $DB->EscapeString($doc->getSysName()) . '", ' . '"' . $doc->getPath() . '", ' . "'" . $DB->EscapeString($doc->getSigners()) . "', " . $doc->getType() . ', ' . $parentId . ', ' . $childId . ')';
     $DB->Query($sql);
     $doc->setId($DB->LastID());
     TDataBaseDocument::saveDocumentParent($doc, $doc->getId());
 }
开发者ID:Digt,项目名称:trusted-php,代码行数:21,代码来源:document.php

示例5: createDocumentComparisonString

 /**
  * @param  Document $document
  * @return string
  */
 protected static function createDocumentComparisonString($document, $ignoreCopyDifferences = false)
 {
     if ($document instanceof Document) {
         $d = array();
         if ($document instanceof Document_PageSnippet) {
             $elements = $document->getElements();
             ksort($elements);
             foreach ($elements as $key => $value) {
                 if ($value instanceof Document_Tag_Video) {
                     //with video can't use frontend(), it includes random id
                     $d["element_" . $key] = $value->getName() . ":" . $value->type . "_" . $value->id;
                 } else {
                     if (!$value instanceof Document_Tag_Block) {
                         $d["element_" . $key] = $value->getName() . ":" . $value->frontend();
                     } else {
                         $d["element_" . $key] = $value->getName();
                     }
                 }
             }
             if ($document instanceof Document_Page) {
                 $d["name"] = $document->getName();
                 $d["keywords"] = $document->getKeywords();
                 $d["title"] = $document->getTitle();
                 $d["description"] = $document->getDescription();
             }
             $d["published"] = $document->isPublished();
         }
         if ($document instanceof Document_Link) {
             $d['link'] = $document->getHtml();
         }
         if (!$ignoreCopyDifferences) {
             $d["key"] = $document->getKey();
             $d["id"] = $document->getId();
             $d["modification"] = $document->getModificationDate();
             $d["creation"] = $document->getCreationDate();
             $d["userModified"] = $document->getUserModification();
             $d["parentId"] = $document->getParentId();
             $d["path"] = $document->getPath();
         }
         $d["userOwner"] = $document->getUserOwner();
         $properties = $document->getProperties();
         $d = array_merge($d, self::createPropertiesComparisonString($properties));
         return implode(",", $d);
     } else {
         return null;
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:51,代码来源:Tool.php

示例6: getTreeNodePermissionConfig

 /**
  * @param  User $user
  * @param  Document $childDocument
  * @param  Document $parentDocument
  * @param boolean $expanded
  * @return
  */
 protected function getTreeNodePermissionConfig($user, $childDocument, $parentDocument, $expanded)
 {
     $userGroup = $user->getParent();
     if ($userGroup instanceof User) {
         $childDocument->getPermissionsForUser($userGroup);
         $lock_list = $childDocument->isAllowed("list");
         $lock_view = $childDocument->isAllowed("view");
         $lock_save = $childDocument->isAllowed("save");
         $lock_publish = $childDocument->isAllowed("publish");
         $lock_unpublish = $childDocument->isAllowed("unpublish");
         $lock_delete = $childDocument->isAllowed("delete");
         $lock_rename = $childDocument->isAllowed("rename");
         $lock_create = $childDocument->isAllowed("create");
         $lock_permissions = $childDocument->isAllowed("permissions");
         $lock_settings = $childDocument->isAllowed("settings");
         $lock_versions = $childDocument->isAllowed("versions");
         $lock_properties = $childDocument->isAllowed("properties");
         $lock_properties = $childDocument->isAllowed("properties");
     }
     if ($parentDocument) {
         $parentDocument->getPermissionsForUser($user);
     }
     $documentPermission = $childDocument->getPermissionsForUser($user);
     $generallyAllowed = $user->isAllowed("documents");
     $parentId = (int) $childDocument->getParentId();
     $parentAllowedList = true;
     if ($parentDocument instanceof Document) {
         $parentAllowedList = $parentDocument->isAllowed("list") and $generallyAllowed;
     }
     $tmpDocument = array("_parent" => $parentId > 0 ? $parentId : null, "_id" => (int) $childDocument->getId(), "text" => $childDocument->getKey(), "type" => $childDocument->getType(), "path" => $childDocument->getFullPath(), "basePath" => $childDocument->getPath(), "elementType" => "document", "permissionSet" => $documentPermission->getId() > 0 and $documentPermission->getCid() === $childDocument->getId(), "list" => $childDocument->isAllowed("list"), "list_editable" => $parentAllowedList and $generallyAllowed and !$lock_list and !$user->isAdmin(), "view" => $childDocument->isAllowed("view"), "view_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_view and !$user->isAdmin(), "save" => $childDocument->isAllowed("save"), "save_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_save and !$user->isAdmin(), "publish" => $childDocument->isAllowed("publish"), "publish_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_publish and !$user->isAdmin(), "unpublish" => $childDocument->isAllowed("unpublish"), "unpublish_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_unpublish and !$user->isAdmin(), "delete" => $childDocument->isAllowed("delete"), "delete_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_delete and !$user->isAdmin(), "rename" => $childDocument->isAllowed("rename"), "rename_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_rename and !$user->isAdmin(), "create" => $childDocument->isAllowed("create"), "create_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_create and !$user->isAdmin(), "permissions" => $childDocument->isAllowed("permissions"), "permissions_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_permissions and !$user->isAdmin(), "settings" => $childDocument->isAllowed("settings"), "settings_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_settings and !$user->isAdmin(), "versions" => $childDocument->isAllowed("versions"), "versions_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_versions and !$user->isAdmin(), "properties" => $childDocument->isAllowed("properties"), "properties_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_properties and !$user->isAdmin());
     $tmpDocument["expanded"] = $expanded;
     $tmpDocument["iconCls"] = "pimcore_icon_" . $childDocument->getType();
     // set type specific settings
     if ($childDocument->getType() == "page") {
         $tmpDocument["_is_leaf"] = $childDocument->hasNoChilds();
         $tmpDocument["iconCls"] = "pimcore_icon_page";
         // test for a site
         try {
             $site = Site::getByRootId($childDocument->getId());
             $tmpDocument["iconCls"] = "pimcore_icon_site";
             $tmpDocument["site"] = $site;
         } catch (Exception $e) {
         }
     } else {
         if ($childDocument->getType() == "folder") {
             $tmpDocument["_is_leaf"] = $childDocument->hasNoChilds();
             if ($childDocument->hasNoChilds()) {
                 $tmpDocument["iconCls"] = "pimcore_icon_folder";
             }
         } else {
             if ($childDocument->getType() == "link") {
                 $tmpDocument["_is_leaf"] = $childDocument->hasNoChilds();
                 if ($childDocument->hasNoChilds()) {
                     $tmpDocument["iconCls"] = "pimcore_icon_link";
                 }
             } else {
                 $tmpDocument["leaf"] = true;
                 $tmpDocument["_is_leaf"] = true;
             }
         }
     }
     if (!$childDocument->isPublished()) {
         $tmpDocument["cls"] = "pimcore_unpublished";
     }
     return $tmpDocument;
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:73,代码来源:DocumentController.php


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