public static function getFeedData($url, $header = false) { $ff = FlowFlow::get_instance(); $use = $ff->getGeneralSettings()->useCurlFollowLocation(); $useIpv4 = $ff->getGeneralSettings()->useIPv4(); $c = curl_init(); curl_setopt($c, CURLOPT_USERAGENT, self::$USER_AGENT); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_POST, 0); curl_setopt($c, CURLOPT_FAILONERROR, true); // Enable if you have 'Network is unreachable' error if ($useIpv4) { curl_setopt($c, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); } if ($use) { curl_setopt($c, CURLOPT_FOLLOWLOCATION, true); } curl_setopt($c, CURLOPT_AUTOREFERER, true); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_VERBOSE, false); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); if (is_array($header)) { curl_setopt($c, CURLOPT_HTTPHEADER, $header); } curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($c, CURLOPT_TIMEOUT, 30); $page = $use ? curl_exec($c) : self::curl_exec_follow($c); $error = curl_error($c); $errors = array(); if (strlen($error) > 0) { $errors[] = $error; } curl_close($c); return array('response' => $page, 'errors' => $errors, 'url' => $url); }
/** * @return string|bool */ public function getAccessToken() { if ($this->access_token != null) { return $this->access_token; } if (false !== ($access_token_transient = get_transient(FlowFlow::$PLUGIN_SLUG_DOWN . self::$postfix_at))) { $access_token = $access_token_transient; } else { $auth = FlowFlow::get_instance()->get_auth_options(); $access_token = $auth['facebook_access_token']; if (!isset($access_token) || empty($access_token)) { return false; } } if (false === get_transient(FlowFlow::$PLUGIN_SLUG_DOWN . self::$postfix_at_expires)) { $auth = FlowFlow::get_instance()->get_auth_options(); $facebookAppId = $auth['facebook_app_id']; $facebookAppSecret = $auth['facebook_app_secret']; $this->extendAccessToken($access_token, $facebookAppId, $facebookAppSecret); } $this->access_token = $access_token; return $access_token; }
<div id="fade-overlay" class="loading"> <i class="flaticon-settings"></i> </div> <!-- @TODO: Provide markup for your options page here. --> <form id="flow_flow_form" method="post" action="options.php" enctype="multipart/form-data"> <!--Register settings--> <?php settings_fields('ff_opts'); $options = FlowFlow::get_instance()->get_options(); $auth = FlowFlow::get_instance()->get_auth_options(); $arr = (array) $options['streams']; $count = count($arr); $feedsChanged = $options['feeds_changed']; $options['feeds_changed'] = ''; // init clear // FlowFlowAdmin::debug_to_console('OPTIONS'); // FlowFlowAdmin::debug_to_console($options); ?> <script> var STREAMS = <?php echo json_encode($options["streams"]); ?> ; var _ajaxurl = '<?php