本文整理汇总了PHP中get_component函数的典型用法代码示例。如果您正苦于以下问题:PHP get_component函数的具体用法?PHP get_component怎么用?PHP get_component使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_component函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/**
* widget function.
*
* @see WP_Widget
* @access public
* @param array $args
* @param array $instance
* @return void
*/
function widget($args, $instance)
{
if ($this->get_cached_widget($args)) {
return;
}
if (!empty($_GET['selected_package'])) {
return;
}
extract($args);
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
$icon = isset($instance['icon']) ? $instance['icon'] : null;
if ($icon) {
$before_title = sprintf($before_title, 'ion-' . $icon);
}
ob_start();
global $post, $product;
$products = $this->get_bookable_products($post->ID);
$job_id = $post->ID;
if (!$products) {
return;
}
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
$booking_calendar = $this->get_booking_calendar(reset($products));
get_component('element', 'booking-product', compact('products', 'booking_calendar'));
echo $after_widget;
$content = ob_get_clean();
echo apply_filters($this->widget_id, $content);
$this->cache_widget($args, $content);
}
示例2: render
/**
* Méthode permettant d'afficher l'arbre à partir de celui passé en paramètre.
*
* @param ITree $tree
* @param array $options
* @param $key
*
* @return mixed|string
*/
public function render(ITree $tree, array $options, $key)
{
$this->defaults($tree, $tree->getRoot());
if ($key != null && !isset($options["baseId"])) {
$options["id"] = $this->options["id"] . "_" . $key;
$options["baseId"] = $this->options["id"];
} elseif ($key != null && isset($options["baseId"])) {
$options["id"] = $options["baseId"] . "_" . $key;
}
if ($key != null && isset($options["selected"])) {
$options["selected"] = isset($options["selected"][$key]) ? $options["selected"][$key] : "";
}
$options = array_merge($this->options, $options);
$build = function ($tree) use(&$build, &$options, $key) {
$output = is_string($options['rootOpen']) ? $options['rootOpen'] : $options['rootOpen']($tree);
$nodes = $tree instanceof ITreeViewerItem && $tree->isRoot() ? array($tree) : $tree;
/** @var ITreeViewerItem $node */
foreach ($nodes as $node) {
$output .= is_string($options['childOpen']) ? $options['childOpen'] : $options['childOpen']($node, $node->getType(), $key);
$output .= $options['nodeDecorator']($node);
if (count($node->getChildren()) > 0) {
$output .= $build($node->getChildren());
}
$output .= is_string($options['childClose']) ? $options['childClose'] : $options['childClose']($node);
}
return $output . (is_string($options['rootClose']) ? $options['rootClose'] : $options['rootClose']($tree));
};
return html_entity_decode(sfOutputEscaper::unescape(get_component("eitreeviewer", "displaySelectMode", array("root" => $tree, "html" => $build($tree->getRoot()), "options" => $options, "key" => $key, "tree" => $this))), ENT_QUOTES, "UTF-8");
}
示例3: shortcode
public function shortcode($atts = array(), $content = '')
{
$atts = $this->logic(shortcode_atts($this->get_default_atts(), $atts, $this->base));
if ($content) {
$atts['content'] = do_shortcode($content);
}
return get_component('Shortcode', $this->base, $atts, false);
}
示例4: upload_field_upload_markup
public function upload_field_upload_markup($markup, $file, $form_id, $id)
{
$file_path = GFFormsModel::get_file_upload_path($form_id, $file['uploaded_filename']);
$url = explode('/', $file_path['url']);
array_pop($url);
array_push($url, $file['uploaded_filename']);
$file['url'] = implode('/', $url);
return get_component('twig', 'uploaded-file', compact('file', 'form_id', 'id'), false);
}
示例5: sendAdminNotification
public static function sendAdminNotification($booking)
{
sfContext::getInstance()->getConfiguration()->loadHelpers('Partial');
$mailer = sfContext::getInstance()->getMailer();
$body = '<html><body>' . get_component('Payment', 'adminNotificationEmail', array('booking' => $booking)) . '</body></html>';
$message = $mailer->compose(array('maakler@lkm.ee' => 'lkm.ee'), sfConfig::get('app_admin_email'), '');
$message->setBody($body, 'text/html');
$mailer->send($message);
}
示例6: render
protected function render($view, $vars = array(), $echo = true)
{
$path = str_replace('Controller', '', implode('/', explode('\\', str_replace('App\\Controllers\\', '', get_called_class()))));
$html = get_component($path, $view, $vars, $echo);
if ($echo) {
echo $html;
} else {
return $html;
}
}
示例7: fossa_sidebar2_ads
function fossa_sidebar2_ads()
{
if (component_exists('sidebar2-ads')) {
echo "<div class=\"sidebarads\">";
get_component('sidebar2-ads');
echo "</div><div class=\"clear\"></div>";
} else {
return;
}
}
示例8: display_instagramfeed
public function display_instagramfeed()
{
$instagram_uid = "1186117710";
$access_token = "19039620.87d5630.e4a8f758e4ad4901b195c97fac5c4caf";
$photo_count = 12;
$json_link = "https://api.instagram.com/v1/users/{$instagram_uid}/media/recent/?";
$json_link .= "access_token={$access_token}&count={$photo_count}";
$json = file_get_contents($json_link);
$obj = json_decode($json, true, 512, JSON_BIGINT_AS_STRING);
get_component('elements', 'instagram-feed', compact('obj'));
}
示例9: depp_voter
/**
* Return the HTML code for an unordered list showing opinions that can be voted
* If the user has already voted, then a message appears
*
* @param BaseObject $object Propel object instance to vote
* @param string $domid unique css identifier for the block (div) containing the voter tool
* @param string $message a message string to be displayed in the voting-message block
* @param array $options Array of HTML options to apply on the HTML list
* @return string
**/
function depp_voter($object, $domid = 'depp-voter-block', $message = '', $options = array())
{
if (is_null($object)) {
sfLogger::getInstance()->debug('A NULL object cannot be voted');
return '';
}
$user_id = deppPropelActAsVotableBehaviorToolkit::getUserId();
// anonymous votes
if ((is_null($user_id) || $user_id == '') && !$object->allowsAnonymousVoting()) {
return __('Anonymous voting is not allowed') . ", " . __('please') . " " . link_to('login', '/login');
}
try {
$voting_range = $object->getVotingRange();
$options = _parse_attributes($options);
if (!isset($options['id'])) {
$options = array_merge($options, array('id' => 'voting-items'));
}
if ($object instanceof sfOutputEscaperObjectDecorator) {
$object_class = get_class($object->getRawValue());
} else {
$object_class = get_class($object);
}
$object_id = $object->getReferenceKey();
$token = deppPropelActAsVotableBehaviorToolkit::addTokenToSession($object_class, $object_id);
// already voted
if ($object->hasBeenVotedByUser($user_id)) {
$message .= " " . link_to_remote(__('Take your vote back'), array('url' => sprintf('deppVoting/unvote?domid=%s&token=%s', $domid, $token), 'update' => $domid, 'script' => true, 'complete' => visual_effect('appear', $domid) . visual_effect('highlight', $domid)));
}
$list_content = '';
for ($i = -1 * $voting_range; $i <= $voting_range; $i++) {
if ($i == 0 && !$object->allowsNeutralPosition()) {
continue;
}
$text = sprintf("[%d]", $i);
$label = sprintf(__('Vote %d!'), $i);
if ($object->hasBeenVotedByUser($user_id) && $object->getUserVoting($user_id) == $i) {
$list_content .= content_tag('li', $text);
} else {
$list_content .= ' <li>' . link_to_remote($text, array('url' => sprintf('deppVoting/vote?domid=%s&token=%s&voting=%d', $domid, $token, $i), 'update' => $domid, 'script' => true, 'complete' => visual_effect('appear', $domid) . visual_effect('highlight', $domid)), array('title' => $label)) . '</li>';
}
}
$results = get_component('deppVoting', 'votingDetails', array('object' => $object));
return content_tag('ul', $list_content, $options) . content_tag('div', $message, array('id' => 'voting-message')) . content_tag('div', $results, array('id' => 'voting-results'));
} catch (Exception $e) {
sfLogger::getInstance()->err('Exception catched from sf_rater helper: ' . $e->getMessage());
}
}
示例10: get_nested_set_manager
function get_nested_set_manager($model, $field, $root = 0)
{
if (!sfConfig::has('app_sfJqueryTree_withContextMenu')) {
sfConfig::set('app_sfJqueryTree_withContextMenu', true);
}
sfContext::getInstance()->getResponse()->addStylesheet('/sfJqueryTreeDoctrineManagerPlugin/jsTree/themes/default/style.css');
sfContext::getInstance()->getResponse()->addStylesheet('/sfJqueryTreeDoctrineManagerPlugin/css/screen.css');
// by vit
// sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/jquery.js');
sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/jquery.cookie.js');
sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/jquery.tree.min.js');
sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/plugins/jquery.tree.cookie.js');
if (sfConfig::get('app_sfJqueryTree_withContextMenu')) {
sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/plugins/jquery.tree.contextmenu.js');
}
return get_component('sfJqueryTreeDoctrineManager', 'manager', array('model' => $model, 'field' => $field, 'root' => $root));
}
示例11: getSlotValue
public function getSlotValue($slot)
{
sfLoader::loadHelpers(array('Partial'));
$components = sfYaml::load($slot->getValue());
$res = '';
foreach ($components as $name => $params) {
if (!isset($params['component']) && !isset($params['partial'])) {
return sprintf('<strong>Error</strong>: The value of slot %s in incorrect. Component %s has no \'component\' or \'partial\' key.', $slot->getName(), $name);
}
if (isset($params['component'])) {
// component
list($module, $action) = split('/', $params['component']);
unset($params['component']);
$res .= get_component($module, $action, $params);
} else {
// partial
$res .= get_partial($params['partial'], $params);
unset($params['partial']);
}
}
return $res;
}
示例12: dynpages_replace_match
function dynpages_replace_match($match)
{
global $args;
$replacement = '';
if ($match[1] && (!isset($match[4]) || !$match[4])) {
$replacement .= $match[1];
}
if (isset($args)) {
$saved_args = $args;
}
$args = array();
$paramstr = isset($match[3]) ? html_entity_decode(trim($match[3]), ENT_QUOTES, 'UTF-8') : '';
while ($paramstr && preg_match('/^([^"\', ]*|"[^"]*"|\'[^\']*\')(\\s+|\\s*,\\s*|$)/', $paramstr, $pmatch)) {
$value = trim($pmatch[1]);
if (substr($value, 0, 1) == '"' || substr($value, 0, 1) == "'") {
$value = substr($value, 1, strlen($value) - 2);
}
$args[] = $value;
$paramstr = substr($paramstr, strlen($pmatch[0]));
}
ob_start();
if (function_exists('get_i18n_component')) {
get_i18n_component($match[2]);
} else {
get_component($match[2]);
}
$replacement .= ob_get_contents();
ob_end_clean();
if (isset($saved_args)) {
$args = $saved_args;
} else {
unset($args);
}
if (!$match[1] && isset($match[4]) && $match[4]) {
$replacement .= $match[4];
}
return $replacement;
}
示例13: execute
/**
* Executes the filter chain, returning the response content with an additional admin toolbar.
*
* @param sfFilterChain $filterChain
*/
public function execute(sfFilterChain $filterChain)
{
$filterChain->execute();
$user = $this->getContext()->getUser();
$sf_format = $this->getContext()->getRequest()->getParameter('sf_format');
if ($sf_format !== '' && !is_null($sf_format) || !$user->isAuthenticated() || !$user->hasPermission(sfConfig::get('app_rt_admin_menu_credential', 'show_admin_menu'))) {
return;
}
$response = $this->getContext()->getResponse();
// Enable admin tools...
$response->setContent(str_replace(array('<!--RTAS', 'RTAS-->'), '', $response->getContent()));
if (function_exists('use_helper')) {
$css = '<link rel="stylesheet" type="text/css" media="screen" href="/rtCorePlugin/css/admin-toolbar.css" />';
$js = '<script type="text/javascript" src="/rtCorePlugin/vendor/jquery/js/jquery.min.js"></script>';
use_helper('Partial', 'I18N');
$toolbar = get_component('rtAdmin', 'menu');
$response->setContent(str_ireplace('<!--rt-admin-holder-->', $toolbar, $response->getContent()));
$response->setContent(str_ireplace('</head>', $css . '</head>', $response->getContent()));
if (!preg_match("/jquery/i", $response->getContent())) {
$response->setContent(str_ireplace('</head>', $js . '</head>', $response->getContent()));
}
}
}
示例14: include_component
/**
* Evaluates and echoes a component.
* For a variable to be accessible to the component and its partial,
* it has to be passed in the third argument.
*
* <b>Example:</b>
* <code>
* include_component('mymodule', 'mypartial', array('myvar' => 12345));
* </code>
*
* @param string module name
* @param string component name
* @param array variables to be made accessible to the component
* @return void
* @see get_component, include_partial, include_component_slot
*/
function include_component($moduleName, $componentName, $vars = array())
{
echo get_component($moduleName, $componentName, $vars);
}
示例15: getSymfonyResource
/**
* Get a symfony resource (partial or component)
*
* This basically looks first for a component defined by the given module
* and action. If one doesn't exist, it then looks for a partial matching
* the module and action pair.
*
* @param string $module
* @param string $action
* @param array $variables
* @return string $html
*/
public static function getSymfonyResource($module, $action = null, $variables = array())
{
if (strpos($module, '/')) {
$variables = (array) $action;
$e = explode('/', $module);
list($module, $action) = $e;
}
$context = sfContext::getInstance();
$context->getConfiguration()->loadHelpers('Partial');
$controller = $context->getController();
if ($controller->componentExists($module, $action)) {
return get_component($module, $action, $variables);
} else {
return get_partial($module . '/' . $action, $variables);
}
throw new sfException('Could not find component or partial for the module "' . $module . '" and action "' . $action . '"');
}