本文整理汇总了PHP中Utils::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::getInstance方法的具体用法?PHP Utils::getInstance怎么用?PHP Utils::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils
的用法示例。
在下文中一共展示了Utils::getInstance方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($mData)
{
if (Utils::getInstance()->array_keys_exists(self::$_aGlobalFileArrayPattern, $mData)) {
return !is_uploaded_file($mData['tmp_name']) ? false : $this->_loadFromGlobals($mData);
} else {
return $this->_loadFromPath($mData);
}
}
示例2: addMockRadio
public function addMockRadio()
{
$name = 'Yodli Radio';
$station_id = Utils::getInstance()->strToFilename($name);
$uid = 1;
$url = "http://stream";
$facebook = "http://facebook";
$twitter = "http://twitter";
$logopath = "http://logo";
$config = ScreenUtils::getInstance()->getDefaultConfig();
$args = ["station_id" => $station_id, "user_id" => $uid, "name" => $name, "logopath" => $logopath, "url" => $url, "facebook" => $facebook, "twitter" => $twitter, "config" => $config];
$res = $this->webDBUtils->addRadio($args);
if (false == $res) {
$this->printErr('WebDBUtilsTest::addMockRadio(): failed');
$this->printErr($this->session->flushError());
} else {
$this->printMsg('WebDBUtilsTest:addMockRadio(): succeeded');
print_r($res);
print PHP_EOL;
}
}
示例3: _updateDataFormat
private function _updateDataFormat()
{
$aGallery = array();
$i = -1;
$utils = Utils::getInstance();
do {
$sPropertyName = 'gal' . ++$i;
if (!is_null($this->{$sPropertyName})) {
$aGallery[] = $sPropertyName;
}
} while (!is_null($this->{$sPropertyName}));
$aGalleryOrder = array();
if (sizeof($aGallery)) {
foreach ($aGallery as $sPropertyName) {
$sUID = $utils->genUID();
$sNewPropertyName = 'gal_' . $sUID;
$this->_aData['dynamic'][$sNewPropertyName] = $this->_aData['dynamic'][$sPropertyName];
$aGalleryOrder[] = $sUID;
unset($this->_aData['dynamic'][$sPropertyName]);
}
}
$this->gallery_order = $aGalleryOrder;
$this->save();
}
示例4: _parseMenuBricks
private function _parseMenuBricks()
{
$aPages = Utils::getInstance()->getPages();
foreach ($this->_getMenuBricks() as $oMenuBrickNode) {
$sMenuNodeContent = '';
foreach ($aPages as $aPageInfos) {
$oClonedMenuNode = $oMenuBrickNode->cloneNode(true);
$this->_parseMenuBrick($oClonedMenuNode, $aPageInfos['url'], $aPageInfos['name']);
self::getNodeContent($oClonedMenuNode, $sMenuNodeContent);
}
self::replaceNodeContent($sMenuNodeContent, $oMenuBrickNode);
$oMenuBrickNode->removeAttribute('data-menu');
}
}
示例5: readDetectProcLog
function readDetectProcLog($app)
{
// sets up utils
$utils = Utils::getInstance();
$wmUtils = WatermarkUtils::getInstance();
$session = Session::getInstance();
$user = User::getInstance();
// reads incoming
$uid = $utils->iStr($app->request()->post('uid'), 64);
if (false == $uid) {
$uid = $user->getId();
}
if (-1 == $uid) {
$uid = $user->getId();
}
//
$pid = $utils->iStr($app->request()->post('pid'), 64);
//
$path = $utils->iStr($app->request()->post('path'), 128);
// sets up a new user
$targetUser = new User(intval($uid));
$path = Settings::storage . $targetUser->getBucket() . '/marked/' . $path;
// reads log file of current detect proc
$res = $wmUtils->readDetectProcLog($path);
$err = false == $res ? $session->flushError() : '';
$res = false == $res ? 'false' : $res;
// evaluates whether or not proc (pid) is running
$proc = $wmUtils->isProcRunning($pid);
$proc = false == $proc ? 'false' : 'true';
// sets up result
$res = array('req' => 'readDetectProcLog', 'res' => $res, 'err' => $err, 'proc' => $proc);
return $res;
}
示例6: PosibException
}
if (!is_writeable(dirname(DATA_PATH)) || !is_writeable(DATA_PATH)) {
throw new PosibException('Error: data file and/or his folder are not writeable !');
}
// global stuffs
global $user;
static $utils;
session_start();
// include libs & tools
include POSIB . 'core/libs/wout.phar';
include POSIB . 'core/tools/singleton.php';
include POSIB . 'core/tools/utils/strings.php';
include POSIB . 'core/tools/utils/globals.php';
include POSIB . 'core/tools/utils/data.php';
include POSIB . 'core/tools/utils.php';
$utils = Utils::getInstance();
include POSIB . 'core/extends/cms_fs.php';
include POSIB . 'core/extends/cms_file.php';
include POSIB . 'core/extends/cms_image.php';
include POSIB . 'core/extends/cms_mail.php';
// include classes
$utils->load(POSIB . 'core/classes/*.php', array(POSIB . 'core/classes/brick.php'));
$utils->clearCache();
// init
$utils->data->init(DATA_PATH);
$wout->init();
// include modules
$utils->load(POSIB . 'modules/*.php');
// run
$wout->run();
// die.
示例7: addScreen
public function addScreen()
{
$name = 'Layout name';
$station_id = Utils::getInstance()->strToFilename($name);
$doc = $this->su->getDefaultConfig();
$res = $this->su->addScreen($name, $station_id, $doc);
if (false == $res) {
$this->printErr('ScreenUtilsTest::addScreen(): failed');
$this->printErr($this->session->flushError());
} else {
$this->printMsg('ScreenUtilsTest::addScreen(): succeeded');
print_r($res);
print PHP_EOL;
}
}
示例8: _generateData
protected function _generateData()
{
$utils = Utils::getInstance();
$sp = self::SP;
$aSitemap = $utils->getTemplates();
$this->set($sp . 'sitemap', $aSitemap);
foreach ($aSitemap as $sPage) {
$this->set($sp . 'pages' . $sp . $sPage . $sp . 'name', $sPage);
$this->set($sp . 'pages' . $sp . $sPage . $sp . 'template', $sPage);
}
$this->save();
}
示例9: _getHeaders
private function _getHeaders()
{
$utils = Utils::getInstance();
$aDomain = explode('.', $utils->globals->server('http_host'));
$sDomainName = $aDomain[sizeof($aDomain) - 2];
$sDomain = $sDomainName . '.' . $aDomain[sizeof($aDomain) - 1];
$sSender = $sDomainName . ' <no-reply@' . $sDomain . '>';
$sHeaders = '';
$sHeaders .= 'Reply-To: ' . $sSender . self::EOL;
$sHeaders .= 'Return-Path: ' . $sSender . self::EOL;
$sHeaders .= 'From: ' . $sSender . self::EOL;
$sHeaders .= 'Organization: ' . $sDomainName . self::EOL;
$sHeaders .= 'Date: ' . date('D, j M Y G:i:s O') . self::EOL;
$sHeaders .= 'MIME-Version: 1.0' . self::EOL;
$sHeaders .= 'X-Sender: <www.' . $sDomain . '>' . self::EOL;
$sHeaders .= 'X-Priority: 1' . self::EOL;
$sHeaders .= 'X-MSMail-Priority: High' . self::EOL;
$sHeaders .= 'X-Mailer: PHP' . phpversion() . self::EOL;
$sHeaders .= 'X-abuse-contact: webmaster@' . $sDomain . self::EOL;
$sHeaders .= 'Content-type: multipart/alternative; boundary="' . $this->boundary . '"' . self::CRLF . self::CRLF;
return $sHeaders;
}
示例10: _getDefaultAddress
private function _getDefaultAddress()
{
DOMParser::getNodeContent($this->_oNode, $sNodeContent);
return strip_tags(Utils::getInstance()->br2nl($sNodeContent));
}
示例11: writeMP3
public function writeMP3()
{
$res = false;
if (false == isset($_FILES)) {
$this->session->setError(L::__('No upload.'));
return false;
}
foreach ($_FILES as $file) {
$src = $file['tmp_name'];
if (false == $this->isMP3($src)) {
$this->session->setError(L::__('Not an MP3 file.'));
return false;
}
$nme = $file['name'];
$nme = Utils::getInstance()->iStr($nme, 128);
$nme = Utils::getInstance()->strToFilename($nme);
$path = $nme;
$dest1 = Settings::storage . $this->user->getBucket() . '/' . $nme;
$dest2 = Settings::storage . $this->user->getBucket() . '/marked/' . $nme;
$this->log->addMessage('Moving file from "' . $src . '" to "' . $dest1 . '"');
$res = @move_uploaded_file($src, $dest1);
if (false == $res) {
$this->session->setError(L::__('Could not move the file.'));
return false;
}
$res = @chmod($dest1, 0644);
if (false == $res) {
$this->session->setError(L::__('Could not chmod the file.'));
return false;
}
$this->log->addMessage('Copying file "' . $dest1 . '" to "' . $dest2 . '"');
$res = @copy($dest1, $dest2);
if (false == $res) {
$this->session->setError(L::__('Could not copy the file.'));
return false;
}
$res = @chmod($dest2, 0644);
if (false == $res) {
$this->session->setError(L::__('Could not chmod the file.'));
return false;
}
$song = array('name' => $nme, 'artist' => '', 'year' => '', 'duration' => '', 'album' => '', 'path' => $path, 'uid' => $this->user->getId(), 'rid' => $this->user->getRadioId());
$res = $this->webDBUtils->addSong($song);
}
return $res;
}
示例12: getBucket
public function getBucket()
{
$res = '/test';
if (null != $this->m && isset($this->m['email'])) {
$res = '/' . Utils::getInstance()->strToFilename($this->m['email']);
if (false == is_dir(Settings::storage . $res)) {
@mkdir(Settings::storage . $res);
}
if (false == is_dir(Settings::storage . $res . '/marked')) {
@mkdir(Settings::storage . $res . '/marked');
}
}
return $res;
}
示例13: get_content
private function get_content($content_url = '', $number = 20, $order = 'n', $exclude_target = '', $start_time = '', $continuation = '')
{
$fields = array('ck' => time(), 'client' => $this->client, 'n' => $number, 'r' => $order, 'output' => 'json');
if (!empty($exclude_target)) {
$fields['xt'] = $exclude_target;
}
if (!empty($start_time)) {
$fields['ot'] = $start_time;
}
if (!empty($continuation)) {
$fields['c'] = $continuation;
}
return $this->request2google('stream/contents/' . Utils::getInstance()->urlencode($content_url), 'get', false, $fields);
}