コード例 #1
0
	<ol id="get_started">
        <li>Add your <a href="//developers.facebook.com/apps/" target="_blank">new Facebook App</a>.</li>
        <li>Add your App ID, App Secret and Page ID to start. <br> You will some of this info under your <a target="_blank" href="//developers.facebook.com/apps/">Facebook Developers account</a>. <br>
           <img src="<?php 
echo plugin_dir_url(__FILE__);
?>
/img/myapp.png" alt="" width="400px"></li>
        <li>Authorize your website with your Facebook App (Login Popup).</li>
        <li>Update your settings and start importing!</li>
        <li>Check your imported <a href="<?php 
echo admin_url('edit.php?post_type=facebookposts');
?>
" target="_blank">Facebook Posts</a></li>

		<?php 
if (FPI_SDK::is_logged()) {
    ?>
		
        	<li>Just in case you need. You can <a href="<?php 
    echo admin_url('tools.php?page=fpi-settings&remove_token=1');
    ?>
">remove your current Access Token here</a>. <br> After doing this you might need to authorize Facebook again</li>
        <?php 
}
?>

	</ol>



	<form class="options" method="post" action="options.php">
コード例 #2
0
        printf('<input type="text" id="fpi_app_id" name="fpi_option[fpi_app_id]" value="%s" />', esc_attr($this->options['fpi_app_id']));
    }
    public function fpi_app_secret_callback()
    {
        printf('<input type="password" id="fpi_app_secret" name="fpi_option[fpi_app_secret]" value="%s" />', isset($this->options['fpi_app_secret']) ? esc_attr($this->options['fpi_app_secret']) : '');
    }
    public function fpi_page_id_callback()
    {
        printf('<input type="text" id="fpi_page_id" name="fpi_option[fpi_page_id]" value="%s" />', esc_attr($this->options['fpi_page_id']));
        echo '<p class="description"><i><a href="//findmyfbid.com/">Click here</a> to find your Page ID.</i></p>';
    }
    public function fpi_access_token()
    {
        printf('<input type="password" disabled id="fpi_access_token" name="fpi_option[fpi_access_token]" value="%s" /><br><p class="description"><i>This Token is provided after you Log in with Facebook</i></p>', isset($this->options['fpi_access_token']) ? esc_attr($this->options['fpi_access_token']) : '');
    }
}
add_action('init', function () {
    // FPI Class page settings
    if (!is_admin()) {
        return false;
    }
    $my_settings_page = new FPI();
    // Remove Token
    if (FPI_SDK::is_new_token()) {
        FPI_SDK::remove_token();
    }
    // Create session, Get new Token
    if (FPI_SDK::is_logged()) {
        FPI_SDK::create_session();
    }
});