本文整理汇总了PHP中Magee_Core::set_shortcode_defaults方法的典型用法代码示例。如果您正苦于以下问题:PHP Magee_Core::set_shortcode_defaults方法的具体用法?PHP Magee_Core::set_shortcode_defaults怎么用?PHP Magee_Core::set_shortcode_defaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magee_Core
的用法示例。
在下文中一共展示了Magee_Core::set_shortcode_defaults方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('alt' => 'scan QR code', 'size' => '100', 'margin' => '4', 'click' => 'no', 'fgcolor' => '#000000', 'bgcolor' => '#FFFFFF'), $args);
extract($defaults);
self::$args = $defaults;
$current_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '';
$qr_pre_output = "";
$qr_output = "";
$qr_post_output = "";
!empty($content) ? $content = strip_tags(trim($content)) : ($content = $current_url);
if ($click == "yes") {
$qr_pre_output = '<a href="' . $content . '">';
$qr_post_output = '</a>';
}
// check if GD is installed on the server
if (extension_loaded('gd') && function_exists('gd_info')) {
$fgcolor = str_replace('#', '', $fgcolor);
$bgcolor = str_replace('#', '', $bgcolor);
$qr_output = '<img src="' . plugins_url('inc/qrcode-image.php', dirname(__FILE__)) . '?size=' . $size . '&fgcolor=' . $fgcolor . '&bgcolor=' . $bgcolor . '&content=' . $content . '" alt="' . $alt . '" width="' . $size . '" height="' . $size . '" />';
} else {
$qr_image = 'https://chart.googleapis.com/chart?cht=qr&chs=' . $size . 'x' . $size . '&chl=' . $content . '&choe=UTF-8';
$qr_output = '<img src="' . $qr_image . '" alt="' . $alt . '" width="' . $size . '" height="' . $size . '" />';
}
return $qr_pre_output . $qr_output . $qr_post_output;
}
示例2: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('id' => '', 'class' => '', 'src' => '', 'link' => '', 'link_target' => ''), $args);
extract($defaults);
self::$args = $defaults;
$html = '<div class="img-frame rounded">';
$html .= '<div class="img-box figcaption-middle text-center fade-in">';
if ($link != '') {
$html .= '<a target="' . $link_target . '" href="' . $link . '">
<img src="' . $src . '" class="feature-img">
<div class="img-overlay dark">
<div class="img-overlay-container">
<div class="img-overlay-content">
<i class="fa fa-link"></i>
</div>
</div>
</div>
</a>';
} else {
$html .= ' <img src="' . $src . '" class="feature-img">
<div class="img-overlay dark">
<div class="img-overlay-container">
<div class="img-overlay-content">
</div>
</div>
</div>';
}
$html .= '</div></div>';
return $html;
}
示例3: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('id' => '', 'class' => '', 'top_icon' => '', 'left_icon' => '', 'left_text' => '', 'counter_num' => '', 'right_text' => '', 'title' => '', 'border' => '0'), $args);
extract($defaults);
self::$args = $defaults;
if ($border == '1') {
$class .= ' box-border';
}
$html = '<div class="magee-counter-box ' . esc_attr($class) . '" id="' . esc_attr($id) . '">';
if ($top_icon) {
$html .= '<div class="counter-top-icon"><i class="fa ' . esc_attr($top_icon) . '"></i></div>';
}
$html .= '<div class="counter">';
if ($left_icon) {
$html .= '<i class="fa ' . esc_attr($left_icon) . '"></i> ';
}
if ($left_text) {
$html .= '<span class="unit">' . esc_attr($left_text) . '</span>';
}
if ($counter_num) {
$html .= '<span class="counter-num">' . esc_attr($counter_num) . '</span>';
}
if ($right_text) {
$html .= '<span class="unit">' . esc_attr($right_text) . '</span>';
}
$html .= '</div>';
$html .= '<h3 class="counter-title">' . esc_attr($title) . '</h3>';
$html .= '</div>';
return $html;
}
示例4: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('id' => '', 'class' => '', 'direction' => 'horizontal', 'front_paddings' => '', 'front_background' => '', 'front_color' => '', 'back_paddings' => '', 'back_background' => '', 'back_color' => ''), $args);
extract($defaults);
self::$args = $defaults;
$uniq_class = uniqid('flip_box-');
$class .= ' ' . $uniq_class;
$class .= ' ' . $direction;
$html = '';
if ($content) {
$contentsplit = explode("|||", $content);
$front_content = isset($contentsplit[0]) ? $contentsplit[0] : '';
$back_content = isset($contentsplit[1]) ? $contentsplit[1] : '';
$html = '<style type="text/css" scoped="scoped">.' . $uniq_class . ' .flipbox-front{background-color:' . $front_background . ';}.' . $uniq_class . ' .flipbox-front .flipbox-content{padding:' . $front_paddings . ';}.' . $uniq_class . ' .flipbox-back{background-color:' . $back_background . ';}.' . $uniq_class . ' .flipbox-back .flipbox-content{padding:' . $back_paddings . ';}</style>';
$html .= '<div class="magee-flipbox-wrap ' . $class . '" id="' . $id . '">
<div class="magee-flipbox">
<div class="flipbox-front">
<div class="flipbox-content">
' . do_shortcode(Magee_Core::fix_shortcodes($front_content)) . '
</div>
</div>
<div class="flipbox-back">
<div class="flipbox-content">
' . do_shortcode(Magee_Core::fix_shortcodes($back_content)) . '
</div>
</div>
</div>
</div>';
}
return $html;
}
示例5: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('id' => '', 'class' => '', 'style' => '', 'border_color' => '', 'border_width' => '0', 'border_position' => 'left', 'background_color' => '', 'button_color' => '', 'button_link' => '#', 'button_icon' => '', 'button_text' => ''), $args);
extract($defaults);
self::$args = $defaults;
$uniq_class = uniqid('promo_box-');
$class .= ' ' . $uniq_class;
$html = '';
$textstyle = sprintf('.' . $uniq_class . '.boxed{border-' . esc_attr($border_position) . '-width: %s; background-color:%s;border-' . esc_attr($border_position) . '-color:%s;}', $border_width, $background_color, $border_color);
$css_style = '';
if ($button_color != '') {
$css_style .= sprintf('.' . $uniq_class . ' .promo-action a{ background-color:%s;', $button_color);
}
if ($style == 'boxed') {
$class .= ' boxed';
$html .= sprintf('<style type="text/css" scoped="scoped">%s </style>', $textstyle);
}
if ($css_style != '') {
$html .= sprintf('<style type="text/css" scoped="scoped">%s </style>', $css_style);
}
$html .= '<div class="magee-promo-box ' . esc_attr($class) . '" id="' . esc_attr($id) . '">
<div class="promo-info">
' . do_shortcode(Magee_Core::fix_shortcodes($content)) . '
</div>
<div class="promo-action">
<a href="' . esc_url($button_link) . '" class="btn-normal btn-lg"><i class="fa ' . esc_attr($button_icon) . '"></i> ' . esc_attr($button_text) . '</a>
</div>
</div>';
return $html;
}
示例6: render_child
/**
* Render the child shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render_child($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('title' => '', 'status' => '', 'icon' => ''), $args);
extract($defaults);
self::$args = $defaults;
if ($status == "open") {
$status = "in";
$expanded = "true";
$collapse = "";
} else {
$status = "";
$expanded = "false";
$collapse = "collapsed";
}
$itemId = 'collapse' . $this->id . "-" . $this->num;
$html = '<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading' . $itemId . '">
<a class="accordion-toggle ' . $collapse . '" data-toggle="collapse" data-parent="#' . $this->id . '" href="#' . $itemId . '" aria-expanded="' . $expanded . '" aria-controls="' . $itemId . '">
<h4 class="panel-title">
<i class="fa ' . $icon . '"></i> ' . esc_attr($title) . '
</h4>
</a>
</div>
<div id="' . $itemId . '" class="panel-collapse collapse ' . $status . '" role="tabpanel" aria-labelledby="heading' . $itemId . '" aria-expanded="' . $expanded . '">
<div class="panel-body">
' . do_shortcode(Magee_Core::fix_shortcodes($content)) . '
<div class="clear"></div>
</div>
</div>
</div>';
$this->num++;
return $html;
}
示例7: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('id' => '', 'class' => '', 'style' => 'border', 'color' => '', 'border_color' => '', 'text_align' => '', 'font_weight' => '400', 'font_size' => '36px', 'margin_top' => '', 'margin_bottom' => '', 'border_width' => '5px'), $args);
extract($defaults);
self::$args = $defaults;
$uniqid = uniqid('heading-');
$class .= ' ' . $uniqid;
$html = '<style type="text/css">
.' . $uniqid . '.magee-heading{
font-size:' . $font_size . ';
font-weight:' . $font_weight . ';
margin-top:' . $margin_top . ';
margin-bottom:' . $margin_bottom . ';
color: ' . $color . ';
border-color: ' . $border_color . ';
text-align: ' . $text_align . ';
}
.' . $uniqid . '.heading-border .heading-inner {
border-width: ' . $border_width . ';
}
.' . $uniqid . '.heading-doubleline .heading-inner:before,
.' . $uniqid . '.heading-doubleline .heading-inner:after {
border-color: ' . $border_color . ';
border-width: ' . $border_width . ';
}
</style>';
$html .= '<h1 class="magee-heading heading-' . $style . ' ' . $class . '" id="' . $id . '"><span class="heading-inner">' . do_shortcode(Magee_Core::fix_shortcodes($content)) . '</span></h1>';
return $html;
}
示例8: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('id' => 'magee-social', 'class' => '', 'icon_size' => '', 'effect_3d' => 'no', 'title' => '', 'icon' => '', 'iconlink' => '#', 'iconcolor' => '#A0A0A0', 'backgroundcolor' => 'transparent', 'iconboxedradius' => ''), $args);
extract($defaults);
self::$args = $defaults;
$uniqid = uniqid('social-');
$this->id = $id . $uniqid;
$uqid = uniqid('tab');
$sty3d = '';
$textstyle = sprintf(' .%s_social_icon_acolor{ color: %s !important ; background-color: %s !important; font-size: %s; }', $uqid, $iconcolor, $backgroundcolor, $icon_size);
$styles = sprintf('<style type="text/css" scoped="scoped">%s </style>', $textstyle);
if ($effect_3d == 'yes') {
$sty3d .= ' icon-3d';
}
switch ($iconboxedradius) {
case 'normal':
break;
case 'boxed':
$sty3d .= ' icon-boxed';
break;
case 'rounded':
$sty3d .= ' icon-boxed rounded';
break;
case 'circle':
$sty3d .= ' icon-boxed circle';
break;
}
$html = sprintf(' %s <a href="%s" Id="%s" class="fa %s magee-icon %s %s %s_social_icon_acolor" data-toggle="tooltip" data-placement="top" title="" data-original-title="%s"></a>', $styles, $iconlink, $id, $icon, $sty3d, $class, $uqid, $title);
return $html;
}
示例9: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('id' => '', 'class' => '', 'title' => '', 'border_color' => '', 'title_background_color' => '', 'title_color' => '', 'border_radius' => ''), $args);
extract($defaults);
self::$args = $defaults;
$add_class = uniqid('panel-');
$class .= ' ' . $add_class;
$css_style = '';
if (is_numeric($border_radius)) {
$border_radius = $border_radius . 'px';
}
if ($title_color) {
$css_style .= '.' . $add_class . ' h3.panel-title{color:' . esc_attr($title_color) . ';}';
}
if ($border_color) {
$css_style .= '.' . $add_class . '{border-color:' . esc_attr($border_color) . ';}';
}
if ($title_background_color) {
$css_style .= '.' . $add_class . ' .panel-heading{background-color:' . esc_attr($title_background_color) . ';}';
}
if ($border_radius) {
$css_style .= '.' . $add_class . '{border-radius:' . esc_attr($border_radius) . ';}';
}
$styles = sprintf('<style type="text/css" scoped="scoped">%s </style>', $css_style);
$content = do_shortcode(Magee_Core::fix_shortcodes($content));
$html = sprintf('%s<div class="panel magee-panel %s" id="%s">
<div class="panel-heading">
<h3 class="panel-title">%s</h3>
</div>
<div class="panel-body">
%s
</div>
</div>', $styles, esc_attr($class), esc_attr($id), esc_attr($title), $content);
return $html;
}
示例10: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('id' => '', 'class' => '', 'icon' => '', 'color' => '', 'size' => '', 'icon_box' => ''), $args);
extract($defaults);
self::$args = $defaults;
if (is_numeric($size)) {
$size = $size . 'px';
}
$html = '';
$css_style = '';
$uniqid = ' magee-fa-icon icon-boxed';
if ($size) {
$css_style .= 'font-size:' . $size . ';';
}
if ($icon_box == 'yes') {
$icon .= $uniqid;
if ($color) {
$css_style .= 'background:' . $color . ';';
}
if ($icon != '') {
$html = sprintf('<i id="%s" class="%s fa %s" style="%s"></i>', $id, $class, $icon, $css_style);
}
} else {
if ($color) {
$css_style .= 'color:' . $color . ';';
}
if ($icon != '') {
$html = sprintf('<i id="%s" class="%s fa %s" style="%s"></i>', $id, $class, $icon, $css_style);
}
}
return $html;
}
示例11: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('type' => '', 'alternative' => ''), $args);
extract($defaults);
self::$args = $defaults;
$html = '';
switch (esc_attr($type)) {
case 'private':
if (current_user_can('publish_posts')) {
$html .= '<div class="content-private">' . do_shortcode(Magee_Core::fix_shortcodes($content)) . '</div>';
} else {
$html .= '<div class="content-private-no">' . esc_attr($alternative) . '</div>';
}
break;
case 'members':
if (is_user_logged_in()) {
$html .= '<div class="content-members">' . do_shortcode(Magee_Core::fix_shortcodes($content)) . '</div>';
} else {
$html .= '<div class="content-members-no">' . esc_attr($alternative) . '</div>';
}
break;
case 'guests':
if (!is_user_logged_in()) {
$html .= '<div class="content-guests">' . do_shortcode(Magee_Core::fix_shortcodes($content)) . '</div>';
} else {
$html .= '<div class="content-guests-no">' . esc_attr($alternative) . '</div>';
}
break;
}
return $html;
}
示例12: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('url' => '', 'number' => 3, 'class' => '', 'id' => ''), $args);
extract($defaults);
self::$args = $defaults;
$html = '';
//$html = '<h2>'._e( 'Recent news from Some-Other Blog:', 'my-text-domain' ).'<h2>';
if ($url !== '') {
include_once ABSPATH . WPINC . '/feed.php';
$rss = fetch_feed(esc_url($url));
$maxitems = 0;
if (!is_wp_error($rss)) {
$maxitems = $rss->get_item_quantity(esc_attr($number));
$rss_items = $rss->get_items(0, $maxitems);
}
$html = '<ul class="' . esc_attr($class) . '" id="' . esc_attr($id) . '">';
if ($maxitems == 0) {
$html .= '<li>' . _e('No items', 'magee-shortcodes') . '</li>';
} else {
foreach ($rss_items as $item) {
$html .= '<li>';
$html .= '<a target="_blank" href="' . esc_url($item->get_permalink()) . '" ';
$html .= 'title="' . __('Posted ' . $item->get_date('j F Y | g:i a'), 'magee-shortcodes') . '">';
$html .= $item->get_title();
$html .= '</a>';
$html .= '</li>';
}
}
$html .= '</ul>';
}
return $html;
}
示例13: render_modal_content
/**
* Render the child shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render_modal_content($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array(), $args);
extract($defaults);
self::$args = $defaults;
$this->modal_content = do_shortcode(Magee_Core::fix_shortcodes($content));
}
示例14: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('id' => '', 'class' => '', 'percent' => '50', 'text' => '', 'height' => 30, 'color' => '', 'direction' => 'left', 'textposition' => 'on', 'number' => 'yes', 'rounded' => 'on', 'striped' => 'none'), $args);
extract($defaults);
self::$args = $defaults;
$percent = str_replace('%', '', $percent);
$percent = esc_attr($percent) . '%';
$css_style = 'width: ' . esc_attr($percent) . ';';
if (is_numeric($height)) {
$height = $height . 'px';
}
$line_height = '';
$bar_height = '';
if ($height) {
$bar_height = 'height:' . esc_attr($height) . ';';
$line_height = 'line-height:' . esc_attr($height) . '';
}
if ($direction == 'left') {
$a = 'left';
$b = 'right';
} else {
$a = 'right';
$b = 'left';
}
$progress = '';
$progress_bar = '';
if ($textposition == 'above') {
$progress .= ' progress-sm';
}
if ($number == 'no') {
$percent = '';
}
if ($rounded == 'on') {
$progress .= ' rounded';
}
if ($striped == 'none') {
$progress_bar .= ' none-striped';
}
if ($striped == 'striped') {
$progress_bar .= ' progress-bar-striped';
}
if ($striped == 'striped animated') {
$progress_bar .= ' progress-bar-striped animated hinge infinite';
}
if ($color) {
$css_style .= 'background-color:' . esc_attr($color) . ';';
}
$html = '<div class="magee-progress-box ' . esc_attr($class) . '" id="' . esc_attr($id) . '">';
if ($textposition == '2') {
$html .= '<div class="porgress-title text-' . $a . ' clearfix">' . esc_textarea($text) . ' <div class="pull-' . $b . '">' . esc_attr($percent) . '</div></div>';
}
$html .= '<div class="progress ' . $progress . '" style="' . $bar_height . '">
<div class="progress-bar pull-' . $a . ' ' . esc_attr($progress_bar) . '" role="progressbar" aria-valuenow="' . esc_textarea($text) . '" aria-valuemin="0" aria-valuemax="100" style="' . $css_style . '">';
if ($textposition == '1') {
$html .= '<div class="progress-title text-' . $a . ' clearfix" style="' . $line_height . '">' . esc_textarea($text) . ' <div class="pull-' . $b . '">' . esc_attr($percent) . '</div></div>';
}
$html .= ' </div></div>';
$html .= '</div>';
return $html;
}
示例15: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
$defaults = Magee_Core::set_shortcode_defaults(array('background_color' => ''), $args);
extract($defaults);
self::$args = $defaults;
$html = sprintf('<span class="label magee-label" style="background-color:%s;">%s</span>', $background_color, do_shortcode($content));
return $html;
}