本文整理匯總了PHP中type::getType方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::getType方法的具體用法?PHP type::getType怎麽用?PHP type::getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::getType方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: afterSave
protected function afterSave()
{
// Set new uploaded file
if ($this->cUploadedFile !== null && $this->cUploadedFile instanceof CUploadedFile) {
$newFilename = $this->getPath() . DIRECTORY_SEPARATOR . $this->getFilename();
if (is_uploaded_file($this->cUploadedFile->getTempName())) {
move_uploaded_file($this->cUploadedFile->getTempName(), $newFilename);
@chmod($newFilename, 0744);
}
/**
* For uploaded jpeg files convert them again - to handle special
* exif attributes (e.g. orientation)
*/
if ($this->cUploadedFile->getType() == 'image/jpeg') {
ImageConverter::TransformToJpeg($newFilename, $newFilename);
}
}
// Set file by given contents
if ($this->newFileContent != null) {
$newFilename = $this->getPath() . DIRECTORY_SEPARATOR . $this->getFilename();
file_put_contents($newFilename, $this->newFileContent);
@chmod($newFilename, 0744);
}
return parent::afterSave();
}
示例2: afterFTPReceived
/**
* (dispatcher hook)
* Check recieved file sequences
* @param type $receiver
* @param type $filepaths
* @param type $hostname
* @return type
*/
public function afterFTPReceived($receiver, $filepaths, $hostname)
{
if ($receiver->getType() != $this->getName()) {
return;
}
$this->checkFilesSeq($filepaths, $hostname);
}
示例3: afterFTPReceived
/**
* Check the received files sequence.
* @param type $receiver
* @param type $filepaths
* @param type $hostname
* @return type
* @throws Exception
*/
public function afterFTPReceived($receiver, $filepaths, $hostname)
{
if ($receiver->getType() != 'smsc' && $receiver->getType() != "smpp" && $receiver->getType() != "mmsc") {
return;
}
$this->checkFilesSeq($filepaths, $hostname);
$path = Billrun_Factory::config()->getConfigValue($receiver->getType() . '.thirdparty.backup_path', false, 'string');
if (!$path) {
return;
}
if ($hostname) {
$path = $path . DIRECTORY_SEPARATOR . $hostname;
}
foreach ($filepaths as $filePath) {
if (!$receiver->backupToPath($filePath, $path, true, true)) {
Billrun_Factory::log()->log("Couldn't save file {$filePath} to third patry path at : {$path}", Zend_Log::ERR);
}
}
}
示例4: validateField
/**
* Bulk PHP validation.
*
* @param type $field Field class instance
* @param type $value
* @return \WP_Error|boolean
* @throws Exception
*/
public function validateField($field)
{
$value = apply_filters('wptoolset_validation_value_' . $field->getType(), $field->getValue());
$rules = $this->_parseRules($field->getValidationData(), $value);
// If not required but empty - skip
if (!isset($rules['required']) && (is_null($value) || $value === false || $value === '')) {
return true;
}
try {
$errors = array();
foreach ($rules as $rule => $args) {
if (!$this->validate($rule, $args['args'])) {
$errors[] = $field->getTitle() . ' ' . $args['message'];
}
}
if (!empty($errors)) {
throw new Exception();
}
} catch (Exception $e) {
return new WP_Error(__CLASS__ . '::' . __METHOD__, 'Field not validated', $errors);
}
return true;
}
示例5: generaAdd
/**
*
* @param type $nome
* @param type $campi
*/
private function generaAdd($nome, $campi)
{
$sql_ = $type = $campi->getType() . ", ";
if ($campi->getDefault()) {
$sql_ .= "DEFAULT = " . $campi->getDefault() . ",";
}
if ($campi->getNullable()) {
$sql .= " NULLABLE = " . $campi->getNullable();
}
if ($sql_[strlen($sql_) - 1] == ",") {
$sql_ = substr($sql_, 0, -1);
}
if ($sql_) {
$this->qb->addColumn($this->name, $nome, $sql_);
}
}
示例6: validateField
/**
* Bulk PHP validation.
*
* @param type $field Field class instance
* @param type $value
* @return \WP_Error|boolean
* @throws Exception
*/
public function validateField($field)
{
$rules = $field->getValidationData();
$value = apply_filters('wptoolset_validation_value_' . $field->getType(), $field->getValue());
// If not required but empty - skip
if (!isset($rules['required']) && (is_null($value) || $value === false || $value === '')) {
return true;
}
try {
$errors = array();
foreach ($rules as $rule => $args) {
$rule = apply_filters('wptoolset_validation_rule_php', $rule);
$args['args'] = apply_filters('wptoolset_validation_args_php', $args['args'], $rule);
// Set value in args - search string '$value' or replace first element
$replace = array_search('$value', $args['args']);
if ($replace !== false) {
$args['args'][$replace] = $value;
} else {
$args['args'][0] = $value;
}
if (!$this->validate($rule, $args['args'])) {
$errors[] = $args['message'];
}
}
if (!empty($errors)) {
throw new Exception();
}
} catch (Exception $e) {
return new WP_Error(__CLASS__ . '::' . __METHOD__, 'Field not validated', $errors);
}
return true;
}
示例7: execPostPackageInstall
/**
* Execute After Packages are installed
* @param type $installedPackage
* @return boolean
*/
protected function execPostPackageInstall($installedPackage)
{
if ($installedPackage->getType() != 'horisen-cms_mod') {
return true;
}
$extras = $installedPackage->getExtra();
if (!isset($extras['installer-name'])) {
return true;
}
//make symlinks
//$this->makeSymlinkModulePublic($extras['installer-name']);
$sqlFile = $this->dir . '/application/modules/' . $extras['installer-name'] . '/init.sql';
if (!file_exists($sqlFile)) {
return true;
}
$this->copySqlScript($sqlFile, $extras['installer-name']);
//$sql = file_get_contents($sqlFile);
//if($this->execSql($sql)){
//$this->io->write("Sql executed for module " . $installedPackage->getName());
//}
}
示例8: validateField
/**
* Bulk PHP validation.
*
* @param type $field Field class instance
* @param type $value
* @return \WP_Error|boolean
* @throws Exception
*/
public function validateField($field)
{
$value = apply_filters('wptoolset_validation_value_' . $field->getType(), $field->getValue());
$rules = $this->_parseRules($field->getValidationData(), $value);
// If not required but empty - skip
if (!isset($rules['required']) && (is_null($value) || $value === false || $value === '')) {
return true;
}
try {
$errors = array();
foreach ($rules as $rule => $args) {
if (!$this->validate($rule, $args['args'])) {
/**
* Allow turn off field name.
*
* Allow turn off field name from error message.
*
* @since x.x.x
*
* @param boolean $var show field title in message, * default true.
*/
if (apply_filters('toolset_common_validation_add_field_name_to_error', true)) {
$errors[] = $field->getTitle() . ' ' . $args['message'];
} else {
$errors[] = $args['message'];
}
}
}
if (!empty($errors)) {
throw new Exception();
}
} catch (Exception $e) {
return new WP_Error(__CLASS__ . '::' . __METHOD__, 'Field not validated', $errors);
}
return true;
}
示例9: getResponse
/**
*
* @param type $method
* @param type $uri
* @return type
* @throws InvalidStatusCodeException
*/
protected function getResponse($method, $uri)
{
if ($this->responseStatusCode != NULL) {
$_responseStatusCode = $this->responseStatusCode;
if ($method->getResponse($this->responseStatusCode) != NULL) {
$this->responseStatusCode = NULL;
return $method->getResponse($_responseStatusCode);
}
throw new InvalidStatusCodeException($this->responseStatusCode, $uri, $method->getType());
}
foreach ($this->statusCodes as $statusCode) {
$response = $method->getResponse($statusCode);
if ($response != NULL) {
return $response;
}
}
if (sizeof($method->getResponses()) > 0) {
$responses = $method->getResponses();
return $responses[key($responses)];
}
throw new NoResponseFoundException($uri, $method->getType());
}