function ai_get_twitter_feeds($atts) { extract(shortcode_atts(array('ai_username' => '', 'ai_numberoftweets' => '', 'ai_tweet_title' => ''), $atts)); $ai_get_twitteruser = $ai_username ? $ai_username : get_option('ai_consumer_screen_name'); $ai_get_notweets = $ai_numberoftweets ? $ai_numberoftweets : get_option('ai_display_number_of_tweets'); $ai_get_tweetstitle = $ai_tweet_title ? $ai_tweet_title : 'Latest Twetter Feeds'; $ai_twitteruser = $ai_get_twitteruser; $ai_notweets = $ai_get_notweets; $ai_consumerkey = get_option('ai_consumer_key'); $ai_consumersecret = get_option('ai_consumer_secret'); $ai_accesstoken = get_option('ai_access_token'); $ai_accesstokensecret = get_option('ai_access_token_secret'); $ai_twitter_css = get_option('ai_twitter_css'); if ($ai_twitteruser != '' && $ai_notweets != '' && $ai_consumerkey != '' && $ai_consumersecret != '' && $ai_accesstoken != '' && $ai_accesstokensecret != '') { $ai_tweets = get_connect($ai_consumerkey, $ai_consumersecret, $ai_accesstoken, $ai_accesstokensecret, $ai_twitteruser, $ai_notweets); wp_register_style('aitwitter', plugins_url('css/aitwitter.css', __FILE__)); wp_enqueue_style('aitwitter'); if (!empty($ai_twitter_css)) { wp_add_inline_style('aitwitter', $ai_twitter_css); } if (is_admin()) { $screen = get_current_screen(); if ($screen->id == 'dashboard') { $ai_wid_title = ""; $ai_class = ""; } else { $ai_wid_title = "<h3 class='widget-title'>" . $ai_get_tweetstitle . "</h3>"; $ai_class = "aiwidgetscss widget"; } } else { $ai_wid_title = "<h3 class='widget-title'>" . $ai_get_tweetstitle . "</h3>"; $ai_class = "aiwidgetscss widget"; } $ai_output = "<div class='" . $ai_class . "'>\r\n\t\t" . $ai_wid_title . "\t\t\t\t\t\r\n\t\t<div class='aiwidget-title'><span class='tweet_author_name'>" . $ai_twitteruser . "</span> <span class='tweet_author_heading'><a href='https://twitter.com/{$ai_twitteruser}' target='_blank'>@" . $ai_twitteruser . "</a></span></div>"; for ($i = 0; $i < count($ai_tweets); $i++) { if (!empty($ai_tweets->errors)) { $ai_output .= '<p>' . $ai_tweets->errors[$i]->message . '</p>'; } else { $ai_img_html = '<a href="https://twitter.com/' . $ai_twitteruser . '" target="_blank"><img src="' . $ai_tweets[$i]->user->profile_image_url_https . '" class="imgalign"/></a>'; $ai_username_html = '<span class="tweet_author_name"> <a href="https://twitter.com/' . $ai_twitteruser . '" target="_blank">' . $ai_tweets[$i]->user->name . '</a> </span> <span class="tweet_author"><a href="https://twitter.com/' . $ai_twitteruser . '" target="_blank">@' . $ai_twitteruser . '</a></span><br />'; $ai_timestamp_html = '<a href="https://twitter.com/' . $ai_tweets[$i]->user->screen_name . '/status/' . $ai_tweets[$i]->id_str . '" target="_blank">' . ai_getTime($ai_tweets[$i]->created_at) . '</a>'; $ai_replay_html = '<a target="_blank" href="https://twitter.com/intent/tweet?in_reply_to=' . $ai_tweets[$i]->id_str . '">reply</a>'; $ai_retweet_html = '<a target="_blank" href="https://twitter.com/intent/retweet?tweet_id=' . $ai_tweets[$i]->id_str . '">retweet</a>'; $ai_favorite_html = '<a target="_blank" href="https://twitter.com/intent/favorite?tweet_id=' . $ai_tweets[$i]->id_str . '">favorite</a>'; $ai_follow_html = '<p class="thinkTwitFollow"><a href="https://twitter.com/' . $ai_twitteruser . '" class="twitter-follow-button" data-show-count="false" data-dnt="true">Follow @' . $ai_twitteruser . '</a></p>'; $ai_follow_html .= "<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>"; $ai_output .= '<div class="imgdisplay">' . $ai_img_html . ' <div class="tweettxts"> <div class="tweettext">' . $ai_username_html . '' . ai_makeLink($ai_tweets[$i]->text) . '  </div> <div class="tweetlink"> ' . $ai_timestamp_html . ' ' . $ai_replay_html . ' ' . $ai_retweet_html . ' ' . $ai_favorite_html . ' <a href="https://twitter.com/' . $ai_twitteruser . '" target="_blank">' . ai_twitter_formatter($ai_tweets[$i]->created_at) . '</a> </div> </div> </div>'; } } $ai_output .= $ai_follow_html . "</div>"; //echo $ai_output; } else { $ai_output = "<div id='aiwidgetscss'>\r\n\t\t<h1>" . $ai_get_tweetstitle . "</h1>\r\n\t\t<div>Please Fill All Required Value</div>\r\n\t\t</div>"; //echo $ai_output; } return $ai_output; }
/** * 获取多个结果集 * @param $sql */ function sql_fetch_tables($sql) { $link = get_connect(); $ret = array(); $stime = my_microtime_float(); if ($link->multi_query($sql)) { loginfo($stime, $sql); do { if ($r = $link->store_result()) { $tb = array(); while ($row = $r->fetch_row()) { $tb[] = $row; } $ret[] = $tb; $r->close(); } } while ($link->next_result()); } return $ret; }
if ($curdir[strlen($curdir) - 1] != '/') { $curdir .= '/'; } $curdir .= "meta/"; define("BASE_META_DIR", $curdir); echo "BASE_META_DIR is not defined. assigned to script dir " . BASE_META_DIR . "\n"; } if (isset($scrape_sales_at) && (int) date("H") != $scrape_sales_at) { if ($scrape_options["debug"]) { echo "skipping sales report scraping - it's not a time (need wait for {$scrape_sales_at}, it's only " . (int) date("H") . " now)\n"; } define("NEED_SALES", false); } else { define("NEED_SALES", true); } $conn = get_connect(); if (!$conn) { die("DB connection failed to established\n"); } else { echo "DB connection established\n"; } if (!isset($logins) || !is_array($logins)) { die('nothing to scrape'); } if (!is_dir(BASE_META_DIR) && !mkdir(BASE_META_DIR)) { die("couldn't access to directory for storing meta data [" . BASE_META_DIR . "]\n"); } if (!is_dir(BASE_META_DIR . '/temp') && !mkdir(BASE_META_DIR . '/temp')) { die("couldn't access to directory for storing meta data [" . BASE_META_DIR . "/temp]\n"); } $success = false;