本文整理汇总了PHP中app::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP app::getConfig方法的具体用法?PHP app::getConfig怎么用?PHP app::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app
的用法示例。
在下文中一共展示了app::getConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getController
/**
* @return core_controller
*/
public function getController()
{
$ctrl_class = (self::getRequest()->getModule() ? self::getRequest()->getModule() : app::getConfig('mod/default')) . CS . core_controller::DIR . CS . self::getRequest()->getControllerName();
if (!class_exists($ctrl_class)) {
throw new core_exception_controller("Cannot find controller '{$ctrl_class}'");
}
$controller = new $ctrl_class();
$controller->setRequest(self::getRequest());
return $controller;
}
示例2: log
static function log($message, $logfile = 'core.log')
{
if (!is_string($message)) {
$message = core_debug::dump($message, false);
}
$message = date('[m-d-Y H:i:s]:') . $message;
$fpath = app::getConfig('dir/sd') . DS . self::LOG_DIR . DS . $logfile;
core_fs::createDirIfNotExists(dirname($fpath));
$fh = fopen($fpath, 'a+');
fputs($fh, $message . "\n");
fclose($fh);
return $message;
}
示例3: addTradePointAction
public function addTradePointAction()
{
try {
$tpData = array('name' => $this->getRequest()->getParam('spn'), 'address' => $this->getRequest()->getParam('adr'), 'long' => $this->getRequest()->getParam('long'), 'lat' => $this->getRequest()->getParam('lat'), 'contact_person ' => $this->getRequest()->getParam('con'), 'phone' => $this->getRequest()->getParam('tel'), 'personal_count' => $this->getRequest()->getParam('per'), 'rate' => $this->getRequest()->getParam('ppr'), 'web' => $this->getRequest()->getParam('web'), 'email' => $this->getRequest()->getParam('eml'), 'info' => $this->getRequest()->getParam('inf'), 'is_light_box' => $this->getRequest()->getParam('ilb'), 'is_panel' => $this->getRequest()->getParam('ipl'), 'shelf' => $this->getRequest()->getParam('slf'), 'competitor_id' => $this->getRequest()->getParam('competitor_id'));
$img_64 = $this->getRequest()->getParam('img');
$uniqid = uniqid('tp');
$file_path = app::getConfig("dir/sd") . 'tp' . DS . 'img' . DS . date('Y') . DS . date('m') . DS . date('d') . DS . $uniqid . '.jpg';
$file_url = 'sd' . DS . 'tp' . DS . 'img' . DS . date('Y') . DS . date('m') . DS . date('d') . DS . $uniqid . '.jpg';
core_fs::createDirIfNotExists(dirname($file_path));
$this->_saveRequestImage($file_path, $img_64);
$tpData['image'] = $file_url;
$trade_point = new manage_model_tradepoint();
$trade_point->setData($tpData);
$trade_point->save();
core_log::log($trade_point->getData(), 'tp/' . date('d-m-Y') . 'trade_points.added.log');
$request = $_REQUEST;
unset($request['img']);
$request['img'] = $file_path;
core_log::log($request, 'tp/' . date('d-m-Y') . 'trade_point.request.log');
$this->_xhrOk();
} catch (Exception $e) {
$request = $_REQUEST;
unset($request['img']);
$request['img'] = $file_path;
core_log::logException($e);
core_log::log($request, 'tp/' . date('d-m-Y') . 'trade_point.request.log');
core_log::log($e->getMessage(), 'tp/' . date('d-m-Y') . 'trade_point.error.log');
$this->_xhrErr('err: see exception log');
}
}
示例4: emailGrab
public function emailGrab()
{
self::$grabtime = time();
$inbox = imap_open('{imap.gmail.com:993/imap/ssl}INBOX', 'f.estelkontrol@gmail.com', 'f.estelkontrol08');
/* get all new emails. If set to 'ALL' instead
* of 'NEW' retrieves all the emails, but can be
* resource intensive, so the following variable,
* $max_emails, puts the limit on the number of emails downloaded.
*
*/
$emails = imap_search($inbox, 'UNSEEN');
/* useful only if the above search is set to 'ALL' */
$max_emails = 100;
/* if any emails found, iterate through each email */
if ($emails) {
$count = 1;
/* put the newest emails on top */
rsort($emails);
/* for every email... */
foreach ($emails as $email_number) {
/* get information specific to this email */
$overview = imap_fetch_overview($inbox, $email_number, 0);
//core_debug::dump($overview);
/* get mail structure */
$structure = imap_fetchstructure($inbox, $email_number);
//core_debug::dump($structure);
$attachments = array();
/* if any attachments found... */
if (isset($structure->parts) && count($structure->parts)) {
for ($i = 0; $i < count($structure->parts); $i++) {
$bodyText = imap_fetchbody($inbox, $email_number, 1.2);
if (!strlen($bodyText) > 0) {
$bodyText = imap_fetchbody($inbox, $email_number, 1);
}
$hinfo = imap_headerinfo($inbox, $email_number);
//core_debug::dump($hinfo);
$subject = $hinfo->subject;
$attachments[$i] = array('email_number' => $email_number, 'is_attachment' => false, 'date' => $hinfo->date, 'filename' => '', 'name' => '', 'attachment' => '', 'subject' => $subject, 'csv' => $bodyText, 'csv_orig' => $bodyText);
if ($structure->parts[$i]->ifdparameters) {
foreach ($structure->parts[$i]->dparameters as $object) {
if (strtolower($object->attribute) == 'filename') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['filename'] = $object->value;
}
}
}
if ($structure->parts[$i]->ifparameters) {
foreach ($structure->parts[$i]->parameters as $object) {
if (strtolower($object->attribute) == 'name') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['name'] = $object->value;
}
}
}
if ($attachments[$i]['is_attachment']) {
$attachments[$i]['attachment'] = imap_fetchbody($inbox, $email_number, $i + 1);
//$attachments[$i]['csv'] = imap_fetchbody($inbox, $email_number, $i);
/* 3 = BASE64 encoding */
if ($structure->parts[$i]->encoding == 3) {
$attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']);
$attachments[$i]['subject'] = base64_decode($attachments[$i]['subject']);
$attachments[$i]['csv'] = base64_decode($attachments[$i]['csv']);
} elseif ($structure->parts[$i]->encoding == 4) {
$attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']);
$attachments[$i]['subject'] = quoted_printable_decode($attachments[$i]['subject']);
$attachments[$i]['csv'] = quoted_printable_decode($attachments[$i]['csv']);
}
}
}
}
/* iterate through each attachment and save it */
foreach ($attachments as $attachment) {
if ($attachment['is_attachment'] == 1) {
$attachment['date'] = date('d.m.Y H:i:s', strtotime($attachment['date']));
echo nl2br(core_log::log("START: Processing email [{$attachment['email_number']}]: {$attachment['subject']} ({$attachment['date']})", self::$grabtime . '.event.imap.log'));
$filename = $attachment['name'];
if (empty($filename)) {
$filename = $attachment['filename'];
}
if (empty($filename)) {
$filename = time() . ".dat";
}
/* prefix the email number to the filename in case two emails
* have the attachment with the same file name.
*/
try {
$rpath = "event" . DS . "img" . DS . uniqid(time() . '-') . "-" . $filename;
$path = app::getConfig("dir/sd") . $rpath;
core_fs::createDirIfNotExists(dirname($path));
$fp = fopen($path, "w+");
fwrite($fp, $attachment['attachment']);
fclose($fp);
$attachment['full_filename'] = $rpath;
$event = $this->_email2event($attachment);
echo nl2br(core_log::log("DONE: ID={$event->getId()} ({$path})", self::$grabtime . '.event.imap.log'));
} catch (Exception $e) {
$a = $attachment;
unset($a['attachment']);
$data = core_debug::dump($a, false);
echo nl2br(core_log::log("ERROR: {$e->getMessage()} ", self::$grabtime . '.event.imap.log'));
//.........这里部分代码省略.........
示例5: getBaseUrl
static function getBaseUrl($item = null)
{
return app::getConfig('url/base') . ($item ? $item : '');
}