本文整理汇总了PHP中Pommo类的典型用法代码示例。如果您正苦于以下问题:PHP Pommo类的具体用法?PHP Pommo怎么用?PHP Pommo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pommo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init($language, $baseDir)
{
if (!is_file($baseDir . 'language/' . $language . '/LC_MESSAGES/pommo.mo')) {
Pommo::kill('Unknown Language (' . $language . ')');
}
// if LC_MESSAGES is not available.. make it (helpful for win32)
if (!defined('LC_MESSAGES')) {
define('LC_MESSAGES', 6);
}
// load gettext emulation layer if PHP is not compiled w/ gettext support
if (!function_exists('gettext')) {
require_once $baseDir . 'lib/gettext/gettext.php';
require_once $baseDir . 'lib/gettext/gettext.inc';
}
// set the locale
if (!Pommo_Helper_L10n::_setLocale(LC_MESSAGES, $language, $baseDir)) {
// *** SYSTEM LOCALE COULD NOT BE USED, USE EMULTATION ****
require_once $baseDir . 'lib/gettext/gettext.php';
require_once $baseDir . 'lib/gettext/gettext.inc';
if (!Pommo_Helper_L10n::_setLocaleEmu(LC_MESSAGES, $language, $baseDir)) {
Pommo::kill('Error setting up language translation!');
}
} else {
// *** SYSTEM LOCALE WAS USED ***
if (!defined('_poMMo_gettext')) {
// set gettext environment
$domain = 'pommo';
bindtextdomain($domain, $baseDir . 'language');
textdomain($domain);
if (function_exists('bind_textdomain_codeset')) {
bind_textdomain_codeset($domain, 'UTF-8');
}
}
}
}
示例2: memorizeBaseURL
function memorizeBaseURL()
{
if (!($handle = fopen(Pommo::$_workDir . '/maintenance.php', 'w'))) {
Pommo::kill('Unable to prepare maintenance.php for writing');
}
$fileContent = "<?php die(); ?>\n[baseURL] = \"Pommo::{$_baseUrl}\"\n";
if (!fwrite($handle, $fileContent)) {
Pommo::kill('Unable to perform maintenance');
}
fclose($handle);
}
示例3: __construct
function __construct($toggleEscaping = true)
{
if ($toggleEscaping) {
Pommo::logErrors();
// PHP Errors are logged, turns display_errors off.
Pommo::toggleEscaping();
// Wraps _T and logger responses with htmlspecialchars()
}
$this->_output = array('success' => false, 'messages' => array(), 'errors' => array());
$this->_successMsg = $this->_failMsg = false;
}
示例4: __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>'));
}
}
示例5: 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;
}
示例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)
{
// 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);
}
示例9: 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');
示例10: PommoGroup
}
// ====== CSV EXPORT ======
if ($_POST['type'] == 'csv') {
if (!$ids) {
$group = new PommoGroup($state['group'], $state['status']);
$subscribers = $group->members();
} else {
$subscribers = PommoSubscriber::get(array('id' => $ids));
}
// supply headers
$o = '"' . Pommo::_T('Email') . '"';
if (!empty($_POST['registered'])) {
$o .= ',"' . Pommo::_T('Date Registered') . '"';
}
if (!empty($_POST['ip'])) {
$o .= ',"' . Pommo::_T('IP Address') . '"';
}
foreach ($fields as $f) {
$o .= ",\"{$f['name']}\"";
}
$o .= "\r\n";
function csvWrap(&$in)
{
$in = '"' . addslashes($in) . '"';
return;
}
foreach ($subscribers as $sub) {
$d = array();
// normalize field order in export
foreach (array_keys($fields) as $id) {
if (array_key_exists($id, $sub['data'])) {
示例11: ini_set
* Copyright (C) 2005, 2006, 2007, 2008 Brice Burgess <bhb@iceburg.net>
*
* This file is part of poMMo (http://www.pommo.org)
*
* poMMo is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2, or any later version.
*
* poMMo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with program; see the file docs/LICENSE. If not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// TODO: Check that magic quotes is turned off
// While poMMo is in development state, we'll attempt to display PHP notices,
// warnings, errors
ini_set('display_errors', '1');
//error_reporting(E_ALL); // [DEVELOPMENT]
error_reporting(E_ALL ^ E_NOTICE);
// [RELEASE]
// Include core components
require 'classes/Pommo_Helper.php';
require 'classes/Pommo_Api.php';
require 'classes/Pommo.php';
// Instantiate pommo
Pommo::preinit(dirname(__FILE__) . '/');
示例12: Pommo_Template
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
$emails = Pommo::get('emails');
$dupes = Pommo::get('dupes');
$fields = Pommo_Fields::get();
$flag = FALSE;
foreach ($fields as $field) {
if ($field['required'] == 'on') {
$flag = TRUE;
}
}
if (isset($_GET['continue'])) {
foreach ($emails as $email) {
$subscriber = array('email' => $email, 'registered' => time(), 'ip' => $_SERVER['REMOTE_ADDR'], 'status' => 1, 'data' => array());
if ($flag) {
$subscriber['flag'] = 9;
}
if (!Pommo_Subscribers::add($subscriber)) {
die('Error importing subscriber');
}
}
sleep(1);
die(Pommo::_T('Complete!') . ' <a href="subscribers_import.php">' . Pommo::_T('Return to') . ' ' . Pommo::_T('Import') . '</a>');
}
$view->assign('flag', $flag);
$view->assign('tally', count($emails));
$view->assign('dupes', $dupes);
$view->display('admin/subscribers/import_txt');
示例13:
<?php
/**
* Copyright (C) 2005, 2006, 2007, 2008 Brice Burgess <bhb@iceburg.net>
*
* This file is part of poMMo (http://www.pommo.org)
*
* poMMo is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2, or any later version.
*
* poMMo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with program; see the file docs/LICENSE. If not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require '../bootstrap.php';
Pommo::redirect('login.php');
示例14: elseif
$state['order'] = 'asc';
}
if (!is_numeric($state['sort']) && $state['sort'] != 'email' && $state['sort'] != 'ip' && $state['sort'] != 'time_registered' && $state['sort'] != 'time_touched') {
$state['sort'] = 'email';
}
if (!is_numeric($state['status'])) {
$state['status'] = 1;
}
if (!is_numeric($state['group']) && $state['group'] != 'all') {
$state['group'] = 'all';
}
if (isset($_REQUEST['searchClear'])) {
$state['search'] = false;
} elseif (isset($_REQUEST['searchField']) && (is_numeric($_REQUEST['searchField']) || $_REQUEST['searchField'] == 'email' || $_REQUEST['searchField'] == 'ip' || $_REQUEST['searchField'] == 'time_registered' || $_REQUEST['searchField'] == 'time_touched')) {
$_REQUEST['searchString'] = trim($_REQUEST['searchString']);
$state['search'] = empty($_REQUEST['searchString']) ? false : array('field' => $_REQUEST['searchField'], 'string' => trim($_REQUEST['searchString']));
}
/**********************************
DISPLAY METHODS
*********************************/
// Get the *empty* group [no member IDs. 3rd arg is set TRUE]
$group = new PommoGroup($state['group'], $state['status'], $state['search']);
// Calculate and Remember number of pages for this group/status combo
$state['pages'] = is_numeric($group->_tally) && $group->_tally > 0 ? ceil($group->_tally / $state['limit']) : 0;
$smarty->assign('state', $state);
$smarty->assign('tally', $group->_tally);
$smarty->assign('groups', PommoGroup::get());
$smarty->assign('fields', PommoField::get());
$smarty->display('admin/subscribers/subscribers_manage.tpl');
Pommo::kill();
示例15: Pommo_Groups
*
* poMMo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with program; see the file docs/LICENSE. If not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**********************************
INITIALIZATION METHODS
*********************************/
require '../bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Groups.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
// Remember the Page State
$state = Pommo_Api::stateInit('subscribers_manage');
// Fetch group + member IDs
$group = new Pommo_Groups($state['group'], $state['status'], $state['search']);
/**********************************
JSON OUTPUT INITIALIZATION
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
/**********************************
PAGINATION AND ORDERING
*********************************/
// Get and Remember the requested number of rows