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


PHP Generic类代码示例

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


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

示例1: loader_import

function &siteevent_translate(&$obj)
{
    loader_import('saf.Database.Generic');
    $g = new Generic('siteevent_event', 'id');
    $g->multilingual = true;
    $res =& $g->translate($obj);
    return $res;
}
开发者ID:vojtajina,项目名称:sitellite,代码行数:8,代码来源:Filters.php

示例2: oidFor

 /**
  * Retrieve oid for a given object. Reserves a new
  * unique oid for the object if it is not yet associated
  * with one. Returns the associated oid otherwise.
  *
  * @param   lang.Object object
  * @return  int
  */
 public function oidFor(Generic $object)
 {
     static $oid = 1;
     if (!isset($this->map[$object->hashCode()])) {
         // Reserve new oid
         $xoid = $oid++;
         // Register object
         $this->map[$object->hashCode()] = $xoid;
         $this->oid[$xoid] = $object;
     }
     return $this->map[$object->hashCode()];
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:20,代码来源:RemoteObjectMap.class.php

示例3: write

 /**
  * Write a record
  *
  * @param   lang.Generic object
  * @param   string[] fields if omitted, all fields will be written
  */
 public function write(Generic $object, array $fields = array())
 {
     $values = array();
     $class = $object->getClass();
     if (!$fields) {
         foreach ($class->getFields() as $f) {
             $values[] = $class->getMethod('get' . ucfirst($f->getName()))->invoke($object);
         }
     } else {
         foreach ($fields as $name) {
             $values[] = $class->getMethod('get' . ucfirst($name))->invoke($object);
         }
     }
     return $this->writeValues($values);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:21,代码来源:CsvBeanWriter.class.php

示例4: overwriteRead

 public function overwriteRead($return)
 {
     $objs = $return['objs'];
     //        pr($objs);
     foreach ($objs as $obj) {
         if (isset($obj->status)) {
             if ($obj->status == "1") {
                 $obj->status = "Free";
             } else {
                 $obj->status = "Occupied";
             }
         }
         if (isset($obj->availability)) {
             if ($obj->availability == "1") {
                 $obj->availability = "Active";
             } else {
                 $obj->availability = "Inactive";
             }
         }
         if (isset($obj->id_restaurant)) {
             $resto = new MasterRestaurantModel();
             $resto->getByID($obj->id_restaurant);
             if (Generic::IsNullOrEmptyString($resto->name)) {
                 $obj->id_restaurant = "Error";
             } else {
                 $obj->id_restaurant = $resto->name;
             }
         }
     }
     return $return;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:31,代码来源:MasterTableModel.php

示例5: changeStatusProgress

 public function changeStatusProgress()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $json = array();
     $json['status_code'] = 1;
     $id_order_detail = isset($_GET['id_order_detail']) ? addslashes($_GET['id_order_detail']) : "";
     if (!$id_order_detail) {
         Generic::errorMsg("id order detail not found!");
     }
     $objOrderDetail = new OrderDetailModel();
     $objOrderDetail->getByID($id_order_detail);
     if ($objOrderDetail->id_order == "") {
         Generic::errorMsg("id order detail not found!");
     }
     $statusProgress = intval($objOrderDetail->status_progress);
     if ($statusProgress == 2) {
         Generic::errorMsg("Status is " . $statusProgress);
     }
     $statusProgress = $statusProgress + 1;
     $objOrderDetail->status_progress = strval($statusProgress);
     $objOrderDetail->load = 1;
     $objOrderDetail->save();
     $json['results'] = $statusProgress;
     echo json_encode($json);
     die;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:28,代码来源:OrderDetail.php

示例6: getCashOutHistoryTransaction

 public function getCashOutHistoryTransaction()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $idResto = Generic::mustCheck($_GET['id_restaurant'], "No ID Restaurant Found");
     $rt = new MasterRestoTransactionModel();
     $arrTrans = $rt->getWhere("id_restaurant='{$idResto}' AND type_transaction='2' ORDER BY datetime_transaction DESC ");
     $result['transactions'] = array();
     foreach ($arrTrans as $trans) {
         unset($b);
         $b['id_transaction'] = $trans->id_transaction;
         $b['id_restaurant'] = $trans->id_restaurant;
         $b['gross_amount'] = (double) $trans->gross_amount;
         $b['net_amount'] = (double) $trans->net_amount;
         $b['type_transaction'] = $trans->type_transaction;
         $b['datetime_transaction'] = $trans->datetime_transaction;
         $b['approved'] = $trans->approved == "1";
         $result['transactions'][] = $b;
     }
     $json['status_code'] = 1;
     $json['results'] = $result;
     echo json_encode($json);
     die;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:25,代码来源:MasterRestoTransaction.php

示例7: recommendationRestoWS

 public function recommendationRestoWS()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $lat = isset($_GET['latitude']) ? addslashes($_GET['latitude']) : "";
     if ($lat == "" or !$lat) {
         $lat = MenuRevoConstants::$latitude;
     }
     if (!Generic::checkLatitude($lat)) {
         Generic::errorMsg("Latitude must be Numeric!");
     }
     $long = isset($_GET['longitude']) ? addslashes($_GET['longitude']) : "";
     if ($long == "" or !$long) {
         $long = MenuRevoConstants::$longitude;
     }
     if (!Generic::checklongitude($long)) {
         Generic::errorMsg("Longitude must be Numeric!");
     }
     $distance = isset($_GET['distance']) ? addslashes($_GET['distance']) : 20;
     if ($distance == '') {
         $distance = 20;
     }
     $page = addslashes($_GET['page']);
     if ($page == "" || $page < 1) {
         $json['status_code'] = 0;
         $json['status_message'] = "No Page Found";
         echo json_encode($json);
         die;
     }
     $limit = addslashes($_GET['limit']);
     if ($limit == "" || $limit < 1) {
         $json['status_code'] = 0;
         $json['status_message'] = "Limit Error";
         echo json_encode($json);
         die;
     }
     $begin = ($page - 1) * $limit;
     $json = array();
     $json['status_code'] = 1;
     global $db;
     $objRecommendation = new RecommendationModel();
     $objRestaurant = new MasterRestaurantModel();
     $qdish = "SELECT recom.*, SQRT(POW(69.1 * (resto.latitude - {$lat}), 2) + POW(69.1 * ({$long} - resto.longitude) * COS(resto.latitude / 57.3), 2)) AS distance FROM {$objRecommendation->table_name} recom LEFT JOIN {$objRestaurant->table_name} resto ON  resto.id_restaurant= recom.id_restaurant AND DATE(recom.end) >= DATE(NOW()) AND DATE(recom.start)<= DATE(NOW())HAVING distance < {$distance} ORDER BY distance LIMIT {$begin},{$limit}";
     $arrRecom = $db->query($qdish, 2);
     //        if (count($arrRecom) == 0) {
     //            $json['status_code'] = 0;
     //            $json['status_message'] = "No ID Found";
     //            echo json_encode($json);
     //            die();
     //        }
     $json['results']['restaurant'] = array();
     foreach ($arrRecom as $recom) {
         $resto = Generic::getRestaurant($recom->id_restaurant);
         $resto['distance'] = $recom->distance;
         $json['results']['restaurant'][] = $resto;
     }
     echo json_encode($json);
     die;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:60,代码来源:Recommendation.php

示例8: write

 /**
  * Write a record
  *
  * @param   lang.Generic object
  * @param   string[] fields if omitted, all fields will be written
  */
 public function write(Generic $object, array $fields = array())
 {
     $values = array();
     $class = $object->getClass();
     // Use the array-cast trick to access private and protected members
     $array = (array) $object;
     if ($fields) {
         foreach ($fields as $name) {
             $values[] = $this->fieldValue($array, $class->getField($name));
         }
     } else {
         foreach ($class->getFields() as $f) {
             $values[] = $this->fieldValue($array, $f);
         }
     }
     return $this->writeValues($values);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:23,代码来源:CsvObjectWriter.class.php

示例9: _preProcess

 /**
  * regex rules for php
  *
  * @return void
  */
 protected function _preProcess()
 {
     parent::_addStringPattern();
     $this->_addPattern('/(class|namespace)\\s([^\\s|\\;]+)/', '$1 <span class="' . $this->_css_prefix . 'method">$2</span>');
     $this->_addPattern('/(include(_once)?|namespace|require(_once)?)([(\\s|\\()])/', '<span class="' . $this->_css_prefix . 'keyword">$1</span>$4');
     $this->_addPattern('/new\\s([^()\\$]+)/', 'new <span class="' . $this->_css_prefix . 'function">$1</span>');
     $this->_addPattern('/extends\\s([^\\s]+)/', 'extends <span class="' . $this->_css_prefix . 'method"><em>$1</em></span>');
     $this->_addPattern('/([\\:]{2})([A-Z_0-9]+)(;|,|:|\\))/', '::<span class="' . $this->_css_prefix . 'constant">$2</span>$3');
     $this->_addPattern('/([\\\\a-zA-Z_0-9]+)([\\:]{2})/', '<span class="' . $this->_css_prefix . 'class">$1</span><span class="' . $this->_css_prefix . 'keyword">::</span>');
     $this->_addPattern('/\\.(?![^\'\\"\\s]*([\'\\"]))/', '<span class="' . $this->_css_prefix . 'keyword">.</span>');
     $this->_addPattern('/default/', '<span class="' . $this->_css_prefix . 'keyword">default</span>');
     $this->_addPattern('/function\\s(.+)\\(/', 'function <span class="' . $this->_css_prefix . 'method">$1</span>(');
     $this->_addPattern('/([^_])array\\(/', '$1<span class="' . $this->_css_prefix . 'function">array</span>(');
     $this->_addPattern('/(\\()([a-zA-Z0-9]+)(\\s)(\\$)/', '$1<span class="' . $this->_css_prefix . 'function">$2</span> $');
     // add the generic code handling stuff
     parent::_preProcess();
     $this->_addPattern('/instanceof\\s(.+)\\)/', '<span class="' . $this->_css_prefix . 'keyword">instanceof</span> <span class="' . $this->_css_prefix . 'function">$1</span>)');
     // namespace stuff
     $this->_addPattern('/use\\s(.*);/', '<span class="' . $this->_css_prefix . 'keyword">use</span> <span class="' . $this->_css_prefix . 'function">$1</span>;');
     $this->_addPattern('/\\\\/', '<span class="' . $this->_css_prefix . 'default">\\</span>');
     $this->_addPattern('/,/', '<span class="' . $this->_css_prefix . 'default">,</span>');
     // keep this in??
     $this->_addPattern('/echo/', '<span class="' . $this->_css_prefix . 'function">echo</span>');
     $this->_addPattern('/(?i)\\b(s(huffle|ort)|is_null|header|var_dump|date|setcookie|n(ext|at(sort|casesort))|c(o(unt|mpact)|urrent)|in_array|(strto|micro)time|u(sort|ksort|asort)|prev|e(nd|xtract)|k(sort|ey|rsort)|a(sort|r(sort|ray_(s(hift|um|plice|earch|lice)|c(h(unk|ange_key_case)|o(unt_values|mbine))|intersect(_(u(key|assoc)|key|assoc))?|diff(_(u(key|assoc)|key|assoc))?|u(n(shift|ique)|intersect(_(uassoc|assoc))?|diff(_(uassoc|assoc))?)|p(op|ush|ad|roduct)|values|key(s|_exists)|f(il(ter|l(_keys)?)|lip)|walk(_recursive)?|r(e(duce|verse)|and)|m(ultisort|erge(_recursive)?|ap))))|r(sort|eset|ange)|m(in|ax)|highlight_(string|file)|s(ys_getloadavg|et_(include_path|magic_quotes_runtime)|leep)|c(on(stant|nection_(status|aborted))|all_user_(func(_array)?|method(_array)?))|time_(sleep_until|nanosleep)|i(s_uploaded_file|n(i_(set|restore|get(_all)?)|et_(ntop|pton))|p2long|gnore_user_abort|mport_request_variables)|u(sleep|nregister_tick_function)|error_(log|get_last)|p(hp_strip_whitespace|utenv|arse_ini_file|rint_r)|flush|long2ip|re(store_include_path|gister_(shutdown_function|tick_function))|get(servby(name|port)|opt|_(c(urrent_user|fg_var)|include_path|magic_quotes_(gpc|runtime))|protobyn(umber|ame)|env)|move_uploaded_file|s(tr(nc(asecmp|mp)|c(asecmp|mp)|len)|et_e(rror_handler|xception_handler))|c(lass_exists|reate_function)|trigger_error|i(s_(subclass_of|a)|nterface_exists)|de(fine(d)?|bug_(print_backtrace|backtrace))|zend_version|property_exists|e(ach|rror_reporting|xtension_loaded)|func(tion_exists|_(num_args|get_arg(s)?))|leak|restore_e(rror_handler|xception_handler)|get_(class(_(vars|methods))?|included_files|de(clared_(classes|interfaces)|fined_(constants|vars|functions))|object_vars|extension_funcs|parent_class|loaded_extensions|resource_type)|method_exists|sys_get_temp_dir|copy|t(empnam|mpfile)|u(nlink|mask)|p(close|open)|f(s(canf|tat|eek)|nmatch|close|t(ell|runcate)|ile(_(put_contents|get_contents))?|open|p(utcsv|assthru)|eof|flush|write|lock|read|get(s(s)?|c(sv)?))|r(e(name|a(dfile|lpath)|wind)|mdir)|get_meta_tags|mkdir|stat|c(h(own|grp|mod)|learstatcache)|is_(dir|executable|file|link|writable|readable)|touch|disk_(total_space|free_space)|file(size|ctime|type|inode|owner|_exists|perms|atime|group|mtime)|l(stat|chgrp)|srand|getrandmax|rand|mt_(srand|getrandmax|rand)|hebrev(c)?|s(scanf|imilar_text|tr(s(tr|pn)|natc(asecmp|mp)|c(hr|spn|oll)|i(str|p(slashes|cslashes|os|_tags))|t(o(upper|k|lower)|r)|_(s(huffle|plit)|ireplace|pad|word_count|r(ot13|ep(eat|lace)))|p(os|brk)|r(chr|ipos|ev|pos))|ubstr(_(co(unt|mpare)|replace))?|etlocale)|c(h(unk_split|r)|ount_chars)|nl(2br|_langinfo)|implode|trim|ord|dirname|uc(first|words)|join|pa(thinfo|rse_str)|explode|quotemeta|add(slashes|cslashes)|wordwrap|l(trim|ocaleconv)|rtrim|money_format|b(in2hex|asename))(?=\\s*\\()/', '<span class="' . $this->_css_prefix . 'function">$1</span>');
     $this->_addPattern('/(image(s(y|tring(up)?|et(style|t(hickness|ile)|pixel|brush)|avealpha|x)|c(har(up)?|o(nvolution|py(res(ized|ampled)|merge(gray)?)?|lor(s(total|et|forindex)|closest(hwb|alpha)?|transparent|deallocate|exact(alpha)?|a(t|llocate(alpha)?)|resolve(alpha)?|match))|reate(truecolor|from(string|jpeg|png|wbmp|g(if|d(2(part)?)?)|x(pm|bm)))?)|2wbmp|t(ypes|tf(text|bbox)|ruecolortopalette)|i(struecolor|nterlace)|d(estroy|ashedline)|jpeg|ellipse|p(s(slantfont|copyfont|text|e(ncodefont|xtendfont)|freefont|loadfont|bbox)|ng|olygon|alettecopy)|f(t(text|bbox)|il(ter|l(toborder|ed(polygon|ellipse|arc|rectangle))?)|ont(height|width))|wbmp|a(ntialias|lphablending|rc)|l(ine|oadfont|ayereffect)|r(otate|ectangle)|g(if|d(2)?|ammacorrect|rab(screen|window))|xbm)|jpeg2wbmp|png2wbmp|gd_info)(?=\\s*\\()/', '<span class="' . $this->_css_prefix . 'function">$1</span>');
     $this->_addPattern('/(?i)\\bmysqli_(s(sl_set|t(ore_result|at|mt_(s(tore_result|end_long_data|qlstate)|num_rows|close|in(sert_id|it)|data_seek|p(aram_count|repare)|e(rr(no|or)|xecute)|f(ield_count|etch|ree_result)|a(ttr_(set|get)|ffected_rows)|res(ult_metadata|et)|bind_(param|result)))|e(t_local_infile_(handler|default)|lect_db)|qlstate)|n(um_(fields|rows)|ext_result)|c(ha(nge_user|racter_set_name)|ommit|lose)|thread_(safe|id)|in(sert_id|it|fo)|options|d(ump_debug_info|ebug|ata_seek)|use_result|p(ing|repare)|err(no|or)|kill|f(ield_(seek|count|tell)|etch_(field(s|_direct)?|lengths|row)|ree_result)|warning_count|a(utocommit|ffected_rows)|r(ollback|eal_(connect|escape_string|query))|get_(server_(info|version)|host_info|client_(info|version)|proto_info)|more_results)(?=\\s*\\()/', '<span class="' . $this->_css_prefix . 'function">$1</span>');
 }
开发者ID:vlucas,项目名称:nijikodo,代码行数:32,代码来源:Php.php

示例10: close

 protected function close($connectionId)
 {
     if (isset($this->_handshakes[$connectionId])) {
         unset($this->_handshakes[$connectionId]);
     } elseif (isset($this->clients[$connectionId])) {
         $this->onClose($connectionId);
         //call user handler
     } elseif (isset($this->services[$connectionId])) {
         $this->onServiceClose($connectionId);
         //call user handler
     } elseif ($this->getIdByConnection($this->_master) == $connectionId) {
         $this->onMasterClose($connectionId);
         //call user handler
     }
     parent::close($connectionId);
     if (isset($this->clients[$connectionId])) {
         unset($this->clients[$connectionId]);
     } elseif (isset($this->services[$connectionId])) {
         unset($this->services[$connectionId]);
     } elseif ($this->getIdByConnection($this->_server) == $connectionId) {
         $this->_server = null;
     } elseif ($this->getIdByConnection($this->_service) == $connectionId) {
         $this->_service = null;
     } elseif ($this->getIdByConnection($this->_master) == $connectionId) {
         $this->_master = null;
     }
     unset($this->_write[$connectionId]);
     unset($this->_read[$connectionId]);
 }
开发者ID:morozovsk,项目名称:websocket,代码行数:29,代码来源:Daemon.php

示例11: onSetUp

 public function onSetUp()
 {
     // mysql from version 5.5.7 does not like to truncate tables with foreign key references: http://bugs.mysql.com/bug.php?id=58788
     $this->getConnection()->getConnection()->exec('SET foreign_key_checks = 0');
     parent::onSetUp();
     $this->getConnection()->getConnection()->exec('SET foreign_key_checks = 1');
 }
开发者ID:jackalope,项目名称:jackalope-prismic,代码行数:7,代码来源:Mysql.php

示例12: remove

 function remove($file, $appname, $id)
 {
     if (!$this->store->remove($appname . '-' . $file)) {
         $this->error = $this->store->error;
         return false;
     }
     return parent::remove($id);
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:8,代码来源:Files.php

示例13: _preProcess

 /**
  * regex rules for ini files
  *
  * @return void
  */
 protected function _preProcess()
 {
     parent::_addStringPattern();
     parent::_addMathPattern();
     parent::_addNumberPattern();
     $this->_addPattern('/(?<![a-zA-Z0-9_])(\\[.*\\])/', '<span class="' . $this->_css_prefix . 'method">$1</span>');
     $this->_addPattern('/\\[(.*\\s?\\:\\s?)(.*)\\]/', '[$1<em>$2</em>]');
 }
开发者ID:vlucas,项目名称:nijikodo,代码行数:13,代码来源:Ini.php

示例14: init

 /**
  * Constructor
  * @return void
  */
 public function init()
 {
     parent::init();
     if ($this->isFinished()) {
         return;
     }
     $this->out("\r\n", false);
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:12,代码来源:Eventsource.php

示例15: process

 /**
  * overriding parent process() so we can get php blocks
  *
  * @return Html
  */
 public function process()
 {
     $this->_tokenizePhp();
     parent::process();
     foreach ($this->_php_blocks as $key => $value) {
         $this->_html = str_replace($key, $value, $this->_html);
     }
 }
开发者ID:vlucas,项目名称:nijikodo,代码行数:13,代码来源:Html.php


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