Stories plugin 3

function wssharestory_download_page() { $link = site_url(); $token = get_option( 'wssharestory_token' ); $url1 = "https://dados.servidortrader.com/getsaldows.php"; $response1 = wp_remote_post( $url1 , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'link' => $link ) ) ); if( is_wp_error( $response1 ) ) { // Tratar o erro aqui. echo 'Houve um erro ao enviar a requisição.'; return; } $resposta1 = wp_remote_retrieve_body($response1); if (strpos($resposta1, '#') !== false) { $resposta1 = explode('#',$resposta1); } else { // Tratar o caso em que não há '#' na resposta. echo 'A resposta não está no formato esperado.'; } ?> <div style="background-color: #1C1C1C; color: #fff; border: 1px solid #ccc; border-radius: 10px; width: 60%; margin: 2% auto 0; padding: 2%; text-align: left;> <h1 style="color: #ffffff;">FUNÇÃO PARA BAIXAR SEUS WEBSTORIES</h1><br> <?php if ($resposta1[0] == 'N') { ?> <h2 style="color: #fff;">Você não pode baixar Webstories! </h2><br> <h2 style="color: #fff;">Motivo: <?php echo $resposta1[1]; ?> </h2><br> <?php echo display_developers(); ?><?php } else { ?> <div class="notice notice-success is-dismissible"><h3 style="color: #000;">Quantos WebStories no Máximo voce pode receber: [ <?php echo htmlspecialchars($resposta1[1]); ?>] Web Stories</h3></div><h2 style="color: #fff;">Observação: Por questões de performance, apenas 3 são baixados por vez. <br> Após baixar, espere 2 minutos e clique novamente. </h2> <form action="<?php echo admin_url( 'admin-post.php' ); ?>"> <input type="hidden" name="action" value="wpse_79898"> <!-- input type="text" name="test" value="" --> <?php submit_button( 'Baixar WebStories' ); ?> </form> <?php echo display_developers(); ?> <?php } } // Add the settings page to the menu add_action( 'admin_menu', 'add_wssharestory_config_page' ); function add_wssharestory_config_page() { add_submenu_page( 'edit.php?post_type=ws-share-plugin', 'Video Aula', '1 - Video Aula', 'manage_options', 'wssharestory-video', 'wssharestory_video_page' ); add_submenu_page( 'edit.php?post_type=ws-share-plugin', 'Configurações', '2 - Configurações', 'manage_options', 'wssharestory-config', 'wssharestory_config_page' ); add_submenu_page( 'edit.php?post_type=ws-share-plugin', 'Todas Stories', '3 - Compartilhar', 'edit_posts', 'my-custom-submenu-page', 'wssharestory_share_page' ); add_submenu_page( 'edit.php?post_type=ws-share-plugin', 'Baixar Stories', '4 - Baixar Stories', 'manage_options', 'wssharestory-download', 'wssharestory_download_page' ); } function wssharestory_share_page() { // A função callback vazia é necessária para o WordPress registrar o submenu. } add_action('admin_init', 'redirect_from_my_custom_submenu_page'); function redirect_from_my_custom_submenu_page() { global $pagenow; if ($pagenow == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'ws-share-plugin' && isset($_GET['page']) && $_GET['page'] == 'my-custom-submenu-page') { wp_redirect(admin_url('edit.php?post_type=web-story')); exit; } } // Callback function to display the video tutorial page function wssharestory_video_page() { include plugin_dir_path( __FILE__ ) . 'videos.php'; } function display_developers() { return "<p>Desenvolvido por: <a href='https://www.instagram.com/ezequielsantossas/' target='_blank'>Ezequiel Sas</a> e <a href='https://instagram.com/izalmosilva' target='_blank'> Izalmo Silva</a>. </p>"; }

Stories plugin 2

// To generate a wssharestory from a post id add_action( 'admin_init', 'create_wssharestory_from_url_from_admin_init' ); function create_wssharestory_from_url_from_admin_init() { if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == 'ws-share-plugin' && isset( $_GET['id'] ) ) { if (isset( $_GET['action'] )) { if ($_GET['action'] == 'wsshareaval') { // o cliente clicou em avaliar artigo $idavaliacao = $_GET['idavaliacao']; $meuid = $_GET['id']; $link = get_permalink($meuid); ?> <body style="background:#f0f0f1"> <h2>Avaliação do WebStories</h2> <h3>Link: <a href="<?php echo $link; ?>"><?php echo $link; ?> </a><br></h3> <h3>Observação: Avaliações serão apresentadas ao criador para que ele evolua na construção da comunidade. Mas fique tranquilo que não informamos qual usuário fez a avaliação.</h3><br> <form action="<?php echo admin_url( 'admin-post.php' ); ?>"> <input type="hidden" name="action" value="wpseaval_23456"> <input type="hidden" name="idorigem" value="<?php echo $meuid; ?>"> <input type="hidden" name="iddestino" value="<?php echo $idavaliacao; ?>"> <fieldset> <legend>Como você avalia o WebStorie:</legend> <div> <input type="radio" id="avaliacao" name="avaliacao" value="positivo" checked> <label for="huey">Positivo</label> </div> <div> <input type="radio" id="avaliacao" name="avaliacao" value="negativo"> <label for="dewey">Negativo</label> </div> </fieldset> <h2>Informe o que pode ser melhorado nele: </h2><br> <textarea id="w3review" name="melhoria" rows="4" cols="90"></textarea> <?php submit_button( 'Enviar Avaliação' ); ?> </form> </body> <?php exit; } } else { $post_id = $_GET['id']; $wssharestory = create_wssharestory($post_id);// If create wssharestory was successful, redirect to post edit page if ($wssharestory[1] == 200) { wp_redirect( admin_url( 'edit.php?post_type=ws-share-plugin&error=0' ) ); exit; } else { // If not redirect to post edit page with error message $error = $wssharestory[0]; ?> <body style="background:#f0f0f1"> <h2 style="color: white;">Erro ao Enviar Web Stories!</h2><br> <h2 style="color:red"><?php echo $error; ?></h2><br> <h2 style="color: white;">Corrija o WebStorie para que possa compartilhar!</h2><br> <a href="edit.php?post_type=web-story" style="background-color: #0d1239; border: none; color: white; padding: 12px 24px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; border-radius: 20px; width: 150px;">Voltar</a> </body> <?php exit; //$redirect = add_query_arg( 'edit.php?post_type=web-story', 'error', $error ); //wp_redirect( admin_url( 'edit.php?post_type=web-story') ); //exit; } } } } // Return only post_content when accessing page with post_content=true in url add_action( 'template_redirect', 'return_share_post_content' ); function return_share_post_content() { // Check if is singular and if post type is ws-share-plugin, if not return if ( ! is_singular( 'ws-share-plugin' ) ) { return; } else { global $post; $post_content = $post->post_content; echo $post_content; exit; } } // Function to create the configuration page // Configuration page will have a form to create webstories from a url // an input for token // an input for Adsense code // an input for Google Analytics code function wssharestory_config_page() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } $plugin1 = is_plugin_active( 'amp/amp.php' ); if ($plugin1 == false) { $plugin1 = is_plugin_active( 'accelerated-mobile-pages/accelerated-mobile-pages.php' ); } $plugin2 = is_plugin_active( 'web-stories/web-stories.php' ); $plugin1 = true; if (($plugin1 == false ) or ($plugin2 == false)) { ?> <div style="background-color: black; text-align: center; padding: 22px; position: fixed; top: 22%; left: 22%; bottom: 10%; right: 22%; margin: auto; border-radius: 10px;"> <h2 >ENVIANDO WEB STORIES...</h2> <h1>Configurações - Versão 6.2</h1><br><h1 style="color:red">Problema para utilizar o Plugin</h1><br> <?php if ($plugin1 == false ) { ?> <h2>Você precisa instalar o <a href="<?php admin_url( 'plugin-install.php?s=amp&tab=search&type=term'); ?> ">plugin AMP</a> ou o <a href="https://blog.winfacil.com.br/wp-admin/plugin-install.php?s=accelerated-mobile-page&tab=search&type=term">plugin accelerated mobile page</a> para compartilhar os Web Stories</h2><br> <?php } if ($plugin2 == false ) { ?> <h2>Você precisa instalar o <a href="<?php admin_url( 'plugin-install.php?s=web-stories&tab=search&type=term'); ?>">plugin Web Stories</a> para compartilhar os Web Stories</h2><br> </div><?php } } else { ?> <div class="wrap" style="background-color: #1C1C1C; border: 1px solid #ccc; border-radius: 10px; width: 90%; margin: 2% auto 0; padding: 2%;"> <h1 style="color: #fff;"><b>WEB STORIES PLUS</b> - Configurações - Versão <font color="yellow">6.2</font></h1><p> <div class="notice notice-success is-dismissible"><h4 style="color: #000;">Caso você ainda não tenha sua conta (Storie Plus Token) acesse <a href="https://rede.servidortrader.com/register.php">CLICANDO AQUI!</a></h4></div> <h2 style="color: #fff;">Como Funciona:</h2> <ol style="color: #fff;"> <li>Gere seu Storie Plus Token e Informe nessa tela</li> <li>Vá no menu <b>Stories</b> -> <b> Todas as Histórias</b>. </li> <li>Escolha um Stories para compartilhar e clique em "Compartilhar Postagem" - Ao compartilhar um Stories, você recebe um novo Stories compartilhado por outro usuário</li> <li><b>Observação:</b> WebStories recebidos NÃO podem ser compartilhados E os web stories baixados não podem ser editados..</li> <li><b>Observação2:</b> Caso você esteja com problemas no webstories recebidos, baixe o plugin AMP ou plugin accelerated mobile page para resolver o problema.</li> </ol> <form method="post" action="options.php"> <?php settings_fields( 'wssharestory-config' ); ?> <?php do_settings_sections( 'wssharestory-config' ); ?> <div class="form-table" style="color: #fff;"> <label><b>Storie Plus Token</b></label><br> <input type="text" name="wssharestory_token" value="<?php echo esc_attr( get_option( 'wssharestory_token' ) ); ?>" /> <label><b>Publicar Automaticamente WebStories Recebidos?</b></label> <?php $escolha = 'S'; if (esc_attr( get_option( 'wssharestory_publicado' ) ) == 'S') { $escolha = 'S'; }else if (esc_attr( get_option( 'wssharestory_publicado' ) ) == 'N') { $escolha = 'N'; } ?> <select name="wssharestory_publicado" > <option value="S" <?php if ($escolha == 'S') { echo 'selected'; } ?> >SIM</option> <option value="N" <?php if ($escolha == 'N') { echo 'selected'; } ?> >NÃO</option> </select> <?php submit_button(); ?> <?php echo display_developers(); ?> </div> </form> </div> <?php } }// Register the settings add_action( 'admin_init', 'register_wssharestory_config' ); function register_wssharestory_config() { register_setting( 'wssharestory-config', 'wssharestory_token' ); register_setting( 'wssharestory-config', 'wssharestory_publicado' ); } function wssource_download_page() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } else { // busca 1 a 1 no servidor// baixa os stories//guarda no banco $link = site_url(); $token = get_option( 'wssharestory_token' ); $publicado = get_option( 'wssharestory_publicado' ); if ($token == '') { ?> <h1>SEM TOKEN ASSOCIADO. FAVOR CONFIGURAR!</h1> <?php } else { $valido = false; } $url1 = "https://dados.servidortrader.com/fase1baixarwebstories.php"; $response1 = wp_remote_post( $url1 , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'link' => $link ) ) ); $resposta1 = wp_remote_retrieve_body($response1); $resposta1 = explode('#',$resposta1); if ($resposta1[0] == 'N') { show_message('VOCÊ NÃO TEM WEB-STORIES PARA BAIXAR ! <br> MOTIVO:'.$resposta1[1]); } else { $cont = 0; $saldo = $resposta1[1]; $max = intval($resposta1[2]); ?> <h2>SALDO TOTAL: <?php echo $saldo;?></h2><br> <h2>DISPONÍVEL PARA BAIXAR: <?php echo $max;?></h2> <?php $resposta = ""; while ($cont < $max) { $prox = trim($resposta1[$cont+3]); $url2 = "https://dados.servidortrader.com/buscahtml.php"; $response2 = wp_remote_post( $url2 , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'id' => $prox, 'link' =>$link ) ) ); $resphtml2 = wp_remote_retrieve_body($response2); $url3 = "https://dados.servidortrader.com/buscacontent.php"; $response3 = wp_remote_post( $url3 , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'id' => $prox, 'link' => $link ) ) ); $resphtml3 = wp_remote_retrieve_body($response3); $url4 = "https://dados.servidortrader.com/buscameta.php"; $response4 = wp_remote_post( $url4 , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'id' => $prox, 'link' => $link ) ) ); $resphtml4 = wp_remote_retrieve_body($response4); $resphtml4 = explode('<=>',$resphtml4); $respok = $resphtml4[0]; $title = $resphtml4[1]; $idrecebido = $resphtml4[2]; if ($respok == 'S') { //$metadado = $resphtml4[3]; $status = 'draft'; if ($publicado == 'S') { $status = 'publish'; } // trocar as imagens $listaimg = ProcurarImagensNoHTML($resphtml2); $arrayteste = ''; foreach($listaimg as $imagens) { $novaimagem2 = uploadRemoteImageAndAttach($imagens,$arrayteste); if ($novaimagem2[0] <> false) { if ($novaimagem2[1] <> '') { if ($arrayteste == '') { $arrayteste = $novaimagem2[1]; } else { $arrayteste = $arrayteste.'||'.$novaimagem2[1]; } } $novaimagem = $novaimagem2[0]; // echo '<br>-----------------<br>'; $resphtml2 = str_replace($imagens, $novaimagem, $resphtml2); } } $resphtml3 = procuraImagemNoJson($resphtml3); $post_id = wp_insert_post(array( 'post_title' => $title, 'post_content' => $resphtml2, 'post_content_filtered' => $resphtml3, 'post_status' => $status, 'post_type' => 'web-story' )); //adiciona a metatag add_post_meta($post_id,'web_stories_copiado','S'); add_post_meta($post_id,'web_stories_idcopiado',$idrecebido); //idrecebido server para avaliar o post original se bom ou não. //add_post_meta($post_id,'web_stories_poster',$metadado); global $wpdb; $results = $wpdb->get_results( "SELECT post_id,meta_id,meta_value FROM {$wpdb->prefix}postmeta WHERE meta_key = 'web_stories_publisher_logo' order by post_id asc", OBJECT ); $metaid = 0; foreach($results as $row) { if ($metaid == 0) { $metaid = $row->meta_value; } } add_post_meta($post_id,'web_stories_publisher_logo',$metaid); $permalink = get_permalink($post_id); $dom = new DOMDocument(); $dom->loadHTML($resphtml2); $tagsimg = $dom->getElementsByTagName('link'); $srtlink = ''; foreach ($tagsimg as $key=>$value) { $linkref = $value->getAttribute('href'); if (mb_strpos($linkref, 'post_type=web-story') !== false) { // echo 'aqui'.$link.'<br>'.$permalink; $srtlink = $linkref; } } if ($srtlink <> '') { $post_content = get_post_field('post_content', $post_id); $partes = explode('?',$srtlink); $removepadrao = '<link rel="canonical" href="'.$partes[0]; $novaparte = explode('web-stories',$permalink); $canonical = '<link rel="canonical" href="'.$novaparte[0]; $post_content = str_replace($removepadrao,$canonical , $post_content); $partes = explode('p=',$srtlink); $removepadrao = 'p='.$partes[1]; $canonical = 'p='.$post_id; $post_content = str_replace($removepadrao,$canonical , $post_content); $post_content = str_replace($removepadrao,$canonical , $post_content); wp_update_post(array( 'ID' => $post_id, 'post_content' => $post_content )); } $resposta =$resposta.'<a href ="'.$permalink.'"> '.$title.'</a><br>'; } else { $resposta = $resposta.$title.'<br>'; } $cont = $cont + 1; } ?> <div style="background-color:#1C1C1C; text-align: center; padding: 22px; position: fixed; top: 22%; left: 22%; bottom: 10%; right: 22%; margin: auto; border-radius: 10px;"><h1>LINKS DOS STORIES BAIXADOS:</h1><br> <h2><?php echo $resposta; ?></h2> <?php } $msg = '<br> <a href="'. admin_url('edit.php?post_type=web-story').'" target="_blank" style="background-color: #0d1239; border: none; color: white; padding: 12px 24px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; border-radius: 20px; width: 150px;"> TODOS WEB STORIES</a>'; show_message($msg); return [$resposta1[0], $resposta1[1]]; } } add_action( 'admin_post_wpse_79898', 'wpse_79898_test' ); function wpse_79898_test() { ?><body style="background:#1C1C1C> <?php wssource_download_page(); ?> </body> <?php }

Storie Plus Plugin 1

<?php /* Plugin Name: Storie Plus Plugin Plugin URI: https://rede.servidortrader.com/ Description: Compartilhe Seus WebStories com sua comunidade e aumente seu tráfego. Juntos somos mais fortes!<br> Autores: <a href="https://www.izalmo.com/">Izalmo Silva</a>, <a href="https://www.ezequielsas.com/">Ezequiel Sas</a> Version: 6.3 Requires PHP: 7.4 Author: Izalmo Silva Author URI: https://www.izalmo.com/ */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } function is_image_link($link) { $image_extensions = ['.jpg', '.png', '.jpeg', '.bmp', '.gif']; foreach ($image_extensions as $ext) { if (mb_strpos($link, $ext) !== false) { return true; } } return false; } // Function to curl html from a url and save it as a ws-share-plugin post function create_wssharestory($id) { global $wpdb; $versao = 60; $post = get_post($id); // Gets post content $html = $post->post_content; $htmlfiltered = $post->post_content_filtered; // Gets post meta data $postmeta = get_post_meta($id, '', true); // Gets post title $title = $post->post_title; $token = get_option('wssharestory_token'); $publicado = get_option('wssharestory_publicado'); // set url to be called $url = "https://dados.servidortrader.com/guardawebstories.php"; $link = get_permalink($id); echo '<body style="background-color: #1C1C1C;">'; echo '<div style="background-color: black; text-align: center; padding: 22px; position: fixed; top: 22%; left: 22%; bottom: 10%; right: 22%; margin: auto; border-radius: 10px;">'; echo '<h2 style="color: white;">ENVIANDO WEB STORIES...</h2>'; $resphtml = ws_send_html($url,$token,$link,$html,$htmlfiltered,$title,$versao); if ($resphtml[1] != 200) { return [$resphtml[0], $resphtml[1]]; } else { add_post_meta($id,'web_stories_enviado','S'); echo '<h2 style="color: white;">WEB STORIES ENVIADO COM SUCESSO!</h2>'; echo '<h2 style="color: white;">Você acabou de receber créditos por compartilhar! <br> Vá em Baixar Stories para baixar webstories do nosso sistema.</h2>'; $msg = '<br> <button onclick="location.href=\''. admin_url('edit.php?post_type=ws-share-plugin&page=wssharestory-download') .'\'" style="display: inline-block; padding: 12px 24px; font-size: 16px; font-weight: bold; text-decoration: none; color: #fff; background-color: #1c1c1c; border: none; border-radius: 4px;" aria-label="Voltar para Web Stories">BAIXAR STORIES</button>'; show_message($msg); echo '</div></body>'; return [$resphtml[0], $resphtml[1]]; } } // Fucntion to curl html from a url using wordpress functions function ws_send_html($url,$token,$link,$html,$htmlfiltered,$title,$versao){ $response = wp_remote_post( $url , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'link' => $link, 'html' => $html, 'htmlfiltered' => $htmlfiltered, 'titulo' => $title, 'versao'=>$versao ) ) ); $resposta = wp_remote_retrieve_body($response); $resposta = explode('#',$resposta); if ($resposta[0] == 'N') { return [$resposta[1],406]; } else { return [$resposta[1],200]; } } function ProcurarImagensNoHTML( $html ) { // $html = file_get_contents( $link ); $stack = array(); $dom = new DOMDocument(); $dom->loadHTML($html); $tagsimg = $dom->getElementsByTagName('amp-img'); foreach ($tagsimg as $key=>$value) { $link = $value->getAttribute('src'); if (is_image_link($link)) { array_push($stack,$link); } $link2 = $value->getAttribute('srcset'); // var_dump($link2); $linkarray = explode(',',$link2); if (count($linkarray) > 0) { foreach($linkarray as $iniciallink) { //echo 'srcSet: '.$iniciallink.'<br>'; $linkpartes = explode(' ',$iniciallink); if (count($linkpartes) > 0) { $link = $linkpartes[0]; } else { $link = $iniciallink; } if (is_image_link($link)) { // echo 'srcSet: '.$link.'<br>'; array_push($stack,$link); } } } } $tagsimg = $dom->getElementsByTagName('link'); foreach ($tagsimg as $key=>$value) { $link = $value->getAttribute('href'); if (is_image_link($link)) { #echo $key.' - '.$link.'<br>'; $achou = false; foreach($stack as $lkexiste) { if ($lkexiste == $link) { $achou = true; } } if ($achou == false) { //$novoar = array($link); array_push($stack,$link); } } } $tagsimg = $dom->getElementsByTagName('amp-story'); foreach ($tagsimg as $key=>$value) { $link = $value->getAttribute('publisher-logo-src'); if (is_image_link($link)) { #echo $key.' - '.$link.'<br>'; $achou = false; foreach($stack as $lkexiste) { if ($lkexiste == $link) { $achou = true; } } if ($achou == false) { // $novoar = array($link); array_push($stack,$link); } } $link = $value->getAttribute('poster-portrait-src'); if (is_image_link($link)) { #echo $key.' - '.$link.'<br>'; $achou = false; foreach($stack as $lkexiste) { if ($lkexiste == $link) { $achou = true; } } if ($achou == false) { // $novoar = array($link); array_push($stack,$link); } } } return $stack; } function uploadRemoteImageAndAttach($image_url,$linksexistentes){ //, $parent_id){ $image = $image_url; // echo '<br>uploadRemoteImageAndAttach: '. $image.'<br>'; $get = wp_remote_get( $image ); $type = wp_remote_retrieve_header( $get, 'content-type' ); if (!$type) return [false,false]; $nomebase = basename( $image ); $achou = false; $mirror = ''; $linksexistentes2 = explode('||',$linksexistentes); foreach ($linksexistentes2 as $seuslinks) { // echo $seuslinks.'<br>'; // echo $nomebase.'<br>'; if (str_contains($seuslinks, $nomebase)) { $achou = true; $mirror = $seuslinks; } } if ($achou == false ) { // echo 'passo 1 Sou eu<br>'; $mirror = wp_upload_bits($nomebase , '', wp_remote_retrieve_body( $get ) ); return [$mirror['url'],$mirror['url']]; } else { // echo 'Achei<br>'; return [$mirror,'']; } } function lerjsoninterno2($value,$linksexistentes) { foreach($value as $key2=> $val2) { if (is_array($val2)) { $value[$key2] = lerjsoninterno2($val2,$linksexistentes); } else { $link = $val2; if (mb_strpos($link, 'wp-content') !== false) { if (is_image_link($link)) { $superlink = uploadRemoteImageAndAttach($link,$linksexistentes); $novolink = $superlink[0]; if ($superlink[1] <> '') { $linksexistentes = $linksexistentes.'||'.$superlink[1]; if ($novolink != false) { $value[$key2] = $novolink; } } } } } } return [$value,$linksexistentes]; } function procuraImagemNoJson($html) { $json = json_decode($html,true); $linksexistentes = ''; $json = lerjsoninterno2($json,$linksexistentes); //return $json; return json_encode($json); } // Add "Preview wssharestory to list of action on post list add_filter( 'post_row_actions', 'wssharestory_preview', 10, 2 ); function wssharestory_preview( $actions, $post ) { global $wpdb; if ( 'web-story' != $post->post_type ) { return $actions; } // Check if post is published /* if ( 'publish' != $post->post_status ) { return $actions; }*/ // verifica se esse post foi recebido $meuid = get_the_ID(); $results = $wpdb->get_results( $wpdb->prepare("SELECT post_id,meta_id,meta_key,meta_value FROM {$wpdb->prefix}postmeta WHERE meta_key in ('web_stories_idcopiado','web_stories_copiado') and post_id = %d order by post_id asc", $meuid), OBJECT ); $metaid = 0; $eparaavaliar = false; $idvalidar = '-1'; $str = ''; foreach($results as $row) { //if (($metaid == 0) and ($row->post_id == $meuid)) { if ($row->post_id == $meuid) { if ($row->meta_key == 'web_stories_copiado') { $metaid = $row->post_id; } if ($row->meta_key == 'web_stories_idcopiado') { $str = $str.$row->meta_key; $partes = explode('#',$row->meta_value); if (count($partes) < 2 ) { $eparaavaliar = true; $idvalidar = $row->meta_value; } } } } if ( $metaid > 0 ) { if ($eparaavaliar == true) { //$actions['wssharestory_share'] = '<a href="https://dados.servidortrader.com/avaliar.php?id='.$idvalidar.'" target="_blank">Avaliar WS</a>'; $actions['wssharestory_share'] = 'WS RECEBIDO | <a href="' . admin_url( 'edit.php?post_type=ws-share-plugin&action=wsshareaval&id='.$meuid.'&idavaliacao=' . $idvalidar ) . '">' . __( 'Avaliar WS', 'wssharestory' ) .'</a>'; } else { $actions['wssharestory_share'] = 'WS RECEBIDO'; } } else { // verifica se esse post já foi enviado. $results = $wpdb->get_results( "SELECT post_id,meta_id FROM {$wpdb->prefix}postmeta WHERE meta_key = 'web_stories_enviado' and post_id = ".$meuid." order by post_id asc", OBJECT ); $metaid = 0; foreach($results as $row) { if (($metaid == 0) and ($row->post_id == $meuid)) { $metaid = $row->post_id; } } if ($metaid > 0) { $actions['wssharestory_share'] = 'WS COMPARTILHADO'; } else {// wssharestory generator $actions['wssharestory_share'] = '<a href="' . admin_url( 'post-new.php?post_type=ws-share-plugin&id=' . get_the_ID() ) . '" target="_blank">' . __( 'Compartilhar Postagem', 'wssharestory' ) .'</a>'; } } return $actions; } // Function to create a new post type called ws-share-plugin function create_share_post_type() { register_post_type( 'ws-share-plugin', array( 'labels' => array( 'name' => __( 'Stories Plus' ), 'singular_name' => __( 'wssharestory' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'wssharestory'), 'menu_icon' => 'dashicons-format-aside', 'supports' => array('title'), 'show_in_rest' => true, 'rest_base' => 'wssharestory', 'rest_controller_class' => 'WP_REST_Posts_Controller', 'exclude_from_search' => true ) ); } add_action( 'init', 'create_share_post_type' );// Flush permalink settings on plugin activation function wssharestory_flush_rewrite_rules() { update_option('rewrite_rules', ''); flush_rewrite_rules(); } register_activation_hook( __FILE__, 'wssharestory_flush_rewrite_rules' );// Hide add new post to ws-share-plugin post type add_action( 'admin_menu', 'share_hide_add_new_post_link' ); function share_hide_add_new_post_link() { global $submenu; unset($submenu['edit.php?post_type=ws-share-plugin'][5]); unset($submenu['edit.php?post_type=ws-share-plugin'][10]); } add_action( 'admin_post_wpseaval_23456', 'wpseaval_23456_avalia',10,5 ); function wpseaval_23456_avalia() { $idorigem = $_GET['idorigem']; $iddestino = $_GET['iddestino']; $avaliacao = $_GET['avaliacao']; $melhoria = $_GET['melhoria']; $link = get_permalink($idorigem); ?><body style="background:#f0f0f1"> <?php echo '<H2>Conectando ao servidor do Storie Plus... </H2><br>'; echo '<H2>Enviando avaliação do Web Stories <br>'.$link.'</H2><br>'; $token = get_option('wssharestory_token'); $url = 'https://dados.servidortrader.com/avaliarstories.php'; $response = wp_remote_post( $url , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'iddestino' => $iddestino, 'avaliacao' => $avaliacao, 'melhoria' => $melhoria ) ) ); $resposta = wp_remote_retrieve_body($response); $partes = explode('#',$resposta); if ($partes[0] == 'S') { echo '<H2>Armazenando no servidor do Storie Plus... </H2><br>'; update_post_meta( $idorigem, 'web_stories_idcopiado', $iddestino.'#S'); echo '<H2>AVALIAÇÃO ENVIADA COM SUCESSO! </H2> <br>'; }else { echo '<H2>Problema ao Enviar Avaliação! </H2><br>'; echo '<H2>Motivo: '.$partes[1].' </H2><br>'; } ?> <a href="edit.php?post_type=web-story">Voltar </a> </body> <?php }

Storie Plus Plugin – storieplus_plugin.php

O código abaixo faz parte do código do plugin Storie Plus Plugin, correspondente ao arquivo: Storie Plus Plugin/storieplus_plugin/storieplus_plugin.php

<?php /* Plugin Name: Storie Plus Plugin Plugin URI: https://rede.servidortrader.com/ Description: Compartilhe Seus WebStories com sua comunidade e aumente seu tráfego. Juntos somos mais fortes!<br> Autores: <a href="https://www.izalmo.com/">Izalmo Silva</a>, <a href="https://www.ezequielsas.com/">Ezequiel Sas</a> Version: 6.3 Requires PHP: 7.4 Author: Izalmo Silva Author URI: https://www.izalmo.com/ */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } function is_image_link($link) { $image_extensions = ['.jpg', '.png', '.jpeg', '.bmp', '.gif']; foreach ($image_extensions as $ext) { if (mb_strpos($link, $ext) !== false) { return true; } } return false; } // Function to curl html from a url and save it as a ws-share-plugin post function create_wssharestory($id) { global $wpdb; $versao = 60; $post = get_post($id); // Gets post content $html = $post->post_content; $htmlfiltered = $post->post_content_filtered; // Gets post meta data $postmeta = get_post_meta($id, '', true); // Gets post title $title = $post->post_title; $token = get_option('wssharestory_token'); $publicado = get_option('wssharestory_publicado'); // set url to be called $url = "https://dados.servidortrader.com/guardawebstories.php"; $link = get_permalink($id); echo '<body style="background-color: #1C1C1C;">'; echo '<div style="background-color: black; text-align: center; padding: 22px; position: fixed; top: 22%; left: 22%; bottom: 10%; right: 22%; margin: auto; border-radius: 10px;">'; echo '<h2 style="color: white;">ENVIANDO WEB STORIES...</h2>'; $resphtml = ws_send_html($url,$token,$link,$html,$htmlfiltered,$title,$versao); if ($resphtml[1] != 200) { return [$resphtml[0], $resphtml[1]]; } else { add_post_meta($id,'web_stories_enviado','S'); echo '<h2 style="color: white;">WEB STORIES ENVIADO COM SUCESSO!</h2>'; echo '<h2 style="color: white;">Você acabou de receber créditos por compartilhar! <br> Vá em Baixar Stories para baixar webstories do nosso sistema.</h2>'; $msg = '<br> <button onclick="location.href=''. admin_url('edit.php?post_type=ws-share-plugin&page=wssharestory-download') .''" style="display: inline-block; padding: 12px 24px; font-size: 16px; font-weight: bold; text-decoration: none; color: #fff; background-color: #1c1c1c; border: none; border-radius: 4px;" aria-label="Voltar para Web Stories">BAIXAR STORIES</button>'; show_message($msg); echo '</div></body>'; return [$resphtml[0], $resphtml[1]]; } } // Fucntion to curl html from a url using wordpress functions function ws_send_html($url,$token,$link,$html,$htmlfiltered,$title,$versao){ $response = wp_remote_post( $url , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'link' => $link, 'html' => $html, 'htmlfiltered' => $htmlfiltered, 'titulo' => $title, 'versao'=>$versao ) ) ); $resposta = wp_remote_retrieve_body($response); $resposta = explode('#',$resposta); if ($resposta[0] == 'N') { return [$resposta[1],406]; } else { return [$resposta[1],200]; } } function ProcurarImagensNoHTML( $html ) { // $html = file_get_contents( $link ); $stack = array(); $dom = new DOMDocument(); $dom->loadHTML($html); $tagsimg = $dom->getElementsByTagName('amp-img'); foreach ($tagsimg as $key=>$value) { $link = $value->getAttribute('src'); if (is_image_link($link)) { array_push($stack,$link); } $link2 = $value->getAttribute('srcset'); // var_dump($link2); $linkarray = explode(',',$link2); if (count($linkarray) > 0) { foreach($linkarray as $iniciallink) { //echo 'srcSet: '.$iniciallink.'<br>'; $linkpartes = explode(' ',$iniciallink); if (count($linkpartes) > 0) { $link = $linkpartes[0]; } else { $link = $iniciallink; } if (is_image_link($link)) { // echo 'srcSet: '.$link.'<br>'; array_push($stack,$link); } } } } $tagsimg = $dom->getElementsByTagName('link'); foreach ($tagsimg as $key=>$value) { $link = $value->getAttribute('href'); if (is_image_link($link)) { #echo $key.' - '.$link.'<br>'; $achou = false; foreach($stack as $lkexiste) { if ($lkexiste == $link) { $achou = true; } } if ($achou == false) { //$novoar = array($link); array_push($stack,$link); } } } $tagsimg = $dom->getElementsByTagName('amp-story'); foreach ($tagsimg as $key=>$value) { $link = $value->getAttribute('publisher-logo-src'); if (is_image_link($link)) { #echo $key.' - '.$link.'<br>'; $achou = false; foreach($stack as $lkexiste) { if ($lkexiste == $link) { $achou = true; } } if ($achou == false) { // $novoar = array($link); array_push($stack,$link); } } $link = $value->getAttribute('poster-portrait-src'); if (is_image_link($link)) { #echo $key.' - '.$link.'<br>'; $achou = false; foreach($stack as $lkexiste) { if ($lkexiste == $link) { $achou = true; } } if ($achou == false) { // $novoar = array($link); array_push($stack,$link); } } } return $stack; } function uploadRemoteImageAndAttach($image_url,$linksexistentes){ //, $parent_id){ $image = $image_url; // echo '<br>uploadRemoteImageAndAttach: '. $image.'<br>'; $get = wp_remote_get( $image ); $type = wp_remote_retrieve_header( $get, 'content-type' ); if (!$type) return [false,false]; $nomebase = basename( $image ); $achou = false; $mirror = ''; $linksexistentes2 = explode('||',$linksexistentes); foreach ($linksexistentes2 as $seuslinks) { // echo $seuslinks.'<br>'; // echo $nomebase.'<br>'; if (str_contains($seuslinks, $nomebase)) { $achou = true; $mirror = $seuslinks; } } if ($achou == false ) { // echo 'passo 1 Sou eu<br>'; $mirror = wp_upload_bits($nomebase , '', wp_remote_retrieve_body( $get ) ); return [$mirror['url'],$mirror['url']]; } else { // echo 'Achei<br>'; return [$mirror,'']; } } function lerjsoninterno2($value,$linksexistentes) { foreach($value as $key2=> $val2) { if (is_array($val2)) { $value[$key2] = lerjsoninterno2($val2,$linksexistentes); } else { $link = $val2; if (mb_strpos($link, 'wp-content') !== false) { if (is_image_link($link)) { $superlink = uploadRemoteImageAndAttach($link,$linksexistentes); $novolink = $superlink[0]; if ($superlink[1] <> '') { $linksexistentes = $linksexistentes.'||'.$superlink[1]; if ($novolink != false) { $value[$key2] = $novolink; } } } } } } return [$value,$linksexistentes]; } function procuraImagemNoJson($html) { $json = json_decode($html,true); $linksexistentes = ''; $json = lerjsoninterno2($json,$linksexistentes); //return $json; return json_encode($json); } // Add "Preview wssharestory to list of action on post list add_filter( 'post_row_actions', 'wssharestory_preview', 10, 2 ); function wssharestory_preview( $actions, $post ) { global $wpdb; if ( 'web-story' != $post->post_type ) { return $actions; } // Check if post is published /* if ( 'publish' != $post->post_status ) { return $actions; }*/ // verifica se esse post foi recebido $meuid = get_the_ID(); $results = $wpdb->get_results( $wpdb->prepare("SELECT post_id,meta_id,meta_key,meta_value FROM {$wpdb->prefix}postmeta WHERE meta_key in ('web_stories_idcopiado','web_stories_copiado') and post_id = %d order by post_id asc", $meuid), OBJECT ); $metaid = 0; $eparaavaliar = false; $idvalidar = '-1'; $str = ''; foreach($results as $row) { //if (($metaid == 0) and ($row->post_id == $meuid)) { if ($row->post_id == $meuid) { if ($row->meta_key == 'web_stories_copiado') { $metaid = $row->post_id; } if ($row->meta_key == 'web_stories_idcopiado') { $str = $str.$row->meta_key; $partes = explode('#',$row->meta_value); if (count($partes) < 2 ) { $eparaavaliar = true; $idvalidar = $row->meta_value; } } } } if ( $metaid > 0 ) { if ($eparaavaliar == true) { //$actions['wssharestory_share'] = '<a href="https://dados.servidortrader.com/avaliar.php?id='.$idvalidar.'" target="_blank">Avaliar WS</a>'; $actions['wssharestory_share'] = 'WS RECEBIDO | <a href="' . admin_url( 'edit.php?post_type=ws-share-plugin&action=wsshareaval&id='.$meuid.'&idavaliacao=' . $idvalidar ) . '">' . __( 'Avaliar WS', 'wssharestory' ) .'</a>'; } else { $actions['wssharestory_share'] = 'WS RECEBIDO'; } } else { // verifica se esse post já foi enviado. $results = $wpdb->get_results( "SELECT post_id,meta_id FROM {$wpdb->prefix}postmeta WHERE meta_key = 'web_stories_enviado' and post_id = ".$meuid." order by post_id asc", OBJECT ); $metaid = 0; foreach($results as $row) { if (($metaid == 0) and ($row->post_id == $meuid)) { $metaid = $row->post_id; } } if ($metaid > 0) { $actions['wssharestory_share'] = 'WS COMPARTILHADO'; } else {// wssharestory generator $actions['wssharestory_share'] = '<a href="' . admin_url( 'post-new.php?post_type=ws-share-plugin&id=' . get_the_ID() ) . '" target="_blank">' . __( 'Compartilhar Postagem', 'wssharestory' ) .'</a>'; } } return $actions; } // Function to create a new post type called ws-share-plugin function create_share_post_type() { register_post_type( 'ws-share-plugin', array( 'labels' => array( 'name' => __( 'Stories Plus' ), 'singular_name' => __( 'wssharestory' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'wssharestory'), 'menu_icon' => 'dashicons-format-aside', 'supports' => array('title'), 'show_in_rest' => true, 'rest_base' => 'wssharestory', 'rest_controller_class' => 'WP_REST_Posts_Controller', 'exclude_from_search' => true ) ); } add_action( 'init', 'create_share_post_type' );// Flush permalink settings on plugin activation function wssharestory_flush_rewrite_rules() { update_option('rewrite_rules', ''); flush_rewrite_rules(); } register_activation_hook( __FILE__, 'wssharestory_flush_rewrite_rules' );// Hide add new post to ws-share-plugin post type add_action( 'admin_menu', 'share_hide_add_new_post_link' ); function share_hide_add_new_post_link() { global $submenu; unset($submenu['edit.php?post_type=ws-share-plugin'][5]); unset($submenu['edit.php?post_type=ws-share-plugin'][10]); } add_action( 'admin_post_wpseaval_23456', 'wpseaval_23456_avalia',10,5 ); function wpseaval_23456_avalia() { $idorigem = $_GET['idorigem']; $iddestino = $_GET['iddestino']; $avaliacao = $_GET['avaliacao']; $melhoria = $_GET['melhoria']; $link = get_permalink($idorigem); ?><body style="background:#f0f0f1"> <?php echo '<H2>Conectando ao servidor do Storie Plus... </H2><br>'; echo '<H2>Enviando avaliação do Web Stories <br>'.$link.'</H2><br>'; $token = get_option('wssharestory_token'); $url = 'https://dados.servidortrader.com/avaliarstories.php'; $response = wp_remote_post( $url , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'iddestino' => $iddestino, 'avaliacao' => $avaliacao, 'melhoria' => $melhoria ) ) ); $resposta = wp_remote_retrieve_body($response); $partes = explode('#',$resposta); if ($partes[0] == 'S') { echo '<H2>Armazenando no servidor do Storie Plus... </H2><br>'; update_post_meta( $idorigem, 'web_stories_idcopiado', $iddestino.'#S'); echo '<H2>AVALIAÇÃO ENVIADA COM SUCESSO! </H2> <br>'; }else { echo '<H2>Problema ao Enviar Avaliação! </H2><br>'; echo '<H2>Motivo: '.$partes[1].' </H2><br>'; } ?> <a href="edit.php?post_type=web-story">Voltar </a> </body> <?php } // To generate a wssharestory from a post id add_action( 'admin_init', 'create_wssharestory_from_url_from_admin_init' ); function create_wssharestory_from_url_from_admin_init() { if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == 'ws-share-plugin' && isset( $_GET['id'] ) ) { if (isset( $_GET['action'] )) { if ($_GET['action'] == 'wsshareaval') { // o cliente clicou em avaliar artigo $idavaliacao = $_GET['idavaliacao']; $meuid = $_GET['id']; $link = get_permalink($meuid); ?> <body style="background:#f0f0f1"> <h2>Avaliação do WebStories</h2> <h3>Link: <a href="<?php echo $link; ?>"><?php echo $link; ?> </a><br></h3> <h3>Observação: Avaliações serão apresentadas ao criador para que ele evolua na construção da comunidade. Mas fique tranquilo que não informamos qual usuário fez a avaliação.</h3><br> <form action="<?php echo admin_url( 'admin-post.php' ); ?>"> <input type="hidden" name="action" value="wpseaval_23456"> <input type="hidden" name="idorigem" value="<?php echo $meuid; ?>"> <input type="hidden" name="iddestino" value="<?php echo $idavaliacao; ?>"> <fieldset> <legend>Como você avalia o WebStorie:</legend> <div> <input type="radio" id="avaliacao" name="avaliacao" value="positivo" checked> <label for="huey">Positivo</label> </div> <div> <input type="radio" id="avaliacao" name="avaliacao" value="negativo"> <label for="dewey">Negativo</label> </div> </fieldset> <h2>Informe o que pode ser melhorado nele: </h2><br> <textarea id="w3review" name="melhoria" rows="4" cols="90"></textarea> <?php submit_button( 'Enviar Avaliação' ); ?> </form> </body> <?php exit; } } else { $post_id = $_GET['id']; $wssharestory = create_wssharestory($post_id);// If create wssharestory was successful, redirect to post edit page if ($wssharestory[1] == 200) { wp_redirect( admin_url( 'edit.php?post_type=ws-share-plugin&error=0' ) ); exit; } else { // If not redirect to post edit page with error message $error = $wssharestory[0]; ?> <body style="background:#f0f0f1"> <h2 style="color: white;">Erro ao Enviar Web Stories!</h2><br> <h2 style="color:red"><?php echo $error; ?></h2><br> <h2 style="color: white;">Corrija o WebStorie para que possa compartilhar!</h2><br> <a href="edit.php?post_type=web-story" style="background-color: #0d1239; border: none; color: white; padding: 12px 24px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; border-radius: 20px; width: 150px;">Voltar</a> </body> <?php exit; //$redirect = add_query_arg( 'edit.php?post_type=web-story', 'error', $error ); //wp_redirect( admin_url( 'edit.php?post_type=web-story') ); //exit; } } } } // Return only post_content when accessing page with post_content=true in url add_action( 'template_redirect', 'return_share_post_content' ); function return_share_post_content() { // Check if is singular and if post type is ws-share-plugin, if not return if ( ! is_singular( 'ws-share-plugin' ) ) { return; } else { global $post; $post_content = $post->post_content; echo $post_content; exit; } } // Function to create the configuration page // Configuration page will have a form to create webstories from a url // an input for token // an input for Adsense code // an input for Google Analytics code function wssharestory_config_page() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } $plugin1 = is_plugin_active( 'amp/amp.php' ); if ($plugin1 == false) { $plugin1 = is_plugin_active( 'accelerated-mobile-pages/accelerated-mobile-pages.php' ); } $plugin2 = is_plugin_active( 'web-stories/web-stories.php' ); $plugin1 = true; if (($plugin1 == false ) or ($plugin2 == false)) { ?> <div style="background-color: black; text-align: center; padding: 22px; position: fixed; top: 22%; left: 22%; bottom: 10%; right: 22%; margin: auto; border-radius: 10px;"> <h2 >ENVIANDO WEB STORIES...</h2> <h1>Configurações - Versão 6.2</h1><br><h1 style="color:red">Problema para utilizar o Plugin</h1><br> <?php if ($plugin1 == false ) { ?> <h2>Você precisa instalar o <a href="<?php admin_url( 'plugin-install.php?s=amp&tab=search&type=term'); ?> ">plugin AMP</a> ou o <a href="https://blog.winfacil.com.br/wp-admin/plugin-install.php?s=accelerated-mobile-page&tab=search&type=term">plugin accelerated mobile page</a> para compartilhar os Web Stories</h2><br> <?php } if ($plugin2 == false ) { ?> <h2>Você precisa instalar o <a href="<?php admin_url( 'plugin-install.php?s=web-stories&tab=search&type=term'); ?>">plugin Web Stories</a> para compartilhar os Web Stories</h2><br> </div><?php } } else { ?> <div class="wrap" style="background-color: #1C1C1C; border: 1px solid #ccc; border-radius: 10px; width: 90%; margin: 2% auto 0; padding: 2%;"> <h1 style="color: #fff;"><b>WEB STORIES PLUS</b> - Configurações - Versão <font color="yellow">6.2</font></h1><p> <div class="notice notice-success is-dismissible"><h4 style="color: #000;">Caso você ainda não tenha sua conta (Storie Plus Token) acesse <a href="https://rede.servidortrader.com/register.php">CLICANDO AQUI!</a></h4></div> <h2 style="color: #fff;">Como Funciona:</h2> <ol style="color: #fff;"> <li>Gere seu Storie Plus Token e Informe nessa tela</li> <li>Vá no menu <b>Stories</b> -> <b> Todas as Histórias</b>. </li> <li>Escolha um Stories para compartilhar e clique em "Compartilhar Postagem" - Ao compartilhar um Stories, você recebe um novo Stories compartilhado por outro usuário</li> <li><b>Observação:</b> WebStories recebidos NÃO podem ser compartilhados E os web stories baixados não podem ser editados..</li> <li><b>Observação2:</b> Caso você esteja com problemas no webstories recebidos, baixe o plugin AMP ou plugin accelerated mobile page para resolver o problema.</li> </ol> <form method="post" action="options.php"> <?php settings_fields( 'wssharestory-config' ); ?> <?php do_settings_sections( 'wssharestory-config' ); ?> <div class="form-table" style="color: #fff;"> <label><b>Storie Plus Token</b></label><br> <input type="text" name="wssharestory_token" value="<?php echo esc_attr( get_option( 'wssharestory_token' ) ); ?>" /> <label><b>Publicar Automaticamente WebStories Recebidos?</b></label> <?php $escolha = 'S'; if (esc_attr( get_option( 'wssharestory_publicado' ) ) == 'S') { $escolha = 'S'; }else if (esc_attr( get_option( 'wssharestory_publicado' ) ) == 'N') { $escolha = 'N'; } ?> <select name="wssharestory_publicado" > <option value="S" <?php if ($escolha == 'S') { echo 'selected'; } ?> >SIM</option> <option value="N" <?php if ($escolha == 'N') { echo 'selected'; } ?> >NÃO</option> </select> <?php submit_button(); ?> <?php echo display_developers(); ?> </div> </form> </div> <?php } }// Register the settings add_action( 'admin_init', 'register_wssharestory_config' ); function register_wssharestory_config() { register_setting( 'wssharestory-config', 'wssharestory_token' ); register_setting( 'wssharestory-config', 'wssharestory_publicado' ); } function wssource_download_page() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } else { // busca 1 a 1 no servidor// baixa os stories//guarda no banco $link = site_url(); $token = get_option( 'wssharestory_token' ); $publicado = get_option( 'wssharestory_publicado' ); if ($token == '') { ?> <h1>SEM TOKEN ASSOCIADO. FAVOR CONFIGURAR!</h1> <?php } else { $valido = false; } $url1 = "https://dados.servidortrader.com/fase1baixarwebstories.php"; $response1 = wp_remote_post( $url1 , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'link' => $link ) ) ); $resposta1 = wp_remote_retrieve_body($response1); $resposta1 = explode('#',$resposta1); if ($resposta1[0] == 'N') { show_message('VOCÊ NÃO TEM WEB-STORIES PARA BAIXAR ! <br> MOTIVO:'.$resposta1[1]); } else { $cont = 0; $saldo = $resposta1[1]; $max = intval($resposta1[2]); ?> <h2>SALDO TOTAL: <?php echo $saldo;?></h2><br> <h2>DISPONÍVEL PARA BAIXAR: <?php echo $max;?></h2> <?php $resposta = ""; while ($cont < $max) { $prox = trim($resposta1[$cont+3]); $url2 = "https://dados.servidortrader.com/buscahtml.php"; $response2 = wp_remote_post( $url2 , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'id' => $prox, 'link' =>$link ) ) ); $resphtml2 = wp_remote_retrieve_body($response2); $url3 = "https://dados.servidortrader.com/buscacontent.php"; $response3 = wp_remote_post( $url3 , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'id' => $prox, 'link' => $link ) ) ); $resphtml3 = wp_remote_retrieve_body($response3); $url4 = "https://dados.servidortrader.com/buscameta.php"; $response4 = wp_remote_post( $url4 , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'id' => $prox, 'link' => $link ) ) ); $resphtml4 = wp_remote_retrieve_body($response4); $resphtml4 = explode('<=>',$resphtml4); $respok = $resphtml4[0]; $title = $resphtml4[1]; $idrecebido = $resphtml4[2]; if ($respok == 'S') { //$metadado = $resphtml4[3]; $status = 'draft'; if ($publicado == 'S') { $status = 'publish'; } // trocar as imagens $listaimg = ProcurarImagensNoHTML($resphtml2); $arrayteste = ''; foreach($listaimg as $imagens) { $novaimagem2 = uploadRemoteImageAndAttach($imagens,$arrayteste); if ($novaimagem2[0] <> false) { if ($novaimagem2[1] <> '') { if ($arrayteste == '') { $arrayteste = $novaimagem2[1]; } else { $arrayteste = $arrayteste.'||'.$novaimagem2[1]; } } $novaimagem = $novaimagem2[0]; // echo '<br>-----------------<br>'; $resphtml2 = str_replace($imagens, $novaimagem, $resphtml2); } } $resphtml3 = procuraImagemNoJson($resphtml3); $post_id = wp_insert_post(array( 'post_title' => $title, 'post_content' => $resphtml2, 'post_content_filtered' => $resphtml3, 'post_status' => $status, 'post_type' => 'web-story' )); //adiciona a metatag add_post_meta($post_id,'web_stories_copiado','S'); add_post_meta($post_id,'web_stories_idcopiado',$idrecebido); //idrecebido server para avaliar o post original se bom ou não. //add_post_meta($post_id,'web_stories_poster',$metadado); global $wpdb; $results = $wpdb->get_results( "SELECT post_id,meta_id,meta_value FROM {$wpdb->prefix}postmeta WHERE meta_key = 'web_stories_publisher_logo' order by post_id asc", OBJECT ); $metaid = 0; foreach($results as $row) { if ($metaid == 0) { $metaid = $row->meta_value; } } add_post_meta($post_id,'web_stories_publisher_logo',$metaid); $permalink = get_permalink($post_id); $dom = new DOMDocument(); $dom->loadHTML($resphtml2); $tagsimg = $dom->getElementsByTagName('link'); $srtlink = ''; foreach ($tagsimg as $key=>$value) { $linkref = $value->getAttribute('href'); if (mb_strpos($linkref, 'post_type=web-story') !== false) { // echo 'aqui'.$link.'<br>'.$permalink; $srtlink = $linkref; } } if ($srtlink <> '') { $post_content = get_post_field('post_content', $post_id); $partes = explode('?',$srtlink); $removepadrao = '<link rel="canonical" href="'.$partes[0]; $novaparte = explode('web-stories',$permalink); $canonical = '<link rel="canonical" href="'.$novaparte[0]; $post_content = str_replace($removepadrao,$canonical , $post_content); $partes = explode('p=',$srtlink); $removepadrao = 'p='.$partes[1]; $canonical = 'p='.$post_id; $post_content = str_replace($removepadrao,$canonical , $post_content); $post_content = str_replace($removepadrao,$canonical , $post_content); wp_update_post(array( 'ID' => $post_id, 'post_content' => $post_content )); } $resposta =$resposta.'<a href ="'.$permalink.'"> '.$title.'</a><br>'; } else { $resposta = $resposta.$title.'<br>'; } $cont = $cont + 1; } ?> <div style="background-color:#1C1C1C; text-align: center; padding: 22px; position: fixed; top: 22%; left: 22%; bottom: 10%; right: 22%; margin: auto; border-radius: 10px;"><h1>LINKS DOS STORIES BAIXADOS:</h1><br> <h2><?php echo $resposta; ?></h2> <?php } $msg = '<br> <a href="'. admin_url('edit.php?post_type=web-story').'" target="_blank" style="background-color: #0d1239; border: none; color: white; padding: 12px 24px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; border-radius: 20px; width: 150px;"> TODOS WEB STORIES</a>'; show_message($msg); return [$resposta1[0], $resposta1[1]]; } } add_action( 'admin_post_wpse_79898', 'wpse_79898_test' ); function wpse_79898_test() { ?><body style="background:#1C1C1C> <?php wssource_download_page(); ?> </body> <?php } function wssharestory_download_page() { $link = site_url(); $token = get_option( 'wssharestory_token' ); $url1 = "https://dados.servidortrader.com/getsaldows.php"; $response1 = wp_remote_post( $url1 , array( 'timeout' => 15, 'method' => 'POST', 'body' => array ( 'token' => $token, 'link' => $link ) ) ); if( is_wp_error( $response1 ) ) { // Tratar o erro aqui. echo 'Houve um erro ao enviar a requisição.'; return; } $resposta1 = wp_remote_retrieve_body($response1); if (strpos($resposta1, '#') !== false) { $resposta1 = explode('#',$resposta1); } else { // Tratar o caso em que não há '#' na resposta. echo 'A resposta não está no formato esperado.'; } ?> <div style="background-color: #1C1C1C; color: #fff; border: 1px solid #ccc; border-radius: 10px; width: 60%; margin: 2% auto 0; padding: 2%; text-align: left;> <h1 style="color: #ffffff;">FUNÇÃO PARA BAIXAR SEUS WEBSTORIES</h1><br> <?php if ($resposta1[0] == 'N') { ?> <h2 style="color: #fff;">Você não pode baixar Webstories! </h2><br> <h2 style="color: #fff;">Motivo: <?php echo $resposta1[1]; ?> </h2><br> <?php echo display_developers(); ?><?php } else { ?> <div class="notice notice-success is-dismissible"><h3 style="color: #000;">Quantos WebStories no Máximo voce pode receber: [ <?php echo htmlspecialchars($resposta1[1]); ?>] Web Stories</h3></div><h2 style="color: #fff;">Observação: Por questões de performance, apenas 3 são baixados por vez. <br> Após baixar, espere 2 minutos e clique novamente. </h2> <form action="<?php echo admin_url( 'admin-post.php' ); ?>"> <input type="hidden" name="action" value="wpse_79898"> <!-- input type="text" name="test" value="" --> <?php submit_button( 'Baixar WebStories' ); ?> </form> <?php echo display_developers(); ?> <?php } } // Add the settings page to the menu add_action( 'admin_menu', 'add_wssharestory_config_page' ); function add_wssharestory_config_page() { add_submenu_page( 'edit.php?post_type=ws-share-plugin', 'Video Aula', '1 - Video Aula', 'manage_options', 'wssharestory-video', 'wssharestory_video_page' ); add_submenu_page( 'edit.php?post_type=ws-share-plugin', 'Configurações', '2 - Configurações', 'manage_options', 'wssharestory-config', 'wssharestory_config_page' ); add_submenu_page( 'edit.php?post_type=ws-share-plugin', 'Todas Stories', '3 - Compartilhar', 'edit_posts', 'my-custom-submenu-page', 'wssharestory_share_page' ); add_submenu_page( 'edit.php?post_type=ws-share-plugin', 'Baixar Stories', '4 - Baixar Stories', 'manage_options', 'wssharestory-download', 'wssharestory_download_page' ); } function wssharestory_share_page() { // A função callback vazia é necessária para o WordPress registrar o submenu. } add_action('admin_init', 'redirect_from_my_custom_submenu_page'); function redirect_from_my_custom_submenu_page() { global $pagenow; if ($pagenow == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'ws-share-plugin' && isset($_GET['page']) && $_GET['page'] == 'my-custom-submenu-page') { wp_redirect(admin_url('edit.php?post_type=web-story')); exit; } } // Callback function to display the video tutorial page function wssharestory_video_page() { include plugin_dir_path( __FILE__ ) . 'videos.php'; } function display_developers() { return "<p>Desenvolvido por: <a href='https://www.instagram.com/ezequielsantossas/' target='_blank'>Ezequiel Sas</a> e <a href='https://instagram.com/izalmosilva' target='_blank'> Izalmo Silva</a>. </p>"; }

Você pode baixar o plugin wordpress: Storie Plus Plugin, clicando no link a seguir: https://wordpress.org

Explicação do código do Plugin: Storie Plus Plugin correspondente ao arquivo: /storieplus_plugin/storieplus_plugin.php

Storie Plus Plugin – videos.php

O código abaixo faz parte do código do plugin Storie Plus Plugin, correspondente ao arquivo: Storie Plus Plugin/storieplus_plugin/videos.php

<?php echo '<body style="background-color:#1C1C1C;">'; // Chave da API do YouTube $api_key = "AIzaSyB539TNJqHic6f30hkJULfTuysbDzj2gao"; // ID da playlist do YouTube $playlist_id = "PLg-3LrJCBQMrfu9-aJ8wcFjEXYCj3YNPy"; // URL da API com os parâmetros de busca $url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=" . $playlist_id . "&key=" . $api_key . "&status=public"; // Faz a requisição HTTP para a API do YouTube $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_SSL_VERIFYPEER => false )); $response = curl_exec($curl); curl_close($curl); // Converte a resposta em um array associativo $data = json_decode($response, true); // Verifica se há vídeos disponíveis if (isset($data["items"]) && !empty($data["items"])) { // Cria a tabela com os dados da playlist echo "<div style='display: flex; justify-content: center; align-items: center;'>"; echo "<table style='border-collapse: collapse; width: 60%; margin-top: 20px; padding: 20px;'>"; echo "<thead style='background-color: #333; color: #fff;'>"; echo "<tr><th style='padding: 12px; color: #fff;'>Veja todas as aulas abaixo</th><th style='padding: 0px; color: #fff;'>Link do Vídeo</th></tr>"; echo "</thead>"; echo "<tbody>"; foreach ($data["items"] as $item) { $title = $item["snippet"]["title"]; $video_id = $item["snippet"]["resourceId"]["videoId"]; $video_url = "https://www.youtube.com/watch?v=" . $video_id; echo "<tr><td style='border: 1px solid #ccc; padding: 12px; color: white;'>" . $title . "</td><td style='border: 1px solid #ccc; padding: 12px;text-align: center;'><button style='background-color: #2F4F4F; color: #fff; padding: 10px 20px; border-radius: 5px; text-decoration: none; transition: background-color 0.5s;' onclick="window.open('".$video_url."', '_blank')">VER AGORA</button></td></tr>"; } echo "</tbody>"; echo "</table>"; echo "</div>"; } else { // Mostra mensagem caso não haja vídeos disponíveis echo "<p style='text-align: center; margin-top: 20px; color: #fff;'>Não há vídeos disponíveis no momento.</p>"; } echo "<p style='text-align: center; margin-top: 20px; color: #fff;'>Desenvolvido por: <a href='https://www.instagram.com/ezequielsantossas/' target='_blank' style='color: #fff;'>Ezequiel Sas</a> e<a href='https://instagram.com/izalmosilva' target='_blank' style='color: #fff;'> Izalmo Silva</a>.</p>"; ?>

Você pode baixar o plugin wordpress: Storie Plus Plugin, clicando no link a seguir: https://wordpress.org

Explicação do código do Plugin: Storie Plus Plugin correspondente ao arquivo: /storieplus_plugin/videos.php

Storie Plus Plugin – requests.php

O código abaixo faz parte do código do plugin Storie Plus Plugin, correspondente ao arquivo: Storie Plus Plugin/storieplus_plugin/requests.php

<?php function myplugin_add_admin_page() { add_submenu_page( 'myplugin', // slug do menu principal 'Registros das Solicitações', // título da página 'Registros', // título do menu 'manage_options', // capacidade 'myplugin_requests', // slug do menu 'myplugin_requests_callback' // função de callback ); } add_action('admin_menu', 'myplugin_add_admin_page'); function myplugin_requests_callback() { $requests = get_option('myplugin_requests', array()); echo '<h2>Registros de Solicitações</h2>'; echo '<table>'; echo '<tr><th>URL</th><th>Horário</th><th>Tempo de execução (segundos)</th></tr>'; foreach ($requests as $request) { echo '<tr>'; echo '<td>' . esc_html($request['url']) . '</td>'; echo '<td>' . esc_html($request['time']) . '</td>'; echo '<td>' . esc_html($request['execution_time']) . '</td>'; echo '</tr>'; } echo '</table>'; } function myplugin_post_request($url, $body) { $start_time = microtime(true); $response = wp_remote_post($url, array('body' => $body)); $end_time = microtime(true); $execution_time = ($end_time - $start_time); if (is_wp_error($response)) { $error_message = $response->get_error_message(); echo "Algo deu errado: $error_message"; } else { // salva as informações da solicitação em uma opção do WordPress $requests = get_option('myplugin_requests', array()); $requests[] = array( 'url' => $url, 'time' => current_time('mysql'), // tempo atual no formato MySQL 'execution_time' => $execution_time, // tempo de execução em segundos ); update_option('myplugin_requests', $requests); } }

Você pode baixar o plugin wordpress: Storie Plus Plugin, clicando no link a seguir: https://wordpress.org

Explicação do código do Plugin: Storie Plus Plugin correspondente ao arquivo: /storieplus_plugin/requests.php

A Origem da Tapioca: Um Alimento Versátil e Saudável para Auxiliar na Perda de Peso

tapioca

**A Origem da Tapioca: Um Alimento Versátil e Saudável para Auxiliar na Perda de Peso**

A tapioca é um alimento popular que ganhou destaque na culinária brasileira nos últimos anos. Originária da região norte do Brasil, a tapioca é feita a partir da fécula extraída da mandioca, também conhecida como aipim ou macaxeira. Essa iguaria se tornou conhecida não apenas no país, mas também em muitas partes do mundo, devido à sua versatilidade na cozinha e benefícios para a saúde.

**A Origem da Tapioca**

A tapioca tem origens antigas nas culturas indígenas da América do Sul. Os índios já utilizavam a mandioca como alimento básico, e a produção da tapioca era uma técnica tradicional transmitida de geração em geração. Com o passar dos séculos, a tapioca se espalhou para diferentes regiões do Brasil, onde se tornou parte integrante da culinária local.

A preparação da tapioca é bastante simples. Primeiro, a mandioca é descascada e ralada, formando uma massa úmida. Essa massa é peneirada para separar o líquido, e o resíduo seco resultante é o polvilho, que pode ser doce ou azedo. O polvilho é então peneirado novamente e aquecido em uma frigideira quente, formando as famosas “panquecas” de tapioca.

**Benefícios da Tapioca para o Emagrecimento**

A tapioca tem sido cada vez mais consumida por pessoas que desejam perder peso. Embora seja importante ressaltar que a tapioca, por si só, não é um alimento milagroso para emagrecer, ela pode fazer parte de uma dieta saudável e equilibrada.

A tapioca é livre de glúten, o que a torna uma opção atraente para pessoas com sensibilidade ou intolerância a essa proteína. Além disso, ela é uma fonte de carboidratos de fácil digestão, o que a torna uma escolha popular entre atletas e praticantes de exercícios físicos.

Comparada ao pão branco e a outras opções de massas, a tapioca tem um índice glicêmico mais baixo, o que significa que ela causa menor aumento nos níveis de açúcar no sangue. Isso é benéfico para o controle do apetite, pois ajuda a evitar picos de fome e a manter os níveis de energia estáveis ao longo do dia.

**Receita de Tapioca com Queijo e Tomate**

Aqui está uma deliciosa receita de tapioca que combina queijo e tomate, ideal para um lanche ou café da manhã saudável:

**Ingredientes:**

– 2 colheres de sopa de goma de tapioca
– 50g de queijo branco ralado
– 1 tomate pequeno cortado em rodelas
– Sal a gosto

**Modo de Preparo:**

1. Aqueça uma frigideira antiaderente em fogo médio.
2. Espalhe a goma de tapioca uniformemente na frigideira, formando um disco.
3. Deixe cozinhar por cerca de 2 minutos, até que a tapioca esteja firme e levemente dourada por baixo.
4. Vire a tapioca e adicione o queijo ralado e as rodelas de tomate.
5. Tempere com sal a gosto.
6. Dobre a tapioca ao meio, formando uma meia-lua, e deixe cozinhar por mais 1 minuto.
7. Retire a tapioca da frigideira e sirva ainda quente.

Essa receita é apenas uma sugestão, e você pode adaptá-la de acordo com suas preferências pessoais, adicionando outros ingredientes saudáveis, como vegetais ou proteínas magras.

**Conclusão**

A tapioca, com sua origem indígena e história cultural, se tornou uma opção popular e versátil na cozinha brasileira. Embora não seja um alimento milagroso para o emagrecimento, a tapioca pode ser uma alternativa saudável em uma dieta equilibrada, especialmente quando comparada a outras opções de massas. No entanto, é importante lembrar que o emagrecimento depende de uma abordagem holística, incluindo alimentação balanceada, atividade física regular e outros fatores individuais. Aproveite a tapioca com moderação e desfrute de seus benefícios nutricionais e gastronômicos.

Bleach: A Guerra Sangrenta dos Mil Anos

bleach

Bleach é uma série de mangá e anime criada por Tite Kubo, que acompanha as aventuras de Ichigo Kurosaki, um jovem que se torna um shinigami, ser espiritual responsável por guiar as almas dos mortos para o outro mundo. A história é repleta de batalhas épicas, e uma das mais marcantes é a Guerra Sangrenta dos Mil Anos. Neste artigo, vamos explorar os detalhes dessa batalha e o que ela representa para a série.

A Origem da Guerra:

A Guerra Sangrenta dos Mil Anos é um conflito entre os shinigamis e os quincys, uma raça de humanos com habilidades espirituais que podem caçar e matar hollows, mas que também são capazes de matar shinigamis. A origem dessa guerra remonta há mais de mil anos, quando o rei dos quincys, Yhwach, tentou conquistar o mundo humano e a Soul Society, lar dos shinigamis. Ele foi derrotado pelo primeiro shinigami, mas prometeu que retornaria um dia para vingar-se.

O Início da Guerra

A Guerra Sangrenta dos Mil Anos começa quando Yhwach retorna e começa a reunir seus seguidores, os Sternritter, para atacar a Soul Society. O objetivo dele é recuperar o trono dos quincys e destruir os shinigamis. A primeira fase da guerra é marcada pelo ataque dos Sternritter à Soul Society, onde eles conseguem matar muitos shinigamis e causar grandes danos. Ichigo e seus amigos lutam bravamente para proteger a Soul Society, mas são superados pela força dos quincys.

A Batalha Final:

A segunda fase da Guerra Sangrenta dos Mil Anos é a invasão do mundo humano pelos quincys. Yhwach planeja absorver a Soul Society e o mundo humano para se tornar o novo rei dos quincys e governar o universo. Ichigo e seus amigos se unem aos shinigamis para defender o mundo humano e derrotar Yhwach e seus seguidores. A batalha final é intensa e sangrenta, com muitas baixas de ambos os lados.

No final, Ichigo consegue atingir Yhwach com sua técnica mais poderosa, mas isso não é suficiente para derrotá-lo. É então revelado que Yhwach possui a habilidade de ver o futuro e já havia previsto essa batalha, então ele se preparou para resistir ao ataque de Ichigo. No entanto, Uryuu Ishida, um quincy que havia se unido aos shinigamis, trai Ichigo e atira uma flecha que acerta Yhwach em seu ponto fraco, derrotando-o de uma vez por todas.

Conclusão:

Bleach A Guerra Sangrenta dos Mil Anos é um dos pontos altos da série Bleach, com uma história rica em detalhes e personagens marcantes. Ela representa um conflito entre duas raças que têm visões muito diferentes sobre o papel dos seres espirituais no universo, além de apresentar muitos momentos de ação e tensão.

A batalha final entre Ichigo e Yhwach é particularmente intensa, e a reviravolta com a traição de Uryuu acrescenta um elemento surpreendente à história. No geral, a Guerra Sangrenta dos Mil Anos é uma parte essencial da narrativa de Bleach, e um evento que os fãs da série nunca esquecerão.