当前位置: 首页>>代码示例>>PHP>>正文


PHP TemplateHandler::setMappedModule方法代码示例

本文整理汇总了PHP中TemplateHandler::setMappedModule方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateHandler::setMappedModule方法的具体用法?PHP TemplateHandler::setMappedModule怎么用?PHP TemplateHandler::setMappedModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TemplateHandler的用法示例。


在下文中一共展示了TemplateHandler::setMappedModule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: embedSWF

 /**
  * Embed flash player with specified parameters
  *
  * @param string $url
  * @param string $target_id
  * @param integer $width
  * @param integer $height
  * @param array $flash_vars
  * @param array $params
  */
 public function embedSWF($url, $target_id, $width, $height, $flash_vars = array(), $params = array())
 {
     $template = new TemplateHandler('embed.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     $p_flashvars = json_encode($flash_vars);
     $p_params = json_encode($params);
     $script = "swfobject.embedSWF('{$url}', '{$target_id}', '{$width}', '{$height}', '{$this->flash_version}', null, {$p_flashvars}, {$p_params});";
     $params = array('params' => $p_params, 'flash_vars' => $p_flashvars, 'url' => $url, 'id' => $target_id, 'width' => $width, 'height' => $height, 'version' => $this->flash_version, 'script' => $script);
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:22,代码来源:swfobject.php

示例2: tag_RoomList

 /**
  * Tag handler for room lists
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_RoomList($tag_params, $children)
 {
     $manager = ChatRoomManager::getInstance();
     $items = $manager->getItems($manager->getFieldNames(), array(), array('name'));
     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('rooms_list_item.xml', $this->path . 'templates/');
     }
     $template->setMappedModule($this->name);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'name' => $item->name, 'description' => $item->description, 'limit' => $item->limit, 'protected' => !empty($item->password) ? CHAR_CHECKED : CHAR_UNCHECKED, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('chat_rooms_change', 400, $this->getLanguageConstant('title_chat_rooms_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'rooms_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('chat_rooms_delete', 400, $this->getLanguageConstant('title_chat_rooms_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'rooms_delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:29,代码来源:chat.php

示例3: saveSettings

 /**
  * Save settings.
  */
 private function saveSettings()
 {
     // grab parameters
     $account_id = fix_chars($_REQUEST['account_id']);
     $account_key = fix_chars($_REQUEST['account_key']);
     $account_secret = fix_chars($_REQUEST['account_secret']);
     $include_code = isset($_REQUEST['include_code']) && ($_REQUEST['include_code'] == 'on' || $_REQUEST['include_code'] == '1') ? 1 : 0;
     $this->saveSetting('account_id', $account_id);
     $this->saveSetting('account_key', $account_key);
     $this->saveSetting('account_secret', $account_secret);
     $this->saveSetting('include_code', $include_code);
     // show message
     $template = new TemplateHandler('message.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     $params = array('message' => $this->getLanguageConstant('message_saved'), 'button' => $this->getLanguageConstant('close'), 'action' => window_Close('callbox_settings'));
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:22,代码来源:callbox.php

示例4: parse


//.........这里部分代码省略.........
                 break;
                 // support for markdown
             // support for markdown
             case 'cms:markdown':
                 $char_count = isset($tag->tagAttrs['chars']) ? fix_id($tag->tagAttrs['chars']) : null;
                 $end_with = isset($tag->tagAttrs['end_with']) ? fix_id($tag->tagAttrs['end_with']) : null;
                 $name = isset($tag->tagAttrs['param']) ? $tag->tagAttrs['param'] : null;
                 $multilanguage = isset($tag->tagAttrs['multilanguage']) ? $tag->tagAttrs['multilanguage'] == 'yes' : false;
                 // get content for parsing
                 if (is_null($name)) {
                     $content = $tag->tagData;
                 }
                 $content = $multilanguage ? $this->params[$name][$language] : $this->params[$name];
                 // convert to HTML
                 $content = Markdown($content);
                 // limit words if specified
                 if (!is_null($char_count)) {
                     if (is_null($end_with)) {
                         $content = limit_words($content, $char_count);
                     } else {
                         $content = limit_words($content, $char_count, $end_with);
                     }
                 }
                 echo $content;
                 break;
                 // call section specific data
             // call section specific data
             case '_section_data':
             case 'cms:section_data':
                 if (!is_null($this->module)) {
                     $file = $this->module->getSectionFile($section, $action, $language);
                     $new = new TemplateHandler(basename($file), dirname($file) . '/');
                     $new->setLocalParams($this->params);
                     $new->setMappedModule($this->module);
                     $new->parse();
                 } else {
                     // log error
                     trigger_error('Mapped module is not loaded! File: ' . $this->file, E_USER_WARNING);
                 }
                 break;
                 // print multilanguage data
             // print multilanguage data
             case '_language_data':
             case 'cms:language_data':
                 $name = isset($tag->tagAttrs['param']) ? $tag->tagAttrs['param'] : null;
                 if (!isset($this->params[$name]) || !is_array($this->params[$name]) || is_null($name)) {
                     break;
                 }
                 $template = new TemplateHandler('language_data.xml', $system_template_path);
                 $template->setMappedModule($this->module);
                 foreach ($this->params[$name] as $lang => $data) {
                     $params = array('param' => $name, 'language' => $lang, 'data' => $data);
                     $template->restoreXML();
                     $template->setLocalParams($params);
                     $template->parse();
                 }
                 break;
                 // replace tag data string with matching params
             // replace tag data string with matching params
             case '_replace':
             case 'cms:replace':
                 $pool = isset($tag->tagAttrs['param']) ? $this->params[$tag->tagAttrs['param']] : $this->params;
                 $keys = array_keys($pool);
                 $values = array_values($pool);
                 foreach ($keys as $i => $key) {
                     $keys[$i] = "%{$key}%";
开发者ID:tareqy,项目名称:Caracal,代码行数:67,代码来源:template.php

示例5: pageItems_Delete_Commit

 /**
  * Perform item removal from specified page
  */
 private function pageItems_Delete_Commit()
 {
     $id = fix_id($_REQUEST['id']);
     $manager = UserPageItemsManager::getInstance();
     // remove item from database
     $manager->deleteData(array('id' => $id));
     // show message
     $template = new TemplateHandler('message.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     $params = array('message' => $this->getLanguageConstant('message_page_item_deleted'), 'button' => $this->getLanguageConstant('close'), 'action' => window_Close('user_pages_items_delete') . ';' . window_ReloadContent('user_pages_items'));
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:17,代码来源:user_page.php

示例6: tag_Level

 /**
  * Print level option
  */
 public function tag_Level($tag_params, $children)
 {
     $max_level = 10;
     if ($_SESSION['level'] < 10) {
         $max_level = $_SESSION['level'] - 1;
     }
     $selected = -1;
     if (isset($tag_params['selected'])) {
         $selected = $tag_params['selected'];
     }
     // create template
     if (isset($tag_params['template'])) {
         if (isset($tag_params['local']) && $tag_params['local'] == 1) {
             $template = new TemplateHandler($tag_params['template'], $this->parent->path . 'templates/');
         } else {
             $template = new TemplateHandler($tag_params['template']);
         }
     } else {
         $template = new TemplateHandler('users_level.xml', $this->parent->path . 'templates/');
     }
     $template->setMappedModule($this->parent->name);
     for ($i = 0; $i <= $max_level; $i++) {
         $params = array('level' => $i, 'selected' => $selected);
         $template->restoreXML();
         $template->setLocalParams($params);
         $template->parse();
     }
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:31,代码来源:user_manager.php

示例7: tag_CodeList

 /**
  * Tag handler for printing code lists
  *
  * @param array $params
  * @param array $children
  */
 public function tag_CodeList($params, $children)
 {
     $manager = CodeManager::getInstance();
     $conditions = array();
     $items = $manager->getItems($manager->getFieldNames(), $conditions, array('id'));
     $template = new TemplateHandler('list_item.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'code' => $item->code, 'url' => $item->url, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('codes_change', 400, $this->getLanguageConstant('title_codes_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'codes_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('codes_delete', 400, $this->getLanguageConstant('title_codes_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'codes_delete'), array('id', $item->id)))), 'item_open' => url_MakeHyperlink($this->getLanguageConstant('open'), $item->url, '', '', '_blank'));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:22,代码来源:code_project.php

示例8: showAffiliateInformation

 /**
  * Show affiliate information.
  */
 private function showAffiliateInformation()
 {
     global $url_rewrite;
     $manager = AffiliatesManager::getInstance();
     $user_id = $_SESSION['uid'];
     $affiliate = $manager->getSingleItem($manager->getFieldNames(), array('user' => $user_id));
     if (is_object($affiliate)) {
         $template = new TemplateHandler('information.xml', $this->path . 'templates/');
         $template->setMappedModule($this->name);
         if ($affiliate->clicks > 0) {
             $rate = round(100 * $affiliate->conversions / $affiliate->clicks, 2);
         } else {
             $rate = 0;
         }
         $params = array('uid' => $affiliate->uid, 'name' => $affiliate->name, 'clicks' => $affiliate->clicks, 'conversions' => $affiliate->conversions, 'rate' => $rate, 'url_rewrite' => $url_rewrite ? 'true' : 'false', 'cancel_action' => window_Close('affiliate_information'));
         $template->restoreXML();
         $template->setLocalParams($params);
         $template->parse();
     }
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:23,代码来源:affiliates.php

示例9: saveApiKey

 /**
  * Save new or changed API key.
  */
 private function saveApiKey()
 {
     $api_key = fix_chars($_REQUEST['api_key']);
     $this->saveSetting('api_key', $api_key);
     // prepare and parse result message
     $template = new TemplateHandler('message.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     $params = array('message' => $this->getLanguageConstant('message_api_key_saved'), 'button' => $this->getLanguageConstant('close'), 'action' => window_Close('page_speed_set_api_key'));
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:15,代码来源:page_speed.php

示例10: saveSettings

 /**
  * Save settings
  */
 private function saveSettings()
 {
     $secret_key = fix_chars($_REQUEST['secret_key']);
     $public_key = fix_chars($_REQUEST['public_key']);
     $this->saveSetting('secret_key', $secret_key);
     $this->saveSetting('public_key', $public_key);
     $template = new TemplateHandler('message.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     $params = array('message' => $this->getLanguageConstant('message_settings_saved'), 'button' => $this->getLanguageConstant('close'), 'action' => window_Close('stripe'));
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:16,代码来源:stripe_payment.php

示例11: tag_CheckoutForm


//.........这里部分代码省略.........
     $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);
         }
         $template->restoreXML();
         $template->setLocalParams($params);
         $template->parse();
     } else {
         // no information available, show form
         $template = new TemplateHandler('buyer_information.xml', $this->path . 'templates/');
         $template->setMappedModule($this->name);
         $template->registerTagHandler('cms:card_type', $this, 'tag_CardType');
         // get fixed country if set
         $fixed_country = '';
         if (isset($this->settings['fixed_country'])) {
             $fixed_country = $this->settings['fixed_country'];
         }
         $params = array('include_shipping' => $include_shipping, 'fixed_country' => $fixed_country, 'bad_fields' => $bad_fields, 'recurring' => $recurring);
         $template->restoreXML();
         $template->setLocalParams($params);
         $template->parse();
     }
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:101,代码来源:shop.php

示例12: 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();
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:13,代码来源:feedback.php

示例13: logout_commit

 /**
  * Perform logout procedure
  */
 private function logout_commit()
 {
     // change session type to default
     Session::change_type();
     // kill session variables
     unset($_SESSION['uid']);
     unset($_SESSION['logged']);
     unset($_SESSION['level']);
     unset($_SESSION['username']);
     unset($_SESSION['fullname']);
     // get message
     $message = $this->parent->getLanguageConstant('message_logout_ok');
     // get url
     $url = url_SetRefresh(url_Make('', $this->parent->name), 2);
     // load template and show the message
     $template = new TemplateHandler('session_message.xml', $this->parent->path . 'templates/');
     $template->setMappedModule($this->parent->name);
     $params = array('message' => $message, 'redirect_url' => $url);
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:25,代码来源:session_manager.php

示例14: saveSettings

 private function saveSettings()
 {
     $terminal_name = fix_chars($_REQUEST['terminal']);
     $this->saveSetting('terminal', $terminal_name);
     $template = new TemplateHandler('message.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     $params = array('message' => $this->getLanguageConstant('message_settings_saved'), 'button' => $this->getLanguageConstant('close'), 'action' => window_Close('tranzila'));
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:11,代码来源:tranzila.php

示例15: tag_ArticleRatingImage

 /**
  * Tag handler for printing article list
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_ArticleRatingImage($tag_params, $children)
 {
     if (isset($tag_params['id'])) {
         // print image tag with specified URL
         $id = fix_id($tag_params['id']);
         $type = isset($tag_params['type']) ? $tag_params['type'] : ImageType::Stars;
         $manager = ArticleManager::getInstance();
         $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
         $template = new TemplateHandler('rating_image.xml', $this->path . 'templates/');
         $template->setMappedModule($this->name);
         if (is_object($item)) {
             $url = url_Make('get_rating_image', $this->name, array('type', $type), array('id', $id));
             $params = array('url' => $url, 'rating' => round($this->getArticleRating($item, 5), 2));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     } else {
         if (isset($_REQUEST['id'])) {
             // print image itself
             $id = fix_id($_REQUEST['id']);
             $type = isset($_REQUEST['type']) ? fix_id($_REQUEST['type']) : ImageType::Stars;
             $manager = ArticleManager::getInstance();
             $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
             switch ($type) {
                 case ImageType::Stars:
                     $background_image = 'stars_bg.png';
                     $foreground_image = 'stars.png';
                     break;
                 case ImageType::Circles:
                     $background_image = 'circles_bg.png';
                     $foreground_image = 'circles.png';
                     break;
                 default:
                     $background_image = 'stars_bg.png';
                     $foreground_image = 'stars.png';
                     break;
             }
             $img_bg = imagecreatefrompng($this->path . 'images/' . $background_image);
             $img_fg = imagecreatefrompng($this->path . 'images/' . $foreground_image);
             // get rating based on image width
             if (is_object($item)) {
                 $rating = $this->getArticleRating($item, imagesx($img_bg));
             } else {
                 $rating = 0;
             }
             $img = imagecreatetruecolor(imagesx($img_bg), imagesy($img_bg));
             imagesavealpha($img, true);
             // make image transparent
             $transparent_color = imagecolorallocatealpha($img, 0, 0, 0, 127);
             imagefill($img, 0, 0, $transparent_color);
             // draw background image
             imagecopy($img, $img_bg, 0, 0, 0, 0, imagesx($img_bg), imagesy($img_bg));
             // draw foreground images
             imagecopy($img, $img_fg, 0, 0, 0, 0, $rating, imagesy($img_bg));
             header('Content-type: image/png');
             imagepng($img);
             imagedestroy($img);
         }
     }
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:67,代码来源:articles.php


注:本文中的TemplateHandler::setMappedModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。