本文整理匯總了PHP中StatusNet::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP StatusNet::init方法的具體用法?PHP StatusNet::init怎麽用?PHP StatusNet::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類StatusNet
的用法示例。
在下文中一共展示了StatusNet::init方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
Event::handle('Autoload', array(&$cls));
}
}
}
}
}
// XXX: how many of these could be auto-loaded on use?
// XXX: note that these files should not use config options
// at compile time since DB config options are not yet loaded.
require_once 'Validate.php';
require_once 'markdown.php';
// XXX: other formats here
define('NICKNAME_FMT', VALIDATE_NUM . VALIDATE_ALPHA_LOWER);
require_once INSTALLDIR . '/lib/util.php';
require_once INSTALLDIR . '/lib/action.php';
require_once INSTALLDIR . '/lib/mail.php';
require_once INSTALLDIR . '/lib/subs.php';
require_once INSTALLDIR . '/lib/clientexception.php';
require_once INSTALLDIR . '/lib/serverexception.php';
try {
StatusNet::init(@$server, @$path, @$conffile);
} catch (NoConfigException $e) {
// XXX: Throw a conniption if database not installed
// XXX: Find a way to use htmlwriter for this instead of handcoded markup
echo '<p>' . _('No configuration file found. ') . '</p>';
echo '<p>' . _('I looked for configuration files in the following places: ') . '<br/> ';
echo implode($e->configFiles, '<br/>');
echo '<p>' . _('You may wish to run the installer to fix this.') . '</p>';
echo '<a href="install.php">' . _('Go to the installer.') . '</a>';
exit;
}
示例2: Status_network
break;
case 'invite':
$reminders[] = $types['invite'];
break;
case 'all':
$reminders = $types;
break;
}
if (have_option('u', 'universe')) {
$sn = new Status_network();
try {
if ($sn->find()) {
while ($sn->fetch()) {
try {
$server = $sn->getServerName();
StatusNet::init($server);
// Different queue manager, maybe!
$qm = QueueManager::get();
foreach ($reminders as $reminder) {
extract($reminder);
$qm->enqueue(array($type, $opts), 'siterem');
if (!$quiet) {
print "Sent pending {$type} reminders for {$server}.\n";
}
}
} catch (Exception $e) {
// keep going
common_log(LOG_ERR, "Couldn't init {$server}.\n", __FILE__);
if (!$quiet) {
print "Couldn't init {$server}.\n";
}
示例3: switchSite
/**
* Change site configuration to site specified by nickname,
* if set up via Status_network. If not, sites other than
* the current will fail horribly.
*
* May throw exception or trigger a fatal error if the given
* site is missing or configured incorrectly.
*
* @param string $nickname
*/
public static function switchSite($nickname)
{
if ($nickname == StatusNet::currentSite()) {
return true;
}
$sn = Status_network::staticGet('nickname', $nickname);
if (empty($sn)) {
return false;
throw new Exception("No such site nickname '{$nickname}'");
}
$server = $sn->getServerName();
StatusNet::init($server);
}