protected function echoTweets($aInstance)
 {
     $aInstance = $aInstance + $this->_aStructure_FormElements;
     if (!count($aInstance['selected_ids'])) {
         echo "<p><strong>Fetch Tweets</strong>: " . __('At least one rule needs to be selected in the widget form.', 'fetch-tweets') . "</p>";
         return;
     }
     fetchTweets(array('ids' => $aInstance['selected_ids'], 'count' => $aInstance['count'], 'twitter_media' => $aInstance['twitter_media'], 'external_media' => $aInstance['external_media'], 'template' => $aInstance['template'], 'avatar_size' => $aInstance['avatar_size'], 'height' => $aInstance['height'], 'height_unit' => $aInstance['height_unit'], 'width' => $aInstance['width'], 'width_unit' => $aInstance['width_unit']));
 }
 public function previewTweets($strContent)
 {
     // Used for the post type single page that functions as preview the result.
     global $post;
     if (!isset($post->post_type) || $post->post_type != $this->oProps->strPostType) {
         return $strContent;
     }
     $intPostID = $post->ID;
     $intCount = get_post_meta($intPostID, 'item_count', true);
     fetchTweets(array('id' => $intPostID, 'count' => $intCount));
     // this draws the result.
     return $strContent;
     // should be an empty string.
 }
 /**
  * Displays tweet previews in the front-end.
  * 
  * @since       Unknown
  * @since       2.4.8       Changed the name from `_replyToPreviewTweets`.
  */
 public function content($sContent)
 {
     return $sContent . fetchTweets(array('id' => $GLOBALS['post']->ID, 'count' => get_post_meta($GLOBALS['post']->ID, 'item_count', true)), false);
 }
Example #4
0
        }
        $this->body = $body;
    }
    public function setPubDate(DateTime $date)
    {
        $this->pubdate = $date->format('Y/m/d H:i:s');
    }
}
$sql = "INSERT INTO `raindrop` (body) VALUES (:body)";
$stmt = $conn->prepare($sql);
$stmt->bindParam(":body", $body);
$form = $_POST;
$body = $form['body'];
$result = $stmt->execute();
function fetchTweets($conn)
{
    $stmt = $conn->query('SELECT * FROM raindrop');
    return $stmt->fetchAll(PDO::FETCH_OBJ);
}
$tweets = [];
$tweets = fetchTweets($conn);
foreach ($tweets as $tweet) {
    echo "<h2>{$tweet->body}</h2>";
    echo "<p>{$tweet->pubdate}</p>";
}
if ($result) {
    echo "Your text has been posted";
} else {
    echo '0 results';
}
// end else
 protected function echoTweets($arrInstance)
 {
     echo fetchTweets(array('tags' => $arrInstance['selected_tag_slugs'], 'tag_field_type' => 'slug', 'count' => $arrInstance['count'], 'operator' => $arrInstance['operator'], 'template' => $arrInstance['template'], 'avatar_size' => $arrInstance['avatar_size'], 'height' => $arrInstance['height'], 'height_unit' => $arrInstance['height_unit'], 'width' => $arrInstance['width'], 'width_unit' => $arrInstance['width_unit']));
 }
 /**
  * Returns the output by the given argument.
  */
 public function _replyToGetOutput($aArgs)
 {
     return fetchTweets($aArgs, false);
 }
Example #7
0
            print $fb_post['permalink'];
            ?>
">Original post</a></p>
								</div>
							<?php 
            $i++;
        }
    }
}
?>
					
				</div>
				<div id="footer-social-twitter">
					<h3>Latest Tweet</h3>
					<?php 
fetchTweets(array('screen_name' => 'StartWithBuild', 'count' => 1, 'avatar_size' => 0));
?>
				</div>
				
				<div id="footer-social-instagram">
					<h3>Latest Instagram Photo</h3>
					<?php 
function fetchData($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 1);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
 protected function echoTweets($arrInstance)
 {
     echo fetchTweets(array('ids' => $arrInstance['selected_ids'], 'count' => $arrInstance['count'], 'template' => $arrInstance['template'], 'avatar_size' => $arrInstance['avatar_size'], 'height' => $arrInstance['height'], 'height_unit' => $arrInstance['height_unit'], 'width' => $arrInstance['width'], 'width_unit' => $arrInstance['width_unit']));
 }