Ir para conteúdo

wellingtonmelo

Members
  • Total de itens

    108
  • Registro em

  • Última visita

  • Dias vencidos

    1

Tudo que wellingtonmelo postou

  1. wellingtonmelo

    Ajuda para exibir imagem dentro da janela de share do facebook

    Olá pessoal, beleza?!! Espero que sim! Vou tentar explicar bem meu problema para ver se aparece um anjo na minha vida e me ajuda com isso! Tenho um projeto quiz para facebook. Todo o tráfego é gerado pelos próprios usuários que fazem o teste, aparece a foto do usuário e ele compartilha em seu facebook. Porém a taxa de compartilhamento está muito baixa, percebi que não esta exibindo a imagem certa dentro da janela de share do facebook. Acredito que quem conhece php e/ou javascript consegue ler o código e ver qual código é responsável por puxar a imagem do resultado dentro da janela de share. É exibida a imagem de "capa", mas não a imagem do resultado. Por favor, veja o funcionamento, basta logar com facebook e para iniciar o teste: https://testesdivertidos.com/qual-seu-status-de-relacionamento-para-este-ano/ Após aparecer o resultado, clique em COMPARTILHAR, verá que a imagem da capa aparece no share, ao invés da imagem do resultado. Bom, os arquivos responsáveis acredito serem 3. wp-quiz-pro.php inc/class-fb-quiz.php inc/class-wp-quiz-pro.php Obs: "class-fb-quiz.php" e "class-wp-quiz-pro.php" estão dentro da pasta inc Segue código, wp-quiz-pro.php: <?php /** * Plugin Name: Testes Pop * Plugin URI: https://testespop.com.br * Description: O TestesPop permite que você adicione facilmente testes para o facebook, ágeis e modernos ao seu site ou blog! Aumente o engajamento e os compartilhamentos enquanto fatura continuamente. * Version: 4122 * Author: TestesPop * Author URI: http://testespop.com.br * * Text Domain: testes-pop * Domain Path: /languages/ */ if ( ! defined( 'ABSPATH' ) ) { exit; // disable direct access } if ( ! class_exists( 'WP_Quiz_Pro_Plugin' ) ) : /** * Register the plugin. * * Display the administration panel, insert JavaScript etc. */ class WP_Quiz_Pro_Plugin { /** * Hold plugin version * * @var string */ public $version = '4122'; /** * Hold an instance of WP_Quiz_Pro_Plugin class. * * @var WP_Quiz_Pro_Plugin */ protected static $instance = null; /** * Hold the current quiz instance * * @var WP_Quiz_Pro */ public $quiz = null; /** * Plugin url. * @var string */ private $plugin_url = null; /** * Plugin path. * @var string */ private $plugin_dir = null; /** * Main WP_Quiz_Pro_Plugin instance. * @return WP_Quiz_Pro_Plugin - Main instance. */ public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new WP_Quiz_Pro_Plugin; } return self::$instance; } /** * You cannot clone this class. */ public function __clone() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'wp-quiz-pro' ), $this->version ); } /** * You cannot unserialize instances of this class. */ public function __wakeup() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'wp-quiz-pro' ), $this->version ); } /** * The Constructor */ private function __construct() { $this->includes(); $this->hooks(); $this->setup_shortcode(); } /** * Load required classes */ private function includes() { // Auto loader spl_autoload_register( array( $this, 'autoloader' ) ); new WP_Quiz_Pro_Admin; } /** * Autoload classes */ public function autoloader( $class ) { $dir = $this->plugin_dir() . 'inc' . DIRECTORY_SEPARATOR; $class_file_name = 'class-' . str_replace( array( 'wp_quiz_pro_', '_' ), array( '', '-' ), strtolower( $class ) ) . '.php'; if ( file_exists( $dir . $class_file_name ) ) { require $dir . $class_file_name; } } /** * Register the [wp_quiz_pro] shortcode. */ private function setup_shortcode() { add_shortcode( 'wp_quiz_pro', array( $this, 'register_shortcode' ) ); add_shortcode( 'wp_quiz_listing', array( $this, 'quiz_listing' ) ); } /** * Hook WP Quiz into WordPress */ private function hooks() { // Common add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); add_action( 'init', array( $this, 'register_post_type' ) ); add_action( 'init', array( $this, 'embeded_output' ) ); // Frontend add_action( 'wp_head', array( $this, 'inline_script' ), 1 ); add_filter( 'the_content', array( $this, 'create_quiz_page' ) ); // Ajax add_action( 'wp_ajax_wq_quizResults', array( $this, 'save_quiz_results' ) ); add_action( 'wp_ajax_nopriv_wq_quizResults', array( $this, 'save_quiz_results' ) ); add_action( 'wp_ajax_wq_submitInfo', array( $this, 'save_quiz_user_info' ) ); add_action( 'wp_ajax_nopriv_wq_submitInfo', array( $this, 'save_quiz_user_info' ) ); add_action( 'wp_ajax_wq_submitFbInfo', array( $this, 'save_quiz_fb_user_info' ) ); add_action( 'wp_ajax_nopriv_wq_submitFbInfo', array( $this, 'save_quiz_fb_user_info' ) ); add_action( 'wp_ajax_check_image_file', array( $this, 'check_image_file' ) ); add_action( 'wp_ajax_check_video_file', array( $this, 'check_video_file' ) ); add_action( 'wp_ajax_dismiss_imagick_notice', array( $this, 'dismiss_imagick_notice' ) ); add_action( 'wp_ajax_dismiss_gdlibrary_notice', array( $this, 'dismiss_gdlibrary_notice' ) ); add_action( 'wp_ajax_wpquiz_get_debug_log', array( $this, 'wp_quiz_pro_get_debug_log' ) ); add_action( 'wp_ajax_connect_aweber', array( $this, 'connect_aweber' ) ); // FB SDK version 2.9 fix if ( isset( $_GET['fbs'] ) && ! empty( $_GET['fbs'] ) ) { add_action( 'template_redirect', array( $this, 'fb_share_fix' ) ); } } /** * Initialise translations */ public function load_plugin_textdomain() { load_plugin_textdomain( 'wp-quiz-pro', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); } /** * Register Quiz post type */ public function register_post_type() { $labels = array( 'name' => __( 'Testes Pop', 'wp-quiz-pro' ), 'menu_name' => __( 'Testes Pop', 'wp-quiz-pro' ), 'singular_name' => __( 'Testes Pop', 'wp-quiz-pro' ), 'name_admin_bar' => _x( 'Testes Pop', 'name admin bar', 'wp-quiz-pro' ), 'all_items' => __( 'Todos os testes', 'wp-quiz-pro' ), 'search_items' => __( 'Procurar teste', 'wp-quiz-pro' ), 'add_new' => _x( 'Adicionar novo', 'quiz', 'wp-quiz-pro' ), 'add_new_item' => __( 'Adicionar novo teste', 'wp-quiz-pro' ), 'new_item' => __( 'Adicionar novo', 'wp-quiz-pro' ), 'view_item' => __( 'Ver teste', 'wp-quiz-pro' ), 'edit_item' => __( 'Editar teste', 'wp-quiz-pro' ), 'not_found' => __( 'Nenhum teste encontrado.', 'wp-quiz-pro' ), 'not_found_in_trash' => __( 'Nenhum teste na lixeira.', 'wp-quiz-pro' ), 'parent_item_colon' => __( 'Teste pai', 'wp-quiz-pro' ), ); $args = array( 'labels' => $labels, 'description' => __( 'Mantém os testes e seus dados.', 'wp-quiz-pro' ), 'menu_position' => 5, 'menu_icon' => 'dashicons-editor-help', 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'supports' => array( 'title', 'author', 'thumbnail', 'excerpt' ), ); register_post_type( 'wp_quiz', $args ); if ( false === get_option( 'wp_quiz_pro_version' ) ) { flush_rewrite_rules(); update_option( 'wp_quiz_pro_version', $this->version ); } } public function quiz_listing( $atts = array() ) { extract( shortcode_atts( array( 'num' => 30 ), $atts ) ); $args = array( 'post_type' => 'wp_quiz', 'post_status' => 'publish', 'posts_per_page' => $num, 'no_found_rows' => true, 'update_post_term_cache' => false ); $the_query = new WP_Query( $args ); if ( ! $the_query->have_posts() ) { return ''; } wp_enqueue_style( 'wp-quiz-listing', $this->plugin_url() . 'assets/css/listing.css', null, null ); ob_start(); include_once 'tmpl-quiz-listing.php'; $out = ob_get_clean(); wp_reset_query(); return $out; } /** * Shortcode used to display quiz * * @return string HTML output of the shortcode */ public function register_shortcode( $atts ) { if ( ! isset( $atts['id'] ) ) { return false; } // we have an ID to work with $quiz = get_post( $atts['id'] ); // check if ID is correct if ( ! $quiz || 'wp_quiz' !== $quiz->post_type ) { return "<!-- wp_quiz {$atts['id']} not found -->"; } // lets go $this->set_quiz( $atts['id'] ); $this->quiz->enqueue_scripts(); return $this->quiz->render_public_quiz(); } /** * Set the current quiz */ public function set_quiz( $id ) { $quiz_type = get_post_meta( $id, 'quiz_type', true ); $quiz_type = str_replace( '_quiz', '', $quiz_type ); $quiz_type = 'WP_Quiz_Pro_' . ucwords( $quiz_type ) . '_Quiz'; $this->quiz = new $quiz_type( $id ); } /** * [create_quiz_page description] * @param [type] $content [description] * @return [type] [description] */ public function create_quiz_page( $content ) { global $post; if ( 'wp_quiz' !== $post->post_type ) { return $content; } if ( ! is_single() ) { return $content; } $quiz_html = $this->register_shortcode( array( 'id' => $post->ID ) ); return $quiz_html . $content; } /** * [save_quiz_results description] * @return [type] [description] */ public function save_quiz_results() { if ( ! wp_verify_nonce( $_POST['_nonce'], 'ajax-quiz-content' ) ) { return; } $correct = isset( $_POST['correct'] ) ? absint( $_POST['correct'] ) : 0; $rid = isset( $_POST['rid'] ) ? $_POST['rid'] : ''; $pid = absint( $_POST['pid'] ); $type = sanitize_text_field( $_POST['type'] ); $user_ip = $this->get_ip(); $user_id = get_current_user_id(); $user_info = get_userdata( $user_id ); $username = is_user_logged_in() ? $user_info->user_login : 'Guest'; $result = ''; $results = get_post_meta( $pid, 'results', true ); if ( 'trivia' === $type ) { $rid = ''; foreach ( $results as $result ) { if ( $result['min'] <= $correct && $result['max'] >= $correct ) { $result = $result['title']; break; } } } elseif ( 'personality' === $type ) { for ( $i = 0; $i < count( $results ); $i++ ) { if ( $i == $rid ) { $result = $results[ $i ]['title']; break; } } } elseif ( 'swiper' === $type ) { $results = $_POST['results']; $questions = get_post_meta( $pid, 'questions', true ); foreach ( $questions as $q_key => $question ) { foreach ( $results as $key => $result ) { if ( $question['uid'] == $key ) { if ( '0' == $result ) { $questions[ $q_key ]['votesDown'] = $question['votesDown'] + 1; } else { $questions[ $q_key ]['votesUp'] = $question['votesUp'] + 1; } } } } update_post_meta( $pid, 'questions', $questions ); $result = ''; } // Save Result $settings = get_option( 'wp_quiz_pro_default_settings' ); if ( isset( $settings['players_tracking'] ) && 1 === $settings['players_tracking'] ) { global $wpdb; $wpdb->insert( $wpdb->prefix . 'wp_quiz_players', array( 'pid' => $pid, 'date' => date( 'Y-m-d', time() ), 'user_ip' => $user_ip, 'username' => $username, 'correct_answered' => $correct, 'result' => $result, 'quiz_type' => $type, ), array( '%d', '%s', '%s', '%s', '%d', '%s', '%s' ) ); } die( 'SUCCESS!' ); } /** * [save_quiz_user_info description] * @return [type] [description] */ public function save_quiz_user_info() { if ( ! wp_verify_nonce( $_POST['_nonce'], 'ajax-quiz-content' ) ) { return; } $output = array( 'status' => 1 ); if ( is_email( $_POST['email'] ) ) { global $wpdb; $username = sanitize_text_field( $_POST['username'] ); $email = sanitize_email( $_POST['email'] ); $pid = absint( $_POST['pid'] ); $this->subscribe_user( $pid, $username, $email ); $result = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wp_quiz_emails WHERE email = '" . $email . "'" ); if ( ! $result ) { //Save info $wpdb->insert( $wpdb->prefix . 'wp_quiz_emails', array( 'pid' => $pid, 'username' => $username, 'email' => $email, 'date' => date( 'Y-m-d', time() ), ), array( '%d', '%s', '%s', '%s' ) ); } $output['status'] = 2; } wp_send_json( $output ); } /** * [save_quiz_fb_user_info description] * @return [type] [description] */ public function save_quiz_fb_user_info() { if ( ! wp_verify_nonce( $_POST['_nonce'], 'ajax-quiz-content' ) ) { return; } $output = array( 'status' => 1 ); if ( ! empty( $_POST['user'] ) ) { global $wpdb; $user = $_POST['user']; $result = $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}wp_quiz_fb_users WHERE uid = '" . $user['id'] . "'" ); if ( ! $result ) { $wpdb->insert( $wpdb->prefix . 'wp_quiz_fb_users', array( 'uid' => absint( $user['id'] ), 'email' => isset( $user['email'] ) ? $user['email'] : '', 'first_name' => $user['first_name'], 'last_name' => $user['last_name'], 'gender' => isset( $user['gender'] ) ? $user['gender'] : '', 'picture' => isset( $user['picture'] ) ? $user['picture'] : '', 'friends' => isset( $user['friends'] ) ? serialize( $user['friends'] ) : '', 'created_at' => date( 'Y-m-d', time() ), 'updated_at' => date( 'Y-m-d', time() ), ), array( '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ); $user['insert_id'] = $wpdb->insert_id; } else { $user['insert_id'] = $result->id; } if ( 'user' === $_POST['profile'] ) { $return = $this->generate_result_user_image( $_POST['pid'], $user ); } else { $return = $this->generate_result_friend_image( $_POST['pid'], $user ); } if ( ! empty( $return['src'] ) ) { $output['src'] = $return['src']; $output['desc'] = $return['desc']; $output['key'] = $return['key']; $output['status'] = 2; } else { $output['error'] = $return['error']; } } wp_send_json( $output ); } /** * [generate_result_user_image description] * @param [type] $post_id [description] * @param [type] $user [description] * @return [type] [description] */ public function generate_result_user_image( $post_id, $user ) { global $wpdb; $return = array(); $results = get_post_meta( $post_id, 'results', true ); if ( extension_loaded( 'imagick' ) && ! empty( $results ) ) { $index = array_rand( $results ); $result = $results[ $index ]; $result['key'] = $index; $play = $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}wp_quiz_fb_plays WHERE user_id = '" . $user['insert_id'] . "' AND pid = '" . $post_id . "'" ); if ( ! $play ) { $wpdb->insert( $wpdb->prefix . 'wp_quiz_fb_plays', array( 'user_id' => absint( $user['insert_id'] ), 'pid' => absint( $post_id ), ), array( '%d', '%d' ) ); } $names = array( 'user_first_name' => $user['first_name'], 'user_last_name' => $user['last_name'], 'friend_first_name' => '', 'friend_last_name' => '', ); $profile = 'https://graph.facebook.com/' . $user['id'] . '/picture?width=320&height=320'; $profile = $this->get_redirect_url( $profile ); $data = $this->generate_fb_result( $post_id, $result, $profile, $names ); $return = $data; } return $return; } public function generate_result_friend_image( $post_id, $user ) { global $wpdb; $return = array(); $results = get_post_meta( $post_id, 'results', true ); if ( extension_loaded( 'imagick' ) && ! empty( $results ) && ! empty( $user['friends'] ) ) { $index = array_rand( $results ); $result = $results[ $index ]; $result['key'] = $index; $index_2 = array_rand( $user['friends'] ); $friend = $user['friends'][ $index_2 ]; $play = $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}wp_quiz_fb_plays WHERE user_id = '" . $user['insert_id'] . "' AND pid = '" . $post_id . "'" ); if ( ! $play ) { $wpdb->insert( $wpdb->prefix . 'wp_quiz_fb_plays', array( 'user_id' => absint( $user['insert_id'] ), 'pid' => absint( $post_id ), ), array( '%d', '%d' ) ); } $profile = 'https://graph.facebook.com/' . $friend['id'] . '/picture?width=320&height=320'; $profile = $this->get_redirect_url( $profile ); $friend_name = explode( ' ', $friend['name'] ); $names = array( 'user_first_name' => $user['first_name'], 'user_last_name' => $user['last_name'], 'friend_first_name' => $friend_name[0], 'friend_last_name' => $friend_name[1], ); $data = $this->generate_fb_result( $post_id, $result, $profile, $names ); $return = $data; } return $return; } public function generate_fb_result( $post_id, $result, $profile, $names ) { $return = array( 'src' => '', 'desc' => '', 'error' => '', ); $profile_tmp = null; $output = null; $draw = null; try { $options = get_option( 'wp_quiz_pro_default_settings' ); $settings = get_post_meta( $post_id, 'settings', true ); $find = array( '%%nomeusuario%%', '%%sobrenome%%', '%%nomeamigo%%', '%%sobrenomeamigo%%' ); $replace = array( $names['user_first_name'], $names['user_last_name'], $names['friend_first_name'], $names['friend_last_name'] ); $title = str_replace( $find, $replace, $result['title'] ); $desc = str_replace( $find, $replace, $result['desc'] ); $upload_dir = wp_upload_dir(); // Load images $profile_tmp = download_url( $profile ); $profile = new Imagick( $profile_tmp ); $profile->resizeImage( $result['proImageWidth'], $result['proImageHeight'], imagick::FILTER_LANCZOS, 0.9 ); $profile->roundCorners( $result['imageRadius'], $result['imageRadius'] ); // Create new image from result $output = new Imagick( str_replace( $upload_dir['baseurl'], $upload_dir['basedir'], $result['image'] ) ); $output->compositeImage( $profile, Imagick::COMPOSITE_DEFAULT, $result['pos_x'], $result['pos_y'] ); // Annotate it if ( ! empty( $title ) ) { $draw = new ImagickDraw(); $draw->setFillColor( $settings['title_color'] ); $draw->setGravity( 1 ); $draw->setFontSize( $settings['title_size'] ); if ( isset( $options['defaults']['external_font'] ) && ! empty( $options['defaults']['external_font'] ) ) { $external_font = str_replace( home_url( '/' ), '', $options['defaults']['external_font'] ); $draw->setFont( '../' . $external_font ); } else { $draw->setFontFamily( $settings['title_font'] ); } list( $lines, $line_height ) = $this->word_wrap_annotation( $output, $draw, $title, $result['titleImageWidth'] ); for ( $i = 0; $i < count( $lines ); $i++ ) { $output->annotateImage( $draw, $result['pos_title_x'], $result['pos_title_y'] + $i * $line_height, 0, $lines[ $i ] ); } } // Save to new image $upload_dir['basedir'] = $upload_dir['basedir'] . '/wp_quiz-result-images'; $upload_dir['baseurl'] = $upload_dir['baseurl'] . '/wp_quiz-result-images'; $output_name = 'image-' . rand( 0, 100000 ) . '.png'; $output->writeImage( $upload_dir['basedir'] . '/' . $output_name ); $return['src'] = $upload_dir['baseurl'] . '/' . $output_name; $return['desc'] = $desc; $return['key'] = $result['key']; } catch ( Exception $ex ) { $return['error'] = $ex->getMessage(); } // Clean up if ( ! is_null( $profile ) && is_a( $profile, 'Imagick' ) ) { $profile->clear(); } if ( ! is_null( $output ) && is_a( $output, 'Imagick' ) ) { $output->clear(); } if ( ! is_null( $draw ) && is_a( $draw, 'ImagickDraw' ) ) { $draw->clear(); } if ( ! is_null( $profile_tmp ) ) { @unlink( $profile_tmp ); } return $return; } public function get_redirect_url( $url ) { $response = wp_remote_head( $url ); $redirect_url = wp_remote_retrieve_header( $response, 'location' ); return $redirect_url ? $redirect_url : $url; } public function word_wrap_annotation( $image, $draw, $text, $max_width ) { $words = preg_split( '%\s%', $text, -1, PREG_SPLIT_NO_EMPTY ); $lines = array(); $i = 0; $line_height = 0; while ( count( $words ) > 0 ) { $metrics = $image->queryFontMetrics( $draw, implode( ' ', array_slice( $words, 0, ++$i ) ) ); $line_height = max( $metrics['textHeight'], $line_height ); if ( $metrics['textWidth'] > $max_width || count( $words ) < $i ) { if ( 1 === $i ) { $i++; } $lines[] = implode( ' ', array_slice( $words, 0, --$i ) ); $words = array_slice( $words, $i ); $i = 0; } } return array( $lines, $line_height ); } public function subscribe_user( $id, $name, $email ) { $settings = get_post_meta( $id, 'settings', true ); $options = get_option( 'wp_quiz_pro_default_settings' ); if ( '1' === $settings['force_action'] ) { if ( '1' === $options['mail_service'] ) { $this->subscribe_mailchimp( $options, $name, $email ); } elseif ( '2' === $options['mail_service'] ) { $this->subscribe_getresponse( $options, $name, $email ); } elseif ( '3' === $options['mail_service'] ) { $this->subscribe_aweber( $options, $name, $email ); } } } private function subscribe_aweber( $options, $name, $email ) { // check for valid data if ( empty( $email ) ) { wp_send_json( array( 'success' => false, 'error' => esc_html__( 'No email address found.', 'wp-quiz-pro' ), ) ); } if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) { wp_send_json( array( 'success' => false, 'error' => esc_html__( 'Not a valid email address.', 'wp-quiz-pro' ), ) ); } // Call service subscription method try { $service = new WP_Quiz_Pro_Subscription_Aweber(); $list_id = $options['aweber']['listid']; $status = $service->subscribe( $name, $email, $list_id ); wp_send_json(array( 'success' => true, 'status' => $status['status'], )); } catch ( Exception $e ) { wp_send_json(array( 'success' => false, 'error' => $e->getMessage(), )); } } private function subscribe_mailchimp( $options, $name, $email ) { $mc_api_key = $options['mailchimp']['api_key']; $mc_list_id = $options['mailchimp']['list_id']; $double_optin = apply_filters( 'wp_quiz_mailchimp_double_notification', false ); $vendor_path = $this->get_vendor_path(); if ( $email && null !== $mc_api_key && null !== $mc_list_id ) { try { if ( ! class_exists( 'Mailchimp' ) ) { require_once( $vendor_path . '/Mailchimp.php' ); } $list = new Mailchimp_Lists( new Mailchimp( $mc_api_key ) ); $merge_vars = null; if ( $name ) { $fname = $name; $lname = ''; if ( $space_pos = strpos( $name, ' ' ) ) { $fname = substr( $name, 0, $space_pos ); $lname = substr( $name, $space_pos ); } $merge_vars = array( 'FNAME' => $fname, 'LNAME' => $lname, ); } $list->subscribe( $mc_list_id, array( 'email' => $email ), $merge_vars, 'html', (bool) $double_optin, true ); } catch ( Exception $ex ) { } } } private function subscribe_getresponse( $options, $name, $email ) { $gr_api_key = $options['getresponse']['api_key']; $gr_list_id = $options['getresponse']['campaign_name']; $vendor_path = $this->get_vendor_path(); if ( $email && null !== $gr_api_key && null !== $gr_list_id ) { try { if ( ! class_exists( 'GetResponse' ) ) { require_once( $vendor_path . '/getresponse.php' ); } $api = new GetResponse( $gr_api_key ); $campaign_ame = $gr_list_id; $subscriber_name = $name; $subscriber_email = $email; $result = $api->getCampaigns( 'EQUALS', $campaign_ame ); $campaigns = array_keys( (array) $result ); $campaign_id = array_pop( $campaigns ); $api->addContact( $campaign_id, $subscriber_name, $subscriber_email ); } catch ( Exception $ex ) { } } } public function get_vendor_path() { return plugin_dir_path( __FILE__ ) . 'vendor'; } public function check_image_file() { $output = array( 'status' => 1 ); $check = false; if ( @getimagesize( $_POST['url'] ) ) { $check = true; } $output['check'] = $check; wp_send_json( $output ); } public function check_video_file() { $output = array( 'status' => 1 ); $check = false; $id = $_POST['video_id']; $url = "//www.youtube.com/oembed?url=http://www.youtube.com/watch?v=$id&format=json"; $headers = get_headers( $url ); if ( '404' !== substr( $headers[0], 9, 3 ) ) { $check = true; } $output['check'] = $check; wp_send_json( $output ); } public static function activate_plugin() { // Don't activate on anything less than PHP 5.4.0 or WordPress 3.4 if ( version_compare( PHP_VERSION, '5.4.0', '<' ) || version_compare( get_bloginfo( 'version' ), '3.4', '<' ) || ! function_exists( 'spl_autoload_register' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; deactivate_plugins( basename( __FILE__ ) ); wp_die( __( 'O Testes Pop requer o PHP na versão 5.4.0 com extensão spl ou superior e o WordPress 3.4 ou superior.', 'wp-quiz-pro' ) ); } //Dont't activate if wp quiz is active if ( defined( 'WP_QUIZ_VERSION' ) ) { deactivate_plugins( basename( __FILE__ ) ); wp_die( __( 'Por favor, desative o plugin Testes Pop primeiro para usar os recursos Premium!', 'wp-quiz-pro' ) ); } include( 'inc/activate-plugin.php' ); } public function get_ip() { //Just get the headers if we can or else use the SERVER global if ( function_exists( 'apache_request_headers' ) ) { $headers = apache_request_headers(); } else { $headers = $_SERVER; } //Get the forwarded IP if it exists if ( array_key_exists( 'X-Forwarded-For', $headers ) && filter_var( $headers['X-Forwarded-For'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) { $the_ip = $headers['X-Forwarded-For']; } elseif ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ) && filter_var( $headers['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) { $the_ip = $headers['HTTP_X_FORWARDED_FOR']; } else { $the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ); } return $the_ip; } public function dismiss_imagick_notice() { add_option( 'wp_dismiss_imagick_notice', 'true' ); } public function dismiss_gdlibrary_notice() { add_option( 'wp_dismiss_gdlibrary_notice', 'true' ); } public function wp_quiz_pro_get_debug_log() { $page = new WP_Quiz_Pro_Page_Support(); $page->get_debug_log(); } public function fb_share_fix() { $data = array_map( 'urldecode', $_GET ); $result = get_post_meta( $data['id'], 'results', true ); $result = isset( $result[ $data['rid'] ] ) ? $result[ $data['rid'] ] : array(); // Picture if(isset($data['img_url']) && $data['img_url'] !== '') { $data['source'] = $data['img_url']; } else if ( 'r' === $data['pic'] ) { $data['source'] = $result['image']; } elseif ( 'f' === $data['pic'] ) { $data['source'] = wp_get_attachment_url( get_post_thumbnail_id( $data['id'] ) ); } elseif ( ( substr( $data['pic'], 0, 6 ) === 'image-' ) ) { $upload_dir = wp_upload_dir(); $upload_dir['baseurl'] = $upload_dir['baseurl'] . '/wp_quiz-result-images'; $data['source'] = $upload_dir['baseurl'] . '/' . $data['pic'] . '.png'; } else { $data['source'] = false; } // Description if(isset($data['desc_text']) && $data['desc_text'] !== '') { $data['description'] = $data['desc_text']; } elseif ( 'r' === $data['desc'] ) { $data['description'] = $result['desc']; } elseif ( 'e' === $data['desc'] ) { $data['description'] = get_post_field( 'post_excerpt', $data['id'] ); } else { $data['description'] = false; } if ( $data['description'] ) { $first = array( '%%nomeusuario%%', '%%nomeamigo%%' ); $last = array( '%%sobrenome%%', '%%sobrenomeamigo%%' ); $data['description'] = str_replace( $first, $data['nf'], $data['description'] ); $data['description'] = str_replace( $last, $data['nl'], $data['description'] ); } $settings = get_option( 'wp_quiz_pro_default_settings' ); $url = ( is_ssl() ? 'https' : 'http' ) . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; global $post; $pid = $post ? $post->ID : $data['id']; $original_url = get_permalink( $pid ); ?> <html> <head> <title><?php wp_title( '' ); ?></title> <meta property="fb:app_id" content="<?php echo $settings['defaults']['fb_app_id'] ?>"> <meta property="og:type" content="website"> <meta name="twitter:card" content="summary_large_image"> <meta property="og:url" content="<?php echo esc_url( $url ); ?>"> <?php if ( ! empty( $data['text'] ) ) : $title = get_the_title( $pid ); $text = esc_attr( $data['text'] ); $title = $title === $text ? $title : $title . ' - ' . $text; ?> <meta property="og:title" content="<?php echo $title ?>"> <meta property="twitter:title" content="<?php echo $title ?>"> <?php endif; ?> <?php if ( ! empty( $data['source'] ) ) : ?> <meta property="og:image" content="<?php echo esc_url( $data['source'] ); ?>"> <meta property="twitter:image" content="<?php echo esc_url( $data['source'] ); ?>"> <?php list( $img_width, $img_height ) = getimagesize( $data['source'] ); ?> <?php if ( isset( $img_width ) && $img_width ) : ?> <meta property="og:image:width" content="<?php echo $img_width ?>"> <?php else: ?> <meta property="og:image:width" content="600"> <?php endif; ?> <?php if ( isset( $img_height ) && $img_height ) : ?> <meta property="og:image:height" content="<?php echo $img_height ?>"> <?php else: ?> <meta property="og:image:height" content="400"> <?php endif; ?> <?php endif; ?> <?php if ( ! empty( $data['description'] ) ) : ?> <meta property="og:description" content="<?php echo esc_attr( $data['description'] ); ?>"> <meta property="twitter:description" content="<?php echo esc_attr( $data['description'] ); ?>"> <?php endif; ?> <meta http-equiv="refresh" content="0;url=<?php echo esc_url( $original_url ); ?>"> </head> <body> Redirecionando, por favor aguarde.... </body> </html> <?php exit; } /* ////////////////////////////////////// ALTEREI AQUI //////////////////////////////////// */ protected static $url_facebook = null; public static function get_url_facebook() { return self::$url_facebook; } public function set_url_facebook($url) { self::$url_facebook = $url; } /* ////////////////////////////////////// ALTEREI AQUI //////////////////////////////////// */ /** * [inline_script description] * @return [type] [description] */ public function inline_script() { $settings = get_option( 'wp_quiz_pro_default_settings' ); /* ////////////////////////////////////// ALTEREI AQUI //////////////////////////////////// */ $this->set_url_facebook($settings['defaults']['fb_app_id2']); /* ////////////////////////////////////// ALTEREI AQUI //////////////////////////////////// */ ?> <script> var quizSiteUrl = '<?php echo home_url( '/' ) ?>'; <?php if ( ! empty( $settings['analytics']['tracking_id'] ) ) { ?> (function(i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function() { (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '<?php echo $settings['analytics']['tracking_id'] ?>', 'auto'); ga('send', 'pageview'); <?php } ?> <?php if ( ! empty( $settings['defaults']['fb_app_id'] ) ) { ?> window.fbAsyncInit = function() { FB.init({ appId : '<?php echo $settings['defaults']['fb_app_id'] ?>', xfbml : true, version : 'v2.9' }); FB.getLoginStatus(function( response ) { getLogin( response ); }); }; (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/pt_BR/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); <?php } ?> </script> <?php if ( is_singular( array( 'wp_quiz' ) ) && isset( $settings['defaults']['share_meta'] ) && 1 === $settings['defaults']['share_meta'] ) { global $post, $wpseo_og; $twitter_desc = $og_desc = str_replace( array( "\r", "\n" ), '', strip_tags( $post->post_excerpt ) ); if ( defined( 'WPSEO_VERSION' ) ) { remove_action( 'wpseo_head', array( $wpseo_og, 'opengraph' ), 30 ); remove_action( 'wpseo_head', array( 'WPSEO_Twitter', 'get_instance' ), 40 ); //use description from yoast $twitter_desc = get_post_meta( $post->ID, '_yoast_wpseo_twitter-description', true ); $og_desc = get_post_meta( $post->ID, '_yoast_wpseo_opengraph-description', true ); } ?> <meta name="twitter:title" content="<?php echo get_the_title(); ?>"> <meta name="twitter:description" content="<?php echo $twitter_desc; ?>"> <meta name="twitter:domain" content="<?php echo esc_url( site_url() ); ?>"> <meta property="og:url" content="<?php the_permalink(); ?>" /> <meta property="og:title" content="<?php echo get_the_title(); ?>" /> <meta property="og:description" content="<?php echo $og_desc; ?>" /> <?php if ( has_post_thumbnail() ) { $thumb_id = get_post_thumbnail_id(); $thumb_url_array = wp_get_attachment_image_src( $thumb_id, 'full', true ); $thumb_url = $thumb_url_array[0]; ?> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image:src" content="<?php echo $thumb_url; ?>"> <meta property="og:image" content="<?php echo $thumb_url; ?>" /> <meta itemprop="image" content="<?php echo $thumb_url; ?>"> <?php } } } public function embeded_output() { if ( ! isset( $_GET['wp_quiz_id'] ) ) { return; } $qid = absint( $_GET['wp_quiz_id'] ); $quiz_html = $this->register_shortcode( array( 'id' => $qid ) ); $settings = get_post_meta( $qid, 'settings', true ); if ( empty( $quiz_html ) ) { return; } ?> <link rel='stylesheet' href='<?php echo $this->plugin_url() . 'assets/css/main.css'; ?>' type='text/css' media='all' /> <link rel='stylesheet' href='<?php echo $this->plugin_url() . 'assets/css/transition.min.css'; ?>' type='text/css' media='all' /> <link rel='stylesheet' href='<?php echo $this->plugin_url() . 'assets/css/embed.min.css'; ?>' type='text/css' media='all' /> <style> .wq_embedToggleQuizCtr{ display: none; } </style> <?php if ( 'traditional' === $settings['skin'] ) { ?> <link rel='stylesheet' href='<?php echo $this->plugin_url() . 'assets/css/traditional-skin.css'; ?>' type='text/css' media='all' /> <?php } elseif ( 'flat' === $settings['skin'] ) { ?> <link rel='stylesheet' href='<?php echo $this->plugin_url() . 'assets/css/flat-skin.css'; ?>' type='text/css' media='all' /> <?php } $this->inline_script(); ?> <script> var wq_l10n = {"correct": "Correct !", "wrong": "Wrong !","captionTrivia":"You got %%score%% out of %%total%%","captionTriviaFB":"I got %%score%% out of %%total%%, and you?","youVoted":"You voted","nonce": "<?php echo wp_create_nonce( 'ajax-quiz-content' ) ?>"}; </script> <?php echo '<div class="wq_embed">' . $quiz_html . '</div>'; ?> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="<?php echo $this->plugin_url() . 'assets/js/embed.min.js'; ?>"></script> <script src="<?php echo $this->plugin_url() . 'assets/js/transition.min.js'; ?>"></script> <script src="<?php echo $this->plugin_url() . 'assets/js/jquery.flip.min.js'; ?>"></script> <script src="<?php echo $this->plugin_url() . 'assets/js/hammer.min.js'; ?>"></script> <script src="<?php echo $this->plugin_url() . 'assets/js/dynamics.min.js'; ?>"></script> <script src="<?php echo $this->plugin_url() . 'assets/js/jquery.jTinder.min.js'; ?>"></script> <script src="<?php echo $this->plugin_url() . 'assets/js/main.min.js'; ?>"></script> <?php die(); } /** * [connect_aweber description] * @return [type] [description] */ public function connect_aweber() { // check for data $aweber_code = isset( $_REQUEST['aweber_code'] ) ? $_REQUEST['aweber_code'] : array(); if ( empty( $aweber_code ) ) { wp_send_json( array( 'success' => false, 'error' => esc_html__( 'No aweber authorization code found.', 'wp-quiz-pro' ), ) ); } try { $service = new WP_Quiz_Pro_Subscription_Aweber(); $data = $service->connect( $aweber_code ); wp_send_json(array( 'success' => true, 'data' => $data, )); } catch ( Exception $e ) { wp_send_json(array( 'success' => false, 'error' => $e->getMessage(), )); } } /** * Get plugin directory. * @return string */ public function plugin_dir() { if ( is_null( $this->plugin_dir ) ) { $this->plugin_dir = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/'; } return $this->plugin_dir; } /** * Get plugin uri. * @return string */ public function plugin_url() { if ( is_null( $this->plugin_url ) ) { $this->plugin_url = untrailingslashit( plugin_dir_url( __FILE__ ) ) . '/'; } return $this->plugin_url; } } /** * Main instance of WP_Quiz_Pro_Plugin. * * Returns the main instance of WP_Quiz_Pro_Plugin to prevent the need to use globals. * * @return WP_Quiz_Pro_Plugin */ function wp_quiz_pro() { return WP_Quiz_Pro_Plugin::get_instance(); } /* ////////////////////////////////////// ALTEREI AQUI //////////////////////////////////// */ function prepare_url_facebook() { return WP_Quiz_Pro_Plugin::get_url_facebook(); } /* ////////////////////////////////////// ALTEREI AQUI //////////////////////////////////// */ endif; add_action( 'plugins_loaded', 'wp_quiz_pro', 10 ); register_activation_hook( __FILE__, array( 'WP_Quiz_Pro_Plugin', 'activate_plugin' ) ); Segue código, class-fb-quiz.php: <?php /** * Override parent 'WP_Quiz_Pro' class with facebook quiz specific markup, */ class WP_Quiz_Pro_Fb_Quiz extends WP_Quiz_Pro { /** * Constructor */ public function __construct( $id ) { parent::__construct( $id ); add_filter( 'wp_quiz_data_attrs', array( $this, 'add_fb_data_attrs' ) ); } public function get_html_questions() { $questions_html = ''; if ( ! empty( $this->questions ) ) { foreach ( $this->questions as $key => $question ) { $desc = ! empty( $question['desc'] ) ? '<p class="desc">' . $question['desc'] . '</p>' : ''; $questions_html .= ' <div class="wq_singleQuestionWrapper wq_IsFb" style=""> <div class="wq_loader-container" style="display:none;"> <div class="wq_loader_text"> <img src="' . wp_quiz_pro()->plugin_url() . 'assets/image/image_spinner.gif" /> <h3 id="wq_text_loader">' . esc_html__( 'Calculando seu resultado...', 'wp-quiz-pro' ) . '</h3> <h4 id="wq_text_loader">' . esc_html__( 'Curta nossa página!', 'wp-quiz-pro' ) . '</h4> <div class="curtir-load" style="margin:auto; width:100px; margin-top:15px;"> <iframe class="facebook-like-button" style="cursor: default;" src="https://www.facebook.com/plugins/like.php?locale=pt_BR&href=https://www.facebook.com/plugins/like.php?locale=pt_BR&href=' . WP_Quiz_Pro_Plugin::get_url_facebook() . '&layout=button_count&action=like&size=small&show_faces=false&share=false&width=50&height=21" width="97" height="20" style="border:none;overflow:hidden;" scrolling="no" frameborder="0" allowTransparency="true"> </iframe> </div><br><br> <center><img src="' . wp_quiz_pro()->plugin_url() . 'assets/image/seta-like.png" style="width:31px; height:71px;"></center> </div> </div> <div class="wq_questionMediaCtr" > <div class="wq_questionImage"><img src="' . $question['image'] . '" /><span>' . $question['imageCredit'] . '</span></div> </div> <div class="wq_questionTextDescCtr"> <h1 class="teste-titulo">' . $question['title'] . '</h1> <div class="titulo-descricao">Por favor, entre com o seu Facebook para ver o seu resultado</div> </div> <style type="text/css"> .mao-e-like{ margin:auto; width:140px; height: 20px; padding-top:5px;} .curta-aqui{ float:left;} .facebook-like-button{ float:right; } </style> <div class="mao-e-like"> <div class="curta-aqui"><img src="' . wp_quiz_pro()->plugin_url() . 'assets/image/gif-mao.gif"></div> <iframe class="facebook-like-button" style="cursor: default;" src="https://www.facebook.com/plugins/like.php?locale=pt_BR&href=https://www.facebook.com/plugins/like.php?locale=pt_BR&href=' . WP_Quiz_Pro_Plugin::get_url_facebook() . '&layout=button_count&action=like&size=small&show_faces=false&share=false&width=50&height=21" width="97" height="20" style="border:none;overflow:hidden;" scrolling="no" frameborder="0" allowTransparency="true"></iframe> </div> <div class="wq_questionLogin"> <button class="wq_loginFB"> <i class="fa fa-facebook-official" aria-hidden="true" style="font-size:28px; float:left; margin-left:6px; line-height:33px;"></i>&nbsp;Entrar com o Facebook </button> </div> </div>'; } }7 return $questions_html; } public function get_html_results() { $results_html = ''; $share_html = $this->get_html_share(); if ( ! empty( $this->results ) ) { $results_html .= ' <div style="display:none;" class="wq_singleResultWrapper wq_IsFb" data-id=""> <img class="wq_resultImg" src=""/> <center><div class="wq_resultDesc" style="line-height:20px; padding-top:10px;padding-bottom:10px;"></div></center> <div class="mao-e-like"> <div class="curta-aqui"><img src="' . wp_quiz_pro()->plugin_url() . 'assets/image/gif-mao.gif"></div> <iframe class="facebook-like-button" style="cursor: default; margin-top:2px;" src="https://www.facebook.com/plugins/like.php?locale=pt_BR&href=' . WP_Quiz_Pro_Plugin::get_url_facebook() . '&layout=button_count&action=like&size=small&show_faces=false&share=false&width=50&height=21" width="97" height="20" style="border:none;overflow:hidden;" scrolling="no" frameborder="0" allowTransparency="true"></iframe> </div> ' . $share_html . ' </div> '; } return $results_html; } public function add_fb_data_attrs( $data ) { $data .= 'data-quiz-profile="' . $this->settings['profile'] . '" '; return $data; } } Segue código, class-wp-quiz-pro.php: <?php /** * Generic WP_Quiz_Pro class. Extended by library specific classes. */ class WP_Quiz_Pro { /** * quiz ID */ public $id = 0; /** * quiz settings */ public $settings = array(); /** * quiz questions */ public $questions = array(); /** * quiz results */ public $results = array(); /** * quiz type */ public $type = ''; /** * quiz ad codes */ public $ad_codes = array(); /** * unique identifier */ public $identifier = 0; /** * default options */ public $options = array(); /** * Constructor */ public function __construct( $id ) { $this->options = get_option( 'wp_quiz_pro_default_settings' ); $this->id = $id; $this->settings = get_post_meta( $id, 'settings', true ); $this->questions = get_post_meta( $id, 'questions', true ); $this->results = get_post_meta( $id, 'results', true ); $this->type = get_post_meta( $id, 'quiz_type', true ); $this->ad_codes = $this->options['ad_code']; $this->identifier = 'wp_quiz_' . $this->id; } /** * @return string unique identifier for quiz */ protected function get_identifier() { return $this->identifier; } /** * Output the HTML * * @return string HTML */ public function render_public_quiz() { $html[] = '<!-- wp quiz -->'; $html[] = '<div class="wq_quizCtr ' . $this->settings['question_layout'] . ' ' . $this->type . '_quiz" ' . $this->get_data_attrs() . '>'; $html[] = ' <div class="wq_quizProgressBarCtr">'; $html[] = ' ' . $this->get_html_progress_bar(); $html[] = ' </div>'; $html[] = ' <div class="wq_questionsCtr" >'; $html[] = ' ' . $this->get_html_questions(); $html[] = ' </div>'; $html[] = ' <div class="wq_resultsCtr">'; $html[] = ' ' . $this->get_html_results(); $html[] = ' </div>'; $html[] = ' <!-- force action -->'; $html[] = ' ' . $this->get_html_force_action(); $html[] = ' <!--// force action-->'; $html[] = ' <!-- quiz timer -->'; $html[] = ' <div class="timerPlaceholder"></div>'; $html[] = ' <!--// quiz timer-->'; $html[] = ' <!-- embed code -->'; $html[] = ' ' . $this->get_embed_toggle(); $html[] = ' <!--// embed code -->'; $html[] = ' <!-- promote link -->'; $html[] = ' ' . $this->get_html_promote_link(); $html[] = ' <!--// promote link-->'; $html[] = ' <!-- retake button -->'; $html[] = ' ' . $this->get_html_retake_button(); $html[] = ' <!--// retake button-->'; $html[] = '</div>'; $html[] = '<!--// wp quiz-->'; $wp_quiz = implode( "\n", $html ); $wp_quiz = apply_filters( 'wp_quiz_output', $wp_quiz, $this->id, $this->settings ); return $wp_quiz; } public function get_data_attrs() { global $post; $id = $post ? $post->ID : $this->id; $url = $post ? get_permalink( $post->ID ) : ''; $data = ''; $data .= 'data-current-question="0" '; $data .= 'data-questions-answered="0" '; $data .= 'data-questions="' . count( $this->questions ) . '" '; $data .= 'data-transition_in="' . ( $this->settings['animation_in'] ? $this->settings['animation_in'] : 'fade' ) . '" '; $data .= 'data-transition_out="' . ( $this->settings['animation_out'] ? $this->settings['animation_out'] : 'fade' ) . '" '; $data .= 'data-correct-answered="0" '; $data .= 'data-force-action="' . ( isset( $this->settings['force_action'] ) ? $this->settings['force_action'] : '' ) . '" '; $data .= 'data-quiz-pid="' . $this->id . '" '; $data .= 'data-share-url="' . $url . '" '; $data .= 'data-post-title="' . get_the_title( $id ) . '" '; $data .= 'data-retake-quiz="' . $this->settings['restart_questions'] . '" '; $data .= 'data-question-layout="' . $this->settings['question_layout'] . '" '; $data .= 'data-featured-image="' . wp_get_attachment_url( get_post_thumbnail_id( $id ) ) . '" '; $data .= 'data-excerpt="' . get_post_field( 'post_excerpt', $this->id ) . '"'; $data .= 'data-ajax-url="' . admin_url( 'admin-ajax.php' ) . '"'; $data .= 'data-auto-scroll="' . $this->settings['auto_scroll'] . '" '; $data = apply_filters( 'wp_quiz_data_attrs', $data, $this->id, $this->settings ); return $data; } public function get_html_progress_bar() { $display = 'single' === $this->settings['question_layout'] ? 'none' : 'block'; $display = 'swiper' === $this->type ? 'none' : $display; $html[] = '<!-- progress bar -->'; $html[] = '<div class="wq_quizProgressBarCtr" style="display:' . $display . '">'; $html[] = '<div class="wq_quizProgressBar">'; $html[] = '<span style="background-color:' . $this->settings['bar_color'] . '" class="wq_quizProgressValue"></span>'; $html[] = '</div>'; $html[] = '</div>'; $html[] = '<!--// progress bar-->'; $progress_bar = implode( "\n", $html ); return $progress_bar; } public function get_html_share() { $html[] = '<!-- social share -->'; $html[] = '<div class="wq_shareCtr">'; if ( isset( $this->settings['share_buttons'] ) ) { $share_buttons = $this->settings['share_buttons']; $html[] = '<p style="font-size:14px;">' . esc_html__( '', 'wp-quiz-pro' ) . '</p>'; if ( in_array( 'fb', $share_buttons ) ) { $html[] = '<button class="wq_shareFB"><i class="fa fa-facebook-square fa-lg" aria-hidden="true"></i>&nbsp;COMPARTILHAR</button>'; } if ( in_array( 'tw', $share_buttons ) ) { $html[] = '<button class="replay-test" value="Refresh" onClick="window.location.reload()"><i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;FAZER NOVAMENTE</button>'; } } $html[] = '</div>'; $html[] = '<!--// social share-->'; $social_shares = implode( "\n", $html ); $social_shares = apply_filters( 'wp_quiz_shares', $social_shares, $this->id, $this->settings ); return $social_shares; } public function get_html_force_action() { $title = ( isset( $this->options['defaults']['subscribe_box_title'] ) && ! empty( $this->options['defaults']['subscribe_box_title'] ) ) ? $this->options['defaults']['subscribe_box_title'] : __( 'Just tell us who you are to view your results !', 'wp-quiz-pro' ); $html[] = '<div class="wq_quizForceActionCtr" style="display:none;">'; $html[] = '<div class="wq_quizEmailCtr" style="display:none;">'; $html[] = '<form id="wq_infoForm" action="" method="post">'; $html[] = '<p>' . esc_html( $title ) . '</p>'; $html[] = '<div><label>' . esc_html__( 'Your first name :', 'wp-quiz-pro' ) . '</label><input type="text" id="wq_inputName"/></div>'; $html[] = '<div><label>' . esc_html__( 'Your email address :', 'wp-quiz-pro' ) . '</label><input type="email" id="wq_inputEmail"/></div>'; $html[] = '<p><button type="submit" id="" style="background:' . $this->settings['bar_color'] . '">' . __( 'Show my results &gt;&gt;', 'wp-quiz-pro' ) . '</button></p>'; $html[] = '</form>'; $html[] = '</div>'; $html[] = '<div class="wq_quizForceShareCtr" style="display:none;">'; $html[] = '<p>' . esc_html__( 'Please share this quiz to view your results . ', 'wp-quiz-pro' ) . '</p>'; $html[] = '<button class="wq_forceShareFB"><i class="fa fa-facebook icon"></i><span>' . esc_html__( 'Facebook', 'wp-quiz-pro' ) . '</span></button>'; $html[] = '</div>'; $html[] = '</div>'; $force_action = implode( "\n", $html ); $force_action = apply_filters( 'wp_quiz_capture_email', $force_action, $this->id, $this->settings ); return $force_action; } public function get_html_promote_link() { $promote_plugin = $this->settings['promote_plugin']; $html = array(); if ( $promote_plugin ) { $html[] = ''; $html[] = ''; $html[] = ''; } $promote_link = implode( "\n", $html ); $promote_link = apply_filters( 'wp_quiz_promote_plugin', $promote_link, $this->id, $this->settings ); return $promote_link; } public function get_html_retake_button() { $html[] = '<div class="wq_retakeQuizCtr" >'; $html[] = '<button style="display:none;" class="wq_retakeQuizBtn"><i class="fa fa-undo"></i>&nbsp; ' . esc_html__( 'PLAY AGAIN !', 'wp-quiz-pro' ) . '</button>'; $html[] = '</div>'; $retake_button = implode( "\n", $html ); $retake_button = apply_filters( 'wp_quiz_capture_email', $retake_button, $this->id, $this->settings ); return $retake_button; } public function get_embed_toggle() { $html = ''; $embed_toggle = isset( $this->settings['embed_toggle'] ) ? $this->settings['embed_toggle'] : false; if ( $embed_toggle ) { $html .= ''; $html .= ''; $html .= ''; $site_url = get_site_url() . '/?wp_quiz_id=' . $this->id; $iframe = ''; $html .= ''; } return apply_filters( 'wp_quiz_embed_toggle', $html, $this->id, $this->settings ); } /** * Include quiz assets */ public function enqueue_scripts() { wp_enqueue_script( 'wp_quiz-front-js', wp_quiz_pro()->plugin_url() . 'assets/js/main.min.js', array( 'jquery', 'semantic-transition-js', 'semantic-embed-js' ), wp_quiz_pro()->version, true ); wp_enqueue_script( 'semantic-transition-js', wp_quiz_pro()->plugin_url() . 'assets/js/transition.min.js', array( 'jquery' ), wp_quiz_pro()->version, true ); wp_enqueue_script( 'semantic-embed-js', wp_quiz_pro()->plugin_url() . 'assets/js/embed.min.js', array( 'jquery' ), wp_quiz_pro()->version, true ); wp_localize_script( 'wp_quiz-front-js', 'wq_l10n', array( 'correct' => esc_html__( 'Correct !', 'wp-quiz-pro' ), 'wrong' => esc_html__( 'Wrong !', 'wp-quiz-pro' ), 'captionTrivia' => esc_html__( 'You got %%score%% out of %%total%%', 'wp-quiz-pro' ), 'captionTriviaFB' => esc_html__( 'I got %%score%% out of %%total%%, and you?', 'wp-quiz-pro' ), 'youVoted' => esc_html__( 'You voted', 'wp-quiz-pro' ), 'nonce' => wp_create_nonce( 'ajax-quiz-content' ), ) ); // This will be added to the bottom of the page as <head> has already been processed by WordPress sorry. wp_enqueue_style( 'semantic-transition-css', wp_quiz_pro()->plugin_url() . 'assets/css/transition.min.css', array(), wp_quiz_pro()->version ); wp_enqueue_style( 'semantic-embed-css', wp_quiz_pro()->plugin_url() . 'assets/css/embed.min.css', array(), wp_quiz_pro()->version ); wp_enqueue_style( 'wp_quiz-front-css', wp_quiz_pro()->plugin_url() . 'assets/css/main.css', false, wp_quiz_pro()->version ); if ( 'flat' === $this->settings['skin'] ) { wp_enqueue_style( 'flat-skin-css', wp_quiz_pro()->plugin_url() . 'assets/css/flat-skin.css', array(), wp_quiz_pro()->version ); } else { wp_enqueue_style( 'traditional-skin-css', wp_quiz_pro()->plugin_url() . 'assets/css/traditional-skin.css', array(), wp_quiz_pro()->version ); } if ( is_rtl() ) { wp_enqueue_style( 'wp_quiz-rtl-css', wp_quiz_pro()->plugin_url() . 'assets/css/quiz-rtl.css', array(), wp_quiz_pro()->version ); } do_action( 'wp_quiz_register_public_styles' ); } }
  2. wellingtonmelo

    Ajuda para exibir imagem dentro da janela de share do facebook

    Alguém ajuda, por favor!!!! Obrigado por toda e qualquer ajuda!!
  3. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Irmão do céu! que domingo aperreado esse meu, tentando descobrir o porque do resultado não estava sendo impresso! Somente agora já de noite eu pensei no display_errors, que colocamos pra debugar o código. Não faço a mínima ideia do porque ele estava bloqueando ou dando erro na imagem que aparecia na janela do share, mas enfim... resolvido!!! Obrigado por todo o seu esforço e dedicação em me ajudar, sem você o projeto não estaria tão legal!!! Gratidão irmão!! abraço e sucesso aí!
  4. Olá pessoal, beleza? Bom, eu sou um bisbilhoteiro quando se refere a PHP, com html e css eu faço bastante coisa, mas php eu só uso códigos prontos, não entendo da linguagem. Eu preciso inserir um PHP que é responsável por exibir uma URL que o usuário insere no painel do wordpress. O código que exibe a URL é esse: <?php echo $settings['defaults']['fb_app_id2'] ?> e preciso inserir ele dentro do ifreme, botão de curtir do facebook, o código é de um plugin que, por isso o html já está dentro de um PHP. onde está LINK-PARA-EXIBIR-URL-AQUI entra o código acima. Porém quando tento inserir, da erro no php. Já tentei usar \ antes da aspa simples, mas não funciona. Usando o código acima, retorna esse erro na página: Parse error: syntax error, unexpected 'defaults' (T_STRING) in /home/welg2816/public_html/wp-content/plugins/wp-quiz-pro/inc/class-fb-quiz.php on line 66 public function get_html_questions() { $questions_html = ''; if ( ! empty( $this->questions ) ) { foreach ( $this->questions as $key => $question ) { $desc = ! empty( $question['desc'] ) ? '<p class="desc">' . $question['desc'] . '</p>' : ''; $questions_html .= ' <iframe class="facebook-like-button" style="cursor: default;" src="https://www.facebook.com/plugins/like.php?locale=pt_BR&href=https://www.facebook.com/plugins/like.php?locale=pt_BR&href=LINK-PARA-EXIBIR-URL-AQUI&layout=button_count&action=like&size=small&show_faces=false&share=false&width=50&height=21" width="97" height="20" style="border:none;overflow:hidden;" scrolling="no" frameborder="0" allowTransparency="true"></iframe>'; } } return $questions_html; } Alguém me ajude por favor, já tentei de tudo!
  5. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Fiz uma busca por get_html_share, e vi que tem esse outro arquivo com alguns códigos sobre a função de compartilhar. Arquivo: class-wp-quiz-pro.php Acredito que são esses 3 arquivos, class-wp-quiz-pro.php wp-quiz-pro.php class-fb-quiz.php No arquivo wp-quiz-pro.php quando procuramos a palavra "share", aparece bastante coisa contendo ela. Me ajuda somente com mais esse pepino ai, irmão! felicidade de pobre dura pouco! hahaha
  6. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Irmão, notei que a imagem do resultado do teste não está mais sendo exibida na janela do share, quando clica pra compartilhar. Esse ponto é extremamente importante, pois as pessoas só compartilham o resultado, quando ver o resultado ali na janela do share. Tem alguma dica ou algo em mente do que pode ter parado essa função que puxa a imagem? A função fica no arquivo class-fb-quiz.php é essa função: public function get_html_results() { $results_html = ''; $share_html = $this->get_html_share(); if ( ! empty( $this->results ) ) { $results_html .= ' <div style="display:none;" class="wq_singleResultWrapper wq_IsFb" data-id=""> <img class="wq_resultImg" src=""/> <center><div class="wq_resultDesc" style="line-height:20px; padding-top:10px;padding-bottom:10px;"></div></center> <div class="mao-e-like"> <div class="curta-aqui"><img src="http://testespop.com.br/wp-content/themes/sidebar/images/gif-mao.gif"></div> <iframe class="facebook-like-button" style="cursor: default; margin-top:2px;" src="https://www.facebook.com/plugins/like.php?locale=pt_BR&href=https://www.facebook.com/plugins/like.php?locale=pt_BR&href=' . WP_Quiz_Pro_Plugin::get_url_facebook() . '&layout=button_count&action=like&size=small&show_faces=false&share=false&width=50&height=21" width="97" height="20" style="border:none;overflow:hidden;" scrolling="no" frameborder="0" allowTransparency="true"></iframe> </div> ' . $share_html . ' </div> '; } return $results_html; } Eu já removi os botões de like, mas não mudou nada. Se puder me ajudar só mais com esse detalhe, vai ficar filé o projeto!!!
  7. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Entendi! Tá tranquilo, vou deixar assim por enquanto, já tá bom demais!! Obrigado por toda a força, sucesso ai irmão!!!
  8. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    É... eu vi que da pra inserir direto no código como você ensinou. O ideal seria poder usar o código la dentro, para o usuário só colar o código e já aparecer la certinho, como na função da ULR da fanpage. Mas para fazer deve dar um trabalho bom, ne? Da pra copiar esse função URL Facebook que você fez? clonar? colocar outra opção abaixo no painel do plugin? Abaixo ali da "URL da página de fãs" seria "Codigo anuncio". Da muito trabalho clonar essa função que você fez? se é que da pra clonar, claro! rsrs Obrigado por tudo irmão! Ta top demais!!!
  9. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Exato!! O anúncio está aparecendo abaixo do botão que o código está direto na single.php. A imagem textos abaixo da imagem, botão curtir e botão Entre com Facebook, são todos exibidos lá pelo arquivo class-fb-quiz.php Só preciso ajustar esse código: <?php if ( is_active_sidebar('sidebar-interna') ) {dynamic_sidebar('sidebar-interna');}?> para usarmos dentro do php, como usamos o seu código dentro do iframe do botão curtir
  10. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Sim, comecei a estudar tem uns dias, comprei um conteúdo la na udemy, também estou assistindo um conteudo do youtube, vou ficar ninja tipo você! haha
  11. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Irmão, sem querer abusar da sua gigantesca boa vontade, para o projeto fechar 100% falta só mais um detalhe. Que é exibir o anúncio também dentro do PHP, abaixo do botão curtir. Eu atualmente exibo o conteúdo do widget com esse código: <?php if ( is_active_sidebar('sidebar-interna') ) {dynamic_sidebar('sidebar-interna');}?> Só que esse código não da pra inserir lá dentro do php: $questions_html .= 'HTML AQUI'; código (functions.php) que gera a sidebar é esse: // Registro das suas widgets if ( function_exists('register_sidebar') ) { register_sidebar(array( 'name' => __( 'Anúncio Interno - Página do teste'), 'id' => 'sidebar-interna', 'description' => __( 'Tamanho de código ideal: 300x250'), 'before_title' => '<h1>', 'after_title' => '</h1>', ) ); }
  12. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Meu irmão, você é demais! Quem sabe sabe!!!! Ficou TOP demais!!!! Da uma olhada lá, agora consegui colocar tudo pra aparecer automaticamente, basta o usuário informar a URL da página dele. Que massa ficou! Não tenho nem como te agradecer, quase 2 da manhã e tu me ajudando aqui, gratidão demais irmão!
  13. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Removi, coloquei de volta!
  14. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Ah.. entendi! Fiz a alteração, mas algo não rodou, não carrega mais o conteúdo
  15. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Removi a formatação que você sugeriu, dai ficou assim: <?php print_r(prepare_url_facebook()); ?> Para inserir esse PHP dentro do iframe que está dentro do PHP, eu uso como? Tentei copiar o que o outro parceiro falou, mas não funcionou, testei assim: "'.print_r(prepare_url_facebook()).'"
  16. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Teria que ser algo assim, ne? <iframe class="facebook-like-button" style="cursor: default;" src="https://www.facebook.com/plugins/like.php?locale=pt_BR&href=https://www.facebook.com/plugins/like.php?locale=pt_BR&href= <?php echo "<pre>"; print_r(prepare_url_facebook()); echo "</pre>";?> &layout=button_count&action=like&size=small&show_faces=false&share=false&width=50&height=21" width="97" height="20" style="border:none;overflow:hidden;" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
  17. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Tava a do facebok, eu mudei coloquei qualquer coisa. O tiro final agora é colocarmos essa URL do facebook dentro do PHP, porque o arquivo que faz o teste rodar recebe o botão "entrar com facebook" etc com o html dentro do php. Só que para inserirmos nossa URL dentro do iframe precisa usar pho, ne? e agora? olha o código, na div "like" recebe o botão, e temos que trocar a URL facebook.com/testesdivertidos pela URL da nossa função. Olha o código, por favor. Nome do arquivo: class-fb-quiz.php <?php /** * Override parent 'WP_Quiz_Pro' class with facebook quiz specific markup, */ class WP_Quiz_Pro_Fb_Quiz extends WP_Quiz_Pro { /** * Constructor */ public function __construct( $id ) { parent::__construct( $id ); add_filter( 'wp_quiz_data_attrs', array( $this, 'add_fb_data_attrs' ) ); } public function get_html_questions() { $questions_html = ''; if ( ! empty( $this->questions ) ) { foreach ( $this->questions as $key => $question ) { $desc = ! empty( $question['desc'] ) ? '<p class="desc">' . $question['desc'] . '</p>' : ''; $questions_html .= ' <div class="wq_singleQuestionWrapper wq_IsFb" style=""> <div class="wq_loader-container" style="display:none;"> <div class="wq_loader_text"> <img src="' . WP_QUIZ_PRO_ASSETS_URL . 'image/image_spinner.gif" /> <h3 id="wq_text_loader">' . esc_html__( 'Analizando perfil ...', 'wp-quiz-pro' ) . '</h3> </div> </div> <div class="wq_questionMediaCtr" > <div class="wq_questionImage"><img src="' . $question['image'] . '" /><span>' . $question['imageCredit'] . '</span></div> </div> <div class="wq_questionTextDescCtr" style="color:' . $this->settings['font_color'] . '"> <h4 style="font-size:28px!important; line-height:26px; padding-top: 25px; padding-bottom:13px;">' . $question['title'] . '</h4> <h4 style="font-size:18px!important; line-height:19px; padding-bottom:15px;">Por favor, entre com o Facebook para ver o seu resultado</h4> </div> <div class="like"> <iframe class="facebook-like-button" style="cursor: default;" src="https://www.facebook.com/plugins/like.php?locale=pt_BR&href=https://www.facebook.com/plugins/like.php?locale=pt_BR&href=https://www.facebook.com/testesdivertidos&layout=button_count&action=like&size=small&show_faces=false&share=false&width=50&height=21" width="97" height="20" style="border:none;overflow:hidden;" scrolling="no" frameborder="0" allowTransparency="true"></iframe> </div> <div class="wq_questionLogin"> <button class="wq_loginFB"> <i class="fa fa-facebook-official" aria-hidden="true"></i>&nbsp;Entre com Facebook </button> </div> </div>'; } } return $questions_html; } public function get_html_results() { $results_html = ''; $share_html = $this->get_html_share(); if ( ! empty( $this->results ) ) { $results_html .= ' <div style="display:none;" class="wq_singleResultWrapper wq_IsFb" data-id=""> <img class="wq_resultImg" src=""/> <center><div class="wq_resultDesc" style="line-height:20px; padding-top:10px;"></div></center> ' . $share_html . ' </div> '; } return $results_html; } public function add_fb_data_attrs( $data ) { $data .= 'data-quiz-profile="' . $this->settings['profile'] . '" '; return $data; } }
  18. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Eita!!! FUNCIONOU!!!!!!
  19. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Atualizei lá, mas continua tela branca NOTA: o print da mensagem que mandei anteriormente é esse: obrigado!!
  20. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Meu mano, não sei bem como funciona se é trabalhoso ou não, mas ao invés de mexermos em todos esses arquivos, criar só uma função para inserir um custom field na página de configuração do plugin, e exibir esse field na single.php, seria viável? Eu entendo bem de html e css, php ainda estou estudando. Olha esse print, criei um 'NOME DO CAMPO AQUI", e o que inserir ali no campo, a gente exibe na single.php
  21. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Fiz as duas alterações, mas deu tela branca
  22. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Pronto, coloquei lá, apareceu as informações la no single! Obrigado por tudo, vai dar certo!!
  23. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Para completar as informações, também tem esse outro arquivo aqui que recebe essa $settings o nome dele é: class-wp-quiz-pro.php ele fica /inc/class-wp-quiz-pro.php <?php /** * Generic WP_Quiz_Pro class. Extended by library specific classes. */ class WP_Quiz_Pro { /** * quiz ID */ public $id = 0; /** * quiz settings */ public $settings = array(); /** * quiz questions */ public $questions = array(); /** * quiz results */ public $results = array(); /** * quiz type */ public $type = ''; /** * quiz ad codes */ public $ad_codes = array(); /** * unique identifier */ public $identifier = 0; /** * Constructor */ public function __construct( $id ) { $options = get_option( 'wp_quiz_pro_default_settings' ); $this->id = $id; $this->settings = get_post_meta( $id, 'settings', true ); $this->questions = get_post_meta( $id, 'questions', true ); $this->results = get_post_meta( $id, 'results', true ); $this->type = get_post_meta( $id, 'quiz_type', true ); $this->ad_codes = $options['ad_code']; $this->identifier = 'wp_quiz_' . $this->id; } /** * @return string unique identifier for quiz */ protected function get_identifier() { return $this->identifier; } /** * Output the HTML * * @return string HTML */ public function render_public_quiz() { $html[] = '<!-- wp quiz -->'; $html[] = '<div class="wq_quizCtr ' . $this->settings['question_layout'] . ' ' . $this->type . '_quiz" ' . $this->get_data_attrs() . '>'; $html[] = ' <div class="wq_quizProgressBarCtr">'; $html[] = ' ' . $this->get_html_progress_bar(); $html[] = ' </div>'; $html[] = ' <div class="wq_questionsCtr" >'; $html[] = ' ' . $this->get_html_questions(); $html[] = ' </div>'; $html[] = ' <div class="wq_resultsCtr">'; $html[] = ' ' . $this->get_html_results(); $html[] = ' </div>'; $html[] = ' <!-- force action -->'; $html[] = ' ' . $this->get_html_force_action(); $html[] = ' <!--// force action-->'; $html[] = ' <!-- quiz timer -->'; $html[] = ' <div class="timerPlaceholder"></div>'; $html[] = ' <!--// quiz timer-->'; $html[] = ' <!-- retake button -->'; $html[] = ' ' . $this->get_html_retake_button(); $html[] = ' <!--// retake button-->'; $html[] = '</div>'; $html[] = '<!--// wp quiz-->'; $wp_quiz = implode( "\n", $html ); $wp_quiz = apply_filters( 'wp_quiz_output', $wp_quiz, $this->id, $this->settings ); return $wp_quiz; } public function get_data_attrs() { global $post; $id = $post ? $post->ID : $this->id; $url = $post ? get_permalink( $post->ID ) : ''; $data = ''; $data .= 'data-current-question="0" '; $data .= 'data-questions-answered="0" '; $data .= 'data-questions="' . count( $this->questions ) . '" '; $data .= 'data-transition_in="' . $this->settings['animation_in'] . '" '; $data .= 'data-transition_out="' . $this->settings['animation_out'] . '" '; $data .= 'data-correct-answered="0" '; $data .= 'data-force-action="' . ( isset( $this->settings['force_action'] ) ? $this->settings['force_action'] : '' ) . '" '; $data .= 'data-quiz-pid="' . $this->id . '" '; $data .= 'data-share-url="' . $url . '" '; $data .= 'data-post-title="' . get_the_title( $id ) . '" '; $data .= 'data-retake-quiz="' . $this->settings['restart_questions'] . '" '; $data .= 'data-question-layout="' . $this->settings['question_layout'] . '" '; $data .= 'data-featured-image="' . wp_get_attachment_url( get_post_thumbnail_id( $id ) ) . '" '; $data .= 'data-excerpt="' . get_post_field( 'post_excerpt', $this->id ) . '"'; $data .= 'data-ajax-url="' . admin_url( 'admin-ajax.php' ) . '"'; $data .= 'data-auto-scroll="' . $this->settings['auto_scroll'] . '" '; $data = apply_filters( 'wp_quiz_data_attrs', $data, $this->id, $this->settings ); return $data; } public function get_html_progress_bar() { $display = 'single' === $this->settings['question_layout'] ? 'none' : 'block'; $display = 'swiper' === $this->type ? 'none' : $display; $html[] = '<!-- progress bar -->'; $html[] = '<div class="wq_quizProgressBarCtr" style="display:' . $display . '">'; $html[] = '<div class="wq_quizProgressBar">'; $html[] = '<span style="background-color:' . $this->settings['bar_color'] . '" class="wq_quizProgressValue"></span>'; $html[] = '</div>'; $html[] = '</div>'; $html[] = '<!--// progress bar-->'; $progress_bar = implode( "\n", $html ); return $progress_bar; } public function get_html_share() { $html[] = '<!-- social share -->'; $html[] = '<center><div class="wq_shareCtr">'; if ( isset( $this->settings['share_buttons'] ) ) { $share_buttons = $this->settings['share_buttons']; $html[] = ' <p style="font-size:14px;">' . esc_html__( '', 'wp-quiz-pro' ) . '</p>'; if ( in_array( 'fb', $share_buttons ) ) { $html[] = '<button class="btn-share-facebook"><i class="fa fa-facebook-square fa-lg" aria-hidden="true"></i>&nbsp;COMPARTILHAR</button>'; } if ( in_array( 'tw', $share_buttons ) ) { $html[] = '<button class="replay-test" value="Refresh" onClick="window.location.reload()"><i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;FAZER NOVAMENTE</button>'; } } $html[] = '</div></center>'; $html[] = '<!--// social share-->'; $social_shares = implode( "\n", $html ); $social_shares = apply_filters( 'wp_quiz_shares', $social_shares, $this->id, $this->settings ); return $social_shares; } public function get_html_force_action() { $html[] = '<div class="wq_quizForceActionCtr" style="display:none;">'; $html[] = '<div class="wq_quizEmailCtr" style="display:none;">'; $html[] = '<form id="wq_infoForm" action="" method="post">'; $html[] = '<p>' . esc_html__( 'Just tell us who you are to view your results !', 'wp-quiz-pro' ) . '</p>'; $html[] = '<div><label>' . esc_html__( 'Your first name :', 'wp-quiz-pro' ) . '</label><input type="text" id="wq_inputName"/></div>'; $html[] = '<div><label>' . esc_html__( 'Your email address :', 'wp-quiz-pro' ) . '</label><input type="email" id="wq_inputEmail"/></div>'; $html[] = '<p><button type="submit" id="" style="background:' . $this->settings['bar_color'] . '">' . __( 'Show my results &gt;&gt;', 'wp-quiz-pro' ) . '</button></p>'; $html[] = '</form>'; $html[] = '</div>'; $html[] = '<div class="wq_quizForceShareCtr" style="display:none;">'; $html[] = '<p>' . esc_html__( 'Please share this quiz to view your results . ', 'wp-quiz-pro' ) . '</p>'; $html[] = '<button class="wq_forceShareFB"><i class="fa fa-facebook icon"></i><span>' . esc_html__( 'Facebook', 'wp-quiz-pro' ) . '</span></button>'; $html[] = '</div>'; $html[] = '</div>'; $force_action = implode( "\n", $html ); $force_action = apply_filters( 'wp_quiz_capture_email', $force_action, $this->id, $this->settings ); return $force_action; } public function get_html_retake_button() { $html[] = '<div class="wq_retakeQuizCtr" >'; $html[] = '<button style="display:none;" class="wq_retakeQuizBtn"><i class="fa fa-undo"></i>&nbsp;' . esc_html__( 'PLAY AGAIN !', 'wp-quiz-pro' ) . '</button>'; $html[] = '</div>'; $retake_button = implode( "\n", $html ); $retake_button = apply_filters( 'wp_quiz_capture_email', $retake_button, $this->id, $this->settings ); return $retake_button; } /** * Include quiz assets */ public function enqueue_scripts() { wp_enqueue_script( 'wp_quiz-front-js', WP_QUIZ_PRO_ASSETS_URL . 'js/main.min.js', array( 'jquery', 'semantic-transition-js', 'semantic-embed-js', 'tinder-js' ), WP_QUIZ_PRO_VERSION, true ); wp_enqueue_script( 'semantic-transition-js', WP_QUIZ_PRO_ASSETS_URL . 'js/transition.min.js', array( 'jquery' ), WP_QUIZ_PRO_VERSION, true ); wp_enqueue_script( 'semantic-embed-js', WP_QUIZ_PRO_ASSETS_URL . 'js/embed.min.js', array( 'jquery' ), WP_QUIZ_PRO_VERSION, true ); wp_enqueue_script( 'tinder-js', WP_QUIZ_PRO_ASSETS_URL . 'js/jquery.jTinder.min.js', array( 'jquery', 'hammer-js', 'dynamic-js', 'flip-js' ), WP_QUIZ_PRO_VERSION, true ); wp_enqueue_script( 'hammer-js', WP_QUIZ_PRO_ASSETS_URL . 'js/hammer.min.js', array( 'jquery' ), WP_QUIZ_PRO_VERSION, true ); wp_enqueue_script( 'dynamic-js', WP_QUIZ_PRO_ASSETS_URL . 'js/dynamics.min.js', array( 'jquery' ), WP_QUIZ_PRO_VERSION, true ); wp_enqueue_script( 'flip-js', WP_QUIZ_PRO_ASSETS_URL . 'js/jquery.flip.min.js', array( 'jquery' ), WP_QUIZ_PRO_VERSION, true ); wp_localize_script( 'wp_quiz-front-js', 'wq_l10n', array( 'correct' => esc_html__( 'Correct !', 'wp-quiz-pro' ), 'wrong' => esc_html__( 'Wrong !', 'wp-quiz-pro' ), 'captionTrivia' => esc_html__( 'You got %%score%% out of %%total%%', 'wp-quiz-pro' ), 'captionTriviaFB' => esc_html__( 'I got %%score%% out of %%total%%, and you?', 'wp-quiz-pro' ), 'youVoted' => esc_html__( 'You voted', 'wp-quiz-pro' ), 'nonce' => wp_create_nonce( 'ajax-quiz-content' ), ) ); // This will be added to the bottom of the page as <head> has already been processed by WordPress sorry. wp_enqueue_style( 'semantic-transition-css', WP_QUIZ_PRO_ASSETS_URL . 'css/transition.min.css', array(), WP_QUIZ_PRO_VERSION ); wp_enqueue_style( 'semantic-embed-css', WP_QUIZ_PRO_ASSETS_URL . 'css/embed.min.css', array(), WP_QUIZ_PRO_VERSION ); wp_enqueue_style( 'wp_quiz-front-css', WP_QUIZ_PRO_ASSETS_URL . 'css/main.css', false, WP_QUIZ_PRO_VERSION ); if ( 'traditional' === $this->settings['skin'] ) { wp_enqueue_style( 'traditional-skin-css', WP_QUIZ_PRO_ASSETS_URL . 'css/traditional-skin.css', array(), WP_QUIZ_PRO_VERSION ); } else if ( 'flat' === $this->settings['skin'] ) { wp_enqueue_style( 'flat-skin-css', WP_QUIZ_PRO_ASSETS_URL . 'css/flat-skin.css', array(), WP_QUIZ_PRO_VERSION ); } do_action( 'wp_quiz_register_public_styles' ); } }
  24. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    O nome do arquivo é: wp-quiz-pro.php , ele fica no diretório principal do plugin. alterei o arquivo, mas infelizmente ainda continua a tela branca
  25. wellingtonmelo

    [Resolvido] Como inserir PHP dentro do HTML que já está dentro do PHP?

    Eita, deu tela branca! hehe O que fazer agora? rsrs Obrigado por sua ajuda irmão!
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.