• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP escapeshellarg函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 /**
  * Constructor.
  *
  * @param Horde_Vcs_Base $rep  A repository object.
  * @param string $dn           Path to the directory.
  * @param array $opts          Any additional options:
  *
  * @throws Horde_Vcs_Exception
  */
 public function __construct(Horde_Vcs_Base $rep, $dn, $opts = array())
 {
     parent::__construct($rep, $dn, $opts);
     $cmd = $rep->getCommand() . ' ls ' . escapeshellarg($rep->sourceroot . $this->_dirName);
     $dir = proc_open($cmd, array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
     if (!$dir) {
         throw new Horde_Vcs_Exception('Failed to execute svn ls: ' . $cmd);
     }
     if ($error = stream_get_contents($pipes[2])) {
         proc_close($dir);
         throw new Horde_Vcs_Exception($error);
     }
     /* Create two arrays - one of all the files, and the other of all the
      * dirs. */
     $errors = array();
     while (!feof($pipes[1])) {
         $line = chop(fgets($pipes[1], 1024));
         if (!strlen($line)) {
             continue;
         }
         if (substr($line, 0, 4) == 'svn:') {
             $errors[] = $line;
         } elseif (substr($line, -1) == '/') {
             $this->_dirs[] = substr($line, 0, -1);
         } else {
             $this->_files[] = $rep->getFile($this->_dirName . '/' . $line);
         }
     }
     proc_close($dir);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:39,代码来源:Svn.php


示例2: escapeArgument

 /**
  * Escapes a string to be used as a shell argument.
  *
  * @param string $argument The argument that will be escaped
  *
  * @return string The escaped argument
  */
 public static function escapeArgument($argument)
 {
     //Fix for PHP bug #43784 escapeshellarg removes % from given string
     //Fix for PHP bug #49446 escapeshellarg doesn't work on Windows
     //@see https://bugs.php.net/bug.php?id=43784
     //@see https://bugs.php.net/bug.php?id=49446
     if ('\\' === DIRECTORY_SEPARATOR) {
         if ('' === $argument) {
             return escapeshellarg($argument);
         }
         $escapedArgument = '';
         $quote = false;
         foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
             if ('"' === $part) {
                 $escapedArgument .= '\\"';
             } elseif (self::isSurroundedBy($part, '%')) {
                 // Avoid environment variable expansion
                 $escapedArgument .= '^%"' . substr($part, 1, -1) . '"^%';
             } else {
                 // escape trailing backslash
                 if ('\\' === substr($part, -1)) {
                     $part .= '\\';
                 }
                 $quote = true;
                 $escapedArgument .= $part;
             }
         }
         if ($quote) {
             $escapedArgument = '"' . $escapedArgument . '"';
         }
         return $escapedArgument;
     }
     return escapeshellarg($argument);
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:41,代码来源:ProcessUtils.php


示例3: db

 public function db($command = '', $args = '')
 {
     if (count($command) == 1 && reset($command) == 'help') {
         return $this->db_help();
     }
     $defaults = array('host' => defined('IMPORT_DB_HOST') ? IMPORT_DB_HOST : DB_HOST, 'user' => defined('IMPORT_DB_USER') ? IMPORT_DB_USER : DB_USER, 'password' => defined('IMPORT_DB_PASSWORD') ? IMPORT_DB_PASSWORD : '', 'name' => defined('IMPORT_DB_NAME') ? IMPORT_DB_NAME : '', 'port' => '3306', 'ssh_host' => defined('IMPORT_DB_SSH_HOST') ? IMPORT_DB_SSH_HOST : '', 'ssh_user' => defined('IMPORT_DB_SSH_USER') ? IMPORT_DB_SSH_USER : '', 'table' => '');
     $args = wp_parse_args($args, $defaults);
     $start_time = time();
     if ($args['ssh_host']) {
         shell_exec(sprintf("ssh -f -L 3308:%s:%s %s@%s sleep 600 >> logfile", $args['host'], $args['port'], $args['ssh_user'], $args['ssh_host']));
         $args['host'] = '127.0.0.1';
         $args['port'] = '3308';
     }
     WP_CLI::line('Importing database from ' . $args['host'] . '...' . ($args['ssh_host'] ? ' via ssh tunnel: ' . $args['ssh_host'] : ''));
     $password = $args['password'] ? '--password=' . escapeshellarg($args['password']) : '';
     // TODO pipe through sed or interconnectIT's search replace script
     if (defined('IMPORT_DB_REMOTE_ABSPATH')) {
         $sed = " | sed s," . trailingslashit(IMPORT_DB_REMOTE_ABSPATH) . "," . ABSPATH . ",g";
     } else {
         $sed = '';
     }
     if ($args['site']) {
         $args['table'] = "wp_{$args['site']}_commentmeta wp_{$args['site']}_comments wp_{$args['site']}_links wp_{$args['site']}_options wp_{$args['site']}_postmeta wp_{$args['site']}_posts wp_{$args['site']}_term_relationships wp_{$args['site']}_term_taxonomy wp_{$args['site']}_terms";
     }
     $exec = sprintf('mysqldump --verbose --host=%s --user=%s %s -P %s %s %s %s | mysql --host=%s --user=%s --password=%s %s', $args['host'], $args['user'], $password, $args['port'], $args['name'], $args['table'], $sed, DB_HOST, DB_USER, escapeshellarg(DB_PASSWORD), DB_NAME);
     WP_CLI::line('Running: ' . $exec);
     WP_CLI::launch($exec);
     WP_CLI::success(sprintf('Finished. Took %d seconds', time() - $start_time));
     wp_cache_flush();
 }
开发者ID:humanmade,项目名称:hm-dev,代码行数:30,代码来源:hm-dev.wp-cli.import.php


示例4: do_update_plugin

function do_update_plugin($dir, $domain)
{
    $old = getcwd();
    chdir($dir);
    if (!file_exists('locale')) {
        mkdir('locale');
    }
    $files = get_plugin_sources(".");
    $cmd = <<<END
xgettext \\
    --from-code=UTF-8 \\
    --default-domain={$domain} \\
    --output=locale/{$domain}.pot \\
    --language=PHP \\
    --add-comments=TRANS \\
    --keyword='' \\
    --keyword="_m:1,1t" \\
    --keyword="_m:1c,2,2t" \\
    --keyword="_m:1,2,3t" \\
    --keyword="_m:1c,2,3,4t" \\

END;
    foreach ($files as $file) {
        $cmd .= ' ' . escapeshellarg($file);
    }
    passthru($cmd);
    chdir($old);
}
开发者ID:Br3nda,项目名称:statusnet-debian,代码行数:28,代码来源:update_po_templates.php


示例5: escapeArgument

 public static function escapeArgument($argument)
 {
     if ('\\' === DIRECTORY_SEPARATOR) {
         if ('' === $argument) {
             return escapeshellarg($argument);
         }
         $escapedArgument = '';
         $quote = false;
         foreach (preg_split('/(")/i', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
             if ('"' === $part) {
                 $escapedArgument .= '\\"';
             } elseif (self::isSurroundedBy($part, '%')) {
                 $escapedArgument .= '^%"' . substr($part, 1, -1) . '"^%';
             } else {
                 if ('\\' === substr($part, -1)) {
                     $part .= '\\';
                 }
                 $quote = true;
                 $escapedArgument .= $part;
             }
         }
         if ($quote) {
             $escapedArgument = '"' . $escapedArgument . '"';
         }
         return $escapedArgument;
     }
     return escapeshellarg($argument);
 }
开发者ID:VicDeo,项目名称:poc,代码行数:28,代码来源:ProcessUtils.php


示例6: prepareCommand

 /**
  * 
  * @param string $message SMS message
  * @return string Parsed command
  * @throws ConfigurationException
  */
 private function prepareCommand($message)
 {
     $tokens = [];
     $params = array_merge($this->params, ['message' => escapeshellarg($message)]);
     foreach ($params as $name => $value) {
         $token = '#' . strtoupper($name) . '#';
         if (is_scalar($value)) {
             $tokens[$token] = $value;
         }
     }
     $command = str_replace(array_keys($tokens), array_values($tokens), $this->command);
     try {
         $useSsh = (bool) $this->getParam('use_ssh');
     } catch (ConfigurationException $exp) {
         $useSsh = false;
     }
     if ($useSsh) {
         $sshHost = (string) $this->getParam('ssh_host');
         $sshLogin = (string) $this->getParam('ssh_login');
         if (empty($sshHost) || empty($sshLogin)) {
             throw new ConfigurationException(__CLASS__ . ' is not configured properly. If SSH is enabled then parameters "ssh_host" and "ssh_login" must be set.');
         }
         $tokens['#COMMAND#'] = $command;
         $command = str_replace(array_keys($tokens), array_values($tokens), $this->sshCommand);
     }
     return $command;
 }
开发者ID:orajo,项目名称:sms-zilla,代码行数:33,代码来源:CiscoAdapter.php


示例7: testAcceptsValidStringInput

 public function testAcceptsValidStringInput()
 {
     $msg = escapeshellarg(file_get_contents("{$this->filesDir}valid.txt"));
     $cmd = "{$this->validateScript} {$msg}";
     $result = $this->runCmd($cmd, $output);
     $this->assertTrue($result, $output);
 }
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:7,代码来源:ElggCommitMessageGitHookTest.php


示例8: compress

 public function compress($source, $type)
 {
     $cmd = sprintf('java -jar %s --type %s --charset UTF-8 --line-break 1000', escapeshellarg($this->yuiPath), $type);
     $process = proc_open($cmd, array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w")), $pipes);
     fwrite($pipes[0], $source);
     fclose($pipes[0]);
     $output = array("stdout" => "", "stderr" => "");
     $readSockets = array("stdout" => $pipes[1], "stderr" => $pipes[2]);
     $empty = array();
     while (false !== stream_select($readSockets, $empty, $empty, 1)) {
         foreach ($readSockets as $stream) {
             $output[$stream == $pipes[1] ? "stdout" : "stderr"] .= stream_get_contents($stream);
         }
         $readSockets = array("stdout" => $pipes[1], "stderr" => $pipes[2]);
         $eof = true;
         foreach ($readSockets as $stream) {
             $eof &= feof($stream);
         }
         if ($eof) {
             break;
         }
     }
     $compressed = $output['stdout'];
     $errors = $output['stderr'];
     $this->errors = "" !== $errors;
     if ($this->errors) {
         $compressed = "";
         $this->errors = sprintf("alert('compression errors, check your source and console for details'); console.error(%s); ", json_encode($errors));
     }
     proc_close($process);
     return $compressed;
 }
开发者ID:znanylekarz,项目名称:assets-loader,代码行数:32,代码来源:AssetsCompressor.php


示例9: call

 /**
  * Call a drush command.
  */
 public function call($command, $options = array(), $args = array())
 {
     // Reset previous command.
     $this->result = null;
     $cmd = array();
     $cmd[] = 'drush';
     $cmd[] = $this->alias;
     $cmd[] = $command;
     $cmd[] = '--backend --quiet';
     foreach ($options as $option) {
         $cmd[] = escapeshellarg($option);
     }
     foreach ($args as $arg) {
         $cmd[] = escapeshellarg($arg);
     }
     $cmd = implode(' ', $cmd);
     $output = '';
     $retval = $this->exec($cmd, $output);
     if ($retval > 0) {
         throw new DrushException('Error running ' . $cmd);
     } else {
         $this->result = $this->parseDrushOutput($output);
     }
     return $this;
 }
开发者ID:jonhattan,项目名称:drush-invoker,代码行数:28,代码来源:DrushInvoker.php


示例10: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     if (!class_exists($arguments['class'])) {
         throw new InvalidArgumentException(sprintf('The class "%s" does not exist.', $arguments['class']));
     }
     // base lib and test directories
     $r = new ReflectionClass($arguments['class']);
     list($libDir, $testDir) = $this->getDirectories($r->getFilename());
     $path = str_replace($libDir, '', dirname($r->getFilename()));
     $test = $testDir . '/unit' . $path . '/' . $r->getName() . 'Test.php';
     // use either the test directory or project's bootstrap
     if (!file_exists($bootstrap = $testDir . '/bootstrap/unit.php')) {
         $bootstrap = sfConfig::get('sf_test_dir') . '/bootstrap/unit.php';
     }
     if (file_exists($test) && $options['force']) {
         $this->getFilesystem()->remove($test);
     }
     if (file_exists($test)) {
         $this->logSection('task', sprintf('A test script for the class "%s" already exists.', $r->getName()), null, 'ERROR');
     } else {
         $this->getFilesystem()->copy(dirname(__FILE__) . '/skeleton/test/UnitTest.php', $test);
         $this->getFilesystem()->replaceTokens($test, '##', '##', array('CLASS' => $r->getName(), 'BOOTSTRAP' => $this->getBootstrapPathPhp($bootstrap, $test), 'DATABASE' => $this->isDatabaseClass($r) ? "\n\$databaseManager = new sfDatabaseManager(\$configuration);\n" : ''));
     }
     if (isset($options['editor-cmd'])) {
         $this->getFilesystem()->execute($options['editor-cmd'] . ' ' . escapeshellarg($test));
     }
 }
开发者ID:cbsistem,项目名称:appflower_studio_playground,代码行数:30,代码来源:sfGenerateTestTask.class.php


示例11: checkPassword

 /**
  * Check if the password is correct without logging in the user
  *
  * @param string $uid      The username
  * @param string $password The password
  *
  * @return true/false
  */
 public function checkPassword($uid, $password)
 {
     $uidEscaped = escapeshellarg($uid);
     $password = escapeshellarg($password);
     $result = array();
     $command = self::SMBCLIENT . ' //' . $this->host . '/dummy -U' . $uidEscaped . '%' . $password;
     $lastline = exec($command, $output, $retval);
     if ($retval === 127) {
         OCP\Util::writeLog('user_external', 'ERROR: smbclient executable missing', OCP\Util::ERROR);
         return false;
     } else {
         if (strpos($lastline, self::LOGINERROR) !== false) {
             //normal login error
             return false;
         } else {
             if (strpos($lastline, 'NT_STATUS_BAD_NETWORK_NAME') !== false) {
                 //login on minor error
                 goto login;
             } else {
                 if ($retval != 0) {
                     //some other error
                     OCP\Util::writeLog('user_external', 'ERROR: smbclient error: ' . trim($lastline), OCP\Util::ERROR);
                     return false;
                 } else {
                     login:
                     $this->storeUser($uid);
                     return $uid;
                 }
             }
         }
     }
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:40,代码来源:smb.php


示例12: createOwnVhostStarter

 public function createOwnVhostStarter()
 {
     if (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.enabled_ownvhost') == '1') {
         $mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
         // /var/www/froxlor, needed for chown
         $user = Settings::Get('phpfpm.vhost_httpuser');
         $group = Settings::Get('phpfpm.vhost_httpgroup');
         $domain = array('id' => 'none', 'domain' => Settings::Get('system.hostname'), 'adminid' => 1, 'mod_fcgid_starter' => -1, 'mod_fcgid_maxrequests' => -1, 'guid' => $user, 'openbasedir' => 0, 'email' => Settings::Get('panel.adminmail'), 'loginname' => 'froxlor.panel', 'documentroot' => $mypath);
         // all the files and folders have to belong to the local user
         // now because we also use fcgid for our own vhost
         safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
         // get php.ini for our own vhost
         $php = new phpinterface($domain);
         // get php-config
         if (Settings::Get('phpfpm.enabled') == '1') {
             // fpm
             $phpconfig = $php->getPhpConfig(Settings::Get('phpfpm.vhost_defaultini'));
         } else {
             // fcgid
             $phpconfig = $php->getPhpConfig(Settings::Get('system.mod_fcgid_defaultini_ownvhost'));
         }
         // create starter-file | config-file
         $php->getInterface()->createConfig($phpconfig);
         // create php.ini (fpm does nothing here, as it
         // defines ini-settings in its pool config)
         $php->getInterface()->createIniFile($phpconfig);
     }
 }
开发者ID:Git-Host,项目名称:Froxlor,代码行数:28,代码来源:cron_tasks.inc.http.35.nginx_phpfpm.php


示例13: mimeFromShell

 private function mimeFromShell()
 {
     if (!strstr(strtolower(PHP_OS), 'win')) {
         if (($this->_mime = exec('file -bi ' . escapeshellarg($this->_path))) && strlen($this->_mime)) {
             /*
              * it's a stupid exception for MS docs files
              * The linux command "file -bi" returns then this:
              * application/msword application/msword
              * which sucks totally :(
              */
             if (strstr($this->_mime, ' ') && !strstr($this->_mime, ';')) {
                 $this->_mime = explode(' ', $this->_mime);
                 if (trim($this->_mime[0]) == $this->_mime[1]) {
                     $this->_mime = $this->_mime[0];
                 }
             }
             $this->parseMime();
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:25,代码来源:fileinfo.php


示例14: dump_base

 protected function dump_base(base $base, InputInterface $input, OutputInterface $output)
 {
     $date_obj = new DateTime();
     $filename = sprintf('%s%s_%s.sql', p4string::addEndSlash($input->getArgument('directory')), $base->get_dbname(), $date_obj->format('Y_m_d_H_i_s'));
     $command = sprintf('mysqldump %s %s %s %s %s %s --default-character-set=utf8', '--host=' . escapeshellarg($base->get_host()), '--port=' . escapeshellarg($base->get_port()), '--user=' . escapeshellarg($base->get_user()), '--password=' . escapeshellarg($base->get_passwd()), '--databases', escapeshellarg($base->get_dbname()));
     if ($input->getOption('gzip')) {
         $filename .= '.gz';
         $command .= ' | gzip -9';
     } elseif ($input->getOption('bzip')) {
         $filename .= '.bz2';
         $command .= ' | bzip2 -9';
     }
     $output->write(sprintf('Generating <info>%s</info> ... ', $filename));
     $command .= ' > ' . escapeshellarg($filename);
     $process = new Process($command);
     $process->setTimeout((int) $input->getOption('timeout'));
     $process->run();
     if (!$process->isSuccessful()) {
         $output->writeln('<error>Failed</error>');
         return 1;
     }
     if (file_exists($filename) && filesize($filename) > 0) {
         $output->writeln('OK');
         return 0;
     } else {
         $output->writeln('<error>Failed</error>');
         return 1;
     }
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:29,代码来源:systemBackupDB.php


示例15: main

 /**
  * The main entry point
  *
  * @throws BuildException
  */
 function main()
 {
     $this->setup('info');
     exec('git log -n 1 --no-decorate --pretty=format:"%h" ' . escapeshellarg(realpath($this->workingCopy)), $out);
     $version = $out[0];
     $this->project->setProperty($this->getPropertyName(), $version);
 }
开发者ID:gokuale,项目名称:CUpdater,代码行数:12,代码来源:GitVersionTask.php


示例16: export

 /**
  * Export the locale files to the browser as a tarball.
  * Requires tar for operation (configured in config.inc.php).
  */
 function export($locale)
 {
     // Construct the tar command
     $tarBinary = Config::getVar('cli', 'tar');
     if (empty($tarBinary) || !file_exists($tarBinary)) {
         // We can use fatalError() here as we already have a user
         // friendly way of dealing with the missing tar on the
         // index page.
         fatalError('The tar binary must be configured in config.inc.php\'s cli section to use the export function of this plugin!');
     }
     $command = $tarBinary . ' cz';
     $localeFilesList = TranslatorAction::getLocaleFiles($locale);
     $localeFilesList = array_merge($localeFilesList, TranslatorAction::getMiscLocaleFiles($locale));
     $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
     $localeFilesList[] = $emailTemplateDao->getMainEmailTemplateDataFilename($locale);
     foreach (array_values(TranslatorAction::getEmailFileMap($locale)) as $emailFile) {
     }
     // Include locale files (main file and plugin files)
     foreach ($localeFilesList as $file) {
         if (file_exists($file)) {
             $command .= ' ' . escapeshellarg($file);
         }
     }
     header('Content-Type: application/x-gtar');
     header("Content-Disposition: attachment; filename=\"{$locale}.tar.gz\"");
     header('Cache-Control: private');
     // Workarounds for IE weirdness
     passthru($command);
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:33,代码来源:TranslatorAction.inc.php


示例17: __construct

	function __construct($content) {
		if(extension_loaded('tidy')) {
			// using the tiny php extension
			$tidy = new Tidy();
			$tidy->parseString(
				$content, 
				array(
					'output-xhtml' => true,
					'numeric-entities' => true,
				), 
				'utf8'
			);
			$tidy->cleanRepair();
			$tidy = str_replace('xmlns="http://www.w3.org/1999/xhtml"','',$tidy);
			$tidy = str_replace('&#160;','',$tidy);
		} elseif(`which tidy`) {
			// using tiny through cli
			$CLI_content = escapeshellarg($content);
			$tidy = `echo $CLI_content | tidy -n -q -utf8 -asxhtml 2> /dev/null`;
			$tidy = str_replace('xmlns="http://www.w3.org/1999/xhtml"','',$tidy);
			$tidy = str_replace('&#160;','',$tidy);
		} else {
			// no tidy library found, hence no sanitizing
			$tidy = $content;
		}
		
		
		
		$this->simpleXML = new SimpleXMLElement($tidy);
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:30,代码来源:CSSContentParser.php


示例18: getThumbnail

 /**
  * {@inheritDoc}
  */
 public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
 {
     $this->initCmd();
     if (is_null($this->cmd)) {
         return false;
     }
     $absPath = $fileview->toTmpFile($path);
     $tmpDir = \OC::$server->getTempManager()->getTempBaseDir();
     $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
     $clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
     $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
     shell_exec($exec);
     //create imagick object from pdf
     $pdfPreview = null;
     try {
         list($dirname, , , $filename) = array_values(pathinfo($absPath));
         $pdfPreview = $dirname . '/' . $filename . '.pdf';
         $pdf = new \imagick($pdfPreview . '[0]');
         $pdf->setImageFormat('jpg');
     } catch (\Exception $e) {
         unlink($absPath);
         unlink($pdfPreview);
         \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
         return false;
     }
     $image = new \OC_Image();
     $image->loadFromData($pdf);
     unlink($absPath);
     unlink($pdfPreview);
     if ($image->valid()) {
         $image->scaleDownToFit($maxX, $maxY);
         return $image;
     }
     return false;
 }
开发者ID:loulancn,项目名称:core,代码行数:38,代码来源:office.php


示例19: subProcessCommandEvaluatesSubRequestIniEntriesCorrectly

 /**
  * @test
  */
 public function subProcessCommandEvaluatesSubRequestIniEntriesCorrectly()
 {
     $settings = array('core' => array('context' => 'Testing', 'phpBinaryPathAndFilename' => '/must/be/set/according/to/schema', 'subRequestIniEntries' => array('someSetting' => 'withValue', 'someFlagSettingWithoutValue' => '')));
     $actual = $this->scriptsMock->_call('buildSubprocessCommand', 'flow:foo:identifier', $settings);
     $this->assertContains(sprintf(' -d %s=%s ', escapeshellarg('someSetting'), escapeshellarg('withValue')), $actual);
     $this->assertContains(sprintf(' -d %s ', escapeshellarg('someFlagSettingWithoutValue')), $actual);
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:10,代码来源:ScriptsTest.php


示例20: getimages

function getimages($dir)
{
    global $imagetypes;
    //		array to hold return values;
    $retval = array();
    //		add trailing slashes if missing;
    if (substr($dir, -1) != "/") {
        $dir .= "/images/";
    }
    //		Full server path to dir
    $fulldir = "{$_SERVER['DOCUMENT_ROOT']}/{$dir}";
    // $fulldir ="localhost/novademo-localhost/images/";
    $d = @dir($fulldir) or die("getimages: Failed opening directory {$_SERVER['DOCUMENT_ROOT']}/{$dir} for reading");
    while (false != ($entry = $d->read())) {
        //		skip hidden files
        if ($entry[0] == ".") {
            continue;
        }
        //		check for image files
        $f = escapeshellarg("{$fulldir}" . "{$entry}");
        $mimetype = trim(`file -bi {$f}`);
        foreach ($imagetypes as $valid_type) {
            if (preg_match("@^{$valid_type}@", $mimetype)) {
                $retval[] = array('file' => "/{$dir}" . "{$entry}", 'size' => getimagesize("{$fulldir}" . "{$entry}"));
                break;
            }
        }
    }
    $d->close();
    return $retval;
}
开发者ID:klewasps,项目名称:velvet,代码行数:31,代码来源:listimage.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP escapeshellcmd函数代码示例发布时间:2022-05-15
下一篇:
PHP escape_title函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap