public static function xml_find_repeating(DOMElement $el, $path = '/') { $path .= $el->nodeName; if (!$el->parentNode instanceof DOMDocument) { $path .= '[1]'; } $children = array(); foreach ($el->childNodes as $child) { if ($child instanceof DOMElement) { if (!empty($children[$child->nodeName])) { return $path . '/' . $child->nodeName; } else { $children[$child->nodeName] = true; } } } // reaching this point means we didn't find anything among current element children, so recursively ask children to find something in them foreach ($el->childNodes as $child) { if ($child instanceof DOMElement) { $result = slef::xml_find_repeating($child, $path . '/'); if ($result) { return $result; } } } // reaching this point means we didn't find anything, so return element itself if the function was called for it if ('/' . $el->nodeName == $path) { return $path; } return NULL; }
public function actionIndex($msg = 'hello world') { while (1) { slef::Test($mes); sleep(5); } }
public function listOrders($conds) { extract(slef::defaultConds($conds)); $tail = "LIMIT {$limit} OFFSET {$offset}"; return safe_array_map(function ($info) { $pb = new productCombine($info['products']); $info['products'] = $pb->products(); $info['customer'] = new Customer($info['customer']); $info['factory'] = new Factory($info['factory']); }, Pdb::fetchALL('*', Order::$table, $tail)); }
public static function image($img, $url, $pathToImg){ $img_html = '<img src="'.Yii::app()->baseUrl.$pathToImg.$img.'" align="left" style="border: none" />'; return slef::a($url, $img_html); }
function replySiteMessage($buyreid, $content) { //return TRUE; $content = htmlentities($content); $data = array('access_token' => $this->access_token, 'buyerId' => $buyreid, 'content' => $content); // print_r($data);exit; $url = "{$this->server}/{$this->rootpath}/{$this->protocol}/{$this->version}/{$this->ns}/api.addMessage/{$this->appKey}"; $result = $this->Curl($url, $data); // $result = json_decode($result,true); if ($result != '0') { //处理失败 slef::$errCode = 401; self::$errMsg = var_export($data, TRUE); writeLog(ALIREPLYERR, '返回数据格式错误 --- ' . $result . "\n" . var_export($data, TRUE)); return FALSE; } else { //处理成功 return TRUE; } }