示例#1
0
 public function addNewAccount()
 {
     if (!is_admin()) {
         return false;
     }
     if (!function_exists('curl_version')) {
         self::addNotice(__("You need to have cURL library enabled in order to use our plugin! Please check it with your hosting company to enable this."), CWP_TEXTDOMAIN);
         return false;
     }
     global $cwp_top_settings;
     $social_network = $_POST['social_network'];
     self::setCurrentNetwork($social_network);
     $networks = $this->getAvailableNetworks();
     $allnetworks = $this->getAllNetworks(true);
     $response = array();
     if ($allnetworks[$social_network] && !CWP_TOP_PRO) {
         self::addNotice("You need to <a target='_blank' href='https://themeisle.com/plugins/tweet-old-post-pro/?utm_source=topplusacc&utm_medium=announce&utm_campaign=top&upgrade=true'>upgrade to the PRO version</a> in order to add a " . ucwords($social_network) . " account, fellow pirate!", 'error');
     } else {
         if (in_array($social_network, $networks) && !CWP_TOP_PRO) {
             self::addNotice("You need to <a target='_blank' href='https://themeisle.com/plugins/tweet-old-post-pro/?utm_source=topplusacc&utm_medium=announce&utm_campaign=top&upgrade=true'>upgrade to the PRO version</a> in order to add more accounts, fellow pirate!", 'error');
         } else {
             switch ($social_network) {
                 case 'twitter':
                     $this->oAuthCallback = $_POST['currentURL'];
                     $twitter = new RopTwitterOAuth($this->consumer, $this->consumerSecret);
                     $requestToken = $twitter->getRequestToken($this->oAuthCallback);
                     update_option('cwp_top_oauth_token', $requestToken['oauth_token']);
                     update_option('cwp_top_oauth_token_secret', $requestToken['oauth_token_secret']);
                     switch ($twitter->http_code) {
                         case 200:
                             $url = $twitter->getAuthorizeURL($requestToken['oauth_token']);
                             $response['url'] = $url;
                             break;
                         default:
                             self::addNotice(__("Could not connect to Twitter!"), CWP_TEXTDOMAIN);
                             break;
                     }
                     break;
                 case 'facebook':
                     if (empty($_POST['extra']['app_id'])) {
                         self::addNotice(__("Could not connect to Facebook! You need to add the App ID", CWP_TEXTDOMAIN), 'error');
                     } else {
                         if (empty($_POST['extra']['app_secret'])) {
                             self::addNotice(__("Could not connect to Facebook! You need to add the App Secret", CWP_TEXTDOMAIN), 'error');
                         } else {
                             update_option('cwp_top_app_id', $_POST['extra']['app_id']);
                             update_option('cwp_top_app_secret', $_POST['extra']['app_secret']);
                             $top_session_state = md5(uniqid(rand(), TRUE));
                             update_option('top_fb_session_state', $top_session_state);
                             $dialog_url = "https://www.facebook.com/" . ROP_TOP_FB_API_VERSION . "/dialog/oauth?client_id=" . $_POST['extra']['app_id'] . "&redirect_uri=" . top_settings_url() . "&state=" . $top_session_state . "&scope=publish_actions,manage_pages,publish_pages,user_posts,user_photos";
                             $response['url'] = $dialog_url;
                         }
                     }
                     break;
                 default:
                     if (CWP_TOP_PRO) {
                         global $CWP_TOP_Core_PRO;
                         $CWP_TOP_Core_PRO->topProAddNewAccount();
                     }
             }
         }
     }
     echo json_encode($response);
     die;
     // Required
 }
示例#2
0
<?php

define("CURRENTURL", top_current_page());
define("CP_DONACIONES_TEXTDOMAIN", "CriptoPay_Donaciones_WP");
define("CP_TEXTDOMAIN", "criptopay");
define("SETTINGSURL", top_settings_url());
// Settings Array
$CP_Donaciones_top_settings = array('name' => "Donaciones Crpto-Pay.com", 'slug' => "Bitcoin & Altcoin Donaciones");
function top_current_page()
{
    $pageURL = 'http';
    if (array_key_exists('HTTPS', $_SERVER) && $_SERVER["HTTPS"] == "on") {
        $pageURL .= "s";
    }
    $pageURL .= "://";
    if (@$_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= @$_SERVER["SERVER_NAME"] . ":" . @$_SERVER["SERVER_PORT"] . @$_SERVER["REQUEST_URI"];
    } else {
        $pageURL .= @$_SERVER["SERVER_NAME"] . @$_SERVER["REQUEST_URI"];
    }
    return $pageURL;
}
function top_settings_url()
{
    $pageURL = admin_url('admin.php?page=CriptoPay_Donaciones_WP');
    return str_replace(":80", "", $pageURL);
}
示例#3
0
				<div class="top_left_instructions">
				<ol>
					<li><?php 
_e('Go on', CWP_TEXTDOMAIN);
?>
 <a href="https://www.tumblr.com/oauth/apps" target="_blank"> https://www.tumblr.com/oauth/apps</a></li>
					<li><?php 
_e('If you already made an application you will see it’s info here, otherwise click “Register application” button.', CWP_TEXTDOMAIN);
?>
</li>
					<li><?php 
_e("Click 'Register application'”' button. Fill 'Application Name', 'Application Website', all other fields (just enter your website URL to the 'Default callback URL') and click Register'.", CWP_TEXTDOMAIN);
?>
 </li>
				 	<li><?php 
printf(__('Copy/Paste the Consumer Key and Consumer Secret in the fields from the right.  ', CWP_TEXTDOMAIN), top_settings_url());
?>
 </li>
				 	<li><?php 
printf(__('Fill URL of your Tumblr Blog.  ', CWP_TEXTDOMAIN));
?>
 </li>

					<li><?php 
_e('Now everything is done, click on <strong>Authorize App</strong> button.', CWP_TEXTDOMAIN);
?>
</li>
				</ol>
			</div>
			<form action="" method="post" id="cwp_top_form" class="  top_auth_form">
			<fieldset class="option twptop_opt_app_id">
示例#4
0
文件: view.php 项目: sumwander/unyil
				<div class="top_left_instructions">
				<ol>
					<li><?php 
_e('Go on', 'tweet-old-post');
?>
 <a href="https://www.tumblr.com/oauth/apps" target="_blank"> https://www.tumblr.com/oauth/apps</a></li>
					<li><?php 
_e('If you already made an application you will see it’s info here, otherwise click “Register application” button.', 'tweet-old-post');
?>
</li>
					<li><?php 
_e("Click 'Register application'”' button. Fill 'Application Name', 'Application Website', all other fields (just enter your website URL to the 'Default callback URL') and click Register'.", 'tweet-old-post');
?>
 </li>
				 	<li><?php 
printf(__('Copy/Paste the Consumer Key and Consumer Secret in the fields from the right.  ', 'tweet-old-post'), top_settings_url());
?>
 </li>
				 	<li><?php 
printf(__('Fill URL of your Tumblr Blog.  ', 'tweet-old-post'));
?>
 </li>

					<li><?php 
_e('Now everything is done, click on <strong>Authorize App</strong> button.', 'tweet-old-post');
?>
</li>
				</ol>
			</div>
			<form action="" method="post" id="cwp_top_form" class="  top_auth_form">
			<fieldset class="option twptop_opt_app_id">