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


PHP is_link函数代码示例

本文整理汇总了PHP中is_link函数的典型用法代码示例。如果您正苦于以下问题:PHP is_link函数的具体用法?PHP is_link怎么用?PHP is_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_file_object

 /**
  * Add info on the user who uploaded the file and the date it was uploaded, and create thumb if it doesn't exist
  */
 protected function get_file_object($file_name)
 {
     // Create the thumb if it doesn't exist
     $thumb = $this->options['upload_dir'] . 'thumb/' . $file_name;
     if (!file_exists(jQueryUpload::thumbFilename($thumb))) {
         $this->create_scaled_image($file_name, $this->options['image_versions']['thumbnail']);
     }
     // Call the parent method to create the file object
     $file = parent::get_file_object($file_name);
     // Add the meta data to the object
     if (is_object($file)) {
         $meta = $this->options['upload_dir'] . 'meta/' . $file_name;
         $file->info = $file->desc = "";
         // If the meta data file exists, extract and render the content
         if (is_file($meta)) {
             $data = unserialize(file_get_contents($meta));
             $file->info = self::renderData($data);
             $file->desc = array_key_exists(2, $data) ? $data[2] : '';
         } elseif (is_link($this->options['upload_dir'] . $file_name)) {
             $title = Title::newFromText($file_name, NS_FILE);
             if (is_object($title) && $title->exists()) {
                 list($uid, $ts, $file->desc) = self::getUploadedFileInfo($title);
                 $file->info = self::renderData(array($uid, wfTimestamp(TS_UNIX, $ts)));
             }
         }
     }
     return $file;
 }
开发者ID:saper,项目名称:organic-extensions,代码行数:31,代码来源:MWUploadHandler.php

示例2: chmod_r

function chmod_r($path, $filemode)
{
    if (!is_dir($path)) {
        return chmod($path, $filemode);
    }
    $dh = opendir($path);
    while (($file = readdir($dh)) !== false) {
        if ($file != '.' && $file != '..') {
            $fullpath = $path . '/' . $file;
            if (is_link($fullpath)) {
                return FALSE;
            } elseif (!is_dir($fullpath)) {
                if (!chmod($fullpath, $filemode)) {
                    return FALSE;
                } elseif (!chmod_r($fullpath, $filemode)) {
                    return FALSE;
                }
            }
        }
    }
    closedir($dh);
    if (chmod($path, $filemode)) {
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:nong053,项目名称:condo,代码行数:27,代码来源:picture_process.php

示例3: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     parent::execute($arguments, $options);
     $projectWebPath = sfConfig::get('sf_web_dir');
     $filesystem = new dmFilesystem($this->dispatcher, $this->formatter);
     foreach (array('dmAdminPlugin', 'dmFrontPlugin') as $plugin) {
         $this->logSection('plugin', 'Configuring plugin - ' . $plugin);
         $this->installPluginAssets($plugin, dm::getDir() . '/' . $plugin);
     }
     // remove useless doctrine assets
     if (is_readable($doctrineAssetPath = dmOs::join($projectWebPath, 'sfDoctrinePlugin'))) {
         if (!is_link($doctrineAssetPath)) {
             $filesystem->deleteDirContent($doctrineAssetPath);
         }
         $filesystem->remove($doctrineAssetPath);
     }
     // remove web cache dir
     $webCacheDir = sfConfig::get('sf_web_dir') . '/cache';
     if (is_link($webCacheDir)) {
         $filesystem->remove($webCacheDir);
     }
     // create web cache dir
     $filesystem->mkdir($webCacheDir);
     if (!file_exists(dmOs::join($projectWebPath, 'sf'))) {
         $filesystem->relativeSymlink(realpath(sfConfig::get('sf_symfony_lib_dir') . '/../data/web/sf'), dmOs::join($projectWebPath, 'sf'), true);
     }
 }
开发者ID:theolymp,项目名称:diem,代码行数:30,代码来源:dmPublishAssetsTask.class.php

示例4: setFileInformations

 /**
  * collect all fileinformations of given file and
  * save them to the global fileinformation array
  *
  * @param string $file
  * @return boolean is valid file?
  */
 protected function setFileInformations($file)
 {
     $this->fileInfo = array();
     // reset previously information to have a cleaned object
     $this->file = $file instanceof \TYPO3\CMS\Core\Resource\File ? $file : NULL;
     if (is_string($file) && !empty($file)) {
         $this->fileInfo = TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($file);
         $this->fileInfo['mtime'] = filemtime($file);
         $this->fileInfo['atime'] = fileatime($file);
         $this->fileInfo['owner'] = fileowner($file);
         $this->fileInfo['group'] = filegroup($file);
         $this->fileInfo['size'] = filesize($file);
         $this->fileInfo['type'] = filetype($file);
         $this->fileInfo['perms'] = fileperms($file);
         $this->fileInfo['is_dir'] = is_dir($file);
         $this->fileInfo['is_file'] = is_file($file);
         $this->fileInfo['is_link'] = is_link($file);
         $this->fileInfo['is_readable'] = is_readable($file);
         $this->fileInfo['is_uploaded'] = is_uploaded_file($file);
         $this->fileInfo['is_writeable'] = is_writeable($file);
     }
     if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
         $pathInfo = \TYPO3\CMS\Core\Utility\PathUtility::pathinfo($file->getName());
         $this->fileInfo = array('file' => $file->getName(), 'filebody' => $file->getNameWithoutExtension(), 'fileext' => $file->getExtension(), 'realFileext' => $pathInfo['extension'], 'atime' => $file->getCreationTime(), 'mtime' => $file->getModificationTime(), 'owner' => '', 'group' => '', 'size' => $file->getSize(), 'type' => 'file', 'perms' => '', 'is_dir' => FALSE, 'is_file' => $file->getStorage()->getDriverType() === 'Local' ? is_file($file->getForLocalProcessing(FALSE)) : TRUE, 'is_link' => $file->getStorage()->getDriverType() === 'Local' ? is_link($file->getForLocalProcessing(FALSE)) : FALSE, 'is_readable' => TRUE, 'is_uploaded' => FALSE, 'is_writeable' => FALSE);
     }
     return $this->fileInfo !== array();
 }
开发者ID:mneuhaus,项目名称:ke_search,代码行数:34,代码来源:class.tx_kesearch_lib_fileinfo.php

示例5: add_dir

 private function add_dir($base, $subdir = "")
 {
     global $page;
     $list = "";
     $dir = opendir("{$base}/{$subdir}");
     while ($filename = readdir($dir)) {
         $fullpath = "{$base}/{$subdir}/{$filename}";
         if (is_link($fullpath)) {
             // ignore
         } else {
             if (is_dir($fullpath)) {
                 if ($filename[0] != ".") {
                     $this->add_dir($base, "{$subdir}/{$filename}");
                 }
             } else {
                 $tmpfile = $fullpath;
                 $tags = $subdir;
                 $tags = str_replace("/", " ", $tags);
                 $tags = str_replace("__", " ", $tags);
                 $list .= "<br>" . html_escape("{$subdir}/{$filename} (" . str_replace(" ", ",", $tags) . ")...");
                 $error = $this->add_image($tmpfile, $filename, $tags);
                 if (is_null($error)) {
                     $list .= "ok\n";
                 } else {
                     $list .= "failed: {$error}\n";
                 }
             }
         }
     }
     closedir($dir);
     // $this->theme->add_status("Adding $subdir", $list);
 }
开发者ID:kmcasto,项目名称:shimmie2,代码行数:32,代码来源:main.php

示例6: copyr

/**
 * Copy a file, or recursively copy a folder and its contents
 *
 * @author      Aidan Lister <aidan@php.net>
 * @version     1.0.1
 * @link        http://aidanlister.com/2004/04/recursively-copying-directories-in-php/
 * @param       string   $source    Source path
 * @param       string   $dest      Destination path
 * @return      bool     Returns TRUE on success, FALSE on failure
 */
function copyr($source, $dest)
{
    // Check for symlinks
    if (is_link($source)) {
        return symlink(readlink($source), $dest);
    }
    // Simple copy for a file
    if (is_file($source)) {
        return copy($source, $dest);
    }
    // Make destination directory
    if (!is_dir($dest)) {
        mkdir($dest);
    }
    // Loop through the folder
    $dir = dir($source);
    while (false !== ($entry = $dir->read())) {
        // Skip pointers
        if ($entry == '.' || $entry == '..') {
            continue;
        }
        // Deep copy directories
        copyr("{$source}/{$entry}", "{$dest}/{$entry}");
    }
    // Clean up
    $dir->close();
    return true;
}
开发者ID:vortechs2000,项目名称:aidanlister-code,代码行数:38,代码来源:function.copyr.php

示例7: get_root_path_and_environment

 /**
  * Determine the webroot for a site.
  *
  * Most of this is cribbed from drush's implementation.
  */
 public function get_root_path_and_environment($start_path)
 {
     $root_path = FALSE;
     $start_path = empty($start_path) ? getcwd() : $start_path;
     foreach (array(TRUE, FALSE) as $follow_symlinks) {
         $path = $start_path;
         if ($follow_symlinks && is_link($path)) {
             $path = realpath($path);
         }
         // Check the start path.
         if ($this->determine_valid_root($path)) {
             $root_path = $path;
             break;
         } else {
             // Move up dir by dir and check each.
             while ($path = $this->shift_path_up($path)) {
                 if ($follow_symlinks && is_link($path)) {
                     $path = realpath($path);
                 }
                 if ($this->determine_valid_root($path)) {
                     $root_path = $path;
                     break 2;
                 }
             }
         }
     }
     $this->root_path = $root_path;
 }
开发者ID:giant-rabbit,项目名称:command_line_tools,代码行数:33,代码来源:SiteInfo.php

示例8: locate_root

/**
 * Locate the actual Drupal root. Based on drush_locate_root().
 */
function locate_root()
{
    $drupal_root = FALSE;
    $start_path = isset($_SERVER['PWD']) ? $_SERVER['PWD'] : '';
    if (empty($start_path)) {
        $start_path = getcwd();
    }
    foreach (array(TRUE, FALSE) as $follow_symlinks) {
        $path = $start_path;
        if ($follow_symlinks && is_link($path)) {
            $path = realpath($path);
        }
        // Check the start path.
        if (valid_root($path)) {
            $drupal_root = $path;
            break;
        } else {
            // Move up dir by dir and check each.
            while ($path = shift_path_up($path)) {
                if ($follow_symlinks && is_link($path)) {
                    $path = realpath($path);
                }
                if (valid_root($path)) {
                    $drupal_root = $path;
                    break 2;
                }
            }
        }
    }
    return $drupal_root;
}
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:34,代码来源:prod_check.dbconnect.php

示例9: setUp

 function setUp()
 {
     $this->fixDir = dirname(__FILE__) . '/_fixtures/big_dir';
     $this->readPath = $this->fixDir . '/file_2.5GB';
     // Generate big file
     if (is_link($this->fixDir)) {
         $parentPath = realpath($this->fixDir);
     } else {
         $parentPath = $this->fixDir;
     }
     if (!is_dir($parentPath)) {
         mkdir($this->fixDir);
     }
     $cmd = '/bin/df --portability ' . escapeshellarg($parentPath) . ' | tail -1 | awk \'{print $4}\'';
     //echo $cmd.PHP_EOL;
     $spaceLeft = `{$cmd}`;
     if ($spaceLeft < 5200000) {
         trigger_error("No sufficient space to create " . $this->readPath . ". Cannot test big files. Tip: link " . $this->fixDir . " to a partition with more than 5GB available.", E_USER_WARNING);
     } else {
         $output = null;
         $returnValue = null;
         exec('dd if=/dev/urandom of=' . $this->readPath . ' bs=1M count=2500', $output, $returnValue);
         if ($returnValue != 0) {
             trigger_error('dd failed, unable to generate the big file');
         }
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:27,代码来源:MD5SumComparisonTest.php

示例10: failureDescription

 /**
  * {@inheritdoc}
  */
 protected function failureDescription($other)
 {
     if (!is_string($other)) {
         if (is_object($other)) {
             $type = sprintf('%s#%s', get_class($other), method_exists($other, '__toString') ? $other->__toString() : '');
         } elseif (null === $other) {
             $type = 'null';
         } else {
             $type = gettype($other) . '#' . $other;
         }
         return $type . ' ' . $this->toString();
     }
     if (!file_exists($other)) {
         return 'not file or directory#' . $other . ' ' . $this->toString();
     }
     if (is_link($other)) {
         $type = 'link';
         $perms = lstat($other);
         $perms = $perms['mode'];
     } else {
         $type = is_file($other) ? 'file' : (is_dir($other) ? 'directory' : 'other');
         $perms = fileperms($other);
     }
     return sprintf('%s#%s %o %s %o', $type, $other, $perms, $this->toString(), $this->mask);
 }
开发者ID:GeckoPackages,项目名称:GeckoPHPUnit,代码行数:28,代码来源:FilePermissionsMaskConstraint.php

示例11: __construct

 public function __construct($environment, $debug)
 {
     if (!ini_get('date.timezone') || !date_default_timezone_get()) {
         $timezone = "Europe/Berlin";
         if (is_link('/etc/localtime')) {
             // Mac OS X (and older Linuxes)
             // /etc/localtime is a symlink to the
             // timezone in /usr/share/zoneinfo.
             $filename = readlink('/etc/localtime');
             if (strpos($filename, '/usr/share/zoneinfo/') === 0) {
                 $timezone = substr($filename, 20);
             }
         } elseif (file_exists('/etc/timezone')) {
             // Ubuntu / Debian.
             $data = file_get_contents('/etc/timezone');
             if ($data) {
                 $timezone = $data;
             }
         } elseif (file_exists('/etc/sysconfig/clock')) {
             // RHEL / CentOS
             $data = parse_ini_file('/etc/sysconfig/clock');
             if (!empty($data['ZONE'])) {
                 $timezone = $data['ZONE'];
             }
         }
         $timezone = preg_replace("/[\\n\\r]+/", "", $timezone);
         date_default_timezone_set($timezone);
     }
     parent::__construct($environment, $debug);
 }
开发者ID:slashworks,项目名称:control,代码行数:30,代码来源:AppKernel.php

示例12: getTimeZone

 /**
  * https://bojanz.wordpress.com/2014/03/11/detecting-the-system-timezone-php/
  */
 public function getTimeZone()
 {
     /*
      * Mac OS X (and older Linuxes)
      * /etc/localtime is a symlink to the
      * timezone in /usr/share/zoneinfo.
      */
     if (is_link('/etc/localtime')) {
         $filename = readlink('/etc/localtime');
         if (strpos($filename, '/usr/share/zoneinfo/') === 0) {
             return substr($filename, 20);
         }
         /*
          * Ubuntu / Debian.
          */
     } elseif (file_exists('/etc/timezone')) {
         $data = file_get_contents('/etc/timezone');
         if ($data) {
             return $data;
         }
         /*
          * RHEL / CentOS
          */
     } elseif (file_exists('/etc/sysconfig/clock')) {
         $data = parse_ini_file('/etc/sysconfig/clock');
         if (!empty($data['ZONE'])) {
             return $data['ZONE'];
         }
     }
 }
开发者ID:axyr,项目名称:silverstripe-cli-installer,代码行数:33,代码来源:EnvironmentChecker.php

示例13: generatePhpbbLink

 public function generatePhpbbLink($varValue, DataContainer $dc)
 {
     if (is_link($dc->activeRecord->phpbb_alias) && readlink($dc->activeRecord->phpbb_alias) == $varValue) {
         Message::addInfo("Path to forum already set");
         return $varValue;
     }
     if (is_link($dc->activeRecord->phpbb_alias) !== false && readlink($dc->activeRecord->phpbb_alias) != $varValue) {
         Message::addInfo("Removing old link");
         unlink($dc->activeRecord->phpbb_alias);
     }
     Message::addInfo("Trying to set Forum Symlink");
     if (file_exists($varValue . "/viewtopic.php")) {
         Message::addInfo("Forum found. Setting Link");
         $result = symlink($varValue, $dc->activeRecord->phpbb_alias);
         if ($result === true) {
             Message::addInfo("Link Set");
         }
         if (!is_link($dc->activeRecord->phpbb_alias . '/ext/ctsmedia') || readlink($dc->activeRecord->phpbb_alias . '/ext/ctsmedia') != "../../contao/vendor/ctsmedia/contao-phpbb-bridge-bundle/src/Resources/phpBB/ctsmedia") {
             Message::addInfo("Setting Vendor Link");
             symlink(TL_ROOT . "/vendor/ctsmedia/contao-phpbb-bridge-bundle/src/Resources/phpBB/ctsmedia", $dc->activeRecord->phpbb_alias . '/ext/ctsmedia');
         }
         Message::addInfo("Please activate the contao extension in the phpbb backend");
     } else {
         //Message::addError("Forum could not be found: ".$varValue . "/viewtopic.php");
         throw new Exception("Forum could not be found: " . $varValue . "/viewtopic.php");
     }
     return $varValue;
 }
开发者ID:ctsmedia,项目名称:contao-phpbb-bridge-bundle,代码行数:28,代码来源:tl_page.php

示例14: fstab

function fstab()
{
    $sock = new sockets();
    $unix = new unix();
    $mkdir = $unix->find_program("mkdir");
    $mount = $unix->find_program("mount");
    $rm = $unix->find_program("rm");
    $ln = $unix->find_program("ln");
    if (!is_link("/run/shm")) {
        if (!is_dir("/run/shm")) {
            shell_exec("{$mkdir} -m 1777 /run/shm");
        }
        if (!is_link("/dev/shm")) {
            shell_exec("{$rm} -rf /dev/shm");
            shell_exec("{$ln} -s /run/shm /dev/shm");
        }
    }
    echo "Starting......: " . date("H:i:s") . " [SMP] checking fstab...\n";
    $datas = explode("\n", @file_get_contents("/etc/fstab"));
    while (list($num, $val) = each($datas)) {
        if (preg_match("#^shm.*?tmpfs#", $val, $re)) {
            echo "Starting......: " . date("H:i:s") . " [SMP] checking fstab already set...\n";
            return;
        }
    }
    echo "Starting......: " . date("H:i:s") . " [SMP] Adding SHM mount point\n";
    $datas[] = "shm\t/dev/shm\ttmpfs\tnodev,nosuid,noexec\t0\t0";
    @file_put_contents("/etc/fstab", @implode("\n", $datas) . "\n");
    echo "Starting......: " . date("H:i:s") . " [SMP] mounting shm point\n";
    exec("{$mount} shm 2>&1", $results);
    while (list($num, $val) = each($results)) {
        echo "Starting......: " . date("H:i:s") . " [SMP] mounting shm `{$val}`\n";
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:34,代码来源:exec.squid.smp.php

示例15: run_files

function run_files($file)
{
    if (is_link($file)) {
        return;
    }
    if (is_dir($file . '/.')) {
        $dh = opendir($file);
        $files = array();
        while (false !== ($f = readdir($dh))) {
            if ($f[0] != '.') {
                $files[] = $file . '/' . $f;
            }
        }
        closedir($dh);
        foreach ($files as $f) {
            run_files($f);
        }
    } else {
        if (basename($file) == __FILE__) {
            echo "Skipping " . __FILE__ . "\n";
            continue;
        }
        if (preg_match('/\\.php$/', $file)) {
            fix_up_file($file);
        }
    }
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:27,代码来源:template_updates.php


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