Respostas no Fórum

Visualizando 8 respostas - 1 até 8 (de um total de 8)
  • Criador do tópico wiruizfe

    (@wiruizfe)

    Pronto ja voltei o código antigo, e selecionei ja a opção de 5 imgs e de 10 imgs e nada!!!

    Criador do tópico wiruizfe

    (@wiruizfe)

    Bom dia Luiza, essa pasta não existe, e nem o arquivo, ja mandei até pesquisar na pasta, mas no único lugar que acha é nas pastas dos sites já instalados!!!
    Estou usando o XAMPP, será que é diferente?

    Criador do tópico wiruizfe

    (@wiruizfe)

    Certo consegui o Token, Inseri todos os dados nos respectivos lugares da imagem, no User ID eu coloquei tanto o login do insta quanto o Client ID e não funcionou nada!!!

    Depois tentei pelo código, mas eu não entendo nada de PHP, segue abaixo o que eu fiz:

    O código era esse postado em cima, e eu alterei a seguinte parte dele com

    /* WP_Widget::form */
    	function form( $instance ) {
    		if ( $instance ) {
    			$title = esc_attr( $instance[ 'Jornal A Semana' ] );
    
    			$access_token = esc_attr( $instance[ '368611750.e41a8af.26de957dc79b495c9ce1dbafa801c428' ] );
    			$user_id = esc_attr( $instance[ 'jornalasemana' ] );
    
    			$picture_number = esc_attr( $instance[ 'picture_number' ] );
    			$picture_size = esc_attr( $instance[ 'picture_size' ] );
    
    			$show_likes = esc_attr( $instance[ 'show_likes' ] );
    			$show_caption = esc_attr( $instance[ 'show_caption' ] );
    
    			$link_images = esc_attr( $instance[ 'link_images' ] );
    
    			$debug_mode = esc_attr( $instance['debug_mode'] );
    
    		}
    		else {
    			$title = __( 'Jornal A Semana', 'text_domain' );
    			$username = __( 'jornalasemana', 'text_domain' );
    			$access_token = __( '368611750.e41a8af.26de957dc79b495c9ce1dbafa801c428', 'text_domain' );
    			$user_id = __( 'e41a8af0735d46699981103ad59c1df6', 'text_domain' );
    		}

    Mesmo assim, nada!!! Será que preciso alterar mais alguma coisa???

    Criador do tópico wiruizfe

    (@wiruizfe)

    Luiza valeu a ajuda, mas esse arquivo eu achei dentro das pastas dos sites… Meu arquivo de config do Banco de dados contém as informações abaixo!!!

    # Example MySQL config file for small systems.
    #
    # This is for a system with little memory (<= 64M) where MySQL is only used
    # from time to time and it's important that the mysqld daemon
    # doesn't use much resources.
    #
    # You can copy this file to
    # C:/xampp/mysql/bin/my.cnf to set global options,
    # mysql-data-dir/my.cnf to set server-specific options (in this
    # installation this directory is C:/xampp/mysql/data) or
    # ~/.my.cnf to set user-specific options.
    #
    # In this file, you can use all long options that a program supports.
    # If you want to know which options a program supports, run the program
    # with the "--help" option.
    
    # The following options will be passed to all MySQL clients
    [client]
    # password       = your_password
    port            = 8080
    socket          = "C:/xampp/mysql/mysql.sock"
    
    # Here follows entries for some specific programs 
    
    # The MySQL server
    [mysqld]
    port= 8080
    socket = "C:/xampp/mysql/mysql.sock"
    basedir = "C:/xampp/mysql"
    tmpdir = "C:/xampp/tmp"
    datadir = "C:/xampp/mysql/data"
    pid_file = "mysql.pid"
    # enable-named-pipe
    key_buffer = 16M
    max_allowed_packet = 256M
    sort_buffer_size = 512K
    net_buffer_length = 8K
    read_buffer_size = 256K
    read_rnd_buffer_size = 512K
    myisam_sort_buffer_size = 8M
    log_error = "mysql_error.log"
    
    # Change here for bind listening
    # bind-address="127.0.0.1"
    # bind-address = ::1          # for ipv6
    
    # Where do all the plugins live
    plugin_dir = "C:/xampp/mysql/lib/plugin/" 
    
    # Don't listen on a TCP/IP port at all. This can be a security enhancement,
    # if all processes that need to connect to mysqld run on the same host.
    # All interaction with mysqld must be made via Unix sockets or named pipes.
    # Note that using this option without enabling named pipes on Windows
    # (via the "enable-named-pipe" option) will render mysqld useless!
    #
    # commented in by lampp security
    #skip-networking
    #skip-federated
    
    # Replication Master Server (default)
    # binary logging is required for replication
    # log-bin deactivated by default since XAMPP 1.4.11
    #log-bin=mysql-bin
    
    # required unique id between 1 and 2^32 - 1
    # defaults to 1 if master-host is not set
    # but will not function as a master if omitted
    server-id	= 1
    
    # Replication Slave (comment out master section to use this)
    #
    # To configure this host as a replication slave, you can choose between
    # two methods :
    #
    # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
    #    the syntax is:
    #
    #    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
    #    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
    #
    #    where you replace <host>, <user>, <password> by quoted strings and
    #    <port> by the master's port number (8080 by default).
    #
    #    Example:
    #
    #    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=8080,
    #    MASTER_USER='joe', MASTER_PASSWORD='secret';
    #
    # OR
    #
    # 2) Set the variables below. However, in case you choose this method, then
    #    start replication for the first time (even unsuccessfully, for example
    #    if you mistyped the password in master-password and the slave fails to
    #    connect), the slave will create a master.info file, and any later
    #    change in this file to the variables' values below will be ignored and
    #    overridden by the content of the master.info file, unless you shutdown
    #    the slave server, delete master.info and restart the slaver server.
    #    For that reason, you may want to leave the lines below untouched
    #    (commented) and instead use CHANGE MASTER TO (see above)
    #
    # required unique id between 2 and 2^32 - 1
    # (and different from the master)
    # defaults to 2 if master-host is set
    # but will not function as a slave if omitted
    #server-id       = 2
    #
    # The replication master for this slave - required
    #master-host     =   <hostname>
    #
    # The username the slave will use for authentication when connecting
    # to the master - required
    #master-user     =   <username>
    #
    # The password the slave will authenticate with when connecting to
    # the master - required
    #master-password =   <password>
    #
    # The port the master is listening on.
    # optional - defaults to 8080
    #master-port     =  <port>
    #
    # binary logging - not required for slaves, but recommended
    #log-bin=mysql-bin
    
    # Point the following paths to different dedicated disks
    #tmpdir = "C:/xampp/tmp"
    #log-update = /path-to-dedicated-directory/hostname
    
    # Uncomment the following if you are using BDB tables
    #bdb_cache_size = 4M
    #bdb_max_lock = 10000
    
    # Comment the following if you are using InnoDB tables
    #skip-innodb
    innodb_data_home_dir = "C:/xampp/mysql/data"
    innodb_data_file_path = ibdata1:10M:autoextend
    innodb_log_group_home_dir = "C:/xampp/mysql/data"
    #innodb_log_arch_dir = "C:/xampp/mysql/data"
    ## You can set .._buffer_pool_size up to 50 - 80 %
    ## of RAM but beware of setting memory usage too high
    innodb_buffer_pool_size = 16M
    innodb_additional_mem_pool_size = 2M
    ## Set .._log_file_size to 25 % of buffer pool size
    innodb_log_file_size = 5M
    innodb_log_buffer_size = 8M
    innodb_flush_log_at_trx_commit = 1
    innodb_lock_wait_timeout = 50
    
    ## UTF 8 Settings
    #init-connect=\'SET NAMES utf8\'
    #collation_server=utf8_unicode_ci
    #character_set_server=utf8
    #skip-character-set-client-handshake
    #character_sets-dir="C:/xampp/mysql/share/charsets"
    
    [mysqldump]
    quick
    max_allowed_packet = 256M
    
    [mysql]
    no-auto-rehash
    # Remove the next comment character if you are not familiar with SQL
    #safe-updates
    
    [isamchk]
    key_buffer = 20M
    sort_buffer_size = 20M
    read_buffer = 2M
    write_buffer = 2M
    
    [myisamchk]
    key_buffer = 20M
    sort_buffer_size = 20M
    read_buffer = 2M
    write_buffer = 2M
    
    [mysqlhotcopy]
    interactive-timeout
    Criador do tópico wiruizfe

    (@wiruizfe)

    Luiza você esta me ajudando muito, consegui achar os caminhos aqui…Mas quando eu fui fazer o procedimento no Insta para pegar o Token, olha só a mensagem que aparece!!

    Instagram pede para colocar esse link:

    https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code

    com meu id de cliente no lugar do CLIENT-ID, mas o que recebo de resposta é:

    {“code”: 400, “error_type”: “OAuthException”, “error_message”: “Redirect URI does not match registered redirect URI”}

    Criador do tópico wiruizfe

    (@wiruizfe)

    Só achei duas coisas, essa imagem e o código que vou colocar abaixo para edição do plugin.

    <?php
    /*
    Plugin Name: Instagram-Widget-for-WordPress
    Plugin URI: http://davidmregister.com/instagram-widget-for-wordpress
    Description: This plugin get a users recent images, up to 10, and displays them in a WordPress Widget. It will also display likes and comments if uplaoded with the images.
    Version: 1.3.1
    Author: David Register
    Author URI: http://davidmregister.com
    License: GPL2
    */
    
    /**
     * Instagrm_Feed_Widget Class
     */
    class Instagrm_Feed_Widget extends WP_Widget {
    	/** constructor */
    	function __construct() {
    		parent::WP_Widget( /* Base ID */'instagrm_widget', /* Name */'Instagram Widget for WordPress', array( 'description' => 'A widget to display a users instagrm feed' ) );
    	}
    
    	/* WP_Widget::widget */
    	function widget( $args, $instance ) {
    		extract( $args );
    		//get widget information to display on page
    		$title = apply_filters( 'widget_title', $instance['title'] );
    
    		$user_id = apply_filters( 'widget_title', $instance['user_id'] );
    		$access_token = apply_filters( 'widget_title', $instance['access_token'] );
    
    		$picture_number = apply_filters( 'widget_title', $instance['picture_number'] );
    		$picture_size = apply_filters( 'widget_title', $instance['picture_size'] );
    		$link_images = apply_filters( 'widget_title', $instance['link_images'] );
    
    		$show_likes = apply_filters( 'widget_title', $instance['show_likes'] );
    		$show_caption = apply_filters( 'widget_title', $instance['show_caption'] );
    
    		$debug_mode = apply_filters( 'widget_title', $instance['debug_mode'] );
    
    		echo $before_widget;
    		if ( $title ){
    			echo $before_username ."<h2 class='gentesque' id='instagram_widget_title'>". $title ."</h2>". $after_username;
    		};
    
    		if($debug_mode){
    
    			// Check requirements
            	if (extension_loaded('curl')){
    				$curl_ver = curl_version();
    				echo '<p>Curl is <b>Enabled</b></p>';
    				echo '<p>Curl Version Number:'.$curl_ver['version_number'].'</p>';
    				echo '<p>User ID:'.$user_id.'</p>';
    				echo '<p>Access Token:<span style="word-wrap:break-word;width:100px;">'.$access_token.'</span></p>';
    				$results = $this->get_recent_data($user_id,$access_token);
    				echo '<p><b>Results</b>:</p>';
    				foreach($results->meta as $key => $val){
    					echo "<p>".$key.": ".$val."</p>";
    				}
    			}else{
    				echo '<p>Curl is <b>NOT</b> Enabled</p>';
    			}
    			return;
    		}
    
    		?>
    		<style>
    			.instagram_likes,.instagram_caption{
    				margin-bottom: 0px !important;
    			}
    			#instagram_widget li{
    				margin-bottom: 10px;
    			}
    		</style>
    		<?php
    		$results = $this->get_recent_data($user_id,$access_token);
    		$i=1;
    		echo "<ul id='instagram_widget'>";
    		if(!empty($results->data)){
    			foreach($results->data as $item){
    				if($picture_number == 0){
    					echo "<strong>Please set the Number of images to show within the widget</strong>";
    					break;
    				}
    
    				echo "
    <li>";
    				if(!empty($link_images)){
    					echo "<a>link."' target='_blank'><img src='".$item->images->$picture_size->url."' alt='".$title." image'/></a>";
    				}else{
    					echo "<img src='".$item->images->$picture_size->url."' alt=''/>";
    				}
    				if($show_likes){
    					if(!empty($item->likes->count)){
    						echo "<p class='instagram_likes'>Likes: <span class='likes_count'>".$item->likes->count."</span></p>";
    					}
    				}
    				if($show_caption){
    					if(!empty($item->caption->text)){
    						echo "<p class='instagram_caption'>".$item->caption->text."</p>";
    					}
    				}
    				echo "</li>
    ";
    				if($i == $picture_number){
    					echo "";
    					break;
    				}else{
    					$i++;
    				}
    			}
    		}else{
    			echo "<strong>The user currently does not have any images...</strong>";
    		}
    		echo $after_widget;
    	}
    
    	/* WP_Widget::update */
    	function update( $new_instance, $old_instance ) {
    		$instance = $old_instance;
    
    		//update setting with information form widget form
    		$instance['title'] = strip_tags($new_instance['title']);
    
    		$instance['access_token'] = strip_tags($new_instance['access_token']);
    		$instance['user_id'] = strip_tags($new_instance['user_id']);
    
    		$instance['picture_number'] = strip_tags($new_instance['picture_number']);
    		$instance['picture_size'] = strip_tags($new_instance['picture_size']);
    		$instance['link_images'] = strip_tags($new_instance['link_images']);
    
    		$instance['show_likes'] = strip_tags($new_instance['show_likes']);
    		$instance['show_caption'] = strip_tags($new_instance['show_caption']);
    
    		$instance['debug_mode'] = strip_tags($new_instance['debug_mode']);
    
    		return $instance;
    	}
    
    	/* WP_Widget::form */
    	function form( $instance ) {
    		if ( $instance ) {
    			$title = esc_attr( $instance[ 'title' ] );
    
    			$access_token = esc_attr( $instance[ 'access_token' ] );
    			$user_id = esc_attr( $instance[ 'user_id' ] );
    
    			$picture_number = esc_attr( $instance[ 'picture_number' ] );
    			$picture_size = esc_attr( $instance[ 'picture_size' ] );
    
    			$show_likes = esc_attr( $instance[ 'show_likes' ] );
    			$show_caption = esc_attr( $instance[ 'show_caption' ] );
    
    			$link_images = esc_attr( $instance[ 'link_images' ] );
    
    			$debug_mode = esc_attr( $instance['debug_mode'] );
    
    		}
    		else {
    			$title = __( 'Title', 'text_domain' );
    			$username = __( 'Username', 'text_domain' );
    			$access_token = __( 'Access Token', 'text_domain' );
    			$user_id = __( 'User ID', 'text_domain' );
    		}
    
    		$picture_sizes = array('thumbnail' => 'Thumbnail', 'low_resolution' => 'Low Resolution','standard_resolution' => 'Standard Resolution');
    		?>
    		<p>
    		<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
    		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
    		</p>
    		<p>
    		<label for="<?php echo $this->get_field_id('user_id'); ?>"><?php _e('User ID:'); ?></label>
    		<input class="widefat" id="<?php echo $this->get_field_id('user_id'); ?>" name="<?php echo $this->get_field_name('user_id'); ?>" type="text" value="<?php echo $user_id; ?>" />
    		</p>
    		<p>
    		<label for="<?php echo $this->get_field_id('access_token'); ?>"><?php _e('Access Token:'); ?></label>
    		<input class="widefat" id="<?php echo $this->get_field_id('access_token'); ?>" name="<?php echo $this->get_field_name('access_token'); ?>" type="text" value="<?php echo $access_token; ?>" />
    		</p>
    		<p>
    			<label for="<?php echo $this->get_field_id('picture_number'); ?>"><?php _e('Number of Images:'); ?></label>
    			<select id="<?php echo $this->get_field_id('picture_number'); ?>" name="<?php echo $this->get_field_name('picture_number'); ?>">
    					<option value="0">Select Number</option>
    				<?php for($i=1;$i<11;$i++):?>
    					<option value="<?php echo $i;?>" <?php if($i == $picture_number){echo 'selected="selected"';};?>><?php echo $i;?></option>
    				<?php endfor;?>
    			</select>
    		</p>
    		<p>
    			<label for="<?php echo $this->get_field_id('picture_size'); ?>"><?php _e('Picture Size:'); ?></label>
    			<select id="<?php echo $this->get_field_id('picture_size'); ?>" name="<?php echo $this->get_field_name('picture_size'); ?>">
    					<?php foreach($picture_sizes as $item => $val):?>
    						<option value="<?php echo $item;?>" <?php if($item == $picture_size){echo 'selected="selected"';};?>><?php echo $val;?></option>
    					<?php endforeach;?>
    			</select>
    		</p>
    		<p>
    		<label for="<?php echo $this->get_field_id('link_images'); ?>"><?php _e('Link images to full image:'); ?></label>
    		<input class="widefat" id="<?php echo $this->get_field_id('link_images'); ?>" name="<?php echo $this->get_field_name('link_images'); ?>" type="checkbox" <?php echo (($link_images)? "CHECKED":''); ?> />
    		</p>
    		<p>
    		<label for="<?php echo $this->get_field_id('show_likes'); ?>"><?php _e('Show Likes:'); ?></label>
    		<input class="widefat" id="<?php echo $this->get_field_id('show_likes'); ?>" name="<?php echo $this->get_field_name('show_likes'); ?>" type="checkbox" <?php echo (($show_likes)? "CHECKED":''); ?> />
    		</p>
    		<p>
    		<label for="<?php echo $this->get_field_id('show_caption'); ?>"><?php _e('Show Caption:'); ?></label>
    		<input class="widefat" id="<?php echo $this->get_field_id('show_caption'); ?>" name="<?php echo $this->get_field_name('show_caption'); ?>" type="checkbox" <?php echo (($show_caption)? "CHECKED":''); ?> />
    		</p>
    		<p>
    		<label for="<?php echo $this->get_field_id('debug_mode'); ?>"><?php _e('Debug Mode:'); ?></label>
    		<input class="widefat" id="<?php echo $this->get_field_id('debug_mode'); ?>" name="<?php echo $this->get_field_name('debug_mode'); ?>" type="checkbox" <?php echo (($debug_mode)? "CHECKED":''); ?> />
    		</p>
    		<p>If you do not have a ID or access token, please visit <a href="http://instagram.davidmregister.com/">Get Access token</a> to receive a valid token</p>
    		<?php
    	}
    
    	function get_recent_data($user_id, $access_token){
    		//CURL REST API to get users recent photos
    		$ch = curl_init();
    
    		//set the url, number of POST vars, POST data
    		curl_setopt($ch,CURLOPT_URL,'https://api.instagram.com/v1/users/'.$user_id.'/media/recent/?access_token='.$access_token);
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    		//execute post
    		$result = curl_exec($ch);
    
    		//close connection
    		curl_close($ch);
    		$result = json_decode($result);
    		return $result;
    	}
    
    } // class Instagrm_Feed_Widget
    
    // register Instagrm widget
    add_action( 'widgets_init', create_function( '', 'register_widget("Instagrm_Feed_Widget");' ) );
    
    ?>
    Criador do tópico wiruizfe

    (@wiruizfe)

    Ok, Então eu fiz o download do site via FTP (que esta grande com pouco mais de 10Gb), fiz tbm o bkp do DB em formato SQL mas tive que selecionar a opção de compactar como ZIP pq estava muito grande tbm.

    Agora quando importo para o DB para meu localhost aparece a seguinte mensagem:

    Import terminou com sucesso, 1 queries executados. (asemana_2.sql.zip)

    <b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 66500712 bytes) in <b>/home/httpd/html/pma/libraries/zip.lib.php</b> on line <b>116</b>
    [ Edit inline ] [ Edita ] [ Create PHP code ]

    Erro

    Static analysis:

    5 errors were found during analysis.

    Unexpected character. (near “:” at position 25)
    Unexpected beginning of statement. (near “br” at position 1)
    Unexpected beginning of statement. (near “b” at position 8)
    Unexpected beginning of statement. (near “Fatal” at position 10)
    Unrecognized statement type. (near “error” at position 16)

    Comando SQL:

    <b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 66500712 bytes) in <b>/home/httpd/html/pma/libraries/zip.lib.php</b> on line <b>116</b>

    Mensagens do MySQL : Documentação
    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘
    <b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tr’ at line 1

    Criador do tópico wiruizfe

    (@wiruizfe)

    Sou novo no WordPress, não consigo achar onde estão as informações do usuário e a integração!! Pode me ajudar?

Visualizando 8 respostas - 1 até 8 (de um total de 8)