function enjoyinstagram_options_page()
    {
        $tab = isset($_GET['tab']) ? $_GET['tab'] : $this->enjoyinstagram_general_settings_key;
        ?>
		<div class="wrap">
			<h2><div class="ei_block">
					<div class="ei_left_block">
						<div class="ei_hard_block">
							<?php 
        echo '<img src="' . plugins_url('images/enjoyinstagram.png', __FILE__) . '" > ';
        ?>
						</div>

						<div class="ei_twitter_block">
							<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.mediabeta.com/enjoy-instagram/" data-text="I've just installed Enjoy Instagram for wordpress. Awesome!" data-hashtags="wordpress">Tweet</a>
							<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
							</script>
						</div>

						<div id="fb-root"></div>
						<script>(function(d, s, id) {
								var js, fjs = d.getElementsByTagName(s)[0];
								if (d.getElementById(id)) return;
								js = d.createElement(s); js.id = id;
								js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&appId=359330984151581&version=v2.0";
								fjs.parentNode.insertBefore(js, fjs);
							}(document, 'script', 'facebook-jssdk'));</script>
						<div class="ei_facebook_block">
							<div class="fb-like" data-href="http://www.mediabeta.com/enjoy-instagram/" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true">
							</div>
						</div>
					</div>

					<div id="buy_me_a_coffee" style="background:url(<?php 
        echo plugins_url('images/buymeacoffee.png', __FILE__);
        ?>
)#fff no-repeat; ">

						<div class="pad_coffee">
							<span class="coffee_title">Buy me a coffee!</span>
							<p><span>If you liked our work please consider to make a kind donation through Paypal.</span></p>
							<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="8MXZ37DWHAX46">
<input type="image" src="https://www.paypalobjects.com/en_US/IT/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
</form>
						</div>
					</div>
				</div>
				<div class="ei_block">


					<div id="premium_release">

						<div class="pad_premium_release">
							<span class="coffee_title">Premium Version is <a href="http://www.mediabeta.com/enjoy-instagram-premium/">HERE</a> !</span>
							<p><span style="color:#900; font-weight: bold;">Enjoy Instagram Premium</span> is the only plugin that allows you to <span style="color:#900; font-weight: bold;">moderate</span> the pictures and choose which show.<br />
								Discover now all the features and innovations, <a href="http://www.mediabeta.com/enjoy-instagram-premium/">CLICK HERE</a></p>

						</div>

					</div>
				</div>
			</h2>


			<?php 
        $this->plugin_options_tabs();
        ?>
			<?php 
        if ($tab == 'enjoyinstagram_general_settings') {
            if (isset($_GET['code']) && $_GET['code'] != '') {
                // get access token
                $client_id = get_option('enjoyinstagram_client_id');
                $client_secret = get_option('enjoyinstagram_client_secret');
                $redirect_uri = admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings');
                $code = $_GET['code'];
                $apiData = array('client_id' => $client_id, 'client_secret' => $client_secret, 'grant_type' => 'authorization_code', 'redirect_uri' => $redirect_uri, 'code' => $code);
                $apiHost = 'https://api.instagram.com/oauth/access_token';
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $apiHost);
                curl_setopt($ch, CURLOPT_POST, count($apiData));
                curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($apiData));
                curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                $jsonData = curl_exec($ch);
                curl_close($ch);
                $user = json_decode($jsonData, true);
                $enjoyinstagram_user_id = $user['user']['id'];
                $enjoyinstagram_user_username = replace4byte($user['user']['username']);
                $enjoyinstagram_user_profile_picture = $user['user']['profile_picture'];
                $enjoyinstagram_user_fullname = replace4byte($user['user']['full_name']);
                $enjoyinstagram_user_website = $user['user']['website'];
                $enjoyinstagram_user_bio = replace4byte($user['user']['bio']);
                $enjoyinstagram_access_token = $user['access_token'];
                update_option('enjoyinstagram_user_id', $enjoyinstagram_user_id);
                update_option('enjoyinstagram_user_username', $enjoyinstagram_user_username);
                update_option('enjoyinstagram_user_profile_picture', $enjoyinstagram_user_profile_picture);
                update_option('enjoyinstagram_user_fullname', $enjoyinstagram_user_fullname);
                update_option('enjoyinstagram_user_website', $enjoyinstagram_user_website);
                update_option('enjoyinstagram_user_bio', $enjoyinstagram_user_bio);
                update_option('enjoyinstagram_access_token', $enjoyinstagram_access_token);
                // get accee token fine
                include 'library/profile_auth.php';
            } else {
                if (!get_option('enjoyinstagram_access_token')) {
                    include 'library/autenticazione.php';
                } else {
                    include 'library/profile_auth.php';
                }
            }
        } else {
            if ($tab == 'enjoyinstagram_advanced_settings') {
                include 'library/impostazioni_shortcode.php';
            }
        }
        ?>
		</div>
	<?php 
    }
Beispiel #2
0
    function enjoyinstagram_options_page()
    {
        $tab = isset($_GET['tab']) ? $_GET['tab'] : $this->enjoyinstagram_general_settings_key;
        ?>
		<div class="wrap">
			<h2><div class="ei_block">
					<div class="ei_left_block">
						<div class="ei_hard_block">
							<?php 
        echo '<img src="' . plugins_url('images/enjoyinstagram.png', __FILE__) . '" > ';
        ?>
						</div>

						<div class="ei_twitter_block">
							<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.mediabeta.com/enjoy-instagram/" data-text="I've just installed Enjoy Instagram for wordpress. Awesome!" data-hashtags="wordpress">Tweet</a>
							<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
							</script>
						</div>

						<div id="fb-root"></div>
						<script>(function(d, s, id) {
								var js, fjs = d.getElementsByTagName(s)[0];
								if (d.getElementById(id)) return;
								js = d.createElement(s); js.id = id;
								js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&appId=359330984151581&version=v2.0";
								fjs.parentNode.insertBefore(js, fjs);
							}(document, 'script', 'facebook-jssdk'));</script>
						<div class="ei_facebook_block">
							<div class="fb-like" data-href="http://www.mediabeta.com/enjoy-instagram/" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true">
							</div>
						</div>
					</div>

					<div id="buy_me_a_coffee" style="background:url(<?php 
        echo plugins_url('images/buymeacoffee.png', __FILE__);
        ?>
)#fff no-repeat; ">

						<div class="pad_coffee">
							<span class="coffee_title">Buy me a coffee!</span>
							<p><span>If you liked our work please consider to make a kind donation through Paypal.</span></p>
							<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
								<input type="hidden" name="cmd" value="_s-xclick">
								<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYA2UD9nEEx7DpSJjZ9cMPpXQcwkplkngz5Om2lrCRndClH2wsLNtoW6zpt0WHv90aE8pabeHs019W7MSA/7lPiNbMr62sSV/b8+80b9wBX9ch7GTKNcgXQ3qO2Gg16+iRa0EkwFZY6wjVu1d6cjYUROR1FYziTkOwZ0rFB1BIpDOTELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIxmfBLfx5kLKAgaCjqYuWhMkP5ATABAMc7wK8XgJ3TEvNz/GfgaA5eVLM1+g3CYoDo/gBat7kKhfRUh03V4NLSuk+AwDbOzHUx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AxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTQwMzE3MTUzNDA2WjAjBgkqhkiG9w0BCQQxFgQULx/mUONLbAeob5jHfwrjw49VOi0wDQYJKoZIhvcNAQEBBQAEgYBJzOmAZY/fXJWt1EHmthZz55pvpW0T1z7F4XVAk85mH/0ZIgRrA9Bj5lsU/3YKvx3LCj4SFRRkTIb0f77/vWtN1BoZi1wWwSMODl9kdbVlQNh61FVXBp1FaKoiq1pn176D2uKGpRloQiWH2jP+TGrS81XTEI4rVai73+Tr5Ms/RQ==-----END PKCS7-----
            ">
								<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
								<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
							</form>
						</div>
					</div>
				</div>
				<div class="ei_block">


					<div id="premium_release">

						<div class="pad_premium_release">
							<span class="coffee_title">Premium Version is <a href="http://www.mediabeta.com/enjoy-instagram-premium/">HERE</a> !</span>
							<p><span style="color:#900; font-weight: bold;">Enjoy Instagram Premium</span> is the only plugin that allows you to <span style="color:#900; font-weight: bold;">moderate</span> the pictures and choose which show.<br />
								Discover now all the features and innovations, <a href="http://www.mediabeta.com/enjoy-instagram-premium/">CLICK HERE</a></p>

						</div>

					</div>
				</div>
			</h2>


			<?php 
        $this->plugin_options_tabs();
        ?>
			<?php 
        if ($tab == 'enjoyinstagram_general_settings') {
            if (isset($_GET['code']) && $_GET['code'] != '') {
                // get access token
                $client_id = get_option('enjoyinstagram_client_id');
                $client_secret = get_option('enjoyinstagram_client_secret');
                $redirect_uri = admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings');
                $code = $_GET['code'];
                $apiData = array('client_id' => $client_id, 'client_secret' => $client_secret, 'grant_type' => 'authorization_code', 'redirect_uri' => $redirect_uri, 'code' => $code);
                $apiHost = 'https://api.instagram.com/oauth/access_token';
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $apiHost);
                curl_setopt($ch, CURLOPT_POST, count($apiData));
                curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($apiData));
                curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                $jsonData = curl_exec($ch);
                curl_close($ch);
                $user = json_decode($jsonData, true);
                $enjoyinstagram_user_id = $user['user']['id'];
                $enjoyinstagram_user_username = replace4byte($user['user']['username']);
                $enjoyinstagram_user_profile_picture = $user['user']['profile_picture'];
                $enjoyinstagram_user_fullname = replace4byte($user['user']['full_name']);
                $enjoyinstagram_user_website = $user['user']['website'];
                $enjoyinstagram_user_bio = replace4byte($user['user']['bio']);
                $enjoyinstagram_access_token = $user['access_token'];
                update_option('enjoyinstagram_user_id', $enjoyinstagram_user_id);
                update_option('enjoyinstagram_user_username', $enjoyinstagram_user_username);
                update_option('enjoyinstagram_user_profile_picture', $enjoyinstagram_user_profile_picture);
                update_option('enjoyinstagram_user_fullname', $enjoyinstagram_user_fullname);
                update_option('enjoyinstagram_user_website', $enjoyinstagram_user_website);
                update_option('enjoyinstagram_user_bio', $enjoyinstagram_user_bio);
                update_option('enjoyinstagram_access_token', $enjoyinstagram_access_token);
                // get accee token fine
                include 'library/profile_auth.php';
            } else {
                if (!get_option('enjoyinstagram_access_token')) {
                    include 'library/autenticazione.php';
                } else {
                    include 'library/profile_auth.php';
                }
            }
        } else {
            if ($tab == 'enjoyinstagram_advanced_settings') {
                include 'library/impostazioni_shortcode.php';
            }
        }
        ?>
		</div>
	<?php 
    }