本文整理汇总了PHP中Pommo::_T方法的典型用法代码示例。如果您正苦于以下问题:PHP Pommo::_T方法的具体用法?PHP Pommo::_T怎么用?PHP Pommo::_T使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pommo
的用法示例。
在下文中一共展示了Pommo::_T方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Pommo_Db
function Pommo_Db($username = NULL, $password = NULL, $database = NULL, $hostname = NULL, $tablePrefix = NULL)
{
// turn off magic quotes runtime
if (get_magic_quotes_runtime()) {
if (!set_magic_quotes_runtime(0)) {
Pommo::kill('Could not turn off PHP\'s magic_quotes_runtime');
}
}
$this->_prefix = $tablePrefix;
$this->_database = $database;
$this->table = array('config' => '`' . $tablePrefix . 'config`', 'fields' => '`' . $tablePrefix . 'fields`', 'group_rules' => '`' . $tablePrefix . 'group_rules`', 'groups' => '`' . $tablePrefix . 'groups`', 'mailing_notices' => '`' . $tablePrefix . 'mailing_notices`', 'mailing_current' => '`' . $tablePrefix . 'mailing_current`', 'mailings' => '`' . $tablePrefix . 'mailings`', 'scratch' => '`' . $tablePrefix . 'scratch`', 'subscriber_data' => '`' . $tablePrefix . 'subscriber_data`', 'subscriber_pending' => '`' . $tablePrefix . 'subscriber_pending`', 'subscriber_update' => '`' . $tablePrefix . 'subscriber_update`', 'subscribers' => '`' . $tablePrefix . 'subscribers`', 'templates' => '`' . $tablePrefix . 'templates`', 'queue' => '`' . $tablePrefix . 'queue`', 'updates' => '`' . $tablePrefix . 'updates`');
$this->_dieOnQuery = TRUE;
$this->_debug = FALSE;
$this->_results = array();
// connect to mysql database using config variables from poMMo class (set in setup/config.php).
// supress errors to hide login information...
$this->_link = mysql_connect($hostname, $username, $password);
if (!$this->_link) {
Pommo::kill(Pommo::_T('Could not establish database connection.') . ' ' . Pommo::_T('Verify your settings in config.php'));
}
if (!@mysql_select_db($database, $this->_link)) {
Pommo::kill(sprintf(Pommo::_T('Connected to database server but could not select database (%s). Does it exist?'), $database) . ' ' . Pommo::_T('Verify your settings in config.php'));
}
// Make sure any results we retrieve or commands we send use the same charset and collation as the database:
// code taken from Juliette Reinders Folmer; http://www.adviesenzo.nl/examples/php_mysql_charset_fix/
// TODO: Cache the charset?
$db_charset = mysql_query("SHOW VARIABLES LIKE 'character_set_database'", $this->_link);
$charset_row = mysql_fetch_assoc($db_charset);
mysql_query("SET NAMES '" . $charset_row['Value'] . "'", $this->_link);
unset($db_charset, $charset_row);
// setup safeSQL class
$this->_safeSQL = new SafeSQL_MySQL($this->_link);
}
示例2: parseSQL
function parseSQL($ignoreerrors = false, $file = false)
{
$dbo = Pommo::$_dbo;
$logger = Pommo::$_logger;
if (!$file) {
$file = Pommo::$_baseDir . 'sql/sql.schema.php';
}
$file_content = @file($file);
if (empty($file_content)) {
Pommo::kill('Error installing. Could not read ' . $file);
}
$query = '';
foreach ($file_content as $sql_line) {
$tsl = trim($sql_line);
if ($sql_line != "" && substr($tsl, 0, 2) != "--" && substr($tsl, 0, 1) != "#") {
$query .= $sql_line;
if (preg_match("/;\\s*\$/", $sql_line)) {
$matches = array();
preg_match('/:::(.+):::/', $query, $matches);
if ($matches[1]) {
$query = preg_replace('/:::(.+):::/', $dbo->table[$matches[1]], $query);
}
$query = trim($query);
if (!$dbo->query($query) && !$ignoreerrors) {
$logger->addErr(Pommo::_T('Database Error: ') . $dbo->getError());
return false;
}
$query = '';
}
}
}
return true;
}
示例3: __construct
function __construct($args = array())
{
$defaults = array('username' => null, 'requiredLevel' => 0);
$p = Pommo_Api::getParams($defaults, $args);
if (empty(Pommo::$_session['username'])) {
Pommo::$_session['username'] = $p['username'];
}
$this->_username =& Pommo::$_session['username'];
$this->_permissionLevel = $this->getPermissionLevel($this->_username);
if ($p['requiredLevel'] > $this->_permissionLevel) {
Pommo::kill(sprintf(Pommo::_T('Denied access. You must %slogin%s to' . ' access this page...'), '<a href="' . Pommo::$_baseUrl . 'index.php?referer=' . $_SERVER['PHP_SELF'] . '">', '</a>'));
}
}
示例4: validate
function validate(&$in)
{
global $pommo;
$invalid = array();
if (empty($in['name'])) {
$invalid[] = 'name';
}
if (empty($in['body']) && empty($in['altbody'])) {
$invalid[] = Pommo::_T('Both HTML and Text cannot be empty');
}
if (!empty($invalid)) {
Pommo::$_logger->addErr(implode(',', $invalid), 3);
return false;
}
return true;
}
示例5: perform
function perform()
{
Pommo_Helper_Maintenance::memorizeBaseURL();
if (is_file(Pommo::$_workDir . '/import.csv')) {
if (!unlink(Pommo::$_workDir . '/import.csv')) {
Pommo::kill('Unable to remove import.csv');
}
}
// truncate error log
if (filesize(Pommo::$_workDir . '/ERROR_LOG') > 25) {
rename(Pommo::$_workDir . '/ERROR_LOG', Pommo::$_workDir . '/ERROR_LOG_OLD');
}
if (!($handle = fopen(Pommo::$_workDir . '/ERROR_LOG', 'w'))) {
Pommo::$_logger->addErr(Pommo::_T('Can write to ERROR_LOG. Check work directory permissions!'));
return;
}
fwrite($handle, "<?php die(); ?>\n");
fclose($handle);
return true;
}
示例6: PommoGroup
function PommoGroup($groupID = NULL, $status = 1, $filter = FALSE)
{
$this->_status = $status;
if (!is_numeric($groupID)) {
// exception if no group ID was passed -- group assumes "all subscribers".
$GLOBALS['pommo']->requireOnce($GLOBALS['pommo']->_baseDir . 'inc/helpers/subscribers.php');
$this->_group = array('rules' => array(), 'id' => 0);
$this->_id = 0;
$this->_name = Pommo::_T('All Subscribers');
$this->_memberIDs = is_array($filter) ? PommoGroup::getMemberIDs($this->_group, $status, $filter) : null;
$this->_tally = is_array($filter) ? count($this->_memberIDs) : PommoSubscriber::tally($status);
return;
}
$this->_group = current(PommoGroup::get(array('id' => $groupID)));
$this->_id = $groupID;
$this->_name =& $this->_group['name'];
$this->_memberIDs = PommoGroup::getMemberIDs($this->_group, $status, $filter);
$this->_tally = count($this->_memberIDs);
return;
}
示例7: __construct
function __construct($groupID = NULL, $status = 1, $filter = FALSE)
{
$this->_status = $status;
if (!is_numeric($groupID)) {
// exception if no group ID was passed -- group assumes "all subscribers".
require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
$this->_group = array('rules' => array(), 'id' => 0);
$this->_id = 0;
$this->_name = Pommo::_T('All Subscribers');
$this->_memberIDs = is_array($filter) ? Pommo_Groups::getMemberIDs($this->_group, $status, $filter) : null;
$this->_tally = is_array($filter) ? count($this->_memberIDs) : Pommo_Subscribers::tally($status);
return;
}
$this->_group = current(Pommo_Groups::get(array('id' => $groupID)));
$this->_id = $groupID;
$this->_name =& $this->_group['name'];
$this->_memberIDs = Pommo_Groups::getMemberIDs($this->_group, $status, $filter);
$this->_tally = count($this->_memberIDs);
return;
}
示例8: display
function display($resource_name, $cache_id = null, $compile_id = null, $display = false)
{
global $pommo;
// attempt to load the theme's requested template
if (!is_file($this->template_dir . '/' . $resource_name)) {
// template file not existant in theme, fallback to "default" theme
if (!is_file($this->_themeDir . 'default/' . $resource_name)) {
// requested template file does not exist in "default" theme, die.
Pommo::kill(sprintf(Pommo::_T('Template file (%s) not found in default or current theme'), $resource_name));
} else {
$resource_name = $this->_themeDir . 'default/' . $resource_name;
$this->template_dir = $this->_themeDir . 'default';
}
}
if ($pommo->_logger->isMsg()) {
$this->assign('messages', $pommo->_logger->getMsg());
}
if ($pommo->_logger->isErr()) {
$this->assign('errors', $pommo->_logger->getErr());
}
return parent::display($resource_name, $cache_id = null, $compile_id = null, $display = false);
}
示例9: display
function display($resource_name)
{
$resource_name .= '.php';
// attempt to load the theme's requested template
if (!is_file($this->template_dir . '/' . $resource_name)) {
// template file not existant in theme, fallback to "default" theme
if (!is_file($this->_themeDir . 'default/' . $resource_name)) {
// requested template file does not exist in "default" theme, die.
Pommo::kill(sprintf(Pommo::_T('Template file (%s) not found in' . ' default or current theme'), $resource_name));
} else {
$resource_name = $this->_themeDir . 'default/' . $resource_name;
$this->template_dir = $this->_themeDir . 'default';
}
} else {
$resource_name = $this->template_dir . '/' . $resource_name;
}
if (Pommo::$_logger->isMsg()) {
$this->assign('messages', Pommo::$_logger->getMsg());
}
if (Pommo::$_logger->isErr()) {
$this->assign('errors', Pommo::$_logger->getErr());
}
include $resource_name;
}
示例10: current
$mailing = current(Pommo_Mailing::get(array('id' => $_REQUEST['mailings'])));
// change group name to ID
$groups = Pommo_Groups::getNames();
$gid = 'all';
foreach ($groups as $group) {
if ($group['name'] == $mailing['group']) {
$gid = $group['id'];
}
}
Pommo_Api::stateReset(array('mailing'));
// if this is a plain text mailing, switch body + altbody.
if ($mailing['ishtml'] == 'off') {
$mailing['altbody'] = $mailing['body'];
$mailing['body'] = null;
}
// Initialize page state with default values overriden by those held in $_REQUEST
$state =& Pommo_Api::stateInit('mailing', array('fromname' => $mailing['fromname'], 'fromemail' => $mailing['fromemail'], 'frombounce' => $mailing['frombounce'], 'list_charset' => $mailing['charset'], 'mailgroup' => $gid, 'subject' => $mailing['subject'], 'body' => $mailing['body'], 'altbody' => $mailing['altbody']));
Pommo::redirect(Pommo::$_baseUrl . 'mailings_start.php');
break;
case 'delete':
$deleted = Pommo_Mailing::delete($mailingIDS);
$logger->addMsg(Pommo::_T('Please Wait') . '...');
$params = $json->encode(array('ids' => $mailingIDS));
$view->assign('callbackFunction', 'deleteMailing');
$view->assign('callbackParams', $params);
break;
default:
$logger->AddErr('invalid call');
break;
}
$view->display('admin/rpc');
示例11: subscriberData
function subscriberData(&$in, $p = array())
{
$defaults = array('prune' => true, 'active' => true, 'log' => true, 'ignore' => false, 'ignoreInactive' => true, 'skipReq' => false);
$p = Pommo_Api::getParams($defaults, $p);
require_once Pommo::$_baseDir . 'classes/Pommo_Fields.php';
$logger = Pommo::$_logger;
$fields = Pommo_Fields::get(array('active' => $p['active']));
$valid = true;
foreach ($fields as $id => $field) {
$inactive = $field['active'] == 'on' ? false : true;
if (!isset($in[$id]) && $p['skipReq']) {
continue;
}
$in[$id] = @trim($in[$id]);
if (empty($in[$id])) {
unset($in[$id]);
// don't include blank values
if ($field['required'] == 'on') {
if ($p['log']) {
$logger->addErr(sprintf(Pommo::_T('%s is a required field.'), $field['prompt']));
}
$valid = false;
}
continue;
}
// shorten
$in[$id] = substr($in[$id], 0, 255);
switch ($field['type']) {
case "checkbox":
if (strtolower($in[$id]) == 'true') {
$in[$id] = 'on';
}
if (strtolower($in[$id]) == 'false') {
$in[$id] = '';
}
if ($in[$id] != 'on' && $in[$id] != '') {
if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
unset($in[$id]);
break;
}
if ($p['log']) {
$logger->addErr(sprintf(Pommo::_T('Illegal input for field %s.'), $field['prompt']));
}
$valid = false;
}
break;
case "multiple":
if (is_array($in[$id])) {
foreach ($in[$id] as $key => $val) {
if (!in_array($val, $field['array'])) {
if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
unset($in[$id]);
break;
}
if ($p['log']) {
$logger->addErr(sprintf(Pommo::_T('Illegal input for field %s.'), $field['prompt']));
}
$valid = false;
}
}
} elseif (!in_array($in[$id], $field['array'])) {
if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
unset($in[$id]);
break;
}
if ($p['log']) {
$logger->addErr(sprintf(Pommo::_T('Illegal input for field %s.'), $field['prompt']));
}
$valid = false;
}
break;
case "date":
// convert date to timestamp [float; using adodb time library]
if (is_numeric($in[$id])) {
$in[$id] = Pommo_Helper::timeToStr($in[$id]);
}
$in[$id] = Pommo_Helper::timeFromStr($in[$id]);
if (!$in[$id]) {
if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
unset($in[$id]);
break;
}
if ($p['log']) {
$logger->addErr(sprintf(Pommo::_T('Field (%s) must be a date (' . Pommo_Helper::timeGetFormat() . ').'), $field['prompt']));
}
$valid = false;
}
break;
case "number":
if (!is_numeric($in[$id])) {
if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
unset($in[$id]);
break;
}
if ($p['log']) {
$logger->addErr(sprintf(Pommo::_T('Field (%s) must be a number.'), $field['prompt']));
}
$valid = false;
}
break;
//.........这里部分代码省略.........
示例12: PommoUpgrade
if (!PommoInstall::parseSQL(false, $file)) {
$logger->addErr('Error Loading Default Mailing Templates.');
}
// serialize the latest updates
$GLOBALS['pommoFakeUpgrade'] = true;
Pommo::requireOnce($pommo->_baseDir . 'install/helper.upgrade.php');
PommoUpgrade();
$logger->addMsg(Pommo::_T('Installation Complete! You may now login and setup poMMo.'));
$logger->addMsg(Pommo::_T('Login Username: ') . 'admin');
$logger->addMsg(Pommo::_T('Login Password: ') . $pass);
$smarty->assign('installed', TRUE);
} else {
// INSTALL FAILED
$dbo->debug(FALSE);
// drop existing poMMo tables
foreach (array_keys($dbo->table) as $key) {
$table = $dbo->table[$key];
$sql = 'DROP TABLE IF EXISTS ' . $table;
$dbo->query($sql);
}
$logger->addErr('Installation failed! Enable debbuging to expose the problem.');
}
}
} else {
// __ FORM NOT VALID
$logger->addMsg(Pommo::_T('Please review and correct errors with your submission.'));
}
}
$smarty->assign($_POST);
$smarty->display('install.tpl');
Pommo::kill();
示例13: Pommo_Template
/**********************************
INITIALIZATION METHODS
*********************************/
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
if (Pommo_Mailing::isCurrent()) {
Pommo::kill(sprintf(Pommo::_T('A Mailing is currently processing. Visit the' . ' %sStatus%s page to check its progress.'), '<a href="mailing_status.php">', '</a>'));
}
if (Pommo::$_config['demo_mode'] == 'on') {
$logger->addMsg(sprintf(Pommo::_T('%sDemonstration Mode%s is on -- no Emails' . ' will actually be sent. This is good for testing settings.'), '<a href="' . Pommo::$_baseUrl . 'setup_configure.php#mailings">', '</a>'));
}
require_once Pommo::$_baseDir . 'themes/wysiwyg/editors.php';
$editors = new PommoWYSIWYG();
$editor = $editors->loadEditor();
if (!$editor) {
die('Could not find requested WYSIWYG editor (' . $editor . ') in editors.php');
}
$view->assign('wysiwygJS', $editor);
// translation assignments for dialg titles...
$view->assign('t_personalization', Pommo::_T('Personalization'));
$view->assign('t_testMailing', Pommo::_T('Test Mailing'));
$view->assign('t_saveTemplate', Pommo::_T('Save Template'));
$view->display('admin/mailings/mailings_start');
示例14: current
$field = current(PommoField::get(array('id' => $_REQUEST['field_id'])));
if ($field['id'] != $_REQUEST['field_id']) {
die('bad field ID');
}
$affected = PommoField::subscribersAffected($field['id'], $_REQUEST['options']);
if (count($affected) > 0 && empty($_REQUEST['confirmed'])) {
$msg = sprintf(Pommo::_T('Deleting option %1$s will affect %2$s subscribers who have selected this choice. They will be flagged as needing to update their records.'), '<b>' . $_REQUEST['options'] . '</b>', '<em>' . count($affected) . '</em>');
$msg .= "\n " . Pommo::_T('Are you sure?');
$json->add('callbackFunction', 'confirm');
$json->add('callbackParams', $msg);
$json->serve();
} else {
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php');
$options = PommoField::optionDel($field, $_REQUEST['options']);
if (!options) {
$json->fail(Pommo::_T('Error with deletion.'));
}
// flag subscribers for update
if (count($affected) > 0) {
PommoSubscriber::flagByID($affected);
}
$json->add('callbackFunction', 'updateOptions');
$json->add('callbackParams', $options);
$json->serve();
}
break;
default:
die('invalid request passed to ' . __FILE__);
break;
}
die;
示例15: PommoTemplate
*/
/**********************************
INITIALIZATION METHODS
*********************************/
require '../../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/groups.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
$smarty->assign('returnStr', Pommo::_T('Subscribers Page'));
/** SET PAGE STATE
* limit - The Maximum # of subscribers to show per page
* sort - The subscriber field to sort by (email, ip, time_registered, time_touched, status, or field_id)
* order - Order Type (ascending - ASC /descending - DESC)
* info - (hide/show) Time Registered/Updated, IP address
*
* status - Filter by subscriber status (active, inactive, pending, all)
* group - Filter by group members (groupID or 'all')
*/
// Initialize page state with default values overriden by those held in $_REQUEST
$state =& PommoAPI::stateInit('subscribers_manage', array('limit' => 150, 'sort' => $pommo->_default_subscriber_sort, 'order' => 'asc', 'status' => 1, 'group' => 'all', 'page' => 1, 'search' => false), $_REQUEST);
/**********************************
VALIDATION ROUTINES
*********************************/
if (!is_numeric($state['limit']) || $state['limit'] < 1 || $state['limit'] > 1000) {