本文整理汇总了PHP中TemplateHandler::registerTagHandler方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateHandler::registerTagHandler方法的具体用法?PHP TemplateHandler::registerTagHandler怎么用?PHP TemplateHandler::registerTagHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplateHandler
的用法示例。
在下文中一共展示了TemplateHandler::registerTagHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showTransactionDetails
/**
* Show details for specified transaction
*/
private function showTransactionDetails()
{
$manager = ShopTransactionsManager::getInstance();
$buyer_manager = ShopBuyersManager::getInstance();
$address_manager = ShopDeliveryAddressManager::getInstance();
$id = fix_id($_REQUEST['id']);
$transaction = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
$buyer = $buyer_manager->getSingleItem($buyer_manager->getFieldNames(), array('id' => $transaction->buyer));
$address = $address_manager->getSingleItem($address_manager->getFieldNames(), array('id' => $transaction->address));
$full_address = "{$address->name}\n\n{$address->street}\n";
$full_address .= "{$address->zip} {$address->city}\n";
if (empty($address->state)) {
$full_address .= $address->country;
} else {
$full_address .= "{$address->state}, {$address->country}";
}
$params = array('id' => $transaction->id, 'uid' => $transaction->uid, 'type' => $transaction->type, 'type_string' => '', 'status' => $transaction->status, 'currency' => $transaction->currency, 'handling' => $transaction->handling, 'shipping' => $transaction->shipping, 'timestamp' => $transaction->timestamp, 'delivery_method' => $transaction->delivery_method, 'remark' => $transaction->remark, 'total' => $transaction->total, 'first_name' => $buyer->first_name, 'last_name' => $buyer->last_name, 'email' => $buyer->email, 'address_name' => $address->name, 'address_street' => $address->street, 'address_city' => $address->city, 'address_zip' => $address->zip, 'address_state' => $address->state, 'address_country' => $address->country, 'full_address' => $full_address);
$template = new TemplateHandler('transaction_details.xml', $this->path . 'templates/');
// register tag handler
$template->registerTagHandler('_item_list', $this, 'tag_TransactionItemList');
$template->registerTagHandler('_transaction_status', $this, 'tag_TransactionStatus');
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
示例2: showWarehouses
/**
* Show list of discounts
*/
private function showWarehouses()
{
$template = new TemplateHandler('warehouse_list.xml', $this->path . 'templates/');
$params = array('warehouse_new' => url_MakeHyperlink($this->_parent->getLanguageConstant('add_warehouse'), window_Open('shop_warehouse_add', 300, $this->_parent->getLanguageConstant('title_warehouse_add'), true, true, backend_UrlMake($this->name, 'warehouses', 'add'))));
$template->registerTagHandler('cms:warehouse_list', $this, 'tag_WarehouseList');
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
示例3: tag_DownloadsList
/**
* Handle _downloads_list tag
*
* @param array $tag_params
* @param array $children
*/
public function tag_DownloadsList($tag_params, $children)
{
$manager = DownloadsManager::getInstance();
$conditions = array();
if (!isset($tag_params['show_invisible'])) {
$conditions['visible'] = 1;
}
// get items from database
$items = $manager->getItems($manager->getFieldNames(), $conditions);
if (isset($tag_params['template'])) {
if (isset($tag_params['local']) && $tag_params['local'] == 1) {
$template = new TemplateHandler($tag_params['template'], $this->path . 'templates/');
} else {
$template = new TemplateHandler($tag_params['template']);
}
} else {
$template = new TemplateHandler('list_item.xml', $this->path . 'templates/');
}
$template->setMappedModule($this->name);
$template->registerTagHandler('_download', $this, 'tag_Download');
if (count($items) > 0) {
foreach ($items as $item) {
$params = array('id' => $item->id, 'name' => $item->name, 'description' => $item->description, 'filename' => $item->filename, 'size' => $item->size, 'count' => $item->count, 'visible' => $item->visible, 'timestamp' => $item->timestamp, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('downloads_change', 400, $this->getLanguageConstant('title_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('downloads_delete', 400, $this->getLanguageConstant('title_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'delete'), array('id', $item->id)))));
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
}
}
示例4: showModules
/**
* Display
*/
private function showModules()
{
$template = new TemplateHandler('modules_list.xml', $this->path . 'templates/');
$template->setMappedModule($this->name);
$params = array();
$template->registerTagHandler('_module_list', $this, 'tag_ModuleList');
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
示例5: showLists
/**
* Show mailing lists window.
*/
private function showLists()
{
// update list
$this->updateLists();
// create template
$template = new TemplateHandler('lists.xml', $this->path . 'templates/');
$template->setMappedModule($this->name);
// create menu links
// create template params
$params = array();
// register tag handlers
$template->registerTagHandler('cms:items', $this, 'tag_ListItems');
// show template
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
示例6: changeManufacturer
/**
* Show form for changing manufacturer data
*/
private function changeManufacturer()
{
$id = fix_id($_REQUEST['id']);
$manager = ShopManufacturerManager::getInstance();
$item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
if (!is_object($item)) {
return;
}
$template = new TemplateHandler('manufacturer_change.xml', $this->path . 'templates/');
$template->setMappedModule($this->name);
if (class_exists('gallery')) {
$gallery = gallery::getInstance();
$template->registerTagHandler('_image_list', $gallery, 'tag_ImageList');
}
$params = array('id' => $item->id, 'name' => $item->name, 'web_site' => $item->web_site, 'logo' => $item->logo, 'form_action' => backend_UrlMake($this->name, 'manufacturers', 'save'), 'cancel_action' => window_Close('shop_manufacturer_change'));
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
示例7: showTemplateSelection
/**
* Show form for selecting email templates for notifying users.
*/
private function showTemplateSelection()
{
if (class_exists('contact_form')) {
// get contact form and show settings
$contact_form = contact_form::getInstance();
$template = new TemplateHandler('email_templates.xml', $this->parent->path . 'templates/');
$template->setMappedModule($this->parent->name);
$template->registerTagHandler('cms:templates', $contact_form, 'tag_TemplateList');
$params = array('form_action' => backend_UrlMake($this->parent->name, 'email_templates_save'), 'cancel_action' => window_Close('system_users_email_templates'));
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
} else {
// contact form module is not active, show message instead
$template = new TemplateHandler('message.xml', $this->parent->path . 'templates/');
$template->setMappedModule($this->parent->name);
$params = array('message' => $this->parent->getLanguageConstant('message_no_contact_form'), 'button' => $this->parent->getLanguageConstant('close'), 'action' => window_Close('system_users_email_templates'));
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
}
示例8: editField
/**
* Show form for editing existing field.
*/
private function editField()
{
$id = fix_id($_REQUEST['id']);
$manager = ContactForm_FormFieldManager::getInstance();
$item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
if (is_object($item)) {
$template = new TemplateHandler('fields_change.xml', $this->path . 'templates/');
$template->setMappedModule($this->name);
$params = array('id' => $item->id, 'form' => $item->form, 'name' => $item->name, 'type' => $item->type, 'label' => $item->label, 'placeholder' => $item->placeholder, 'min' => $item->min, 'max' => $item->max, 'maxlength' => $item->maxlength, 'value' => $item->value, 'pattern' => $item->pattern, 'disabled' => $item->disabled, 'required' => $item->required, 'autocomplete' => $item->autocomplete, 'form_action' => backend_UrlMake($this->name, 'fields_save'), 'cancel_action' => window_Close('contact_form_fields_edit'));
$template->registerTagHandler('cms:field_types', $this, 'tag_FieldTypes');
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
}
示例9: showReferrals
/**
* Show referalls for current affiliate
*/
private function showReferrals()
{
$template = new TemplateHandler('referral_list.xml', $this->path . 'templates/');
$template->setMappedModule($this->name);
if (isset($_REQUEST['group_by']) && $_REQUEST['group_by'] == 'landing') {
$column = $this->getLanguageConstant('column_landing');
} else {
$column = $this->getLanguageConstant('column_url');
}
$params = array('column_group_by' => $column);
$template->registerTagHandler('_referral_list', $this, 'tag_ReferralList');
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
示例10: tag_CheckoutForm
/**
* Handle drawing checkout form
*
* @param array $tag_params
* @param array $children
*/
public function tag_CheckoutForm($tag_params, $children)
{
$account_information = array();
$shipping_information = array();
$billing_information = array();
$payment_method = null;
$stage = isset($_REQUEST['stage']) ? fix_chars($_REQUEST['stage']) : null;
$recurring = isset($_SESSION['recurring_plan']) && !empty($_SESSION['recurring_plan']);
// decide whether to include shipping and account information
if (isset($tag_params['include_shipping'])) {
$include_shipping = fix_id($tag_params['include_shipping']) == 1;
} else {
$include_shipping = true;
}
$bad_fields = array();
$info_available = false;
// grab user information
if (!is_null($stage)) {
// get payment method
$payment_method = $this->getPaymentMethod($tag_params);
if (is_null($payment_method)) {
throw new PaymentMethodError('No payment method selected!');
}
// get billing information
$billing_information = $this->getBillingInformation($payment_method);
$billing_required = array('billing_full_name', 'billing_card_type', 'billing_credit_card', 'billing_expire_month', 'billing_expire_year', 'billing_cvv');
$bad_fields = $this->checkFields($billing_information, $billing_required, $bad_fields);
// get shipping information
if ($include_shipping && $stage == 'set_info') {
$shipping_information = $this->getShippingInformation();
$shipping_required = array('name', 'email', 'street', 'city', 'zip', 'country');
$bad_fields = $this->checkFields($shipping_information, $shipping_required, $bad_fields);
}
}
$info_available = count($bad_fields) == 0 && !is_null($payment_method);
if ($info_available) {
$address_manager = ShopDeliveryAddressManager::getInstance();
$currency_manager = ShopCurrenciesManager::getInstance();
// get fields for payment method
$return_url = url_Make('checkout_completed', 'shop', array('payment_method', $payment_method->get_name()));
$cancel_url = url_Make('checkout_canceled', 'shop', array('payment_method', $payment_method->get_name()));
// get currency info
$currency = $this->settings['default_currency'];
$currency_item = $currency_manager->getSingleItem(array('id'), array('currency' => $currency));
if (is_object($currency_item)) {
$transaction_data['currency'] = $currency_item->id;
}
// get buyer
$buyer = $this->getUserAccount();
if ($include_shipping) {
$address = $this->getAddress($buyer, $shipping_information);
} else {
$address = null;
}
// update transaction
$transaction_type = $recurring ? TransactionType::SUBSCRIPTION : TransactionType::SHOPPING_CART;
$summary = $this->updateTransaction($transaction_type, $payment_method, '', $buyer, $address);
// emit signal and return if handled
if ($stage == 'set_info') {
Events::trigger('shop', 'before-checkout', $payment_method->get_name(), $return_url, $cancel_url);
foreach ($result_list as $result) {
if ($result) {
$this->showCheckoutRedirect();
return;
}
}
}
// create new payment
if ($recurring) {
// recurring payment
$checkout_fields = $payment_method->new_recurring_payment($_SESSION['recurring_plan'], $billing_information, $return_url, $cancel_url);
} else {
// regular payment
$checkout_fields = $payment_method->new_payment($transaction_data, $billing_information, $summary['items_for_checkout'], $return_url, $cancel_url);
}
// load template
$template = $this->loadTemplate($tag_params, 'checkout_form.xml');
$template->registerTagHandler('cms:checkout_items', $this, 'tag_CheckoutItems');
$template->registerTagHandler('cms:delivery_methods', $this, 'tag_DeliveryMethodsList');
// parse template
$params = array('checkout_url' => $payment_method->get_url(), 'checkout_fields' => $checkout_fields, 'checkout_name' => $payment_method->get_title(), 'currency' => $this->getDefaultCurrency(), 'recurring' => $recurring, 'include_shipping' => $include_shipping);
// for recurring plans add additional params
if ($recurring) {
$plans = $payment_method->get_recurring_plans();
$plan_name = $_SESSION['recurring_plan'];
$plan = $plans[$plan_name];
$params['plan_name'] = $plan['name'];
$params['plan_description'] = $this->formatRecurring(array('price' => $plan['price'], 'period' => $plan['interval_count'], 'period' => $plan['interval_count'], 'unit' => $plan['interval'], 'setup' => $plan['setup_price'], 'trial_period' => $plan['trial_count'], 'trial_unit' => $plan['trial']));
} else {
$params['sub-total'] = number_format($summary['total'], 2);
$params['shipping'] = number_format($summary['shipping'], 2);
$params['handling'] = number_format($summary['handling'], 2);
$params['total_weight'] = number_format($summary['weight'], 2);
$params['total'] = number_format($summary['total'] + $summary['shipping'] + $summary['handling'], 2);
//.........这里部分代码省略.........
示例11: showFeedback
/**
* Show content of feedback form in backend.
*/
private function showFeedback()
{
$template = new TemplateHandler('list.xml', $this->path . 'templates/');
$template->setMappedModule($this->name);
$template->registerTagHandler('cms:list', $this, 'tag_FeedbackList');
$params = array();
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
示例12: chatSettings
/**
* Display channel management form
*/
private function chatSettings()
{
$template = new TemplateHandler('channel_list.xml', $this->path . 'templates/');
$template->setMappedModule($this->name);
$params = array('link_new' => window_OpenHyperlink($this->getLanguageConstant('add_channel'), 'chat_settings_add_channel', 400, $this->getLanguageConstant('title_channel_add'), true, false, $this->name, 'chat_channel_add'));
$template->registerTagHandler('_channel_list', $this, 'tag_ChannelList');
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
示例13: tag_Container
/**
* Container tag handler
*
* @param array $tag_params
* @param array $children
*/
public function tag_Container($tag_params, $children)
{
if (!isset($tag_params['id'])) {
return;
}
$id = fix_id($tag_params['id']);
$manager = GalleryContainerManager::getInstance();
$item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
if (isset($tag_params['template'])) {
if (isset($tag_params['local']) && $tag_params['local'] == 1) {
$template = new TemplateHandler($tag_params['template'], $this->path . 'templates/');
} else {
$template = new TemplateHandler($tag_params['template']);
}
} else {
$template = new TemplateHandler('container.xml', $this->path . 'templates/');
}
$template->setMappedModule($this->name);
$template->registerTagHandler('_image', $this, 'tag_Image');
$template->registerTagHandler('_image_list', $this, 'tag_ImageList');
$template->registerTagHandler('_group', $this, 'tag_Group');
$template->registerTagHandler('_group_list', $this, 'tag_GroupList');
if (is_object($item)) {
$params = array('id' => $item->id, 'text_id' => $item->text_id, 'name' => $item->name, 'description' => $item->description, 'image' => $this->getContainerImage($item));
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
}
示例14: changePlan
/**
* Show form for changing an existing plan.
*/
private function changePlan()
{
$id = fix_id($_REQUEST['id']);
$shop = shop::getInstance();
$manager = PayPal_PlansManager::getInstance();
$plan = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
if (is_object($plan)) {
$template = new TemplateHandler('plans_change.xml', $this->path . 'templates/');
$template->registerTagHandler('cms:cycle_unit', $shop, 'tag_CycleUnit');
$template->setMappedModule($this->name);
$params = array('id' => $plan->id, 'text_id' => $plan->text_id, 'name' => $plan->name, 'trial' => $plan->trial, 'trial_count' => $plan->trial_count, 'interval' => $plan->interval, 'interval_count' => $plan->interval_count, 'price' => $plan->price, 'setup_price' => $plan->setup_price, 'start_time' => $plan->start_time, 'group_name' => $plan->group_name, 'form_action' => backend_UrlMake($this->name, 'recurring_plans_save'), 'cancel_action' => window_Close('paypal_recurring_plans_change'));
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
}
示例15: groupVideos
/**
* Show video selection form
*/
private function groupVideos()
{
$id = fix_id($_REQUEST['id']);
$template = new TemplateHandler('group_videos.xml', $this->path . 'templates/');
$template->setMappedModule($this->name);
$params = array('group' => $id, 'form_action' => backend_UrlMake($this->name, 'group_videos_save'), 'cancel_action' => window_Close($this->name . '_group_videos'));
$template->registerTagHandler('_group_videos', $this, 'tag_GroupVideos');
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}