/** * Run this before bbcode is called to render content before bbcode() had a chance to mess it up */ function before_bbcode($original_body, &$has_video = false) { global $host; $body = preg_replace(array('#(?<!\\[url(=|\\]))((?:https?://)(?:www\\.)?vimeo\\.com/([0-9]*)(?:(?:\\?|&)[^\\s<\\]"]*)?)#is', '#(?<!\\[url(=|\\]))((?:https?://)(?:www\\.)?coub\\.com/(?:view|embed)/([0-9a-zA-Z]*)(?:(?:\\?|&)[^\\s<\\]"]*)?)#is', '#(?<!\\[url(=|\\]))((?:https?://)(?:www\\.)?facebook\\.com/\\S+/videos/[^\\s<\\]"]+(?:(?:\\?|&)[^\\s<\\]"]*)?)#is', '#(?<!\\[url(=|\\]))((?:https?://)?video-[^\\s<\\]"]+\\.mp4(?:(?:\\?)[^\\s<\\]"]*)?)#is', '#(?<!\\[url(=|\\]))((?:https?://)(?:www\\.)?facebook\\.com/video\\.php\\?v=[^\\s<\\]"]+(?:(?:\\?|&)[^\\s<\\]"]*)?)#is', '#(?<!(\\[url(=|]))|\\[img=)((?:https?://)(?:www\\.)?i\\.imgur\\.com/([^\\s\\.]*)\\.?(?:[a-z]+)?(?:(?:\\?|&)[^\\s<\\]"]*)?)#is', '#(?<!(\\]|/|\\.|=))((?:www\\.|m\\.)?(?:\\byoutu\\b\\.be/|\\byoutube\\b\\.com/(?:embed|v|watch\\?(?:[^\\s<\\]"]*?)?v=))([\\w-]{10,12})(?:(?:\\?|&)[^\\s<\\]"]*)?)#is'), array('<div class="vimeo"><iframe src="https://player.vimeo.com/video/$3" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe><br/>Link: <a href="$2">$2</a></div>', '<div class="coub"><iframe src="//coub.com/embed/$3?muted=false&autostart=false&originalSize=false&hideTopBar=false&startWithHD=false" width="500" height="281" frameborder="0" allowfullscreen="true"></iframe><br/>Link: <a href="$2">$2</a></div>', '<div class="fb-video" data-href="$2" data-width="500"></div><br/>Link: <a href="$2">$2</a>', '<div class="fb-video" data-href="$2" data-width="500"></div><br/><a href="$2">Please note that this link is only temporary and will not be available in the future</a>', '<div class="fb-video" data-href="$2" data-width="500"></div><br/>Link: <a href="$2">$2</a>', '<div class="imgur"><blockquote class="imgur-embed-pub" lang="en" data-id="$4"><a href="//imgur.com/$4">Direct Link</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script></div>', '<div class="youtube"><iframe type="text/html" width="480" height="320" src="http://www.youtube-nocookie.com/embed/$3?enablejsapi=1&start=0&wmode=transparent&origin=http://' . $host . '" frameborder="0"></iframe><br/>Link: <a href="$2">$2</a></div>'), $original_body); if (isset($has_video)) { $has_video = strcmp($body, $original_body) != 0; } // Embedding Twitter links $body = twitter($body); // Fix postimage.org tags $body = fix_postimage_tags($body); return $body; }
/** * Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format. * @param array $options Options to pass to the method * @param string $format Return format * @return string */ function getFavorites($options = array()) { $options['screen_name'] = twitter('profile.screen_name', null, false); return $this->request('favorites', $options, 'get'); }
function start_content() { echo '<div id="content_section">'; echo '<div class="frame">'; echo '<div id="main_content_section">'; echo '<table class="main_table">'; echo '<tr>'; echo '<td id="sidebar">'; //user(); sidebar(""); echo '<div class="sidenode">'; twitter(); echo '</div>'; // side_ad(); echo '</td>'; echo '<td id="main_content">'; }
flickr(); break; case 'enlarged_flickr': enlargedFlickr($flickr_user,$flickr_id,$flickr_enlarge_url); break; case 'map': map($latitude,$longitude,$zoom,$default_map_type); break; case 'twitter': twitter($hashtag); break; case 'reportform': reportform(); break; } ?>
Data::getParm($id, $title, $desc, $price, $stock, $productUrl); $table = new Table(); $table->setClass("tableGray"); //Action Bar and Action Group. $apb1 = new ActionBar(); $acg1 = new ActionGroup(); $acg1->setCaption(""); $acg1->setImage("img/ic_share.png"); $btn_facebook = new ButtonBar(); $btn_facebook->setCaption("Facebook"); $btn_facebook->setImage("img/ic_facebook.png"); $btn_facebook->onTap(facebook()); $btn_tw = new ButtonBar(); $btn_tw->setCaption("Twitter"); $btn_tw->setImage("img/ic_tw.png"); $btn_tw->onTap(twitter()); $btn_sms = new ButtonBar(); $btn_sms->setCaption("SMS"); $btn_sms->setImage("img/ic_sms.png"); $btn_sms->onTap(sms()); $btn_email = new ButtonBar(); $btn_email->setCaption("EMail"); $btn_email->setImage("img/ic_email.png"); $btn_email->onTap(email()); $acg1->addControl($btn_facebook); $acg1->addControl($btn_tw); $acg1->addControl($btn_sms); $acg1->addControl($btn_email); $apb1->addControl($acg1); //Add action bar to a SDPanel. $win->addControl($apb1);
/** * Called after LayoutHelper::nodeBody() * * @return string */ public function afterNodeBody() { //reasons to fail if (!twitter('profile.id', null, false)) { return false; } //initializing variables static $favorites; $favored = 'needs-favored'; $metas = array('tweet_id' => false); foreach ((array) $this->Layout->node['Meta'] as $meta) { $metas[$meta['key']] = $meta['value']; } if (!isset($favorites)) { $tweet = twitter(); $favorites = $tweet->getFavorites(); //this method requires authentication and I can't figure it out //print_r($favorites); } if (false) { $favored = 'tweet-favored'; } $html = '<span class="tweet-actions ' . $favored . '" tweet_id="' . $metas['tweet_id'] . '" data="' . base64_encode(json_encode($this->Layout->node['Node'])) . '">'; if ($metas['tweet_id']) { $html .= '<a href="#" class="favorite-action" title="Favorite"> <span><i></i><b>Favorite</b></span> </a>'; } $html .= '<a href="#" class="reply-action" title="Reply"> <span><i></i><b>Reply</b></span> </a> <a href="#" class="retweet-action" title="Retweet"> <span><i></i><b>Retweet</b></span> </a> </span>'; return $html; }
function process_domain($d) { global $stats; global $inputdir; global $triggers; global $domains; global $messages; global $nresources; // echo("$d\n"); $stats['n_domains']++; $c = file_get_contents($inputdir . $d); $lines = explode("\n", $c); foreach ($lines as $i => $line) { if (substr($line, 0, 1) != '{') { $lines[$i] = ''; } } $c = implode("\n", $lines); $c = "[" . $c . "]"; $c = str_replace("\n", "", $c); $c = str_replace(",]", "]", $c); $c = str_replace("Syntax error: parse error", "", $c); $c = str_replace("\n", "", $c); $resources = array_unique(json_decode($c, 1), SORT_REGULAR); $n = count($resources); if ($n == 0) { echo "{$d} has errors\n"; $stats['n_domains_with_errors']++; return; } @$nresources[$n / 10]++; if ($n > 500) { $messages[] = "{$d} has {$n} resources"; } // and then update the statistics $has_js = false; $has_external_js = false; $has_flash = false; $has_external_flash = false; $has_external_content = false; $has_google = false; $has_facebook = false; $has_yahoo = false; $has_twitter = false; $has_ads = false; $triggered = []; foreach ($triggers as $trigger) { $triggered[$trigger] = false; } foreach ($resources as $res) { $url = $res['url']; $type = $res['content-type']; if (isflash($type, $url)) { $has_flash = true; $is_flash = true; } else { $is_flash = false; } if (isjs($type, $url)) { $has_js = true; $is_js = true; } else { $is_js = false; } if (!$has_ads) { if (ads($url)) { echo "{$d} contains ads from {$url}\n"; $has_ads = true; } } foreach ($triggers as $trigger) { if (contains($url, $trigger)) { $triggered[$trigger] = $url; } } if (contains($url, 'jquery')) { $has_jquery = true; } if (facebook($url)) { $has_facebook = true; } if (google($url)) { $has_google = true; } if (yahoo($url)) { $has_yahoo = true; } if (twitter($url)) { $has_twitter = true; } if (!same_domain($d, $url)) { if ($is_js) { $has_external_js = true; } if ($is_flash) { $has_external_flash = true; } $has_external_content = true; } } foreach ($triggers as $trigger) { if ($triggered[$trigger]) { $stats["n_domains_with_{$trigger}"] += 1; $domains[$trigger][$d] = $triggered[$trigger]; } } $stats['n_domains_with_js'] += $has_js ? 1 : 0; $stats['n_domains_with_external_js'] += $has_external_js ? 1 : 0; $stats['n_domains_with_external_content'] += $has_external_content ? 1 : 0; $stats['n_domains_clean'] += $has_external_content ? 0 : 1; $stats['n_domains_with_flash'] += $has_flash ? 1 : 0; $stats['n_domains_with_external_flash'] += $has_external_flash ? 1 : 0; $stats['n_domains_with_google'] += $has_google ? 1 : 0; $stats['n_domains_with_facebook'] += $has_facebook ? 1 : 0; $stats['n_domains_with_yahoo'] += $has_yahoo ? 1 : 0; $stats['n_domains_with_twitter'] += $has_twitter ? 1 : 0; $stats['n_domains_with_ads'] += $has_ads ? 1 : 0; }
<footer class="site-footer cf" role="contentinfo"> <div class="copyright"><?php echo html::a('/contact', '© 2009-' . date('Y') . ' Bastian Allgeier GmbH'); ?> </div> <ul class="nav nav-right"> <li><?php echo twitter('@getkirby'); ?> </li> <li><a href="/contact">Contact</a></li> <li><a href="/changelog">Changelog</a></li> <li><a href="/made-with-kirby-and-love">Made with Kirby and <b class="red">♥</b></a></li> </ul> </footer>
/** * function is responsible for marking a tweet as favorited * * @return unknown */ public function favorite() { //reasons to fail if (!isset($this->params['url']['id'])) { return false; } $tweet = twitter(); $r = $tweet->createFavorite($this->params['url']['id']); die; }
<?php /** * Main object. * @author Kikapp * @version 1.0 */ $win = new SDPanel(); $win->setCaption("Twitter API!"); $actionBar = new ActionBar(); $actionBar->setClass("applicationBars"); $mainTable = new Table(); //$mainTable-> setClass("table.general"); $input = new InputText(); $input->setLabelCaption("Write what you want to tweet!"); $button = new Button(); $button->setCaption("Tweet!"); $button->onTap(twitter()); $button->setClass("button.blue"); $mainTable->addControl($input, 1, 1, 1, 1, "Center", "Middle"); $mainTable->addControl($button, 2, 1, 1, 1, "Center", "Middle"); $win->addControl($mainTable); function twitter() { Twitter::Tweet($input); }
function viewAccueil($db) { menu(); // Users $users = new Users($db); $nbUsers = 0; $listeUsers = $users->selectAll(); foreach ($listeUsers as $unUser) { $nbUsers = $nbUsers + 1; } // Fin users // Début news $news = new News($db); $nbNews = 0; $listeNews = $news->selectAll(); foreach ($listeNews as $uneNews) { $nbNews = $nbNews + 1; } // Fin news // Début profs $profs = new Profs($db); $nbProfsABS = 0; $listeProfs = $profs->selectAll(); foreach ($listeProfs as $unProf) { $nbProfsABS = $nbProfsABS + 1; } // Fin profs echo ' <!--main content start--> <section id="main-content"> <section class="wrapper"> <!--state overview start--> <div class="row state-overview"> <div class="col-lg-3 col-sm-6"> <section class="panel"> <div class="symbol terques"> <i class="fa fa-user"></i> </div> <div class="value"> <h1 class="count"> '; echo $nbUsers; echo '</h1> <p>Utilisateurs</p> </div> </section> </div> <div class="col-lg-3 col-sm-6"> <section class="panel"> <div class="symbol red"> <i class="fa fa-tags"></i> </div> <div class="value"> <h1 class=" count2"> '; echo $nbNews; echo ' </h1> <p>Actualités en ligne</p> </div> </section> </div> <div class="col-lg-3 col-sm-6"> <section class="panel"> <div class="symbol yellow"> <i class="fa fa-shopping-cart"></i> </div> <div class="value"> <h1 class=" count3"> 0 </h1> <p>Téléchargement de l\'application</p> </div> </section> </div> <div class="col-lg-3 col-sm-6"> <section class="panel"> <div class="symbol blue"> <i class="fa fa-bar-chart-o"></i> </div> <div class="value"> <h1 class=" count4"> '; echo $nbProfsABS; echo ' </h1> <p>Professeurs absents</p> </div> </section> </div> </div> <!--state overview end--> <div class="row"> <div class="col-lg-8"> <!--latest product info start--> <!--latest product info end--> <!--twitter feedback start--> <section class="panel post-wrap pro-box"> <aside class="post-highlight terques v-align"> <div class="panel-body"> '; twitter(); echo ' </div> </aside> <aside> <div class="post-info"> <span class="arrow-pro left"></span> <div class="panel-body"> <div class="text-center twite"> <h1>Dernier tweet du Lycée Guy Mollet</h1> </div> <footer class="social-footer"> <ul> <li> <a href="#"> <i class="fa fa-facebook"></i> </a> </li> <li class="active"> <a href="#"> <i class="fa fa-twitter"></i> </a> </li> </ul> </footer> </div> </div> </aside> </section> <!--twitter feedback end--> </div> <div class="col-lg-4"> <!--weather statement start--> <section class="panel"> <div class="weather-bg"> <div class="panel-body"> <div class="row"> <div class="col-xs-6"> <i class="fa fa-cloud"></i> Arras </div> <div class="col-xs-6"> <div class="degree">'; echo $_COOKIE["Cookie_Temperature"]; echo '</div> </div> </div> </div> </div> <footer class="weather-category"> <ul> <li class="active"> <h5>humidité</h5> '; echo $_COOKIE["Cookie_Humidite"]; echo '% </li> <li> <h5>precipitation</h5> '; echo $_COOKIE["Cookie_Precip"]; echo ' % </li> <li> <h5>vent</h5> '; echo $_COOKIE["Cookie_Vent"]; echo ' </li> </ul> </footer> </section> <!--weather statement end--> </div> </div> </section> </section> <!--main content end--> </section>'; }
<p> <?php if ($team->role() != '') { ?> <?php echo $team->role(); ?> <br> <?php } ?> <?php if ($team->tw() != '') { ?> <?php echo twitter($team->tw()); ?> <?php } ?> <?php if ($team->mail() != '') { ?> <a href="mailto:<?php echo $team->mail(); ?> "><i class="fa fa-envelope"></i></a> <?php } ?>
/** * Once every day a summaray will be tweeted, so that no nightly issue slips through unnoticed. * If nothing was tweeted since the last summary the summary is skipped. * @params * $bot :array, as defined in config.php * @returns nothing */ function summary_tweet($bot) { echo "\nProcessing summary\n"; echo "------------------------------------------------\n"; $last_summaries = get_logged_events("summary"); if (sizeof($last_summaries) <= 1) { /* The first two attempts to post the summary is blocked. On the first run lots of old issues get logged but not twittered. We dont want them to be included in the first summary. The second run may occur less than 24 hours later than the first one. It too would spam all the old issues. Blocking the first two attempts ensures that 24 hours have passed since the initial run of the bot, before posting any summary and thus no crap gets posted. */ echo "First regular run of the daily summary on this bot. No tweet will be sent."; $event = array("issue_id" => -1, "initiative_id" => -1, "job" => "summary"); log_event($event); //make sure the next run doesn't look like the first one return true; } $last_summary = (int) $last_summaries[0]["time"]; if ($last_summary == 0) { $since = time() - 24 * 60 * 60; } else { $sinde = $last_summary; } $min_gap = 1 * 60 * 60; //Minimum gap between two summaries, should be at least 60*60 seconds! $tweet_prefix = sprintf($bot['daily_tweet'], $bot['hashtag']); $tweet = ""; if (date("G") == $bot['daily_hour'] and $last_summary < time() - $min_gap) { //as long as the last summary did not occur during $min_gap seconds foreach ($bot['jobs'] as $job_label => $job) { $last_24h_events = get_logged_events($job_label, $last_summary); $num = sizeof($last_24h_events); if ($num > 0) { $tweet .= " {$job_label} {$num},"; } echo "\t{$job_label} {$num}\n"; } if ($tweet == "") { echo "\tNothing happend during the last 24 hours. No tweet will be sent."; } else { $tweet[strlen($tweet) - 1] = "."; echo "\tSending tweet: '{$tweet}'\n"; if (twitter($bot['twitter'], $tweet_prefix . $tweet)) { echo "\t\tSummary sent."; } else { echo "\t\tAborted: unable to send tweet.\n"; return false; } } $event = array("issue_id" => -1, "initiative_id" => -1, "job" => "summary"); log_event($event); } else { $date = date("D d.M Y, H:i", $last_summary); echo "It's not time for that: Waiting until " . $bot['daily_hour'] . "h.\n"; if (sizeof($last_summaries) > 1) { echo "Last summary was tweeted at {$date}."; } else { echo "There has no summary been tweeted yet."; } } echo "\n\n"; }
/** * Template code for including the twitter login button into the theme * * @param boolean $display_if_logged_in * @return html|string */ function twitter_login_button($display_if_logged_in = true) { //initializing variables App::import('Helper', 'Session'); $Session = new SessionComponent(); $auth = $Session->read('Auth'); //reasons to fail if (twitter('profile.id', null, false)) { return false; } if (!$display_if_logged_in && isset($auth['User']['id'])) { return false; } // The same as require('controllers/users_controller.php'); App::import('Helper', 'Html'); $html = new HtmlHelper(); $html->css('/twitterlogin/css/style.css', 'stylesheet', array('inline' => false)); echo "<a href='" . Router::url(array('admin' => false, 'plugin' => null, 'controller' => 'twitterlogin', 'action' => 'authorize'), true) . "'><div class='twitter-login-lighter'></div></a>"; }
if ($_GET['return'] == "twitter" && getSetting("enable_twitter", "text") == "true") { if (!empty($_SESSION['oauth_token']) && !empty($_SESSION['oauth_token_secret']) && !empty($_GET['oauth_verifier'])) { $twitter = twitter(); // Initialize Twitter try { $access_token = $twitter->oauth("oauth/access_token", array("oauth_verifier" => $_GET['oauth_verifier'])); // Change OAuth verifier with access code $_SESSION['twitter_token'] = $access_token['oauth_token']; // Save new OAuth token $_SESSION['twitter_token_secret'] = $access_token['oauth_token_secret']; // Same unset($_SESSION['oauth_token']); // Remove old OAuth token unset($_SESSION['oauth_token_secret']); // Same $twitter = twitter(); // Initialize Twitter again with the new OAuth token $get = $twitter->get("account/verify_credentials"); // Retrieve user info $get = (array) $get; $sid = $get['id']; $_SESSION['sid'] = $sid; // Save social ID to session $usercheck = mysqli_query($con, "SELECT * FROM users WHERE type='twitter' AND sid='{$sid}'"); if (mysqli_num_rows($usercheck) > 0) { // Check if user exists $login = explode("|||", socialLogin($sid, "twitter")); // Login if ($login[0]) { header('Location: ' . $login[1]); exit;
<dl class="faq"> <dt>Am I registered to vote?</dt> <dd><a target="_blank" href="https://www.vote.virginia.gov/search">Check your registration status</a></dd> <dt>Where do I vote?</dt> <dd><a target="_blank" href="https://voterinfo.sbe.virginia.gov/PublicSite/Public/FT2/PublicPollingPlace.aspx">Confirm your polling place</a></dd> <dt>Oh no! I'm not registered to vote. How can I register?</dt> <dd><a target="_blank" href="https://www.vote.virginia.gov">Register to vote online.</a> The deadline to register to vote November 3 is October 13.</dd> <dt>I will not be able to vote in person November 3. How do I request an absentee ballot?</dt> <dd><a target="_blank" href="http://elections.virginia.gov/index.php/casting-a-ballot/absentee-voting/">Request an absentee ballot.</a>The deadline to apply for an absentee ballot is October 26.</dd> </dl> </div> <div class="grid-4 omega non-mobile"> <?php include '../inc/sub-sidebar.php'; mailchimp(); twitter(); ?> </div> </div> </div> <?php include '../inc/footer.php'; ?>
</div> </header> <div class="main">[%LAYOUT_CONTENT%]</div> </div> <footer class="footer"> <div id="footer-tab"> <div id="social"> <ul class="social"> <li><a href="<?php echo facebook(); ?> " title="Facebook"><span class="icon fa fa-facebook"></span></a></li> <li><a href="<?php echo twitter(); ?> " title="Twitter"><span class="icon fa fa-twitter"></span></a></li> <li><a href="<?php echo googlePlus(); ?> " title="Google+"><span class="icon fa fa-google-plus"></span></a></li> <li><a href="<?php echo pinterest(); ?> " title="Pinterest"><span class="icon fa fa-pinterest"></span></a></li> <li><a href="<?php echo linkedIn(); ?> " title="LinkedIn"><span class="icon fa fa-linkedin"></span></a></li> <li><a href="<?php