本文整理汇总了PHP中RSMembershipHelper::readConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP RSMembershipHelper::readConfig方法的具体用法?PHP RSMembershipHelper::readConfig怎么用?PHP RSMembershipHelper::readConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSMembershipHelper
的用法示例。
在下文中一共展示了RSMembershipHelper::readConfig方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save($data)
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$config = RSMembershipConfig::getInstance();
// parse rules
if (isset($data['rules'])) {
$rules = new JAccessRules($data['rules']);
$asset = JTable::getInstance('asset');
if (!$asset->loadByName($this->option)) {
$root = JTable::getInstance('asset');
$root->loadByName('root.1');
$asset->name = $this->option;
$asset->title = $this->option;
$asset->setLocation($root->id, 'last-child');
}
$asset->rules = (string) $rules;
if (!$asset->check() || !$asset->store()) {
$this->setError($asset->getError());
return false;
}
}
if (!isset($data['captcha_enabled_for']) && isset($data['captcha_enabled']) && $data['captcha_enabled'] > 0) {
$data['captcha_enabled_for'] = array();
}
foreach ($data as $prop => $val) {
$config->set($prop, $val);
}
RSMembershipHelper::readConfig(true);
return true;
}
示例2: plgSystemRSMembership
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @since 1.5
*/
function plgSystemRSMembership(&$subject, $config)
{
parent::__construct($subject, $config);
if (file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsmembership' . DS . 'helpers' . DS . 'rsmembership.php')) {
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsmembership' . DS . 'helpers' . DS . 'rsmembership.php';
RSMembershipHelper::readConfig();
}
}
示例3: __construct
function __construct()
{
parent::__construct();
JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsmembership' . DS . 'tables');
$document =& JFactory::getDocument();
// Add the css stylesheet
$document->addStyleSheet(JURI::root(true) . '/components/com_rsmembership/assets/css/rsmembership.css');
// Add the javascript
$document->addScript(JURI::root(true) . '/components/com_rsmembership/assets/js/rsmembership.js');
// Set the database object
$this->_db =& JFactory::getDBO();
RSMembershipHelper::readConfig();
}
示例4: __construct
function __construct()
{
parent::__construct();
$document =& JFactory::getDocument();
// Add the css stylesheet
$document->addStyleSheet(JURI::root(true) . '/administrator/components/com_rsmembership/assets/css/rsmembership.css');
if (RSMembershipHelper::isJ16()) {
$document->addStyleSheet(JURI::root(true) . '/administrator/components/com_rsmembership/assets/css/rsmembership16.css');
}
// Set the database object
$this->_db =& JFactory::getDBO();
RSMembershipHelper::readConfig();
}
示例5: defined
<?php
/**
* @version 1.0.0
* @package RSMembership! 1.0.0
* @copyright (C) 2009-2010 www.rsjoomla.com
* @license GPL, http://www.gnu.org/licenses/gpl-2.0.html
*/
defined('_JEXEC') or die('Restricted access');
// Require the base controller
require_once JPATH_COMPONENT . DS . 'controller.php';
require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'rsmembership.php';
RSMembershipHelper::readConfig();
// See if this is a request for a specific controller
$controller = JRequest::getCmd('controller');
if (!empty($controller)) {
require_once JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php';
$controller = 'RSMembershipController' . $controller;
$RSMembershipController = new $controller();
} else {
$RSMembershipController = new RSMembershipController();
}
$RSMembershipController->execute(JRequest::getCmd('task'));
// Redirect if set
$RSMembershipController->redirect();
示例6: idevCheckConnection
function idevCheckConnection()
{
$post = JRequest::get('post');
if (isset($post['idev_url'])) {
if (strlen($post['idev_url']) > 5) {
$post['idev_url'] = rtrim($post['idev_url'], '/');
$post['idev_url'] .= '/';
}
$this->_db->setQuery("UPDATE #__rsmembership_configuration SET `value`='" . $this->_db->getEscaped($post['idev_url']) . "' WHERE `name`='idev_url' LIMIT 1");
$this->_db->query();
}
RSMembershipHelper::readConfig(true);
$result = RSMembership::updateIdev(array('idev_saleamt' => 1.0, 'idev_ordernum' => 'test', 'ip_address' => '127.0.0.1'));
if (!$result['success']) {
JError::raiseWarning(500, JText::sprintf('RSM_IDEV_COULD_NOT_CONNECT', $result['url'], !empty($result['error']) ? $result['error'] : JText::_('RSM_UNKNOWN'), $result['code']));
return false;
}
return true;
}
示例7: sendExpirationEmails
function sendExpirationEmails()
{
RSMembershipHelper::readConfig();
$db = JFactory::getDBO();
// Check the last time this has been run
$now = RSMembershipHelper::getCurrentDate();
if ($now < RSMembershipHelper::getConfig('expire_last_run') + RSMembershipHelper::getConfig('expire_check_in') * 60) {
return;
}
$db->setQuery("UPDATE #__rsmembership_configuration SET `value`='" . $now . "' WHERE `name`='expire_last_run'");
$db->query();
// Get custom fields
$db->setQuery("SELECT id, name FROM #__rsmembership_fields WHERE published='1' ORDER BY ordering");
$fields = $db->loadObjectList();
// Get expiration intervals and memberships
// Performance check - if no emails can be sent, no need to grab the membership
$db->setQuery("SELECT * FROM #__rsmembership_memberships WHERE (`user_email_from_addr`!='' OR `user_email_use_global`='1' OR `admin_email_to_addr` != '') AND published='1'");
$memberships = $db->loadObjectList();
$date = JFactory::getDate();
$update_ids = array();
foreach ($memberships as $membership) {
// Select all the subscriptions that match (about to expire)
$db->setQuery("SELECT u.id AS user_id, u.email AS user_email, u.name AS user_name, u.username AS user_username, mu.id AS muid, mu.extras, mu.membership_end FROM #__rsmembership_membership_users mu LEFT JOIN #__users u ON (mu.user_id=u.id) WHERE mu.`status`='0' AND mu.`notified`='0' AND mu.membership_end > 0 AND mu.`membership_end` < '" . ($date->toUnix() + $membership->expire_notify_interval * 86400) . "' AND mu.`membership_id`='" . $membership->id . "' LIMIT " . (int) RSMembershipHelper::getConfig('expire_emails'));
$results = $db->loadObjectList();
if (empty($results)) {
continue;
}
foreach ($results as $result) {
$extras = '';
// Performance check
if ($result->extras && (strpos($membership->user_email_expire_text . $membership->user_email_expire_subject, '{extras}') !== false || strpos($membership->admin_email_expire_text . $membership->admin_email_expire_subject, '{extras}') !== false)) {
$db->setQuery("SELECT `name` FROM #__rsmembership_extra_values WHERE `id` IN (" . $result->extras . ")");
$extras = implode(', ', $db->loadResultArray());
}
$replace = array('{membership}', '{extras}', '{email}', '{name}', '{username}', '{interval}');
$with = array($membership->name, $extras, $result->user_email, $result->user_name, $result->user_username, ceil(($result->membership_end - $date->toUnix()) / 86400));
$db->setQuery("SELECT * FROM #__rsmembership_users WHERE user_id='" . (int) $result->user_id . "'");
$user_data_tmp = $db->loadObject();
$user_data = array();
foreach ($fields as $field) {
$field_id = 'f' . $field->id;
$user_data[$field->name] = isset($user_data_tmp->{$field_id}) ? $user_data_tmp->{$field_id} : '';
}
unset($user_data_tmp);
foreach ($fields as $field) {
$name = $field->name;
$replace[] = '{' . $name . '}';
if (isset($user_data[$name])) {
$with[] = is_array($user_data[$name]) ? implode("\n", $user_data[$name]) : $user_data[$name];
} else {
$with[] = '';
}
}
$jconfig = JFactory::getConfig();
if ($membership->user_email_expire_subject) {
$message = str_replace($replace, $with, $membership->user_email_expire_text);
// from address
$from = $membership->user_email_use_global ? $jconfig->getValue('config.mailfrom') : $membership->user_email_from_addr;
// from name
$fromName = $membership->user_email_use_global ? $jconfig->getValue('config.fromname') : $membership->user_email_from;
// recipient
$recipient = $result->user_email;
// user email
// subject
$subject = str_replace($replace, $with, $membership->user_email_expire_subject);
// body
$body = $message;
// mode
$mode = $membership->user_email_mode;
// cc
$cc = null;
// bcc
$bcc = null;
// attachments
$db->setQuery("SELECT `path` FROM #__rsmembership_membership_attachments WHERE `membership_id`='" . $membership->id . "' AND `email_type`='user_email_expire' AND `published`='1' ORDER BY `ordering`");
$attachment = $db->loadResultArray();
// reply to
$replyto = $from;
// reply to name
$replytoname = $fromName;
// send to user
RSMembershipHelper::sendMail($from, $fromName, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname);
}
// admin emails
if ($membership->admin_email_expire_subject) {
$message = str_replace($replace, $with, $membership->admin_email_expire_text);
// from address
$from = $result->user_email;
// from name
$fromName = $result->user_name;
// recipient
$recipient = $membership->admin_email_to_addr;
// subject
$subject = str_replace($replace, $with, $membership->admin_email_expire_subject);
// body
$body = $message;
// mode
$mode = $membership->admin_email_mode;
// cc
$cc = null;
//.........这里部分代码省略.........