• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP nxs_settings_save函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中nxs_settings_save函数的典型用法代码示例。如果您正苦于以下问题:PHP nxs_settings_save函数的具体用法?PHP nxs_settings_save怎么用?PHP nxs_settings_save使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了nxs_settings_save函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: nxs_save_ntwrksOpts

 function nxs_save_ntwrksOpts($networks)
 {
     if (function_exists('nxs_settings_save')) {
         nxs_settings_save($networks);
     }
     if (function_exists('get_option')) {
         if (!empty($networks)) {
             update_option('NS_SNAutoPoster', $networks);
         }
     }
 }
开发者ID:digideskio,项目名称:stammtisch,代码行数:11,代码来源:nxs_functions_adv.php


示例2: showGenNTSettings

        function showGenNTSettings($ntOpts)
        {
            global $nxs_plurl, $nxs_snapSetPgURL, $nxs_gOptions;
            $ntInfo = $this->ntInfo;
            if (isset($_GET['auth']) && $_GET['auth'] == $ntInfo['lcode']) {
                require_once 'apis/scOAuth.php';
                $options = $ntOpts[$_GET['acc']];
                $consumer_key = $options['appKey'];
                $consumer_secret = $options['appSec'];
                $callback_url = $nxs_snapSetPgURL . "&auth=" . $ntInfo['lcode'] . "a&acc=" . $_GET['acc'];
                $tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret);
                $tum_oauth->baseURL = 'https://www.flickr.com/services';
                $tum_oauth->request_token_path = '/oauth/request_token';
                $tum_oauth->access_token_path = '/oauth/access_token';
                $request_token = $tum_oauth->getReqToken($callback_url);
                $options['oAuthToken'] = $request_token['oauth_token'];
                $options['oAuthTokenSecret'] = $request_token['oauth_token_secret'];
                switch ($tum_oauth->http_code) {
                    case 200:
                        $url = 'https://www.flickr.com/services/oauth/authorize?oauth_token=' . $options['oAuthToken'];
                        if (function_exists('get_option')) {
                            $nxs_gOptions = get_option('NS_SNAutoPoster');
                        }
                        if (!empty($nxs_gOptions)) {
                            $nxs_gOptions[$ntInfo['lcode']][$_GET['acc']] = $options;
                            nxs_settings_save($nxs_gOptions);
                        }
                        echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "' . $url . '"</script>';
                        break;
                    default:
                        echo '<br/><b style="color:red">Could not connect to Flickr. Refresh the page or try again later.</b>';
                        die;
                }
                die;
            }
            if (isset($_GET['auth']) && $_GET['auth'] == $ntInfo['lcode'] . 'a') {
                require_once 'apis/scOAuth.php';
                $options = $ntOpts[$_GET['acc']];
                $consumer_key = $options['appKey'];
                $consumer_secret = $options['appSec'];
                $tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret, $options['oAuthToken'], $options['oAuthTokenSecret']);
                //prr($tum_oauth);
                $tum_oauth->baseURL = 'https://www.flickr.com/services';
                $tum_oauth->request_token_path = '/oauth/request_token';
                $tum_oauth->access_token_path = '/oauth/access_token';
                $access_token = $tum_oauth->getAccToken($_GET['oauth_verifier']);
                prr($access_token);
                $options['accessToken'] = $access_token['oauth_token'];
                $options['accessTokenSec'] = $access_token['oauth_token_secret'];
                if (function_exists('get_option')) {
                    $nxs_gOptions = get_option('NS_SNAutoPoster');
                }
                if (!empty($nxs_gOptions)) {
                    $nxs_gOptions[$ntInfo['lcode']][$_GET['acc']] = $options;
                    nxs_settings_save($nxs_gOptions);
                }
                $tum_oauth = new wpScoopITOAuth($consumer_key, $consumer_secret, $options['accessToken'], $options['accessTokenSec']);
                echo "OK. Let's Get Profile: ";
                prr($access_token);
                $params = array('format' => 'php_serial', 'method' => 'flickr.urls.getUserProfile');
                $uinfo = $tum_oauth->makeReq('https://api.flickr.com/services/rest/', $params);
                // prr($uinfo);die();
                if (is_array($uinfo) && isset($uinfo['user'])) {
                    $options['appAppUserName'] = $access_token['username'] . "(" . urldecode($access_token['fullname']) . ")";
                    $options['appAppUserID'] = urldecode($uinfo['user']['nsid']);
                    $options['userURL'] = urldecode($uinfo['user']['url']);
                    if (function_exists('get_option')) {
                        $nxs_gOptions = get_option('NS_SNAutoPoster');
                    }
                    if (!empty($nxs_gOptions)) {
                        $nxs_gOptions[$ntInfo['lcode']][$_GET['acc']] = $options;
                        nxs_settings_save($nxs_gOptions);
                    }
                }
                //die();
                if (!empty($options['appAppUserID'])) {
                    $gGet = $_GET;
                    unset($gGet['auth']);
                    unset($gGet['acc']);
                    unset($gGet['oauth_token']);
                    unset($gGet['oauth_verifier']);
                    unset($gGet['post_type']);
                    $sturl = explode('?', $nxs_snapSetPgURL);
                    $nxs_snapSetPgURL = $sturl[0] . (!empty($gGet) ? '?' . http_build_query($gGet) : '');
                    echo '<br/><br/>All good?! Redirecting ..... <script type="text/javascript">window.location = "' . $nxs_snapSetPgURL . '"</script>';
                    break;
                    die;
                } else {
                    die("<span style='color:red;'>ERROR: Authorization Error: <span style='color:darkred; font-weight: bold;'>" . print_r($uinfo, true) . "</span></span>");
                }
            }
            ?>
    <div class="nxs_box">
      <div class="nxs_box_header">
        <div class="nsx_iconedTitle" style="margin-bottom:1px;background-image:url(<?php 
            echo $nxs_plurl;
            ?>
img/<?php 
            echo $ntInfo['lcode'];
            ?>
//.........这里部分代码省略.........
开发者ID:jguzmanf88,项目名称:social-networks-auto-poster-facebook-twitter-g,代码行数:101,代码来源:fl.php


示例3: showGenNTSettings

        function showGenNTSettings($ntOpts)
        {
            global $nxs_snapSetPgURL, $nxs_plurl, $nxs_gOptions;
            $ntInfo = $this->ntInfo;
            // V2 Auth
            if (isset($_GET['code']) && $_GET['code'] != '' && isset($_GET['state']) && substr($_GET['state'], 0, 7) == 'nxs-li-') {
                $at = $_GET['code'];
                $ii = str_replace('nxs-li-', '', $_GET['state']);
                echo "----=={ oAuth 2.0 Wordflow }==----<br/>-= This is normal technical authorization info that will dissapear (Unless you get some errors) =- <br/><br/><br/>";
                $gGet = $_GET;
                unset($gGet['code']);
                unset($gGet['state']);
                unset($gGet['post_type']);
                $sturl = explode('?', $nxs_snapSetPgURL);
                $nxs_snapSetPgURL = $sturl[0] . (!empty($gGet) ? '?' . http_build_query($gGet) : '');
                $nto = $ntOpts[$ii];
                $wprg = array();
                $wprg['sslverify'] = false;
                if (isset($nto['liAPIKey'])) {
                    echo "-=";
                    prr($nto);
                    // die();
                    $tknURL = 'https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=' . $at . '&redirect_uri=' . urlencode($nxs_snapSetPgURL) . '&client_id=' . $nto['liAPIKey'] . '&client_secret=' . $nto['liAPISec'];
                    $response = wp_remote_post($tknURL, $wprg);
                    prr($tknURL);
                    if (is_object($response) && isset($response->errors)) {
                        prr($response);
                        die;
                    }
                    if (is_array($response) && stripos($response['body'], '"error":') !== false) {
                        prr($response['body']);
                        prr(json_decode($response['body'], true));
                        die;
                    }
                    $resp = json_decode($response['body'], true);
                    prr($resp);
                    if (!is_array($resp) || empty($resp['access_token'])) {
                        prr($resp);
                        die;
                    }
                    if (function_exists('get_option')) {
                        $currTime = time() + get_option('gmt_offset') * HOUR_IN_SECONDS;
                    } else {
                        $currTime = time();
                    }
                    $nto['liAccessToken'] = $resp['access_token'];
                    $nto['liAccessTokenSecret'] = 'No Need for oAuth V2';
                    $nto['liOAuthVerifier'] = 'No Need for oAuth V2';
                    $nto['liAccessTokenExp'] = $currTime + $resp['expires_in'];
                    echo "<br/>----=={ Expires: " . date('Y-m-d H:i:s', $nto['liAccessTokenExp']) . " }==---- <br/>";
                    $tknURL = 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name)?format=json&oauth2_access_token=' . $nto['liAccessToken'];
                    $response = wp_remote_get($tknURL, $wprg);
                    prr($tknURL);
                    prr($response);
                    $user = json_decode($response['body'], true);
                    if (!empty($user['id'])) {
                        $nto['liUserID'] = $user['id'];
                        $nto['liUserInfo'] = $user['firstName'] . $user['lastName'] . (!empty($user['id']) ? " (" . $user['id'] . ")" : '');
                        $nto['isV2'] = true;
                        if (function_exists('get_option')) {
                            $nxs_gOptions = get_option('NS_SNAutoPoster');
                        }
                        if (!empty($nxs_gOptions)) {
                            $nxs_gOptions['li'][$ii] = $nto;
                            prr($nto);
                            nxs_settings_save($nxs_gOptions);
                        }
                        ?>
<script type="text/javascript">window.location = "<?php 
                        echo $nxs_snapSetPgURL;
                        ?>
"</script>      
        <?php 
                    }
                }
                die;
            }
            // V1 Auth
            if (isset($_GET['auth']) && $_GET['auth'] == 'li') {
                require_once 'apis/liOAuth.php';
                $options = $ntOpts[$_GET['acc']];
                $api_key = $options['liAPIKey'];
                $api_secret = $options['liAPISec'];
                $callback_url = $nxs_snapSetPgURL . "&auth=lia&acc=" . $_GET['acc'];
                $li_oauth = new nsx_LinkedIn($api_key, $api_secret, $callback_url);
                $request_token = $li_oauth->getRequestToken();
                //echo "####"; prr($request_token); die();
                if (!is_object($request_token)) {
                    echo "### LinkedIn Authorization Error:";
                    prr($request_token);
                    if (is_string($request_token) && stripos($request_token, 'timestamp') !== false) {
                        echo "Your Server Time: " . date('m/d/Y h:i:s a');
                        echo " Correct Time: " . date('m/d/Y h:i:s a', nxs_ntp_time('t1.timegps.net'));
                    }
                    die;
                }
                $options['liOAuthToken'] = $request_token->key;
                $options['liOAuthTokenSecret'] = $request_token->secret;
                // prr($li_oauth);
                switch ($li_oauth->http_code) {
//.........这里部分代码省略.........
开发者ID:Florian-Eschenbacher,项目名称:schneeeule,代码行数:101,代码来源:li.php


示例4: nxs_doPublishToDA

 function nxs_doPublishToDA($postID, $options)
 {
     $ntCd = 'DA';
     $ntCdL = 'da';
     $ntNm = 'deviantART';
     if (!is_array($options)) {
         $options = maybe_unserialize(get_post_meta($postID, $options, true));
     }
     $addParams = nxs_makeURLParams(array('NTNAME' => $ntNm, 'NTCODE' => $ntCd, 'POSTID' => $postID, 'ACCNAME' => $options['nName']));
     $blogTitle = htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES);
     if ($blogTitle == '') {
         $blogTitle = home_url();
     }
     $ii = $options['ii'];
     if (!isset($options['pType'])) {
         $options['pType'] = 'im';
     }
     if ($options['pType'] == 'sh') {
         sleep(rand(1, 10));
     }
     $logNT = '<span style="color:#800000">deviantART</span> - ' . $options['nName'];
     $snap_ap = get_post_meta($postID, 'snap' . $ntCd, true);
     $snap_ap = maybe_unserialize($snap_ap);
     if ($options['pType'] != 'aj' && is_array($snap_ap) && (nxs_chArrVar($snap_ap[$ii], 'isPosted', '1') || nxs_chArrVar($snap_ap[$ii], 'isPrePosted', '1'))) {
         $snap_isAutoPosted = get_post_meta($postID, 'snap_isAutoPosted', true);
         if ($snap_isAutoPosted != '2') {
             nxs_addToLogN('W', 'Notice', $logNT, '-=Duplicate=- Post ID:' . $postID, 'Already posted. No reason for posting duplicate' . ' |' . $uqID);
             return;
         }
     }
     $message = array('message' => '', 'link' => '', 'imageURL' => '', 'videoURL' => '');
     if ($postID == '0') {
         echo "Testing ... <br/><br/>";
         $message['description'] = 'Test Post, Description';
         $message['title'] = 'Test Post - Title';
         $message['url'] = home_url();
     } else {
         nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPrePosted' => '1'));
         $post = get_post($postID);
         if (!$post) {
             return;
         }
         $options['daTitleFormat'] = nsFormatMessage($options['daTitleFormat'], $postID, $addParams);
         $options['daTextFormat'] = nsFormatMessage($options['daTextFormat'], $postID, $addParams);
         // prr($options['daTextFormat']); echo $postID;
         $extInfo = ' | PostID: ' . $postID . " - " . (isset($post) && is_object($post) ? $post->post_title : '');
     }
     //## Actual Post
     $ntToPost = new nxs_class_SNAP_DA();
     $ret = $ntToPost->doPostToNT($options, $message);
     // echo "~~~"; prr($ret); echo "+++";
     //## Save Session
     if (empty($options['ck'])) {
         $options['ck'] = '';
     }
     if (!empty($ret) && is_array($ret) && !empty($ret['ck']) && !empty($ret['ck']) && serialize($ret['ck']) != $options['ck']) {
         $options['ck'] = serialize($ret['ck']);
         $options['mh'] = serialize($ret['mh']);
         if (function_exists('get_option')) {
             $nxs_gOptions = get_option('NS_SNAutoPoster');
         }
         if (!empty($nxs_gOptions)) {
             $nxs_gOptions['da'][$ii] = $options;
             nxs_settings_save($nxs_gOptions);
         }
     }
     //## Process Results
     if (!is_array($ret) || $ret['isPosted'] != '1') {
         //## Error
         if ($postID == '0') {
             prr($ret);
         }
         nxs_addToLogN('E', 'Error', $logNT, '-=ERROR=- ' . print_r($ret, true), $extInfo);
     } else {
         // ## All Good - log it.
         if ($postID == '0') {
             nxs_addToLogN('S', 'Test', $logNT, 'OK - TEST Message Posted ');
             echo _e('OK - Message Posted, please see your ' . $logNT . ' Page. ', 'social-networks-auto-poster-facebook-twitter-g');
         } else {
             nxs_metaMarkAsPosted($postID, $ntCd, $options['ii'], array('isPosted' => '1', 'pgID' => $ret['postID'], 'postURL' => $ret['postURL'], 'pDate' => date('Y-m-d H:i:s')));
             nxs_addToLogN('S', 'Posted', $logNT, 'OK - Message Posted ', $extInfo);
         }
     }
     //## Return Result
     if ($ret['isPosted'] == '1') {
         return 200;
     } else {
         return print_r($ret, true);
     }
 }
开发者ID:Florian-Eschenbacher,项目名称:schneeeule,代码行数:90,代码来源:da.php


示例5: showGenNTSettings

        function showGenNTSettings($ntOpts)
        {
            global $nxs_snapSetPgURL, $nxs_plurl, $nxs_gOptions;
            $ntInfo = $this->ntInfo;
            // V2 Auth
            if (isset($_GET['code']) && $_GET['code'] != '' && isset($_GET['state']) && substr($_GET['state'], 0, 7) == 'nxs-bg-') {
                $at = $_GET['code'];
                $ii = str_replace('nxs-bg-', '', $_GET['state']);
                echo "----=={ oAuth 2.0 Wordflow }==----<br/>-= This is normal technical authorization info that will dissapear (Unless you get some errors) =- <br/><br/><br/>";
                $gGet = $_GET;
                unset($gGet['code']);
                unset($gGet['state']);
                unset($gGet['post_type']);
                $sturl = explode('?', $nxs_snapSetPgURL);
                $nxs_snapSetPgURL = $sturl[0] . (!empty($gGet) ? '?' . http_build_query($gGet) : '');
                $nto = $ntOpts[$ii];
                $wprg = array();
                $wprg['sslverify'] = false;
                if (isset($nto['APIKey'])) {
                    echo "-=";
                    prr($nto);
                    // die();
                    $tknURL = 'https://www.googleapis.com/oauth2/v3/token?code=' . $at . '&redirect_uri=' . urlencode($nxs_snapSetPgURL) . '&scope=&client_id=' . $nto['APIKey'] . '&client_secret=' . $nto['APISec'] . '&grant_type=authorization_code';
                    $response = wp_remote_post($tknURL, $wprg);
                    prr($tknURL);
                    if (is_object($response) && isset($response->errors)) {
                        prr($response);
                        die;
                    }
                    if (is_array($response) && stripos($response['body'], '"error":') !== false) {
                        prr($response['body']);
                        prr(json_decode($response['body'], true));
                        die;
                    }
                    $resp = json_decode($response['body'], true);
                    prr($resp);
                    if (!is_array($resp) || empty($resp['access_token'])) {
                        prr($resp);
                        die;
                    }
                    if (function_exists('get_option')) {
                        $currTime = time() + get_option('gmt_offset') * HOUR_IN_SECONDS;
                    } else {
                        $currTime = time();
                    }
                    $nto['AccessToken'] = $resp['access_token'];
                    $nto['AccessTokenSecret'] = 'No Need for oAuth V2';
                    $nto['OAuthVerifier'] = 'No Need for oAuth V2';
                    $nto['AccessTokenExp'] = $currTime + $resp['expires_in'];
                    $nto['RefreshToken'] = $resp['refresh_token'];
                    echo "<br/>----=={ Expires: " . date('Y-m-d H:i:s', $nto['AccessTokenExp']) . " }==---- <br/>";
                    if (!empty($nto['bgBlogID'])) {
                        if (substr($nto['bgBlogID'], 0, 4) == 'http') {
                            $tknURL = 'https://www.googleapis.com/blogger/v3/blogs/byurl/?url=' . $nto['bgBlogID'] . '?access_token=' . $nto['AccessToken'];
                        } else {
                            $tknURL = 'https://www.googleapis.com/blogger/v3/blogs/' . $nto['bgBlogID'] . '?access_token=' . $nto['AccessToken'];
                        }
                    }
                    $response = wp_remote_get($tknURL, $wprg);
                    prr($tknURL);
                    prr($response);
                    $user = json_decode($response['body'], true);
                    prr($user);
                    if (!empty($user['url'])) {
                        $nto['blogURL'] = $user['url'];
                        $nto['bgBlogID'] = $user['id'];
                        $nto['blogInfo'] = $user['name'] . " [" . $user['id'] . "] (" . $user['url'] . ")";
                        if (function_exists('get_option')) {
                            $nxs_gOptions = get_option('NS_SNAutoPoster');
                        }
                        if (!empty($nxs_gOptions)) {
                            $nxs_gOptions['bg'][$ii] = $nto;
                            prr($nto);
                            nxs_settings_save($nxs_gOptions);
                        }
                        ?>
<script type="text/javascript">window.location = "<?php 
                        echo $nxs_snapSetPgURL;
                        ?>
"</script>      
        <?php 
                    }
                }
                die;
            }
            ?>
    
    <div class="nxs_box">
      <div class="nxs_box_header"> 
        <div class="nsx_iconedTitle" style="margin-bottom:1px;background-image:url(<?php 
            echo $nxs_plurl;
            ?>
img/<?php 
            echo $ntInfo['lcode'];
            ?>
16.png);"><?php 
            echo $ntInfo['name'];
            ?>
          <?php 
            $cbo = count($ntOpts);
//.........这里部分代码省略.........
开发者ID:digideskio,项目名称:stammtisch,代码行数:101,代码来源:bg.php


示例6: showGenNTSettings

        function showGenNTSettings($ntOpts)
        {
            global $nxs_snapSetPgURL, $nxs_plurl, $nxs_gOptions;
            $ntInfo = $this->ntInfo;
            if (isset($_GET['auth']) && $_GET['auth'] == 'tr') {
                require_once 'apis/trOAuth.php';
                $options = $ntOpts[$_GET['acc']];
                $consumer_key = $options['trConsKey'];
                $consumer_secret = $options['trConsSec'];
                $callback_url = $nxs_snapSetPgURL . "&auth=tra&acc=" . $_GET['acc'];
                $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret);
                prr($tum_oauth);
                $request_token = $tum_oauth->getRequestToken($callback_url);
                echo "####";
                prr($request_token);
                $options['trOAuthToken'] = $request_token['oauth_token'];
                $options['trOAuthTokenSecret'] = $request_token['oauth_token_secret'];
                // prr($tum_oauth ); die();
                switch ($tum_oauth->http_code) {
                    case 200:
                        $url = $tum_oauth->getAuthorizeURL($options['trOAuthToken']);
                        if (function_exists('get_option')) {
                            $nxs_gOptions = get_option('NS_SNAutoPoster');
                        }
                        if (!empty($nxs_gOptions)) {
                            $nxs_gOptions['tr'][$_GET['acc']] = $options;
                            nxs_settings_save($nxs_gOptions);
                        }
                        echo '<script type="text/javascript">window.location = "' . $url . '"</script>';
                        break;
                    default:
                        echo '<br/><b style="color:red">Could not connect to Tumblr. Refresh the page or try again later.</b>';
                        die;
                }
                die;
            }
            if (isset($_GET['auth']) && $_GET['auth'] == 'tra') {
                require_once 'apis/trOAuth.php';
                $options = $ntOpts[$_GET['acc']];
                prr($options);
                $consumer_key = $options['trConsKey'];
                $consumer_secret = $options['trConsSec'];
                $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $options['trOAuthToken'], $options['trOAuthTokenSecret']);
                $options['trAccessTocken'] = $tum_oauth->getAccessToken($_REQUEST['oauth_verifier']);
                // prr($_GET);  prr($_REQUEST);   prr($options['trAccessTocken']);
                $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $options['trAccessTocken']['oauth_token'], $options['trAccessTocken']['oauth_token_secret']);
                if (function_exists('get_option')) {
                    $nxs_gOptions = get_option('NS_SNAutoPoster');
                }
                if (!empty($nxs_gOptions)) {
                    $nxs_gOptions['tr'][$_GET['acc']] = $options;
                    nxs_settings_save($nxs_gOptions);
                }
                $userinfo = $tum_oauth->get('http://api.tumblr.com/v2/user/info');
                prr($userinfo);
                prr($tum_oauth);
                // prr($url); die();
                if (is_array($userinfo->response->user->blogs)) {
                    foreach ($userinfo->response->user->blogs as $blog) {
                        if (stripos($blog->url, $options['trPgID']) !== false) {
                            $gGet = $_GET;
                            unset($gGet['auth']);
                            unset($gGet['acc']);
                            unset($gGet['oauth_token']);
                            unset($gGet['oauth_verifier']);
                            unset($gGet['post_type']);
                            $sturl = explode('?', $nxs_snapSetPgURL);
                            $nxs_snapSetPgURL = $sturl[0] . (!empty($gGet) ? '?' . http_build_query($gGet) : '');
                            echo '<script type="text/javascript">window.location = "' . $nxs_snapSetPgURL . '"</script>';
                            die;
                        }
                    }
                    prr($userinfo);
                    die("<span style='color:red;'>ERROR: Authorized USER don't have access to the specified blog: <span style='color:darkred; font-weight: bold;'>" . $options['trPgID'] . "</span></span>");
                }
            }
            ?>
    
    <div class="nxs_box">
      <div class="nxs_box_header"> 
        <div class="nsx_iconedTitle" style="margin-bottom:1px;background-image:url(<?php 
            echo $nxs_plurl;
            ?>
img/<?php 
            echo $ntInfo['lcode'];
            ?>
16.png);"><?php 
            echo $ntInfo['name'];
            ?>
          <?php 
            $cbo = count($ntOpts);
            ?>
 
          <?php 
            if ($cbo > 1) {
                ?>
<div class="nsBigText"><?php 
                echo "(" . ($cbo == '0' ? 'No' : $cbo) . " ";
                _e('accounts', 'nxs_snap');
                echo ")";
//.........这里部分代码省略.........
开发者ID:brettex,项目名称:pspark,代码行数:101,代码来源:tr.php


示例7: showGenNTSettings


//.........这里部分代码省略.........
                        prr($response);
                        die;
                    }
                    parse_str($response['body'], $params);
                    $at = $params['access_token'];
                    $fbo['fbAppAuthToken'] = $at;
                    $appsecret_proof = hash_hmac('sha256', $fbo['fbAppAuthToken'], $fbo['fbAppSec']);
                    $aacct = array('access_token' => $fbo['fbAppAuthToken'], 'appsecret_proof' => $appsecret_proof, 'method' => 'get');
                    $res = wp_remote_get("https://graph.facebook.com/me?" . http_build_query($aacct, null, '&'));
                    if (is_wp_error($res) || empty($res['body'])) {
                        echo "Can't get Facebook User.";
                        prr($res);
                        die;
                    } else {
                        $user = json_decode($res['body'], true);
                        if (empty($user)) {
                            echo "Can't get Facebook User. JSON Error. ";
                            prr($res);
                            die;
                        } else {
                            if (!empty($user['id'])) {
                                echo "-= Got user: ";
                                prr($user);
                                $page_id = $fbo['fbPgID'];
                                echo "-= Authorizing Page =-";
                                if (!is_numeric($page_id) && stripos($fbo['fbURL'], '/groups/') != false) {
                                    //$fbPgIDR = wp_remote_get('nxs.php?g='.$fbo['fbURL']); // TODO - how to replace
                                    $fbPgIDR = trim($fbPgIDR['body']);
                                    $page_id = $fbPgIDR != '' ? $fbPgIDR : $page_id;
                                }
                                $aacct = array('access_token' => $fbo['fbAppAuthToken'], 'appsecret_proof' => $appsecret_proof, 'method' => 'get');
                                $fbo['destType'] = '';
                                echo "https://graph.facebook.com/{$page_id}?fields=access_token&" . http_build_query($aacct, null, '&');
                                $res = wp_remote_get("https://graph.facebook.com/{$page_id}?fields=access_token&" . http_build_query($aacct, null, '&'));
                                prr($res);
                                if (is_wp_error($res) || empty($res['body'])) {
                                    echo "Can't get Page Token.";
                                    prr($res);
                                    die;
                                } else {
                                    $token = json_decode($res['body'], true);
                                    if (empty($token)) {
                                        echo "Can't get Page Token. JSON Error. ";
                                        prr($res);
                                        die;
                                    } else {
                                        if (!empty($token['error'])) {
                                            if (!empty($token['error']['message'])) {
                                                $errMsg = $token['error']['message'];
                                                if (stripos($errMsg, 'Unknown fields: access_token') !== false || stripos($errMsg, 'Cannot query users by their username') !== false || stripos($errMsg, 'node type (User)') !== false) {
                                                    $token['access_token'] = $fbo['fbAppAuthToken'];
                                                    $fbo['destType'] = stripos($fbo['fbURL'], '/groups/') != false ? 'gr' : 'pr';
                                                } else {
                                                    if (stripos($errMsg, 'Unsupported get request') !== false) {
                                                        echo "<b style='color:red;'>Error </b>: Your Facebook URL ( <i>" . $fbo['fbURL'] . "</i> ) is either incorrect or authorzing user don't have rights to post there.<br/>";
                                                    }
                                                    echo '<br/>Reported Error: ', $errMsg, "\n";
                                                    die;
                                                }
                                            }
                                        }
                                        if (!empty($token['access_token'])) {
                                            $fbo['fbAppPageAuthToken'] = $token['access_token'];
                                        } else {
                                            echo "Can't get Page Token. NO TOKEN RETURNED. Are you sure that user you are trying to authorize is an admin of the page? This message means user was authorized as profile, but page refused to return authorization token. This usually happens when user has <b>no rights</b> to post to that page. ";
                                            prr($res);
                                            die;
                                        }
                                    }
                                }
                            } else {
                                echo "Can't get User. NO USER RETURNED. ";
                                prr($res);
                                die;
                            }
                        }
                    }
                    if (!empty($user['id'])) {
                        $fbo['fbAppAuthUser'] = $user['id'];
                        $fbo['fbAppAuthUserName'] = $user['name'] . (!empty($user['username']) ? " (" . $user['username'] . ")" : '');
                        if (function_exists('get_option')) {
                            $nxs_gOptions = get_option('NS_SNAutoPoster');
                        }
                        if (!empty($nxs_gOptions)) {
                            $nxs_gOptions['fb'][$ii] = $fbo;
                            nxs_settings_save($nxs_gOptions);
                        }
                        ?>
<script type="text/javascript">window.location = "<?php 
                        echo $nxs_snapSetPgURL;
                        ?>
"</script>      
      <?php 
                    }
                    die;
                }
            }
            $ntParams = array('ntInfo' => $ntInfo, 'nxs_plurl' => $nxs_plurl, 'ntOpts' => $ntOpts, 'chkField' => 'fbAppAuthUser');
            nxs_showListRow($ntParams);
        }
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:101,代码来源:fb.php


示例8: showGenNTSettings

        function showGenNTSettings($ntOpts)
        {
            global $nxs_plurl, $nxs_snapSetPgURL, $nxs_gOptions;
            $ntInfo = $this->ntInfo;
            if (isset($_GET['code']) && $_GET['code'] != '' && (isset($_GET['state']) && stripos($_GET['state'], 'ap-') !== false)) {
                $at = $_GET['code'];
                $to = explode('-', $_GET['state']);
                $_GET['acc'] = $to[1];
                echo "-= This is normal technical authorization info that will dissapear (Unless you get some errors) =- <br/><br/><br/>";
                $fbo = $ntOpts[$_GET['acc']];
                $wprg = array();
                $response = wp_remote_get('https://graph.facebook.com/nextscripts', $wprg);
                echo $nxs_snapSetPgURL . '&auth=ap&acc=' . $_GET['acc'] . "||";
                if (stripos($nxs_snapSetPgURL, 'page=NextScripts_SNAP.php') === false) {
                    $newURL = explode('?', $nxs_snapSetPgURL);
                    $nxs_snapSetPgURL = $newURL[0];
                }
                if (is_wp_error($response) && isset($response->errors['http_request_failed']) && stripos($response->errors['http_request_failed'][0], 'SSL') !== false) {
                    prr($response->errors);
                    $wprg['sslverify'] = false;
                }
                if (isset($fbo['appID'])) {
                    echo "-=";
                    prr($fbo);
                    $wprg['body'] = array('client_id' => $fbo['appID'], 'client_secret' => $fbo['appSec'], 'grant_type' => 'authorization_code', 'redirect_uri' => $nxs_snapSetPgURL, 'state' => 'ap-' . $_GET['acc'], 'code' => $at);
                    prr($wprg);
                    $response = wp_remote_post('https://account.app.net/oauth/access_token', $wprg);
                    if (is_object($response) && isset($response->errors) || is_array($response) && stripos($response['body'], '"error":') !== false) {
                        prr($response);
                        die;
                    }
                    $params = json_decode($response['body'], true);
                    $fbo['apAppAuthToken'] = $params['access_token'];
                    if ($params['user_id'] > 0) {
                        $fbo['appAppUserID'] = $params['user_id'];
                        $fbo['appAppUserName'] = $params['username'];
                    }
                    if ($params['user_id'] > 0) {
                        if (function_exists('get_option')) {
                            $nxs_gOptions = get_option('NS_SNAutoPoster');
                        }
                        if (!empty($nxs_gOptions)) {
                            $nxs_gOptions['ap'][$_GET['acc']] = $fbo;
                            nxs_settings_save($nxs_gOptions);
                        }
                        ?>
<script type="text/javascript">window.location = "<?php 
                        echo $nxs_snapSetPgURL;
                        ?>
"</script>      
       <?php 
                    }
                    die;
                }
            }
            ?>
    
    <div class="nxs_box">
      <div class="nxs_box_header"> 
        <div class="nsx_iconedTitle" style="margin-bottom:1px;background-image:url(<?php 
            echo $nxs_plurl;
            ?>
img/<?php 
            echo $ntInfo['lcode'];
            ?>
16.png);"><?php 
            echo $ntInfo['name'];
            ?>
          <?php 
            $cbo = count($ntOpts);
            ?>
 
          <?php 
            if ($cbo > 1) {
                ?>
<div class="nsBigText"><?php 
                echo "(" . ($cbo == '0' ? 'No' : $cbo) . " ";
                _e('accounts', 'nxs_snap');
                echo ")";
                ?>
</div><?php 
            }
            ?>
        </div>
      </div>
      <div class="nxs_box_inside">
        <?php 
            foreach ($ntOpts as $indx => $pbo) {
                if (trim($pbo['nName'] == '')) {
                    $pbo['nName'] = 'App.Net';
                }
                if (!isset($pbo[$ntInfo['lcode'] . 'OK']) || $pbo[$ntInfo['lcode'] . 'OK'] == '') {
                    $pbo[$ntInfo['lcode'] . 'OK'] = isset($pbo['appAppUserID']) && $pbo['appAppUserID'] > 1 ? '1' : '';
                }
                ?>
            <p style="margin:0px;margin-left:5px;"> <img id="<?php 
                echo $ntInfo['code'] . $indx;
                ?>
LoadingImg" style="display: none;" src='<?php 
                echo $nxs_plurl;
//.........这里部分代码省略.........
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:101,代码来源:ap.php



注:本文中的nxs_settings_save函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP nxs_showCatTagsCTFilters函数代码示例发布时间:2022-05-15
下一篇:
PHP nxs_metaMarkAsPosted函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap