本文整理汇总了PHP中em_get_link函数的典型用法代码示例。如果您正苦于以下问题:PHP em_get_link函数的具体用法?PHP em_get_link怎么用?PHP em_get_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了em_get_link函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
$instance = array_merge($this->defaults, $instance);
$instance = $this->fix_scope($instance);
// depcreciate
echo $args['before_widget'];
echo $args['before_title'];
echo $instance['title'];
echo $args['after_title'];
if (is_numeric($instance['time_limit']) && $instance['time_limit'] > 0) {
$instance['scope'] = date('Y-m-d') . "," . date('Y-m-t', strtotime('+' . ($instance['time_limit'] - 1) . ' month'));
}
$instance['owner'] = false;
$events = EM_Events::get($instance);
echo "<ul>";
$li_wrap = !preg_match('/^<li>/i', trim($instance['format']));
if (count($events) > 0) {
foreach ($events as $event) {
if ($li_wrap) {
echo '<li>' . $event->output($instance['format']) . '</li>';
} else {
echo $event->output($instance['format']);
}
}
} else {
echo '<li>' . __('No events', 'dbem') . '</li>';
}
if (!empty($instance['all_events'])) {
$events_link = !empty($instance['all_events_text']) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events', 'dbem'));
echo '<li>' . $events_link . '</li>';
}
echo "</ul>";
echo $args['after_widget'];
}
示例2: widget
/** @see WP_Widget::widget */
function widget($args, $instance) {
$instance = array_merge($this->defaults, $instance);
$instance = $this->fix_scope($instance); // depcreciate
echo $args['before_widget'];
if( !empty($instance['title']) ){
echo $args['before_title'];
echo apply_filters('widget_title',$instance['title'], $instance, $this->id_base);
echo $args['after_title'];
}
//remove owner searches
$instance['owner'] = false;
//legacy stuff
//add li tags to old widgets that have no forced li wrappers
if ( !preg_match('/^<li/i', trim($instance['format'])) ) $instance['format'] = '<li>'. $instance['format'] .'</li>';
if (!preg_match('/^<li/i', trim($instance['no_events_text'])) ) $instance['no_events_text'] = '<li>'.$instance['no_events_text'].'</li>';
//orderby fix for previous versions with old orderby values
if( !array_key_exists($instance['orderby'], $this->em_orderby_options) ){
//replace old values
$old_vals = array(
'name' => 'event_name',
'end_date' => 'event_end_date',
'start_date' => 'event_start_date',
'end_time' => 'event_end_time',
'start_time' => 'event_start_time'
);
foreach($old_vals as $old_val => $new_val){
$instance['orderby'] = str_replace($old_val, $new_val, $instance['orderby']);
}
}
//get events
$events = EM_Events::get(apply_filters('em_widget_events_get_args',$instance));
//output events
echo "<ul>";
if ( count($events) > 0 ){
foreach($events as $event){
echo $event->output( $instance['format'] );
}
}else{
echo $instance['no_events_text'];
}
if ( !empty($instance['all_events']) ){
$events_link = (!empty($instance['all_events_text'])) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events','charity'));
echo '<li class="all-events-link">'.$events_link.'</li>';
}
echo "</ul>";
echo $args['after_widget'];
}
示例3: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
$instance = array_merge($this->defaults, $instance);
$instance = $this->fix_scope($instance);
// depcreciate
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'];
echo apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
echo $args['after_title'];
}
$instance['owner'] = false;
//orderby fix for previous versions with old orderby values
if (!array_key_exists($instance['orderby'], $this->em_orderby_options)) {
//replace old values
$old_vals = array('name' => 'event_name', 'end_date' => 'event_end_date', 'start_date' => 'event_start_date', 'end_time' => 'event_end_time', 'start_time' => 'event_start_time');
foreach ($old_vals as $old_val => $new_val) {
$instance['orderby'] = str_replace($old_val, $new_val, $instance['orderby']);
}
}
$events = EM_Events::get(apply_filters('em_widget_events_get_args', $instance));
echo "<div id='events'>";
$li_wrap = !preg_match('/^<div class="item">/i', trim($instance['format']));
if (count($events) > 0) {
foreach ($events as $event) {
if ($li_wrap) {
echo '<div class="item">' . $event->output($instance['format']) . '</div>';
} else {
echo $event->output($instance['format']);
}
}
} else {
echo '<div class="item"><h4>' . $instance['no_events_text'] . '</h4></div>';
}
if (!empty($instance['all_events'])) {
$events_link = !empty($instance['all_events_text']) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events', 'dbem'));
echo '<div class="all-events-link">» ' . $events_link . '</div>';
}
echo "</div>";
echo $args['after_widget'];
}
示例4: em_get_link_shortcode
/**
* Shortcode for a link to events page. Default will show events page title in link text, if you use [events_link]text[/events_link] 'text' will be the link text
* @param array $atts
* @param string $text
* @return string
*/
function em_get_link_shortcode($atts, $text = '')
{
return em_get_link($text);
}
示例5: em_link
/**
* Prints the result of em_get_link()
* @param string $text
* @uses em_get_link()
*/
function em_link($text = '')
{
echo em_get_link($text);
}
示例6: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
$instance = array_merge($this->defaults, $instance);
$instance = $this->fix_scope($instance);
// depcreciate
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'];
echo apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
echo $args['after_title'];
}
//remove owner searches
$instance['owner'] = false;
//legacy stuff
//add li tags to old widgets that have no forced li wrappers
if (!preg_match('/^<li/i', trim($instance['format']))) {
$instance['format'] = '<li>' . $instance['format'] . '</li>';
}
if (!preg_match('/^<li/i', trim($instance['no_events_text']))) {
$instance['no_events_text'] = '<li>' . $instance['no_events_text'] . '</li>';
}
//orderby fix for previous versions with old orderby values
if (!array_key_exists($instance['orderby'], $this->em_orderby_options)) {
//replace old values
$old_vals = array('name' => 'event_name', 'end_date' => 'event_end_date', 'start_date' => 'event_start_date', 'end_time' => 'event_end_time', 'start_time' => 'event_start_time');
foreach ($old_vals as $old_val => $new_val) {
$instance['orderby'] = str_replace($old_val, $new_val, $instance['orderby']);
}
}
//get events
$events = EM_Events::get(apply_filters('em_widget_events_get_args', $instance));
//output events
echo '<ul class="event-list">';
$instance['format'] = '<li>
<div class="event EVENTCLASS">
<p class="event-date">
<time datetime="#_{Y-m-d}">#_{d.m.Y}</time>
</p>
<h3>#_EVENTNAME</h3>
<a href="#_EVENTURL">' . __("Mehr erfahren.", 'evjusers') . '</a>
</div>
</li>';
$event_classes = array('evjusers' => '', 'offers' => 'event-offers', 'events' => 'event-events', 'media' => 'event-media');
if (count($events) > 0) {
foreach ($events as $event) {
$event_class = get_field('kategorie', $event->post_id);
if ($event_class) {
$event_class = $event_classes[$event_class];
} else {
$event_class = "";
}
$format = str_replace('EVENTCLASS', $event_class, $instance['format']);
echo $event->output($format);
}
} else {
echo $instance['no_events_text'];
}
if (!empty($instance['all_events'])) {
$events_link = !empty($instance['all_events_text']) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events', 'dbem'));
echo '<li class="all-events-link">' . $events_link . '</li>';
}
echo "</ul>";
echo $args['after_widget'];
}