芝麻web文件管理V1.00
编辑当前文件:/home4/randall/public_html/sl/wp-content/plugins/trx_utils/shortcodes/trx_basic/twitter.php
"", "consumer_key" => "", "consumer_secret" => "", "token_key" => "", "token_secret" => "", "count" => "3", "controls" => "yes", "interval" => "", "autoheight" => "no", "align" => "", "scheme" => "", "bg_color" => "", "bg_image" => "", "bg_overlay" => "", "bg_texture" => "", // Common params "id" => "", "class" => "", "animation" => "", "css" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => "" ), $atts))); $twitter_username = $user ? $user : lorem_ipsum_books_media_store_get_theme_option('twitter_username'); $twitter_consumer_key = $consumer_key ? $consumer_key : lorem_ipsum_books_media_store_get_theme_option('twitter_consumer_key'); $twitter_consumer_secret = $consumer_secret ? $consumer_secret : lorem_ipsum_books_media_store_get_theme_option('twitter_consumer_secret'); $twitter_token_key = $token_key ? $token_key : lorem_ipsum_books_media_store_get_theme_option('twitter_token_key'); $twitter_token_secret = $token_secret ? $token_secret : lorem_ipsum_books_media_store_get_theme_option('twitter_token_secret'); $twitter_count = max(1, $count ? $count : intval(lorem_ipsum_books_media_store_get_theme_option('twitter_count'))); if (empty($id)) $id = "sc_testimonials_".str_replace('.', '', mt_rand()); if (empty($width)) $width = "100%"; if (!empty($height) && lorem_ipsum_books_media_store_param_is_on($autoheight)) $autoheight = "no"; if (empty($interval)) $interval = mt_rand(5000, 10000); if ($bg_image > 0) { $attach = wp_get_attachment_image_src( $bg_image, 'full' ); if (isset($attach[0]) && $attach[0]!='') $bg_image = $attach[0]; } if ($bg_overlay > 0) { if ($bg_color=='') $bg_color = lorem_ipsum_books_media_store_get_scheme_color('bg'); $rgb = lorem_ipsum_books_media_store_hex2rgb($bg_color); } $class .= ($class ? ' ' : '') . lorem_ipsum_books_media_store_get_css_position_as_classes($top, $right, $bottom, $left); $ws = lorem_ipsum_books_media_store_get_css_dimensions_from_values($width); $hs = lorem_ipsum_books_media_store_get_css_dimensions_from_values('', $height); $css .= ($hs) . ($ws); $output = ''; if (!empty($twitter_consumer_key) && !empty($twitter_consumer_secret) && !empty($twitter_token_key) && !empty($twitter_token_secret)) { $data = lorem_ipsum_books_media_store_get_twitter_data(array( 'mode' => 'user_timeline', 'consumer_key' => $twitter_consumer_key, 'consumer_secret' => $twitter_consumer_secret, 'token' => $twitter_token_key, 'secret' => $twitter_token_secret ) ); if ($data && isset($data[0]['text'])) { lorem_ipsum_books_media_store_enqueue_slider('swiper'); $output = ($bg_color!='' || $bg_image!='' || $bg_overlay>0 || $bg_texture>0 || lorem_ipsum_books_media_store_strlen($bg_texture)>2 || ($scheme && !lorem_ipsum_books_media_store_param_is_off($scheme) && !lorem_ipsum_books_media_store_param_is_inherit($scheme)) ? '
' . '
0 ? ' data-overlay="'.esc_attr($bg_overlay).'" data-bg_color="'.esc_attr($bg_color).'"' : '') . '>' : '') . '
' . '
0 ? ' data-interval="'.esc_attr($interval).'"' : '') . '>' . '
'; $cnt = 0; if (is_array($data) && count($data) > 0) { foreach ($data as $tweet) { if (lorem_ipsum_books_media_store_substr($tweet['text'], 0, 1)=='@') continue; $output .= '
' . '
' . '
' . '
' . '
@' . esc_html($tweet['user']['screen_name']) . '
' . force_balance_tags(lorem_ipsum_books_media_store_prepare_twitter_text($tweet)) . '
' . '
' . '
'; if (++$cnt >= $twitter_count) break; } } $output .= '
' . '
' . '
' . '
' . ($bg_color!='' || $bg_image!='' || $bg_overlay>0 || $bg_texture>0 || lorem_ipsum_books_media_store_strlen($bg_texture)>2 ? '
' : ''); } } return apply_filters('lorem_ipsum_books_media_store_shortcode_output', $output, 'trx_twitter', $atts, $content); } add_shortcode('trx_twitter', 'lorem_ipsum_books_media_store_sc_twitter'); } /* Register shortcode in the internal SC Builder -------------------------------------------------------------------- */ if ( !function_exists( 'lorem_ipsum_books_media_store_sc_twitter_reg_shortcodes' ) ) { //add_action('lorem_ipsum_books_media_store_action_shortcodes_list', 'lorem_ipsum_books_media_store_sc_twitter_reg_shortcodes'); function lorem_ipsum_books_media_store_sc_twitter_reg_shortcodes() { lorem_ipsum_books_media_store_sc_map("trx_twitter", array( "title" => esc_html__("Twitter", 'trx_utils'), "desc" => wp_kses_data( __("Insert twitter feed into post (page)", 'trx_utils') ), "decorate" => false, "container" => false, "params" => array( "user" => array( "title" => esc_html__("Twitter Username", 'trx_utils'), "desc" => wp_kses_data( __("Your username in the twitter account. If empty - get it from Theme Options.", 'trx_utils') ), "value" => "", "type" => "text" ), "consumer_key" => array( "title" => esc_html__("Consumer Key", 'trx_utils'), "desc" => wp_kses_data( __("Consumer Key from the twitter account", 'trx_utils') ), "value" => "", "type" => "text" ), "consumer_secret" => array( "title" => esc_html__("Consumer Secret", 'trx_utils'), "desc" => wp_kses_data( __("Consumer Secret from the twitter account", 'trx_utils') ), "value" => "", "type" => "text" ), "token_key" => array( "title" => esc_html__("Token Key", 'trx_utils'), "desc" => wp_kses_data( __("Token Key from the twitter account", 'trx_utils') ), "value" => "", "type" => "text" ), "token_secret" => array( "title" => esc_html__("Token Secret", 'trx_utils'), "desc" => wp_kses_data( __("Token Secret from the twitter account", 'trx_utils') ), "value" => "", "type" => "text" ), "count" => array( "title" => esc_html__("Tweets number", 'trx_utils'), "desc" => wp_kses_data( __("Tweets number to show", 'trx_utils') ), "divider" => true, "value" => 3, "max" => 20, "min" => 1, "type" => "spinner" ), "controls" => array( "title" => esc_html__("Show arrows", 'trx_utils'), "desc" => wp_kses_data( __("Show control buttons", 'trx_utils') ), "value" => "yes", "type" => "switch", "options" => lorem_ipsum_books_media_store_get_sc_param('yes_no') ), "interval" => array( "title" => esc_html__("Tweets change interval", 'trx_utils'), "desc" => wp_kses_data( __("Tweets change interval (in milliseconds: 1000ms = 1s)", 'trx_utils') ), "value" => 7000, "step" => 500, "min" => 0, "type" => "spinner" ), "align" => array( "title" => esc_html__("Alignment", 'trx_utils'), "desc" => wp_kses_data( __("Alignment of the tweets block", 'trx_utils') ), "divider" => true, "value" => "", "type" => "checklist", "dir" => "horizontal", "options" => lorem_ipsum_books_media_store_get_sc_param('align') ), "autoheight" => array( "title" => esc_html__("Autoheight", 'trx_utils'), "desc" => wp_kses_data( __("Change whole slider's height (make it equal current slide's height)", 'trx_utils') ), "value" => "yes", "type" => "switch", "options" => lorem_ipsum_books_media_store_get_sc_param('yes_no') ), "scheme" => array( "title" => esc_html__("Color scheme", 'trx_utils'), "desc" => wp_kses_data( __("Select color scheme for this block", 'trx_utils') ), "value" => "", "type" => "checklist", "options" => lorem_ipsum_books_media_store_get_sc_param('schemes') ), "bg_color" => array( "title" => esc_html__("Background color", 'trx_utils'), "desc" => wp_kses_data( __("Any background color for this section", 'trx_utils') ), "value" => "", "type" => "color" ), "bg_image" => array( "title" => esc_html__("Background image URL", 'trx_utils'), "desc" => wp_kses_data( __("Select or upload image or write URL from other site for the background", 'trx_utils') ), "readonly" => false, "value" => "", "type" => "media" ), "bg_overlay" => array( "title" => esc_html__("Overlay", 'trx_utils'), "desc" => wp_kses_data( __("Overlay color opacity (from 0.0 to 1.0)", 'trx_utils') ), "min" => "0", "max" => "1", "step" => "0.1", "value" => "0", "type" => "spinner" ), "bg_texture" => array( "title" => esc_html__("Texture", 'trx_utils'), "desc" => wp_kses_data( __("Predefined texture style from 1 to 11. 0 - without texture.", 'trx_utils') ), "min" => "0", "max" => "11", "step" => "1", "value" => "0", "type" => "spinner" ), "width" => lorem_ipsum_books_media_store_shortcodes_width(), "height" => lorem_ipsum_books_media_store_shortcodes_height(), "top" => lorem_ipsum_books_media_store_get_sc_param('top'), "bottom" => lorem_ipsum_books_media_store_get_sc_param('bottom'), "left" => lorem_ipsum_books_media_store_get_sc_param('left'), "right" => lorem_ipsum_books_media_store_get_sc_param('right'), "id" => lorem_ipsum_books_media_store_get_sc_param('id'), "class" => lorem_ipsum_books_media_store_get_sc_param('class'), "animation" => lorem_ipsum_books_media_store_get_sc_param('animation'), "css" => lorem_ipsum_books_media_store_get_sc_param('css') ) )); } } /* Register shortcode in the VC Builder -------------------------------------------------------------------- */ if ( !function_exists( 'lorem_ipsum_books_media_store_sc_twitter_reg_shortcodes_vc' ) ) { //add_action('lorem_ipsum_books_media_store_action_shortcodes_list_vc', 'lorem_ipsum_books_media_store_sc_twitter_reg_shortcodes_vc'); function lorem_ipsum_books_media_store_sc_twitter_reg_shortcodes_vc() { vc_map( array( "base" => "trx_twitter", "name" => esc_html__("Twitter", 'trx_utils'), "description" => wp_kses_data( __("Insert twitter feed into post (page)", 'trx_utils') ), "category" => esc_html__('Content', 'trx_utils'), 'icon' => 'icon_trx_twitter', "class" => "trx_sc_single trx_sc_twitter", "content_element" => true, "is_container" => false, "show_settings_on_create" => true, "params" => array( array( "param_name" => "user", "heading" => esc_html__("Twitter Username", 'trx_utils'), "description" => wp_kses_data( __("Your username in the twitter account. If empty - get it from Theme Options.", 'trx_utils') ), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "consumer_key", "heading" => esc_html__("Consumer Key", 'trx_utils'), "description" => wp_kses_data( __("Consumer Key from the twitter account", 'trx_utils') ), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "consumer_secret", "heading" => esc_html__("Consumer Secret", 'trx_utils'), "description" => wp_kses_data( __("Consumer Secret from the twitter account", 'trx_utils') ), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "token_key", "heading" => esc_html__("Token Key", 'trx_utils'), "description" => wp_kses_data( __("Token Key from the twitter account", 'trx_utils') ), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "token_secret", "heading" => esc_html__("Token Secret", 'trx_utils'), "description" => wp_kses_data( __("Token Secret from the twitter account", 'trx_utils') ), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "count", "heading" => esc_html__("Tweets number", 'trx_utils'), "description" => wp_kses_data( __("Number tweets to show", 'trx_utils') ), "class" => "", "divider" => true, "value" => 3, "type" => "textfield" ), array( "param_name" => "controls", "heading" => esc_html__("Show arrows", 'trx_utils'), "description" => wp_kses_data( __("Show control buttons", 'trx_utils') ), "admin_label" => true, "class" => "", "value" => array_flip(lorem_ipsum_books_media_store_get_sc_param('yes_no')), "type" => "dropdown" ), array( "param_name" => "interval", "heading" => esc_html__("Tweets change interval", 'trx_utils'), "description" => wp_kses_data( __("Tweets change interval (in milliseconds: 1000ms = 1s)", 'trx_utils') ), "class" => "", "value" => "7000", "type" => "textfield" ), array( "param_name" => "align", "heading" => esc_html__("Alignment", 'trx_utils'), "description" => wp_kses_data( __("Alignment of the tweets block", 'trx_utils') ), "class" => "", "value" => array_flip(lorem_ipsum_books_media_store_get_sc_param('align')), "type" => "dropdown" ), array( "param_name" => "autoheight", "heading" => esc_html__("Autoheight", 'trx_utils'), "description" => wp_kses_data( __("Change whole slider's height (make it equal current slide's height)", 'trx_utils') ), "class" => "", "value" => array("Autoheight" => "yes" ), "type" => "checkbox" ), array( "param_name" => "scheme", "heading" => esc_html__("Color scheme", 'trx_utils'), "description" => wp_kses_data( __("Select color scheme for this block", 'trx_utils') ), "group" => esc_html__('Colors and Images', 'trx_utils'), "class" => "", "value" => array_flip(lorem_ipsum_books_media_store_get_sc_param('schemes')), "type" => "dropdown" ), array( "param_name" => "bg_color", "heading" => esc_html__("Background color", 'trx_utils'), "description" => wp_kses_data( __("Any background color for this section", 'trx_utils') ), "group" => esc_html__('Colors and Images', 'trx_utils'), "class" => "", "value" => "", "type" => "colorpicker" ), array( "param_name" => "bg_image", "heading" => esc_html__("Background image URL", 'trx_utils'), "description" => wp_kses_data( __("Select background image from library for this section", 'trx_utils') ), "group" => esc_html__('Colors and Images', 'trx_utils'), "class" => "", "value" => "", "type" => "attach_image" ), array( "param_name" => "bg_overlay", "heading" => esc_html__("Overlay", 'trx_utils'), "description" => wp_kses_data( __("Overlay color opacity (from 0.0 to 1.0)", 'trx_utils') ), "group" => esc_html__('Colors and Images', 'trx_utils'), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "bg_texture", "heading" => esc_html__("Texture", 'trx_utils'), "description" => wp_kses_data( __("Texture style from 1 to 11. Empty or 0 - without texture.", 'trx_utils') ), "group" => esc_html__('Colors and Images', 'trx_utils'), "class" => "", "value" => "", "type" => "textfield" ), lorem_ipsum_books_media_store_get_vc_param('id'), lorem_ipsum_books_media_store_get_vc_param('class'), lorem_ipsum_books_media_store_get_vc_param('animation'), lorem_ipsum_books_media_store_get_vc_param('css'), lorem_ipsum_books_media_store_vc_width(), lorem_ipsum_books_media_store_vc_height(), lorem_ipsum_books_media_store_get_vc_param('margin_top'), lorem_ipsum_books_media_store_get_vc_param('margin_bottom'), lorem_ipsum_books_media_store_get_vc_param('margin_left'), lorem_ipsum_books_media_store_get_vc_param('margin_right') ), ) ); class WPBakeryShortCode_Trx_Twitter extends Lorem_Ipsum_Books_Media_Store_VC_ShortCodeSingle {} } } ?>