/** @return FlowFlow|null */ public static function get_instance() { if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
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; }
<option value="center">Centered</option> <option value="right">Right</option> </select> </div> </dd> <dt class="hide">Preview</dt> <dd class="preview"> <h1>Live preview</h1> <div data-preview="bg-color" class="ff-stream-wrapper ff-layout-grid ff-theme-classic ff-style-4 shuffle"> <div data-preview="card-color,shadow-color,width" class="ff-item ff-twitter shuffle-item filtered" style="visibility: visible; opacity:1;"> <h4 data-preview="name-color">Header example</h4> <p data-preview="text-color">This is regular text paragraph, can be tweet, facebook post etc. This is example of <a href="#" data-preview="links-color">link in text</a>.</p> <span class="ff-img-holder" style="max-height: 171px"><img src="' . FlowFlow::get_plugin_directory() . '/assets/67.png" style="width:100%;"></span> <div class="ff-item-meta"> <span class="separator" data-preview="bcolor"></span> <span class="ff-userpic" style="background:url(' . FlowFlow::get_plugin_directory() . '/assets/chevy.jpeg)"><i class="ff-icon" data-overrideProp="border-color" data-preview="card-color"><i class="ff-icon-inner"></i></i></span><a data-preview="name-color" target="_blank" rel="nofollow" href="#" class="ff-name">Looks Awesome</a><a data-preview="other-color" target="_blank" rel="nofollow" href="#" class="ff-nickname">@looks_awesome</a><a data-preview="other-color" target="_blank" rel="nofollow" href="#" class="ff-timestamp">21m ago </a> </div> </div> </div> </dd> </dl> <span id="stream-stylings-sbmt-%id%" class="admin-button green-button submit-button">Save Changes</span> </div> </div> <div class="section" id="css-%id%"> <h1 class="desc-following">Stream custom CSS</h1> <p class="desc" style="margin-bottom:10px"> Prefix your selectors with <strong>#ff-stream-%id%</strong> to target this specific stream </p> <textarea name="stream-%id%-css" cols="100" rows="10" id="stream-%id%-css"/> </textarea>
/** * Register and enqueue admin-specific JavaScript. * * @since 1.0.0 * * @return null Return early if no settings page is registered. */ public function enqueue_admin_scripts() { if (!isset($this->plugin_screen_hook_suffix)) { return; } $screen = get_current_screen(); if ($this->plugin_screen_hook_suffix == $screen->id) { wp_enqueue_script(FlowFlow::$PLUGIN_SLUG . '-admin-script', FlowFlow::get_plugin_directory() . 'js/admin.js', array('jquery'), FlowFlow::VERSION); wp_enqueue_script(FlowFlow::$PLUGIN_SLUG . '-zeroclipboard', FlowFlow::get_plugin_directory() . 'js/zeroclipboard/ZeroClipboard.min.js', array('jquery'), FlowFlow::VERSION); wp_enqueue_script(FlowFlow::$PLUGIN_SLUG . '-tinycolor', FlowFlow::get_plugin_directory() . 'js/tinycolor.js', array('jquery'), FlowFlow::VERSION); wp_enqueue_script(FlowFlow::$PLUGIN_SLUG . '-colorpickersliders', FlowFlow::get_plugin_directory() . 'js/jquery.colorpickersliders.js', array('jquery'), FlowFlow::VERSION); } }