コード例 #1
0
ファイル: ic-hooks.php プロジェクト: praveenhotha/ig
function destroy_api_session()
{
    ICStore()->clear();
}
コード例 #2
0
ファイル: ic-functions.php プロジェクト: praveenhotha/ig
function save_token_in_session($access_token)
{
    // save token in session
    ICStore()->set(IC_TOKEN_STORAGE_KEY, $access_token);
    // update tokens in proxy instance
    ICApi()->update_tokens($access_token);
    // fetch user profile
    $response = ICApi()->auth_request('/users/me');
    // dd($response);
    // store in session
    ICStore()->set(IC_LOGGED_IN_USER_KEY, $response);
}
コード例 #3
0
ファイル: header-wrap.php プロジェクト: praveenhotha/ig
<?php

$community = ICStore()->get("COMMUNITY_CONFIG");
if (get_query_var('idea_slug', false)) {
    ?>

	<?php 
    get_template_part('templates/header-idea-public-page');
    ?>

<?php 
} else {
    ?>
	<div id="site">
			<div id="loading">
				<div class="spinner">
					<div class="bounce1"></div>
					<div class="bounce2"></div>
					<div class="bounce3"></div>
				</div>
			</div>

		<div id="page-wrapper">
			<div id="page-header" class="bg-black font-inverse">
				<div id="header-logo" class="logo-bg">
					<a href="" style="background-image:url('<?php 
    echo $community->logo;
    ?>
')" class="logo-content-big" title="<?php 
    echo bloginfo('title');
    ?>
コード例 #4
0
ファイル: _front-page.php プロジェクト: praveenhotha/ig
					<i class="glyph-icon icon-chevron-left" style="display:none;"></i>
				</button>
				<div id="app-featured-region-container" class="col-md-2 all-animate pad0A" style="margin-top:10px;">
					<img class="img-responsive mrg10B" src="/wp-content/themes/ideagist-community/assets/img/ideagist-ads-1.jpg">
					<img class="img-responsive mrg10B" src="/wp-content/themes/ideagist-community/assets/img/ideagist-ads-2.jpg">
					<img class="img-responsive mrg10B" src="/wp-content/themes/ideagist-community/assets/img/ideagist-ads-3.jpg">
				</div>
			</div>
		</div>
	</div>

	<!-- JS config vars -->

	<script type="text/javascript">
		var community = <?php 
    echo json_encode(ICStore()->get("COMMUNITY_CONFIG"));
    ?>
;
		var community_id = parseInt('<?php 
    echo IC_COMMUNITY_ID;
    ?>
');
		var apiurl = '<?php 
    echo IC_API_BASE_URL;
    ?>
';
	</script>

	<!-- Templates -->

	<?php 
コード例 #5
0
 private function done($oauth_token, $oauth_verifier)
 {
     //get the access token
     $access_token = $this->accessToken($oauth_verifier, $oauth_token);
     // save token in session
     ICStore()->set(IC_TOKEN_STORAGE_KEY, $access_token);
     // update tokens in proxy instance
     ICApi()->update_tokens($access_token);
     // fetch user profile
     $response = ICApi()->auth_request('/users/me');
     // store in session
     ICStore()->set(IC_LOGGED_IN_USER_KEY, $response);
     // check if redirect_to url is set in session, then use it
     $redirect_to = self::$store->get('redirect_to');
     if (!empty($redirect_to)) {
         // remove from session
         self::$store->set('redirect_to', '');
         wp_redirect($redirect_to);
         exit;
     }
     //redirect to home
     wp_redirect(site_url('/dashboard'));
     exit;
 }
コード例 #6
0
 public function ideagist_api_request_handler()
 {
     if (empty($GLOBALS['wp']->query_vars['ideagist_proxyapi'])) {
         return;
     }
     if (empty($_REQUEST['path'])) {
         return;
     }
     $path = urldecode(trim($_REQUEST['path']));
     $parts = explode('?', $path);
     if (count($parts) > 0) {
         $path = $parts[0];
         $params = $parts[1];
         parse_str($params, $data);
         // dd($data);
         unset($_REQUEST['path']);
         // dd($data);
         if (count($_REQUEST) > 0) {
             $data = array_merge_recursive($data, $_REQUEST);
         }
         // dd($data);
         if (is_array($data) && count($data) > 0) {
             $path .= '?' . urldecode(http_build_query($data));
         }
         // dd($path);
     }
     // dd($path);
     $request_method = strtolower($_SERVER['REQUEST_METHOD']);
     if (in_array($request_method, array('post', 'put', 'patch'))) {
         // if( $request_method == 'put' ) {
         //grab the data
         $data = json_decode(file_get_contents('php://input'), true);
         // if( !empty( $_GET['api'] ) && $_GET['api'] == 'public' ) {
         // 	$method = $_GET['method'];
         // 	$response = $this->public_api_request( $method, $data );
         // } else {
         // } else {
         // 	$data = $_POST;
         // }
         // parse_str( file_get_contents('php://input'), $data );
         // dd( $data);
         $response = $this->auth_post_request($path, $data);
         // }
     } elseif ($request_method == 'get') {
         // check for request params in path
         // $pathParts = explode( '?', $path );
         // if( is_array( $pathParts ) && count( $pathParts ) > 1 ) {
         // 	$path = $pathParts[0];
         // 	$query_string = $pathParts[1];
         // 	parse_str( $query_string, $data );
         // }
         // if( $path === '/users/me' || $path === '/users/me/' ) {
         // header( 'Content-Type: text/plain' );
         //fetch from session and return
         // $response = ICStore()->get( IC_LOGGED_IN_USER_KEY );
         // } else {
         $response = $this->auth_get_request($path);
         if ($path === '/users/me' || $path === '/users/me/') {
             // update session data
             ICStore()->set(IC_LOGGED_IN_USER_KEY, $response);
         }
         // }
     } elseif ($request_method == 'delete') {
         $response = $this->auth_delete_request($path);
     } else {
         $response = array('method not implemented');
     }
     header("Content-Type: application/json; charset=UTF-8");
     if (!is_string($response)) {
         $response = json_encode($response);
     }
     die($response);
 }