Complex classes like File often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use File, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 92 | class File extends DataObject implements ShortcodeHandler, AssetContainer, Thumbnail, CMSPreviewable { |
||
| 93 | |||
| 94 | use ImageManipulation; |
||
| 95 | |||
| 96 | private static $default_sort = "\"Name\""; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @config |
||
| 100 | * @var string |
||
| 101 | */ |
||
| 102 | private static $singular_name = "File"; |
||
| 103 | |||
| 104 | private static $plural_name = "Files"; |
||
| 105 | |||
| 106 | /** |
||
| 107 | * Permissions necessary to view files outside of the live stage (e.g. archive / draft stage). |
||
| 108 | * |
||
| 109 | * @config |
||
| 110 | * @var array |
||
| 111 | */ |
||
| 112 | private static $non_live_permissions = array('CMS_ACCESS_LeftAndMain', 'CMS_ACCESS_AssetAdmin', 'VIEW_DRAFT_CONTENT'); |
||
| 113 | |||
| 114 | private static $db = array( |
||
| 115 | "Name" => "Varchar(255)", |
||
| 116 | "Title" => "Varchar(255)", |
||
| 117 | "File" =>"DBFile", |
||
| 118 | // Only applies to files, doesn't inherit for folder |
||
| 119 | 'ShowInSearch' => 'Boolean(1)', |
||
| 120 | ); |
||
| 121 | |||
| 122 | private static $has_one = array( |
||
| 123 | "Parent" => "SilverStripe\\Assets\\File", |
||
| 124 | "Owner" => "SilverStripe\\Security\\Member" |
||
| 125 | ); |
||
| 126 | |||
| 127 | private static $defaults = array( |
||
| 128 | "ShowInSearch" => 1, |
||
| 129 | ); |
||
| 130 | |||
| 131 | private static $extensions = array( |
||
| 132 | "SilverStripe\\ORM\\Hierarchy\\Hierarchy", |
||
| 133 | "SilverStripe\\ORM\\Versioning\\Versioned" |
||
| 134 | ); |
||
| 135 | |||
| 136 | private static $casting = array ( |
||
| 137 | 'TreeTitle' => 'HTMLFragment' |
||
| 138 | ); |
||
| 139 | |||
| 140 | private static $table_name = 'File'; |
||
| 141 | |||
| 142 | /** |
||
| 143 | * @config |
||
| 144 | * @var array List of allowed file extensions, enforced through {@link validate()}. |
||
| 145 | * |
||
| 146 | * Note: if you modify this, you should also change a configuration file in the assets directory. |
||
| 147 | * Otherwise, the files will be able to be uploaded but they won't be able to be served by the |
||
| 148 | * webserver. |
||
| 149 | * |
||
| 150 | * - If you are running Apache you will need to change assets/.htaccess |
||
| 151 | * - If you are running IIS you will need to change assets/web.config |
||
| 152 | * |
||
| 153 | * Instructions for the change you need to make are included in a comment in the config file. |
||
| 154 | */ |
||
| 155 | private static $allowed_extensions = array( |
||
| 156 | '', 'ace', 'arc', 'arj', 'asf', 'au', 'avi', 'bmp', 'bz2', 'cab', 'cda', 'css', 'csv', 'dmg', 'doc', |
||
| 157 | 'docx', 'dotx', 'dotm', 'flv', 'gif', 'gpx', 'gz', 'hqx', 'ico', 'jar', 'jpeg', 'jpg', 'js', 'kml', |
||
| 158 | 'm4a', 'm4v', 'mid', 'midi', 'mkv', 'mov', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'ogg', 'ogv', 'pages', |
||
| 159 | 'pcx', 'pdf', 'png', 'pps', 'ppt', 'pptx', 'potx', 'potm', 'ra', 'ram', 'rm', 'rtf', 'sit', 'sitx', |
||
| 160 | 'tar', 'tgz', 'tif', 'tiff', 'txt', 'wav', 'webm', 'wma', 'wmv', 'xls', 'xlsx', 'xltx', 'xltm', 'zip', |
||
| 161 | 'zipx', |
||
| 162 | ); |
||
| 163 | |||
| 164 | /** |
||
| 165 | * @config |
||
| 166 | * @var array Category identifiers mapped to commonly used extensions. |
||
| 167 | */ |
||
| 168 | private static $app_categories = array( |
||
| 169 | 'archive' => array( |
||
| 170 | 'ace', 'arc', 'arj', 'bz', 'bz2', 'cab', 'dmg', 'gz', 'hqx', 'jar', 'rar', 'sit', 'sitx', 'tar', 'tgz', |
||
| 171 | 'zip', 'zipx', |
||
| 172 | ), |
||
| 173 | 'audio' => array( |
||
| 174 | 'aif', 'aifc', 'aiff', 'apl', 'au', 'avr', 'cda', 'm4a', 'mid', 'midi', 'mp3', 'ogg', 'ra', |
||
| 175 | 'ram', 'rm', 'snd', 'wav', 'wma', |
||
| 176 | ), |
||
| 177 | 'document' => array( |
||
| 178 | 'css', 'csv', 'doc', 'docx', 'dotm', 'dotx', 'htm', 'html', 'gpx', 'js', 'kml', 'pages', 'pdf', |
||
| 179 | 'potm', 'potx', 'pps', 'ppt', 'pptx', 'rtf', 'txt', 'xhtml', 'xls', 'xlsx', 'xltm', 'xltx', 'xml', |
||
| 180 | ), |
||
| 181 | 'image' => array( |
||
| 182 | 'alpha', 'als', 'bmp', 'cel', 'gif', 'ico', 'icon', 'jpeg', 'jpg', 'pcx', 'png', 'ps', 'tif', 'tiff', |
||
| 183 | ), |
||
| 184 | 'image/supported' => array( |
||
| 185 | 'gif', 'jpeg', 'jpg', 'png' |
||
| 186 | ), |
||
| 187 | 'flash' => array( |
||
| 188 | 'fla', 'swf' |
||
| 189 | ), |
||
| 190 | 'video' => array( |
||
| 191 | 'asf', 'avi', 'flv', 'ifo', 'm1v', 'm2v', 'm4v', 'mkv', 'mov', 'mp2', 'mp4', 'mpa', 'mpe', 'mpeg', |
||
| 192 | 'mpg', 'ogv', 'qt', 'vob', 'webm', 'wmv', |
||
| 193 | ), |
||
| 194 | ); |
||
| 195 | |||
| 196 | /** |
||
| 197 | * Map of file extensions to class type |
||
| 198 | * |
||
| 199 | * @config |
||
| 200 | * @var |
||
| 201 | */ |
||
| 202 | private static $class_for_file_extension = array( |
||
| 203 | '*' => 'SilverStripe\\Assets\\File', |
||
| 204 | 'jpg' => 'SilverStripe\\Assets\\Image', |
||
| 205 | 'jpeg' => 'SilverStripe\\Assets\\Image', |
||
| 206 | 'png' => 'SilverStripe\\Assets\\Image', |
||
| 207 | 'gif' => 'SilverStripe\\Assets\\Image', |
||
| 208 | ); |
||
| 209 | |||
| 210 | /** |
||
| 211 | * @config |
||
| 212 | * @var bool If this is true, then restrictions set in {@link $allowed_max_file_size} and |
||
| 213 | * {@link $allowed_extensions} will be applied to users with admin privileges as |
||
| 214 | * well. |
||
| 215 | */ |
||
| 216 | private static $apply_restrictions_to_admin = true; |
||
| 217 | |||
| 218 | /** |
||
| 219 | * If enabled, legacy file dataobjects will be automatically imported into the APL |
||
| 220 | * |
||
| 221 | * @config |
||
| 222 | * @var bool |
||
| 223 | */ |
||
| 224 | private static $migrate_legacy_file = false; |
||
| 225 | |||
| 226 | /** |
||
| 227 | * @config |
||
| 228 | * @var boolean |
||
| 229 | */ |
||
| 230 | private static $update_filesystem = true; |
||
| 231 | |||
| 232 | public static function get_shortcodes() { |
||
| 235 | |||
| 236 | /** |
||
| 237 | * Replace "[file_link id=n]" shortcode with an anchor tag or link to the file. |
||
| 238 | * |
||
| 239 | * @param array $arguments Arguments passed to the parser |
||
| 240 | * @param string $content Raw shortcode |
||
| 241 | * @param ShortcodeParser $parser Parser |
||
| 242 | * @param string $shortcode Name of shortcode used to register this handler |
||
| 243 | * @param array $extra Extra arguments |
||
| 244 | * @return string Result of the handled shortcode |
||
| 245 | */ |
||
| 246 | public static function handle_shortcode($arguments, $content, $parser, $shortcode, $extra = array()) { |
||
| 275 | |||
| 276 | /** |
||
| 277 | * Find the record to use for a given shortcode. |
||
| 278 | * |
||
| 279 | * @param array $args Array of input shortcode arguments |
||
| 280 | * @param int $errorCode If the file is not found, or is inaccessible, this will be assigned to a HTTP error code. |
||
| 281 | * @return File|null The File DataObject, if it can be found. |
||
| 282 | */ |
||
| 283 | public static function find_shortcode_record($args, &$errorCode = null) { |
||
| 306 | |||
| 307 | /** |
||
| 308 | * Given a HTTP Error, find an appropriate substitute File or SiteTree data object instance. |
||
| 309 | * |
||
| 310 | * @param int $errorCode HTTP Error value |
||
| 311 | * @return File|SiteTree File or SiteTree object to use for the given error |
||
| 312 | */ |
||
| 313 | protected static function find_error_record($errorCode) { |
||
| 321 | |||
| 322 | /** |
||
| 323 | * A file only exists if the file_exists() and is in the DB as a record |
||
| 324 | * |
||
| 325 | * Use $file->isInDB() to only check for a DB record |
||
| 326 | * Use $file->File->exists() to only check if the asset exists |
||
| 327 | * |
||
| 328 | * @return bool |
||
| 329 | */ |
||
| 330 | public function exists() { |
||
| 333 | |||
| 334 | /** |
||
| 335 | * Find a File object by the given filename. |
||
| 336 | * |
||
| 337 | * @param string $filename Filename to search for, including any custom parent directories. |
||
| 338 | * @return File |
||
| 339 | */ |
||
| 340 | public static function find($filename) { |
||
| 357 | |||
| 358 | /** |
||
| 359 | * Just an alias function to keep a consistent API with SiteTree |
||
| 360 | * |
||
| 361 | * @return string The link to the file |
||
| 362 | */ |
||
| 363 | public function Link() { |
||
| 366 | |||
| 367 | /** |
||
| 368 | * @deprecated 4.0 |
||
| 369 | */ |
||
| 370 | public function RelativeLink() { |
||
| 374 | |||
| 375 | /** |
||
| 376 | * Just an alias function to keep a consistent API with SiteTree |
||
| 377 | * |
||
| 378 | * @return string The absolute link to the file |
||
| 379 | */ |
||
| 380 | public function AbsoluteLink() { |
||
| 383 | |||
| 384 | /** |
||
| 385 | * @return string |
||
| 386 | */ |
||
| 387 | public function getTreeTitle() { |
||
| 390 | |||
| 391 | /** |
||
| 392 | * @param Member $member |
||
| 393 | * @return bool |
||
| 394 | */ |
||
| 395 | public function canView($member = null) { |
||
| 407 | |||
| 408 | /** |
||
| 409 | * Check if this file can be modified |
||
| 410 | * |
||
| 411 | * @param Member $member |
||
| 412 | * @return boolean |
||
| 413 | */ |
||
| 414 | public function canEdit($member = null) { |
||
| 426 | |||
| 427 | /** |
||
| 428 | * Check if a file can be created |
||
| 429 | * |
||
| 430 | * @param Member $member |
||
| 431 | * @param array $context |
||
| 432 | * @return boolean |
||
| 433 | */ |
||
| 434 | public function canCreate($member = null, $context = array()) { |
||
| 446 | |||
| 447 | /** |
||
| 448 | * Check if this file can be deleted |
||
| 449 | * |
||
| 450 | * @param Member $member |
||
| 451 | * @return boolean |
||
| 452 | */ |
||
| 453 | public function canDelete($member = null) { |
||
| 465 | |||
| 466 | /** |
||
| 467 | * Returns the fields to power the edit screen of files in the CMS. |
||
| 468 | * You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension} |
||
| 469 | * and implementing updateCMSFields(FieldList $fields) on that extension. |
||
| 470 | * |
||
| 471 | * @return FieldList |
||
| 472 | */ |
||
| 473 | public function getCMSFields() { |
||
| 518 | |||
| 519 | /** |
||
| 520 | * Get title for current file status |
||
| 521 | * |
||
| 522 | * @return string |
||
| 523 | */ |
||
| 524 | public function getStatusTitle() { |
||
| 533 | |||
| 534 | /** |
||
| 535 | * Returns a category based on the file extension. |
||
| 536 | * This can be useful when grouping files by type, |
||
| 537 | * showing icons on filelinks, etc. |
||
| 538 | * Possible group values are: "audio", "mov", "zip", "image". |
||
| 539 | * |
||
| 540 | * @param string $ext Extension to check |
||
| 541 | * @return string |
||
| 542 | */ |
||
| 543 | public static function get_app_category($ext) { |
||
| 550 | |||
| 551 | /** |
||
| 552 | * For a category or list of categories, get the list of file extensions |
||
| 553 | * |
||
| 554 | * @param array|string $categories List of categories, or single category |
||
| 555 | * @return array |
||
| 556 | */ |
||
| 557 | public static function get_category_extensions($categories) { |
||
| 585 | |||
| 586 | /** |
||
| 587 | * Returns a category based on the file extension. |
||
| 588 | * |
||
| 589 | * @return string |
||
| 590 | */ |
||
| 591 | public function appCategory() { |
||
| 594 | |||
| 595 | |||
| 596 | /** |
||
| 597 | * Should be called after the file was uploaded |
||
| 598 | */ |
||
| 599 | public function onAfterUpload() { |
||
| 602 | |||
| 603 | /** |
||
| 604 | * Make sure the file has a name |
||
| 605 | */ |
||
| 606 | protected function onBeforeWrite() { |
||
| 622 | |||
| 623 | /** |
||
| 624 | * This will check if the parent record and/or name do not match the name on the underlying |
||
| 625 | * DBFile record, and if so, copy this file to the new location, and update the record to |
||
| 626 | * point to this new file. |
||
| 627 | * |
||
| 628 | * This method will update the File {@see DBFile} field value on success, so it must be called |
||
| 629 | * before writing to the database |
||
| 630 | * |
||
| 631 | * @return bool True if changed |
||
| 632 | */ |
||
| 633 | public function updateFilesystem() { |
||
| 661 | |||
| 662 | /** |
||
| 663 | * Collate selected descendants of this page. |
||
| 664 | * $condition will be evaluated on each descendant, and if it is succeeds, that item will be added |
||
| 665 | * to the $collator array. |
||
| 666 | * |
||
| 667 | * @param string $condition The PHP condition to be evaluated. The page will be called $item |
||
| 668 | * @param array $collator An array, passed by reference, to collect all of the matching descendants. |
||
| 669 | * @return true|null |
||
| 670 | */ |
||
| 671 | public function collateDescendants($condition, &$collator) { |
||
| 684 | |||
| 685 | /** |
||
| 686 | * Setter function for Name. Automatically sets a default title, |
||
| 687 | * and removes characters that might be invalid on the filesystem. |
||
| 688 | * Also adds a suffix to the name if the filename already exists |
||
| 689 | * on the filesystem, and is associated to a different {@link File} database record |
||
| 690 | * in the same folder. This means "myfile.jpg" might become "myfile-1.jpg". |
||
| 691 | * |
||
| 692 | * Does not change the filesystem itself, please use {@link write()} for this. |
||
| 693 | * |
||
| 694 | * @param string $name |
||
| 695 | * @return $this |
||
| 696 | */ |
||
| 697 | public function setName($name) { |
||
| 742 | |||
| 743 | /** |
||
| 744 | * Gets the URL of this file |
||
| 745 | * |
||
| 746 | * @return string |
||
| 747 | */ |
||
| 748 | public function getAbsoluteURL() { |
||
| 755 | |||
| 756 | /** |
||
| 757 | * Gets the URL of this file |
||
| 758 | * |
||
| 759 | * @uses Director::baseURL() |
||
| 760 | * @param bool $grant Ensures that the url for any protected assets is granted for the current user. |
||
| 761 | * @return string |
||
| 762 | */ |
||
| 763 | public function getURL($grant = true) { |
||
| 769 | |||
| 770 | /** |
||
| 771 | * Get URL, but without resampling. |
||
| 772 | * |
||
| 773 | * @param bool $grant Ensures that the url for any protected assets is granted for the current user. |
||
| 774 | * @return string |
||
| 775 | */ |
||
| 776 | public function getSourceURL($grant = true) { |
||
| 782 | |||
| 783 | /** |
||
| 784 | * @todo Coupling with cms module, remove this method. |
||
| 785 | * |
||
| 786 | * @return string |
||
| 787 | */ |
||
| 788 | public function DeleteLink() { |
||
| 796 | |||
| 797 | /** |
||
| 798 | * Get expected value of Filename tuple value. Will be used to trigger |
||
| 799 | * a file move on draft stage. |
||
| 800 | * |
||
| 801 | * @return string |
||
| 802 | */ |
||
| 803 | public function generateFilename() { |
||
| 811 | |||
| 812 | /** |
||
| 813 | * Ensure that parent folders are published before this one is published |
||
| 814 | * |
||
| 815 | * @todo Solve this via triggered publishing / ownership in the future |
||
| 816 | */ |
||
| 817 | public function onBeforePublish() { |
||
| 824 | |||
| 825 | /** |
||
| 826 | * Update the ParentID and Name for the given filename. |
||
| 827 | * |
||
| 828 | * On save, the underlying DBFile record will move the underlying file to this location. |
||
| 829 | * Thus it will not update the underlying Filename value until this is done. |
||
| 830 | * |
||
| 831 | * @param string $filename |
||
| 832 | * @return $this |
||
| 833 | */ |
||
| 834 | public function setFilename($filename) { |
||
| 857 | |||
| 858 | /** |
||
| 859 | * Returns the file extension |
||
| 860 | * |
||
| 861 | * @return string |
||
| 862 | */ |
||
| 863 | public function getExtension() { |
||
| 866 | |||
| 867 | /** |
||
| 868 | * Gets the extension of a filepath or filename, |
||
| 869 | * by stripping away everything before the last "dot". |
||
| 870 | * Caution: Only returns the last extension in "double-barrelled" |
||
| 871 | * extensions (e.g. "gz" for "tar.gz"). |
||
| 872 | * |
||
| 873 | * Examples: |
||
| 874 | * - "myfile" returns "" |
||
| 875 | * - "myfile.txt" returns "txt" |
||
| 876 | * - "myfile.tar.gz" returns "gz" |
||
| 877 | * |
||
| 878 | * @param string $filename |
||
| 879 | * @return string |
||
| 880 | */ |
||
| 881 | public static function get_file_extension($filename) { |
||
| 884 | |||
| 885 | /** |
||
| 886 | * Given an extension, determine the icon that should be used |
||
| 887 | * |
||
| 888 | * @param string $extension |
||
| 889 | * @return string Icon filename relative to base url |
||
| 890 | */ |
||
| 891 | public static function get_icon_for_extension($extension) { |
||
| 906 | |||
| 907 | /** |
||
| 908 | * Return the type of file for the given extension |
||
| 909 | * on the current file name. |
||
| 910 | * |
||
| 911 | * @return string |
||
| 912 | */ |
||
| 913 | public function getFileType() { |
||
| 916 | |||
| 917 | /** |
||
| 918 | * Get descriptive type of file based on filename |
||
| 919 | * |
||
| 920 | * @param string $filename |
||
| 921 | * @return string Description of file |
||
| 922 | */ |
||
| 923 | public static function get_file_type($filename) { |
||
| 952 | |||
| 953 | /** |
||
| 954 | * Returns the size of the file type in an appropriate format. |
||
| 955 | * |
||
| 956 | * @return string|false String value, or false if doesn't exist |
||
| 957 | */ |
||
| 958 | public function getSize() { |
||
| 965 | |||
| 966 | /** |
||
| 967 | * Formats a file size (eg: (int)42 becomes string '42 bytes') |
||
| 968 | * |
||
| 969 | * @todo unit tests |
||
| 970 | * |
||
| 971 | * @param int $size |
||
| 972 | * @return string |
||
| 973 | */ |
||
| 974 | public static function format_size($size) { |
||
| 992 | |||
| 993 | /** |
||
| 994 | * Convert a php.ini value (eg: 512M) to bytes |
||
| 995 | * |
||
| 996 | * @todo unit tests |
||
| 997 | * |
||
| 998 | * @param string $iniValue |
||
| 999 | * @return int |
||
| 1000 | */ |
||
| 1001 | public static function ini2bytes($iniValue) { |
||
| 1012 | |||
| 1013 | /** |
||
| 1014 | * Return file size in bytes. |
||
| 1015 | * |
||
| 1016 | * @return int |
||
| 1017 | */ |
||
| 1018 | public function getAbsoluteSize(){ |
||
| 1021 | |||
| 1022 | public function validate() { |
||
| 1028 | |||
| 1029 | /** |
||
| 1030 | * Maps a {@link File} subclass to a specific extension. |
||
| 1031 | * By default, files with common image extensions will be created |
||
| 1032 | * as {@link Image} instead of {@link File} when using |
||
| 1033 | * {@link Folder::constructChild}, {@link Folder::addUploadToFolder}), |
||
| 1034 | * and the {@link Upload} class (either directly or through {@link FileField}). |
||
| 1035 | * For manually instanciated files please use this mapping getter. |
||
| 1036 | * |
||
| 1037 | * Caution: Changes to mapping doesn't apply to existing file records in the database. |
||
| 1038 | * Also doesn't hook into {@link Object::getCustomClass()}. |
||
| 1039 | * |
||
| 1040 | * @param String File extension, without dot prefix. Use an asterisk ('*') |
||
| 1041 | * to specify a generic fallback if no mapping is found for an extension. |
||
| 1042 | * @return String Classname for a subclass of {@link File} |
||
| 1043 | */ |
||
| 1044 | public static function get_class_for_file_extension($ext) { |
||
| 1048 | |||
| 1049 | /** |
||
| 1050 | * See {@link get_class_for_file_extension()}. |
||
| 1051 | * |
||
| 1052 | * @param String|array |
||
| 1053 | * @param String |
||
| 1054 | */ |
||
| 1055 | public static function set_class_for_file_extension($exts, $class) { |
||
| 1068 | |||
| 1069 | public function getMetaData() { |
||
| 1075 | |||
| 1076 | public function getMimeType() { |
||
| 1082 | |||
| 1083 | public function getStream() { |
||
| 1089 | |||
| 1090 | public function getString() { |
||
| 1096 | |||
| 1097 | public function setFromLocalFile($path, $filename = null, $hash = null, $variant = null, $config = array()) { |
||
| 1106 | |||
| 1107 | public function setFromStream($stream, $filename, $hash = null, $variant = null, $config = array()) { |
||
| 1116 | |||
| 1117 | public function setFromString($data, $filename, $hash = null, $variant = null, $config = array()) { |
||
| 1126 | |||
| 1127 | public function getIsImage() { |
||
| 1130 | |||
| 1131 | public function getFilename() { |
||
| 1134 | |||
| 1135 | public function getHash() { |
||
| 1138 | |||
| 1139 | public function getVariant() { |
||
| 1142 | |||
| 1143 | /** |
||
| 1144 | * Return a html5 tag of the appropriate for this file (normally img or a) |
||
| 1145 | * |
||
| 1146 | * @return string |
||
| 1147 | */ |
||
| 1148 | public function forTemplate() { |
||
| 1151 | |||
| 1152 | /** |
||
| 1153 | * Return a html5 tag of the appropriate for this file (normally img or a) |
||
| 1154 | * |
||
| 1155 | * @return string |
||
| 1156 | */ |
||
| 1157 | public function getTag() { |
||
| 1164 | |||
| 1165 | public function requireDefaultRecords() { |
||
| 1178 | |||
| 1179 | /** |
||
| 1180 | * Joins one or more segments together to build a Filename identifier. |
||
| 1181 | * |
||
| 1182 | * Note that the result will not have a leading slash, and should not be used |
||
| 1183 | * with local file paths. |
||
| 1184 | * |
||
| 1185 | * @param string $part,... Parts |
||
| 1186 | * @return string |
||
| 1187 | */ |
||
| 1188 | public static function join_paths($part = null) { |
||
| 1204 | |||
| 1205 | public function deleteFile() { |
||
| 1208 | |||
| 1209 | public function getVisibility() { |
||
| 1212 | |||
| 1213 | public function publishFile() { |
||
| 1216 | |||
| 1217 | public function protectFile() { |
||
| 1220 | |||
| 1221 | public function grantFile() { |
||
| 1224 | |||
| 1225 | public function revokeFile() { |
||
| 1228 | |||
| 1229 | public function canViewFile() { |
||
| 1232 | |||
| 1233 | public function CMSEditLink() { |
||
| 1238 | |||
| 1239 | public function PreviewLink($action = null) { |
||
| 1249 | } |
||
| 1250 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
integervalues, zero is a special case, in particular the following results might be unexpected: