Plugin Directory

Changeset 1892383


Ignore:
Timestamp:
06/13/2018 06:58:52 PM (8 years ago)
Author:
timwass
Message:

generate access token option

Location:
easy-facebook-feed
Files:
38 added
5 edited

Legend:

Unmodified
Added
Removed
  • easy-facebook-feed/trunk/easy-facebook-feed.php

    r1888357 r1892383  
    44 * Plugin URI: http://shop.stage16.nl
    55 * Description: Easy Facebook Feed shows your Facebook feed in an easy way!
    6  * Version: 3.0.20
     6 * Version: 3.0.21
    77 * Author: timwass
    88 * Text Domain: easy-facebook-feed
  • easy-facebook-feed/trunk/includes/class.eff-admin.php

    r1888357 r1892383  
    130130
    131131        add_settings_field(
     132            'get_access_token', // ID
     133            __("Generate Access Token", 'easy-facebook-feed'), // Title
     134            array($this, 'get_access_token'), // Callback
     135            'my-setting-admin', // Page
     136            'setting_section_id' // Section
     137        );
     138
     139        add_settings_field(
    132140            'facebook_page_id', // ID
    133141            __("Facebook page ID", 'easy-facebook-feed'), // Title
     
    192200     *
    193201     * @param array $input Contains all settings fields as array keys
     202     * @return array
    194203     */
    195204    public function sanitize($input)
     
    249258
    250259    /**
     260     * Print the Section text
     261     */
     262    public function get_access_token()
     263    {
     264        print "<a class='button button-primary' href='https://www.facebook.com/dialog/oauth?scope=manage_pages&client_id=1123168491105924&redirect_uri=https://www.slickremix.com/facebook-token/&state=" . admin_url('admin.php?page=easy-facebook-feed') . "'>Login</a>
     265        <p class='description'>Login to Facebook and get your access token.</p>";
     266    }
     267
     268    /**
    251269     * Get the settings option array and print one of its values
    252270     */
     
    277295    public function enable_accesstoken()
    278296    {
    279         $checked = ($this->options['enable_accesstoken'] === "1") ? 'checked' : '';
     297        if(isset($_GET['final_response']) && $_GET['final_response'] === "true") {
     298            $checked = 'checked';
     299        } else {
     300            $checked = ($this->options['enable_accesstoken'] === "1") ? 'checked' : '';
     301        }
     302
    280303        echo '<input type="checkbox" name="eff_options[enable_accesstoken]" id="enable_accesstoken" value="1" '.$checked.' />';
    281304    }
     
    286309    public function accesstoken_input()
    287310    {
    288         printf(
    289             '<input type="text" name="eff_options[accesstoken]" id="accesstoken" value="%s" />',
    290             isset($this->options['accesstoken']) ? esc_attr($this->options['accesstoken']) : ''
    291         );
     311        if(isset($_GET['final_response']) && $_GET['final_response'] === "true") {
     312            print '<input type="text" name="eff_options[accesstoken]" id="accesstoken" value="'.$_GET['access_token'].'" />
     313            <p class="description" style="color: green; font-weight: bold;">Access Token set</p>';
     314        } else {
     315            printf(
     316                '<input type="text" name="eff_options[accesstoken]" id="accesstoken" value="%s" />',
     317                isset($this->options['accesstoken']) ? esc_attr($this->options['accesstoken']) : ''
     318            );
     319        }
    292320    }
    293321
  • easy-facebook-feed/trunk/includes/class.eff-connect.php

    r1888357 r1892383  
    1414    }
    1515
     16    /**
     17     * @return string
     18     */
    1619    private function getAccessToken()
    1720    {
     
    2326
    2427        return $token;
     28    }
     29
     30    /**
     31     * @param $token
     32     * @return string
     33     */
     34    public function setAccessToken($token)
     35    {
     36        $this->accessToken = $token;
     37
     38        return $this->accessToken;
    2539    }
    2640
  • easy-facebook-feed/trunk/includes/class.eff.php

    r1782913 r1892383  
    3333        $shortcode_atts = shortcode_atts(array(
    3434            'id' => $options['facebook_page_id'],
    35             'limit' => $options['facebook_post_limit'],
     35            'limit' => $options['facebook_post_limit']
    3636        ), $atts);
    3737
     
    5454        foreach ($shortcode_atts['id'] as $id) {
    5555            $con = new EffConnect();
     56
     57            if(isset($atts['access_token'])) {
     58                $con->setAccessToken($atts['access_token']);
     59            }
     60           
    5661            $feed = $con->eff_get_page_feed($id, $shortcode_atts['limit']);
    5762            $page = $con->eff_get_page($id);
  • easy-facebook-feed/trunk/readme.txt

    r1888357 r1892383  
    55Requires at least: 3.0.1
    66Tested up to: 4.9
    7 Stable tag: 3.0.20
    8 Version: 3.0.20
     7Stable tag: 3.0.21
     8Version: 3.0.21
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8787== Changelog ==
    8888
     89= 3.0.21 =
     90* Generate access token option
     91
    8992= 3.0.20 =
    9093* Added option to add your own access token
Note: See TracChangeset for help on using the changeset viewer.