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


PHP caGetOSFamily函数代码示例

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


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

示例1: writeClip

 /** 
  *
  */
 public function writeClip($ps_filepath, $ps_start, $ps_end, $pa_options = null)
 {
     if (!$this->opb_ffmpeg_available) {
         return false;
     }
     $o_tc = new TimecodeParser();
     $vn_start = $vn_end = null;
     if ($o_tc->parse($ps_start)) {
         $vn_start = $o_tc->getSeconds();
     }
     if ($o_tc->parse($ps_end)) {
         $vn_end = $o_tc->getSeconds();
     }
     if (!$vn_start || !$vn_end) {
         return null;
     }
     if ($vn_start >= $vn_end) {
         return null;
     }
     $vn_duration = $vn_end - $vn_start;
     exec($this->ops_path_to_ffmpeg . " -i " . caEscapeShellArg($this->filepath) . " -f mp4 -vcodec libx264 -acodec mp3 -t {$vn_duration}  -y -ss {$vn_start} " . caEscapeShellArg($ps_filepath) . (caGetOSFamily() == OS_POSIX ? " 2> /dev/null" : ""), $va_output, $vn_return);
     if ($vn_return != 0) {
         @unlink($filepath . "." . $ext);
         $this->postError(1610, _t("Error extracting clip from %1 to %2: %3", $ps_start, $ps_end, join("; ", $va_output)), "WLPlugVideo->writeClip()");
         return false;
     }
     return true;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:31,代码来源:Video.php

示例2: write


//.........这里部分代码省略.........
                         $vb_twopass = true;
                     } else {
                         $vb_twopass = false;
                     }
                     // qdiff
                     if (($vs_qdiff = $this->get('qdiff')) != '') {
                         $va_ffmpeg_params["qdiff"] = "-qdiff " . $vs_qdiff;
                     }
                     // partitions
                     if (($vs_partitions = $this->get('partitions')) != '') {
                         $va_ffmpeg_params["partitions"] = "-partitions " . $vs_partitions;
                     }
                     // cmp
                     if (($vs_cmp = $this->get('cmp')) != '') {
                         $va_ffmpeg_params["cmp"] = "-cmp " . $vs_cmp;
                     }
                     // qdiff
                     if (($vs_sc_threshold = $this->get('sc_threshold')) != '') {
                         $va_ffmpeg_params["sc_threshold"] = "-sc_threshold " . $vs_sc_threshold;
                     }
                     // vpre
                     if (!($vs_vpreset = $this->get('vpre')) != '') {
                         $vs_vpreset = null;
                     }
                 }
                 // put it all together
                 // we need to be in a directory where we can write (libx264 logfiles)
                 $vs_cwd = getcwd();
                 chdir(__CA_APP_DIR__ . "/tmp/");
                 $vs_cmd = '';
                 if ($vs_ffmpeg_command) {
                     exec($vs_cmd .= $this->ops_path_to_ffmpeg . " -i " . caEscapeShellArg($this->filepath) . " {$vs_ffmpeg_command} " . caEscapeShellArg($filepath . "." . $ext) . (caIsPOSIX() ? " 2> /dev/null" : ""), $va_output, $vn_return);
                 } else {
                     if ($vs_vpreset) {
                         $vs_other_params = "";
                         if ($vn_audio_bitrate) {
                             $vs_other_params .= "-ab {$vn_audio_bitrate} ";
                         }
                         if ($vn_audio_sample_freq) {
                             $vs_other_params .= "-ar {$vn_audio_sample_freq} ";
                         }
                         if ($vs_res && $vs_res != '') {
                             $vs_other_params .= "-s " . $vs_res;
                         }
                         exec($vs_cmd .= $this->ops_path_to_ffmpeg . " -i " . caEscapeShellArg($this->filepath) . " -f mp4 -vcodec libx264 -acodec libfaac {$vs_other_params} -vpre {$vs_vpreset} -y " . caEscapeShellArg($filepath . "." . $ext) . (caIsPOSIX() ? " 2> /dev/null" : ""), $va_output, $vn_return);
                     } else {
                         if (!$vb_twopass) {
                             exec($vs_cmd .= $this->ops_path_to_ffmpeg . " -i " . caEscapeShellArg($this->filepath) . " -f mp4 -vcodec libx264 -acodec libfaac " . join(" ", $va_ffmpeg_params) . " -y " . caEscapeShellArg($filepath . "." . $ext) . (caGetOSFamily() == OS_POSIX ? " 2> /dev/null" : ""), $va_output, $vn_return);
                         } else {
                             exec($vs_cmd .= $this->ops_path_to_ffmpeg . " -i " . caEscapeShellArg($this->filepath) . " -f mp4 -vcodec libx264 -pass 1 -acodec libfaac " . join(" ", $va_ffmpeg_params) . " -y " . caEscapeShellArg($filepath . "." . $ext) . (caIsPOSIX() ? " 2> /dev/null" : ""), $va_output, $vn_return);
                             exec($vs_cmd .= $this->ops_path_to_ffmpeg . " -i " . caEscapeShellArg($this->filepath) . " -f mp4 -vcodec libx264 -pass 2 -acodec libfaac " . join(" ", $va_ffmpeg_params) . " -y " . caEscapeShellArg($filepath . "." . $ext) . (caIsPOSIX() ? " 2> /dev/null" : ""), $va_output, $vn_return);
                             // probably cleanup logfiles here
                         }
                     }
                 }
                 chdir($vs_cwd);
                 // avoid fun side-effects
                 if (@filesize($filepath . "." . $ext) == 0) {
                     @unlink($filepath . "." . $ext);
                     if ($vs_vpreset) {
                         $this->postError(1610, _t("Couldn't convert file to MPEG4 format [%1]; does the ffmpeg preset '%2' exist? (command was %3)", $vn_return, $vs_vpreset, $vs_cmd), "WLPlugVideo->write()");
                     } else {
                         $this->postError(1610, _t("Couldn't convert file to MPEG4 format [%1] (command was %2)", $vn_return, $vs_cmd), "WLPlugVideo->write()");
                     }
                     return false;
                 }
                 // try to hint for streaming
                 if (file_exists($this->ops_path_to_qt_faststart)) {
                     exec($this->ops_path_to_qt_faststart . " " . caEscapeShellArg($filepath . "." . $ext) . " " . caEscapeShellArg($filepath . "_tmp." . $ext) . (caIsPOSIX() ? " 2> /dev/null" : ""), $va_output, $vn_return);
                     rename("{$filepath}_tmp.{$ext}", "{$filepath}.{$ext}");
                 }
                 # ------------------------------------
                 $this->properties["mimetype"] = $mimetype;
                 $this->properties["typename"] = $this->typenames[$mimetype];
             }
             break;
             # ------------------------------------
         # ------------------------------------
         default:
             if ($mimetype != $this->handle["mime_type"]) {
                 # this plugin can't write this mimetype (no conversions allowed)
                 $this->postError(1610, _t("Can't convert '%1' to %2", $this->handle["mime_type"], $mimetype), "WLPlugVideo->write()");
                 return false;
             }
             # write the file
             if (!copy($this->filepath, $filepath . "." . $ext)) {
                 $this->postError(1610, _t("Couldn't write file to '%1'", $filepath), "WLPlugVideo->write()");
                 return false;
             }
             break;
             # ------------------------------------
     }
     // if output file doesn't exist, ffmpeg failed or isn't installed
     // so use default icons
     if (!file_exists($filepath . "." . $ext)) {
         # use default media icons
         return __CA_MEDIA_VIDEO_DEFAULT_ICON__;
     }
     return $filepath . "." . $ext;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:Video.php

示例3: set


//.........这里部分代码省略.........
                         $vm_value = BaseModel::getPurifier()->purify((string) $vm_value);
                     }
                     if ($this->getFieldInfo($vs_field, "DISPLAY_TYPE") == DT_LIST_MULTIPLE) {
                         if (is_array($vm_value)) {
                             if (!($vs_list_multiple_delimiter = $this->getFieldInfo($vs_field, 'LIST_MULTIPLE_DELIMITER'))) {
                                 $vs_list_multiple_delimiter = ';';
                             }
                             $vs_string_value = join($vs_list_multiple_delimiter, $vm_value);
                             $vs_string_value = str_replace("", '', $vs_string_value);
                             if ($vs_cur_value !== $vs_string_value) {
                                 $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                             }
                             $this->_FIELD_VALUES[$vs_field] = $vs_string_value;
                         }
                     } else {
                         $vm_value = str_replace("", '', $vm_value);
                         if ($this->getFieldInfo($vs_field, "ENTITY_ENCODE_INPUT")) {
                             $vs_value_entity_encoded = htmlentities(html_entity_decode($vm_value));
                             if ($vs_cur_value !== $vs_value_entity_encoded) {
                                 $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                             }
                             $this->_FIELD_VALUES[$vs_field] = $vs_value_entity_encoded;
                         } else {
                             if ($this->getFieldInfo($vs_field, "URL_ENCODE_INPUT")) {
                                 $vs_value_url_encoded = urlencode($vm_value);
                                 if ($vs_cur_value !== $vs_value_url_encoded) {
                                     $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                                 }
                                 $this->_FIELD_VALUES[$vs_field] = $vs_value_url_encoded;
                             } else {
                                 if ($vs_cur_value !== $vm_value) {
                                     $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                                 }
                                 $this->_FIELD_VALUES[$vs_field] = $vm_value;
                             }
                         }
                     }
                     break;
                 case FT_PASSWORD:
                     if (isset($pa_options['purify']) && $pa_options['purify'] || (bool) $this->opb_purify_input || $this->getFieldInfo($vs_field, "PURIFY")) {
                         $vm_value = BaseModel::getPurifier()->purify((string) $vm_value);
                     }
                     if (!$vm_value) {
                         // store blank passwords as blank,
                         $this->_FIELD_VALUES[$vs_field] = "";
                         $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                     } else {
                         // leave the treatment of the password to the AuthAdapter, i.e. don't do hashing here
                         if ($vs_cur_value != $vm_value) {
                             $this->_FIELD_VALUES[$vs_field] = $vm_value;
                             $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                         }
                     }
                     break;
                 case FT_VARS:
                     if (md5(print_r($vs_cur_value, true)) != md5(print_r($vm_value, true))) {
                         $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                     }
                     $this->_FIELD_VALUES[$vs_field] = $vm_value;
                     break;
                 case FT_MEDIA:
                 case FT_FILE:
                     $vb_allow_fetching_of_urls = (bool) $this->_CONFIG->get('allow_fetching_of_media_from_remote_urls');
                     # if there's a tmp_name is the global _FILES array
                     # then we'll process it in insert()/update()...
                     $this->_SET_FILES[$vs_field]['options'] = $pa_options;
                     if (caGetOSFamily() == OS_WIN32) {
                         // fix for paths using backslashes on Windows failing in processing
                         $vm_value = str_replace('\\', '/', $vm_value);
                     }
                     if (isset($pa_options['purify']) && $pa_options['purify'] || (bool) $this->opb_purify_input || $this->getFieldInfo($vs_field, "PURIFY")) {
                         $pa_options["original_filename"] = BaseModel::getPurifier()->purify((string) $pa_options["original_filename"]);
                         $vm_value = BaseModel::getPurifier()->purify((string) $vm_value);
                     }
                     $va_matches = null;
                     if (is_string($vm_value) && (file_exists($vm_value) || $vb_allow_fetching_of_urls && isURL($vm_value) || preg_match("!^userMedia[\\d]+/!", $vm_value))) {
                         $this->_SET_FILES[$vs_field]['original_filename'] = $pa_options["original_filename"];
                         $this->_SET_FILES[$vs_field]['tmp_name'] = $vm_value;
                         $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                     } else {
                         # only return error when file name is not 'none'
                         # 'none' is PHP's stupid way of telling you there
                         # isn't a file...
                         if ($vm_value != "none" && $vm_value) {
                             //$this->postError(1500,_t("%1 does not exist", $vm_value),"BaseModel->set()", $this->tableName().'.'.$vs_field);
                         }
                         return false;
                     }
                     break;
                 default:
                     die("Invalid field type in BaseModel->set()");
                     break;
             }
         } else {
             $this->postError(710, _t("'%1' does not exist in this object", $vs_field), "BaseModel->set()", $this->tableName() . '.' . $vs_field);
             return false;
         }
     }
     return true;
 }
开发者ID:samrahman,项目名称:providence,代码行数:101,代码来源:BaseModel.php

示例4: caIsPOSIX

/**
 * Returns true if running on a POSIX system
 *
 * @return bool
 */
function caIsPOSIX()
{
    return caGetOSFamily() === OS_POSIX;
}
开发者ID:samrahman,项目名称:providence,代码行数:9,代码来源:utilityHelpers.php

示例5: write

 public function write($ps_filepath, $mimetype)
 {
     if (!$this->handle) {
         return false;
     }
     if (strpos($ps_filepath, ':') && caGetOSFamily() != OS_WIN32) {
         $this->postError(1610, _t("Filenames with colons (:) are not allowed"), "WLPlugGmagick->write()");
         return false;
     }
     if ($mimetype == "image/tilepic") {
         if ($this->properties["mimetype"] == "image/tilepic") {
             copy($this->filepath, $ps_filepath);
         } else {
             $tp = new TilepicParser();
             if (!($properties = $tp->encode($this->filepath, $ps_filepath, array("tile_width" => $this->properties["tile_width"], "tile_height" => $this->properties["tile_height"], "layer_ratio" => $this->properties["layer_ratio"], "quality" => $this->properties["quality"], "antialiasing" => $this->properties["antialiasing"], "output_mimetype" => $this->properties["tile_mimetype"], "layers" => $this->properties["layers"])))) {
                 $this->postError(1610, $tp->error, "WLPlugTilepic->write()");
                 return false;
             }
         }
         # update mimetype
         foreach ($properties as $k => $v) {
             $this->properties[$k] = $v;
         }
         $this->properties["mimetype"] = "image/tilepic";
         $this->properties["typename"] = "Tilepic";
         return 1;
     } else {
         # is mimetype valid?
         if (!($ext = $this->info["EXPORT"][$mimetype])) {
             # this plugin can't write this mimetype
             return false;
         }
         $this->handle->setimageformat($this->magick_names[$mimetype]);
         # set quality
         if ($this->properties["quality"] && $this->properties["mimetype"] != "image/tiff") {
             $this->handle->setcompressionquality($this->properties["quality"]);
         }
         $this->handle->setimagebackgroundcolor(new GmagickPixel("#CC0000"));
         if ($this->properties['gamma']) {
             if (!$this->properties['reference-black']) {
                 $this->properties['reference-black'] = 0;
             }
             if (!$this->properties['reference-white']) {
                 $this->properties['reference-white'] = 65535;
             }
             $this->handle->levelimage($this->properties['reference-black'], $this->properties['gamma'], $this->properties['reference-white']);
         }
         $this->handle->stripimage();
         // remove all lingering metadata
         # write the file
         try {
             if (!$this->handle->writeimage($ps_filepath . "." . $ext)) {
                 $this->postError(1610, _t("Error writing file"), "WLPlugGmagick->write()");
                 return false;
             }
             if (!file_exists($ps_filepath . "." . $ext)) {
                 if ($this->handle->getnumberimages() > 1) {
                     if (file_exists($ps_filepath . "-1." . $ext)) {
                         @rename($ps_filepath . "-0." . $ext, $ps_filepath . "." . $ext);
                         $this->properties["mimetype"] = $mimetype;
                         $this->properties["typename"] = $this->handle->getimageformat();
                         // get rid of other pages
                         $i = 1;
                         while (file_exists($vs_f = $ps_filepath . "-" . $i . "." . $ext)) {
                             @unlink($vs_f);
                             $i++;
                         }
                         return $ps_filepath . "." . $ext;
                     }
                 }
                 $this->postError(1610, _t("Error writing file"), "WLPlugGmagick->write()");
                 return false;
             }
         } catch (Exception $e) {
             $this->postError(1610, _t("Error writing file: %1", $e->getMessage()), "WLPlugGmagick->write()");
             return false;
         }
         # update mimetype
         $this->properties["mimetype"] = $mimetype;
         $this->properties["typename"] = $this->handle->getimageformat();
         return $ps_filepath . "." . $ext;
     }
 }
开发者ID:samrahman,项目名称:providence,代码行数:83,代码来源:Gmagick.php

示例6: caBaseDirQuickCheck

 /**
  * I suspect that the application would die before we even reach this check if the base dir is messed up?
  */
 public static function caBaseDirQuickCheck()
 {
     $vs_script_filename = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
     $va_script_name_parts = explode("/", $vs_script_filename);
     $vs_script_called = $va_script_name_parts[sizeof($va_script_name_parts) - 1];
     // index.php or service.php
     $vs_probably_correct_base = str_replace("/{$vs_script_called}", "", $vs_script_filename);
     if (caGetOSFamily() === OS_WIN32) {
         // Windows paths are case insensitive
         if (strcasecmp($vs_probably_correct_base, __CA_BASE_DIR__) != 0) {
             self::addError(_t("It looks like the __CA_BASE_DIR__ variable in your setup.php is not set correctly. Please try to set it to "%1". We came up with this suggestion because the location of this script is "%2".", $vs_probably_correct_base, $vs_script_filename));
         }
     } else {
         if (!($vs_probably_correct_base == __CA_BASE_DIR__)) {
             self::addError(_t("It looks like the __CA_BASE_DIR__ variable in your setup.php is not set correctly. Please try to set it to "%1". We came up with this suggestion because the location of this script is "%2". Note that paths are case sensitive.", $vs_probably_correct_base, $vs_script_filename));
         }
     }
     return true;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:22,代码来源:ConfigurationCheck.php

示例7: write

 public function write($filepath, $mimetype)
 {
     if (!$this->handle) {
         return false;
     }
     if (strpos($filepath, ':') && caGetOSFamily() != OS_WIN32) {
         $this->postError(1610, _t("Filenames with colons (:) are not allowed"), "WLPlugImageMagick->write()");
         return false;
     }
     if ($mimetype == "image/tilepic") {
         if ($this->properties["mimetype"] == "image/tilepic") {
             copy($this->filepath, $filepath);
         } else {
             $tp = new TilepicParser();
             if (!($properties = $tp->encode($this->filepath, $filepath, array("tile_width" => $this->properties["tile_width"], "tile_height" => $this->properties["tile_height"], "layer_ratio" => $this->properties["layer_ratio"], "quality" => $this->properties["quality"], "antialiasing" => $this->properties["antialiasing"], "output_mimetype" => $this->properties["tile_mimetype"], "layers" => $this->properties["layers"])))) {
                 $this->postError(1610, $tp->error, "WLPlugTilepic->write()");
                 return false;
             }
         }
         # update mimetype
         foreach ($properties as $k => $v) {
             $this->properties[$k] = $v;
         }
         $this->properties["mimetype"] = "image/tilepic";
         $this->properties["typename"] = "Tilepic";
         return 1;
     } else {
         # is mimetype valid?
         if (!($ext = $this->info["EXPORT"][$mimetype])) {
             # this plugin can't write this mimetype
             return false;
         }
         if (!$this->_graphicsMagickWrite($this->handle, $filepath . "." . $ext, $mimetype, $this->properties["quality"])) {
             $this->postError(1610, _t("Could not write file %1", $filepath . "." . $ext), "WLPlugImageMagick->write()");
             return false;
         }
         # update mimetype
         $this->properties["mimetype"] = $mimetype;
         $this->properties["typename"] = $this->magick_names[$mimetype];
         return $filepath . "." . $ext;
     }
 }
开发者ID:samrahman,项目名称:providence,代码行数:42,代码来源:GraphicsMagick.php

示例8: caExifToolInstalled

/**
 * Detects if ExifTool (http://www.sno.phy.queensu.ca/~phil/exiftool/) is installed in the given path.
 *
 * @param string $ps_exiftool_path path to ExifTool
 * @return boolean 
 */
function caExifToolInstalled($ps_exiftool_path = null)
{
    if (!$ps_exiftool_path) {
        $ps_exiftool_path = caGetExternalApplicationPath('exiftool');
    }
    global $_MEDIAHELPER_PLUGIN_CACHE_EXIFTOOL;
    if (isset($_MEDIAHELPER_PLUGIN_CACHE_EXIFTOOL[$ps_exiftool_path])) {
        return $_MEDIAHELPER_PLUGIN_CACHE_EXIFTOOL[$ps_exiftool_path];
    } else {
        $_MEDIAHELPER_PLUGIN_CACHE_EXIFTOOL = array();
    }
    if (!trim($ps_exiftool_path) || preg_match("/[^\\/A-Za-z0-9\\.:]+/", $ps_exiftool_path) || !file_exists($ps_exiftool_path)) {
        return false;
    }
    if (!file_exists($ps_exiftool_path)) {
        return $_MEDIAHELPER_PLUGIN_CACHE_EXIFTOOL[$ps_exiftool_path] = false;
    }
    if (caGetOSFamily() == OS_WIN32) {
        return true;
    }
    // don't try exec test on Windows
    exec($ps_exiftool_path . " > /dev/null", $va_output, $vn_return);
    if ($vn_return == 0) {
        return $_MEDIAHELPER_PLUGIN_CACHE_EXIFTOOL[$ps_exiftool_path] = true;
    }
    return $_MEDIAHELPER_PLUGIN_CACHE_EXIFTOOL[$ps_exiftool_path] = false;
}
开发者ID:idiscussforum,项目名称:providence,代码行数:33,代码来源:mediaPluginHelpers.php

示例9: processExists

 function processExists($pn_proc_id)
 {
     if (!$this->canDetectProcesses()) {
         return null;
     }
     switch (caGetOSFamily()) {
         case OS_WIN32:
             $va_proc_info = win32_ps_stat_proc($pn_proc_id);
             return is_array($va_proc_info);
             break;
         default:
             return posix_kill($pn_proc_id, 0) ? true : false;
             break;
     }
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:15,代码来源:ProcessStatus.php

示例10: lockRelease

 public static function lockRelease()
 {
     if (function_exists('sem_get') && caGetOSFamily() == OS_POSIX) {
         if (!self::$s_lock_resource) {
             self::$s_lock_resource = sem_get(ftok(__FILE__, 'CASearchIndexingQueue'));
         }
         sem_release(self::$s_lock_resource);
     } else {
         if (is_resource(self::$s_lock_resource)) {
             @fclose(self::$s_lock_resource);
         }
         @unlink(caGetTempDirPath() . DIRECTORY_SEPARATOR . 'search_indexing_queue.lock');
     }
 }
开发者ID:samrahman,项目名称:providence,代码行数:14,代码来源:ca_search_indexing_queue.php

示例11: set


//.........这里部分代码省略.........
                             BaseModel::$html_purifier = new HTMLPurifier();
                         }
                         $vm_value = BaseModel::$html_purifier->purify((string) $vm_value);
                     }
                     if ($this->getFieldInfo($vs_field, "DISPLAY_TYPE") == DT_LIST_MULTIPLE) {
                         if (is_array($vm_value)) {
                             if (!($vs_list_multiple_delimiter = $this->getFieldInfo($vs_field, 'LIST_MULTIPLE_DELIMITER'))) {
                                 $vs_list_multiple_delimiter = ';';
                             }
                             $vs_string_value = join($vs_list_multiple_delimiter, $vm_value);
                             $vs_string_value = str_replace("", '', $vs_string_value);
                             if ($vs_cur_value !== $vs_string_value) {
                                 $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                             }
                             $this->_FIELD_VALUES[$vs_field] = $vs_string_value;
                         }
                     } else {
                         $vm_value = str_replace("", '', $vm_value);
                         if ($this->getFieldInfo($vs_field, "ENTITY_ENCODE_INPUT")) {
                             $vs_value_entity_encoded = htmlentities(html_entity_decode($vm_value));
                             if ($vs_cur_value !== $vs_value_entity_encoded) {
                                 $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                             }
                             $this->_FIELD_VALUES[$vs_field] = $vs_value_entity_encoded;
                         } else {
                             if ($this->getFieldInfo($vs_field, "URL_ENCODE_INPUT")) {
                                 $vs_value_url_encoded = urlencode($vm_value);
                                 if ($vs_cur_value !== $vs_value_url_encoded) {
                                     $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                                 }
                                 $this->_FIELD_VALUES[$vs_field] = $vs_value_url_encoded;
                             } else {
                                 if ($vs_cur_value !== $vm_value) {
                                     $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                                 }
                                 $this->_FIELD_VALUES[$vs_field] = $vm_value;
                             }
                         }
                     }
                     break;
                 case FT_PASSWORD:
                     if (!$vm_value) {
                         // store blank passwords as blank, not MD5 of blank
                         $this->_FIELD_VALUES[$vs_field] = $vs_crypt_pw = "";
                     } else {
                         if ($this->_CONFIG->get("use_old_style_passwords")) {
                             $vs_crypt_pw = crypt($vm_value, substr($vm_value, 0, 2));
                         } else {
                             $vs_crypt_pw = md5($vm_value);
                         }
                         if ($vs_cur_value != $vm_value && $vs_cur_value != $vs_crypt_pw) {
                             $this->_FIELD_VALUES[$vs_field] = $vs_crypt_pw;
                         }
                         if ($vs_cur_value != $vs_crypt_pw) {
                             $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                         }
                     }
                     break;
                 case FT_VARS:
                     if (md5(print_r($vs_cur_value, true)) != md5(print_r($vm_value, true))) {
                         $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                     }
                     $this->_FIELD_VALUES[$vs_field] = $vm_value;
                     break;
                 case FT_MEDIA:
                 case FT_FILE:
                     $vb_allow_fetching_of_urls = (bool) $this->_CONFIG->get('allow_fetching_of_media_from_remote_urls');
                     # if there's a tmp_name is the global _FILES array
                     # then we'll process it in insert()/update()...
                     $this->_SET_FILES[$vs_field]['options'] = $pa_options;
                     if (caGetOSFamily() == OS_WIN32) {
                         // fix for paths using backslashes on Windows failing in processing
                         $vm_value = str_replace('\\', '/', $vm_value);
                     }
                     $va_matches = null;
                     if (is_string($vm_value) && (file_exists($vm_value) || $vb_allow_fetching_of_urls && isURL($vm_value))) {
                         $this->_SET_FILES[$vs_field]['original_filename'] = $pa_options["original_filename"];
                         $this->_SET_FILES[$vs_field]['tmp_name'] = $vm_value;
                         $this->_FIELD_VALUE_CHANGED[$vs_field] = true;
                     } else {
                         # only return error when file name is not 'none'
                         # 'none' is PHP's stupid way of telling you there
                         # isn't a file...
                         if ($vm_value != "none" && $vm_value) {
                             //$this->postError(1500,_t("%1 does not exist", $vm_value),"BaseModel->set()");
                         }
                         return false;
                     }
                     break;
                 default:
                     die("Invalid field type in BaseModel->set()");
                     break;
             }
         } else {
             $this->postError(710, _t("'%1' does not exist in this object", $vs_field), "BaseModel->set()");
             return false;
         }
     }
     return true;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:101,代码来源:BaseModel.php

示例12: textWithBackgroundColor

 /**
  * Return text in ANSI color
  *
  * @param string $ps_string The string to output
  * @param string $ps_color The background color to output $ps_string with. Colors are defined in CLIBaseUtils::ansiBackgroundColors
  * @return string The string with ANSI color codes. If $ps_color is invalid the original string will be returned without ANSI codes.
  */
 public static function textWithBackgroundColor($ps_string, $ps_color)
 {
     if (!isset(self::$background[$color])) {
         return $ps_string;
     }
     // Disabling color printing under Windows
     if (caGetOSFamily() == OS_WIN32) {
         return $ps_string;
     }
     return "[" . self::$ansiBackgroundColors[$ps_color] . 'm' . $ps_string . "[0m";
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:18,代码来源:CLIBaseUtils.php


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