/** * @see Action::run() */ public function run() { $this->db = Storage::getDatabase(); /*** PART 1: Read from saved posts and construct a markov chain ***/ $posts = $this->db->getPosts($this->useOnlyUnmodeledPosts, $this->postLimit); $markov = $this->buildMarkovChain($posts); if ($this->useOnlyUnmodeledPosts && count($posts) > 0) { $recent_date = $posts[0]['date_saved']; $old_date = $posts[count($posts) - 1]['date_saved']; $this->db->markPostsModeled($old_date, $recent_date); } /*** PART 2: now that we have our markov chain built, sample from it to * build the post ***/ $thepost = $this->constructPostFromMarkovChain($markov); /*** PART 3: Translate the post and send it, if the API key was set ***/ $API = TwitterAPI::getTwitterAPI(); /* ** GOOGLE TRANSLATE API DEPRECATED ** if (isset($this->googleKey)) { $thepost = Translate::translate($thepost, 'en', $this->googleKey); } */ $API->update($thepost); // destroy the database connection unset($this->db); // all done return parent::SUCCESS; }
public function getRecentPosts() { $username = self::getUsernameFromUrl($this->feed->link); $recent = collect(\TwitterAPI::getUserTimeline(['screen_name' => $username, 'count' => 20, 'format' => 'object'])); $tweets = $recent->reject(function ($t) { return !empty($t->in_reply_to_status_id) || $t->retweeted == true; }); return $tweets; }
private function authenticate() { /* Build TwitterAPI object with client credentials. */ $connection = new TwitterAPI(_TWITTER_CONSUMER_KEY_, _TWITTER_CONSUMER_SECRET_); /* Get temporary credentials. */ $request_token = $connection->getRequestToken(_TWITTER_OAUTH_CALLBACK_); /* Save temporary credentials to session. */ $this->session->set_userdata('oauth_token', $request_token['oauth_token']); $this->session->set_userdata('oauth_token_secret', $request_token['oauth_token_secret']); /* If last connection failed don't display authorization link. */ switch ($connection->http_code) { case 200: /* Build authorize URL and redirect user to Twitter. */ $url = $connection->getAuthorizeURL($request_token['oauth_token']); header('Location: ' . $url); break; default: /* Show notification if something went wrong. */ echo 'Could not connect to Twitter. Refresh the page or try again later.'; return false; } }
function update() { global $IN, $DB, $REGX, $LANG, $TMPL, $FNS, $PREFS, $LOC; /* if ($TMPL->fetch_param('debug') == 'yes') { $this->debug = TRUE; }*/ //get the preferences $query = $DB->query("SELECT * FROM exp_twitter_settings LIMIT 1"); if ($query->num_rows == 1) { $twitter_username = $query->row['twitter_username']; $twitter_password = base64_decode($query->row['twitter_password']); $system_status = $query->row['system_status']; $admin_email = $query->row['admin_email']; $notification = $query->row['notification']; } if ($system_status) { //get current setting time and day $datetime = date("M d, Y H:i", $LOC->server_now); $date = date("Y-m-d", $LOC->server_now); $day = date("l", $LOC->server_now); $minTime = date("H:i", $LOC->server_now - 5 * 60); $minTimeA = explode(":", $minTime); $minTime = str_pad($minTimeA[0], 2, '0', STR_PAD_LEFT) . ':' . str_pad($minTimeA[1], 2, '0', STR_PAD_LEFT) . ':00'; $maxTime = date("H:i", $LOC->server_now + 5 * 60); $maxTimeA = explode(":", $maxTime); $maxTime = str_pad($maxTimeA[0], 2, '0', STR_PAD_LEFT) . ':' . str_pad($maxTimeA[1], 2, '0', STR_PAD_LEFT) . ':00'; //get the entries with open, date time etc $sql = "SELECT m.message_id, m.message, m.send_time, m.send_day, h.message_id as sent_message_id, h.sent_date as sent_date\n FROM exp_twitter_messages AS m\n LEFT JOIN exp_twitter_history as h on m.message_id=h.message_id \n WHERE m.status=1 AND m.send_day='" . $day . "' AND send_time>='" . $minTime . "' AND send_time<='" . $maxTime . "'\n GROUP BY m.message_id ORDER BY m.send_time ASC,h.sent_date DESC \n "; $query = $DB->query($sql); if ($query->num_rows > 0) { $message = ''; foreach ($query->result as $row) { if ($row['sent_date'] != $date) { $message_id = $row['message_id']; $message = $row['message']; break; } } if ($message) { //update twitter status //include API class file that post messages using CURL require PATH_MOD . 'twitter/lib/class.twitter.php'; $twitter = new TwitterAPI($twitter_username, $twitter_password); $response = $twitter->updateStatus(urlencode($message)); $LANG->fetch_language_file('twitter'); $msg = ''; switch ($twitter->lastStatusCode()) { case '200': $response['success'] = TRUE; $msg = $LANG->line('successful_tweet'); break; case '400': $msg = $LANG->line('rate_limit_exceeded'); break; case '401': $msg = $LANG->line('no_account'); break; case '403': $msg = "Error: " . $response; break; case '404': $msg = "Error: " . $LANG->line('not_authorised'); break; case '500': $msg = "Error: " . $LANG->line('twiiter_outage'); break; case '502': $msg = "Error: " . $LANG->line('twiiter_outage'); break; case '503': $msg = "Error: " . $LANG->line('twiiter_outage'); break; case '0': $response['success'] = TRUE; $msg = $LANG->line('successful_tweet'); break; } //store this on history table $DB->query("INSERT INTO exp_twitter_history(message_id, message,sent_date) values (" . $message_id . ", '" . $DB->escape_str($message) . "', '" . $date . "' )"); //if notification on, send notification to admin if ($notification and $admin_email != '') { if (!class_exists('EEmail')) { require PATH_CORE . 'core.email' . EXT; } $email_msg = $LANG->line('API_notification'); $email_msg = str_replace("%x", $datetime, $email_msg); $email_msg = str_replace("%y", $message, $email_msg); $email_msg = @str_replace("%z", $msg, $email_msg); $email = new EEmail(); $email->initialize(); $email->wordwrap = true; $email->from($PREFS->ini('webmaster_email'), $PREFS->ini('webmaster_name')); $email->to($admin_email); $email->reply_to($PREFS->ini('webmaster_email')); $email->subject($LANG->line('API_notification_subject')); $email->message($REGX->entities_to_ascii($email_msg)); $email->Send(); } return $message; } else { $LANG->fetch_language_file('twitter'); return $LANG->line('no_entry_scheduled'); } } else { $LANG->fetch_language_file('twitter'); return $LANG->line('no_entry_scheduled'); } } else { $LANG->fetch_language_file('twitter'); return $LANG->line('system_offline'); } }
<?php include_once "TwitterAPI.php"; include_once "settings.php"; if (!empty($_GET) && $_GET['key'] == $settings['oauth_access_token_secret']) { $GetTweets = new TwitterAPI($settings); $UserTweets = $GetTweets->insertTweetsToDB(); if (!empty($UserTweets)) { echo "All new tweets have been inserted to database."; } else { echo "We couldn't find new tweets."; } }
public function action_tweet($msg) { return TwitterAPI::tweet($msg); }
<?php session_start(); require_once "includes/TwitterAPI.php"; include_once "includes/settings.php"; $tweets = new TwitterAPI($settings); //check if session alrady set if (isset($_SESSION['oauth_token']) && isset($_SESSION['oauth_token_secret']) && isset($_GET['oauth_token'])) { $request['oauth_token'] = $_SESSION['oauth_token']; $request['oauth_token_secret'] = $_SESSION['oauth_token_secret']; if (isset($_GET['oauth_token']) && $request['oauth_token'] == $_GET['oauth_token']) { $_SESSION['auth'] = 1; } } $html = ' <!doctype html> <html> <head> <meta charset="utf-8"> <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script> <script type="text/javascript" src="js/ajax.js" ></script> <link rel="stylesheet" href="css/style.css"> <title>TweetToDB</title> </head> <body>'; if (isset($_SESSION['auth'])) { $html .= ' <div id="profile-pic"></div> <div id="container"> <div id="avatar-image">
function update_twitter_status() { global $IN, $DSP, $LANG, $LOC, $DB, $REGX; if ($this->validate_msg_length($_POST['message'], 1, 140) == false) { return $DSP->error_message($LANG->line('invalid_length')); } //get twitter settings $query = $DB->query("SELECT * FROM exp_twitter_settings LIMIT 1"); if ($query->num_rows == 1) { $twitter_username = $query->row['twitter_username']; $twitter_password = base64_decode($query->row['twitter_password']); $system_status = $query->row['system_status']; //check system is on and twitter info provided if ($system_status == 0) { return $DSP->error_message($LANG->line('system_off')); } } else { return $DSP->error_message($LANG->line('setting_not_done')); } //include API class file that post messages using CURL require PATH_MOD . 'twitter/lib/class.twitter.php'; $twitter = new TwitterAPI($twitter_username, $twitter_password); $response = $twitter->updateStatus(urlencode($_POST['message'])); $msg = ''; switch ($twitter->lastStatusCode()) { case '200': $response['success'] = TRUE; $msg = $LANG->line('successful_tweet'); break; case '400': $msg = $LANG->line('rate_limit_exceeded'); break; case '401': $msg = $LANG->line('no_account'); break; case '403': $msg = "Error: " . $response; break; case '404': $msg = "Error: " . $LANG->line('not_authorised'); break; case '413': $msg = "Error: " . $response; break; case '500': $msg = "Error: " . $LANG->line('twiiter_outage'); break; case '502': $msg = "Error: " . $LANG->line('twiiter_outage'); break; case '503': $msg = "Error: " . $LANG->line('twiiter_outage'); break; case '0': $response['success'] = TRUE; $msg = $LANG->line('successful_tweet'); break; } $date = date("Y-m-d", $LOC->server_now); //store this on history table $DB->query("INSERT INTO exp_twitter_history(message,sent_date) values ('" . $DB->escape_str($_POST['message']) . "', '" . $date . "' )"); return $this->twitter_home($msg); }
private function fetch_tweets($tweet_count, $username) { $settings = array('oauth_access_token' => OAUTH_ACCESS_TOKEN, 'oauth_access_token_secret' => OAUTH_ACCESS_TOKEN_SECRET, 'consumer_key' => CONSUMER_KEY, 'consumer_secret' => CONSUMER_SECRET); $url = "https://api.twitter.com/1.1/statuses/user_timeline.json"; $paramfield = "?screen_name={$username}"; $twitter = new TwitterAPI($settings); $tweets = $twitter->setParams($paramfield)->buildOauth($url)->performRequest(); $tweets = json_decode($tweets); // TODO : Code for error $data = new stdClass(); $data->username = $username; $data->tweet_count = $tweet_count; $data->tweets = array(); foreach ($tweets as $tweet) { if ($tweet_count-- === 0) { break; } $data->tweets[] = $this->filter_tweet($tweet->text); } set_transient('recent_tweets_widget', $data, 60 * 5); return $data; }
<?php session_start(); require_once "TwitterAPI.php"; include_once "settings.php"; $Tweets = new TwitterAPI($settings); if (!empty($_GET)) { //add comment if (!empty($_GET['id']) && is_numeric($_GET['id']) && !empty($_GET['comment'])) { $id = $_GET['id']; $comment = htmlentities(addslashes($_GET['comment'])); $postfields = array('status' => $comment, 'in_reply_to_status_id' => $id); $addComment = $Tweets->sendRequest('POST', 'https://api.twitter.com/1.1/statuses/update.json', $postfields, null); if (!empty($addComment)) { echo "<div class='ok'>Your comment added successfully</div>"; } else { echo "<div class='error'>Something wrong happened!<div>"; } } //favorit if (!empty($_GET['id']) && is_numeric($_GET['id']) && $_GET['action'] == 'ret') { $id = $_GET['id']; $postfields = array('id' => $id); $addRet = $Tweets->sendRequest('POST', 'https://api.twitter.com/1.1/statuses/retweet/' . $id . '.json', $postfields, null); if (!empty($addRet)) { $update = $Tweets->updateTweets($id, "retweeted"); echo "<div class='ok'>You have retweeted this tweet</div>"; } else { echo "<div class='error'>Something wrong happened!</div>"; } }
if (!in_array("#goal", $hashtagsList, false) && !in_array("#issue", $hashtagsList, false)) { echo "No action hashtag, skipping the tweet. [" . implode(";", $hashtagsList) . "] \n"; continue; } //var_dump($hashtagsList); echo "New relevant tweet, save to local db. \n"; $this->saveTweet($rson->statuses[$i]->id, mysql_real_escape_string($rson->statuses[$i]->id_str), mysql_real_escape_string($rson->statuses[$i]->created_at), mysql_real_escape_string($rson->statuses[$i]->text), mysql_real_escape_string($rson->statuses[$i]->user->id), mysql_real_escape_string($rson->statuses[$i]->user->id_str), mysql_real_escape_string($rson->statuses[$i]->user->name), mysql_real_escape_string($rson->statuses[$i]->user->screen_name), mysql_real_escape_string($rson->statuses[$i]->user->profile_image_url), mysql_real_escape_string(implode(";", $hashtagsList))); // Ensure that the user exists $userID = $gsAPI->addUser($rson->statuses[$i]->user->name, "https://twitter.com/account/redirect_by_id/" . $rson->statuses[$i]->user->id_str, $rson->statuses[$i]->user->profile_image_url); echo "Tweet user [{$userID}] \n"; //echo in_array("#issue", $hashtagsList, false); //var_dump($hashtagsList); if (in_array("#goal", $hashtagsList, false)) { echo "creating a goal. \n"; $gsAPI->addGoal($gsAPI->BASE_GOAL_URI . $rson->statuses[$i]->id_str, urldecode($this->extractTitle($rson->statuses[$i]->text)), urldecode($rson->statuses[$i]->text), "http://twitter.com/" . $rson->statuses[$i]->user->id_str . "/status/" . $rson->statuses[$i]->id_str, $userID); } elseif (in_array("#issue", $hashtagsList, false)) { echo "Creating a issue. \n"; $gsAPI->addIssue($gsAPI->BASE_ISSUE_URI . $rson->statuses[$i]->id_str, urldecode($this->extractTitle($rson->statuses[$i]->text)), urldecode($rson->statuses[$i]->text), "http://twitter.com/" . $rson->statuses[$i]->user->id_str . "/status/" . $rson->statuses[$i]->id_str, $userID); } else { echo "Error, nothing to do.. \n"; } // Loop next result set sleep(1); } // Loop next action } } } } $twitter = new TwitterAPI(); $twitter->runProcess();
public function parse_items($its, $margs, $wpqargs) { //echo 'ceva'; $fout = ''; $taxonomy = 'categoryportfolio'; $thecustomcats = array(); //print_r($margs); //=======custom categories if ($margs['cats'] != '') { $thecustomcats = explode(',', $margs['cats']); } //print_r($thecustomcats); for ($i = 0; $i < count($its); $i++) { //print_r($its[$i]); $iout = ''; $che = $its[$i]; // --- stabilizing meta $the_id = $che->ID; $the_link = get_permalink($the_id); //== the link to the actual item $the_type = 'thumb'; $striptags = true; $meta_disable_title_subtitle = get_post_meta($the_id, 'dzsp_disable_title_subtitle', true); $meta_disable_content = get_post_meta($the_id, 'dzsp_disable_content', true); $meta_biggallery = get_post_meta($the_id, 'dzsp_biggallery', true); $meta_image_gallery = get_post_meta($the_id, 'dzsp_image_gallery', true); $meta_image_gallery_images = explode(',', $meta_image_gallery); if (get_post_meta($the_id, 'dzsp_item_type', true) != '') { $the_type = get_post_meta($the_id, 'dzsp_item_type', true); } if ($the_type == 'thumb') { if ($meta_image_gallery != '') { $meta_biggallery = 'gallery-for-item-' . $the_id; } } if ($the_type == 'link') { $the_link = get_post_meta($the_id, 'dzsp_featured_media', true); } if (($margs['skin'] == 'skin-accordion' || $margs['skin'] == 'skin-clean') && ($the_type == 'video' || $the_type == 'youtube' || $the_type == 'vimeo' || $the_type == 'gallery' || $the_type == 'audio' || $the_type == 'testimonial')) { $meta_disable_content = 'on'; $meta_disable_title_subtitle = 'on'; } //===== setting up links START / setup links $link_type_featuredmedia = get_post_meta($the_id, 'dzsp_link_featurearea', true); $link_featuredmedia = get_post_meta($the_id, 'dzsp_big_image', true); //dzsp_link_featurearea if (get_post_meta($the_id, 'dzsp_link_featurearea', true) == 'item') { $link_featuredmedia = $the_link; } if (get_post_meta($the_id, 'dzsp_link_featurearea', true) == 'customlink') { $link_featuredmedia = get_post_meta($the_id, 'dzsp_customlink', true); } if (get_post_meta($the_id, 'dzsp_link_featurearea', true) == 'content_opener') { $link_featuredmedia = 'content_opener'; } if (get_post_meta($the_id, 'dzsp_link_featurearea', true) == 'none') { $link_featuredmedia = ''; } $link_type_metaarea = get_post_meta($the_id, 'dzsp_link_metaarea', true); $link_metaarea = $the_link; //dzsp_link_featurearea if (get_post_meta($the_id, 'dzsp_link_metaarea', true) == 'bigimage') { $link_metaarea = get_post_meta($the_id, 'dzsp_big_image', true); } if (get_post_meta($the_id, 'dzsp_link_metaarea', true) == 'customlink') { $link_metaarea = get_post_meta($the_id, 'dzsp_customlink', true); } if (get_post_meta($the_id, 'dzsp_link_metaarea', true) == 'content_opener') { $link_metaarea = 'content_opener'; } if (get_post_meta($the_id, 'dzsp_link_metaarea', true) == 'none') { $link_metaarea = ''; } $link_title = ''; //dzsp_link_featurearea if (get_post_meta($the_id, 'dzsp_link_title', true) == 'item') { $link_title = $the_link; } if (get_post_meta($the_id, 'dzsp_link_title', true) == 'customlink') { $link_title = get_post_meta($the_id, 'dzsp_customlink', true); } if (get_post_meta($the_id, 'dzsp_link_title', true) == 'none') { $link_title = ''; } if ($link_metaarea != '') { $link_title = ''; } // echo ' cevava '.$the_id.' '.get_post_meta($the_id,'dzsp_link_metaarea',true).' | '.$link_metaarea; $str_item_w = ''; $aux = get_post_meta($the_id, 'dzsp_force_width', true); if ($aux != '') { $str_item_w .= ' width:'; if (strpos($aux, "%") === false && strpos($aux, "auto") === false && strpos($aux, "px") === false) { $str_item_w .= $aux . 'px'; } else { $str_item_w .= $aux; } $str_item_w .= ';'; } $str_item_h = ''; $aux = get_post_meta($the_id, 'dzsp_force_height', true); if ($aux != '') { $str_item_h .= ' height:'; if (strpos($aux, "%") === false && strpos($aux, "auto") === false && strpos($aux, "px") === false) { $str_item_h .= $aux . 'px'; } else { $str_item_h .= $aux; } $str_item_h .= ';'; } $str_thumb_w = ''; $aux = get_post_meta($the_id, 'dzsp_force_thumb_width', true); if ($aux != '') { $str_thumb_w .= ' width:'; if (strpos($aux, "%") === false && strpos($aux, "auto") === false && strpos($aux, "px") === false) { $str_thumb_w .= $aux . 'px'; } else { $str_thumb_w .= $aux; } $str_thumb_w .= ';'; } $str_thumb_h = ''; $aux = get_post_meta($the_id, 'dzsp_force_thumb_height', true); if ($aux != '') { $str_thumb_h .= ' height:'; if (strpos($aux, "%") === false && strpos($aux, "auto") === false && strpos($aux, "px") === false) { $str_thumb_h .= $aux . 'px'; } else { $str_thumb_h .= $aux; } $str_thumb_h .= ';'; } $the_subtitle = get_post_meta($the_id, 'dzsp_subtitle', true); if ($the_subtitle == '' && ($margs['skin'] == 'skin-default' || $margs['skin'] == 'skin-zero') && $che->post_excerpt) { $the_subtitle = $che->post_excerpt; } $post_terms = array(); $post_terms = wp_get_post_terms($the_id, $taxonomy, array("fields" => "names")); if ($wpqargs['post_type'] == 'product') { $taxonomy = 'product_cat'; $post_terms = wp_get_post_terms($the_id, $taxonomy, array("fields" => "names")); } if ($wpqargs['post_type'] == 'courses') { //echo 'ceva'; $taxonomy = 'course_categories'; $post_terms = wp_get_post_terms($the_id, 'category', array("fields" => "names")); } if ($wpqargs['post_type'] == 'post') { //echo 'ceva'; $taxonomy = 'category'; $post_terms = wp_get_post_terms($the_id, 'category', array("fields" => "names")); } //print_r($post_terms); //=== needs improving, zoomit - now i think it does not $design_item_width = $margs['design_item_width']; $design_item_height = $margs['design_item_height']; // -- design_item_height was set in the if ($design_item_height == '' || $design_item_height == 'auto') { $design_item_height = 200; } //==temp solution // echo $design_item_width; echo $design_item_height; echo 'design'; $the_src = ''; if ($this->db_mainoptions['thumbs_full_quality'] == 'full') { $the_src = wp_get_attachment_image_src(get_post_thumbnail_id($che->ID), 'full'); } else { if ($this->db_mainoptions['thumbs_full_quality'] == 'medium') { $the_src = wp_get_attachment_image_src(get_post_thumbnail_id($che->ID), array($design_item_width * 2, $design_item_height * 2)); } else { $the_src = wp_get_attachment_image_src(get_post_thumbnail_id($che->ID), array($design_item_width, $design_item_height)); } } //print_r($the_src); $thumbnail_src = $the_src[0]; if ($this->db_mainoptions['misc_force_featured_media_over_featured_image'] == 'on' && get_post_meta($the_id, 'dzsp_featured_media', true) != '' || $thumbnail_src == '' && get_post_meta($the_id, 'dzsp_featured_media', true) != '') { $thumbnail_src = get_post_meta($the_id, 'dzsp_featured_media', true); } // print_r($margs); $maxlen = 233; if (isset($margs['settings_excerpt_len'])) { $maxlen = $margs['settings_excerpt_len']; } if (get_post_meta($the_id, 'dzsp_excerpt_len', true) != '') { $maxlen = get_post_meta($the_id, 'dzsp_excerpt_len', true); } if ($maxlen === 'all') { $maxlen = 1234567; } $po_excerpt_content = ''; // ----- -------- -------- -- --------- // --- -------- start output the item // ---------- ------------- - ----------- $iout .= '<div class="portitem-tobe'; if (get_post_meta($the_id, 'dzsp_extra_classes', true) != '') { $iout .= ' ' . get_post_meta($the_id, 'dzsp_extra_classes', true); } $iout .= '" '; // --- we force the youtube and vimeo to Featured Media Meta Field ( it's a id, you can't set it in Featured Image ) $dataType = $the_type; // --datatype is the type to put int javascript if ($the_type == 'twitter') { $dataType = 'testimonial'; } if ($the_type == 'youtube' || $the_type == 'vimeo' || $the_type == 'video') { // ---- videos // ------ if there is a featured image if ($the_src[0] != '') { $iout .= ' data-thumbnail="' . $the_src[0] . '"'; } $iout .= ' data-source_video="' . get_post_meta($the_id, 'dzsp_featured_media', true) . '"'; if (get_post_meta($the_id, 'dzsp_sourceogg', true) != '') { $iout .= ' data-source_video_ogg="' . get_post_meta($the_id, 'dzsp_sourceogg', true) . '"'; } } else { $iout .= ' data-thumbnail="' . $thumbnail_src . '"'; } if ($the_type == 'audio') { wp_enqueue_script('dzs.audioplayer', $this->thepath . 'audioplayer/audioplayer.js'); wp_enqueue_style('dzs.audioplayer', $this->thepath . 'audioplayer/audioplayer.css'); // print_r($the_src); // ------ if there is a featured image if ($the_src[0] != '') { $iout .= ' data-thumbnail="' . $the_src[0] . '"'; } $iout .= ' data-source_audio="' . get_post_meta($the_id, 'dzsp_featured_media', true) . '"'; if (get_post_meta($the_id, 'dzsp_sourceogg', true) != '') { $iout .= ' data-source_audio_ogg="' . get_post_meta($the_id, 'dzsp_sourceogg', true) . '"'; } } if ($the_type == 'thumb' && isset($margs['settings_biggalleryall']) && $margs['settings_biggalleryall'] == 'on') { $iout .= ' data-biggallery="' . 'port1' . '"'; } else { if ($the_type == 'thumb' && $meta_biggallery != '') { $iout .= ' data-biggallery="' . $meta_biggallery . '"'; } } if (get_post_meta($the_id, 'dzsp_open_big_image_in_lightbox', true) == 'off') { $iout .= ' data-donotopenbigimageinzoombox="on"'; } if (get_post_meta($the_id, 'dzsp_highlight_color', true) != '') { $iout .= ' data-color_highlight="' . get_post_meta($the_id, 'dzsp_highlight_color', true) . '"'; } if (get_post_meta($the_id, 'dzsp_slideshowtime', true) != '') { $iout .= ' data-slideshowtime="' . get_post_meta($the_id, 'dzsp_slideshowtime', true) . '"'; } $iout .= ' data-link="' . $link_metaarea . '"'; $iout .= ' data-typefeaturedarea="' . $dataType . '"'; if (get_post_meta($the_id, 'dzsp_big_image', true) != '') { if ($margs['skin'] == 'skin-clean') { $iout .= ' data-bigimage="' . get_post_meta($the_id, 'dzsp_big_image', true) . '"'; } else { $iout .= ' data-bigimage="' . $link_featuredmedia . '"'; } } if (get_post_meta($the_id, 'dzsp_force_width', true) != '') { $iout .= ' data-forcewidth="' . get_post_meta($the_id, 'dzsp_force_width', true) . '"'; } if (get_post_meta($the_id, 'dzsp_force_height', true) != '') { $iout .= ' data-forceheight="' . get_post_meta($the_id, 'dzsp_force_height', true) . '"'; } if (get_post_meta($the_id, 'dzsp_force_thumb_width', true) != '') { $iout .= ' data-forcethumbwidth="' . get_post_meta($the_id, 'dzsp_force_thumb_width', true) . '"'; } if (get_post_meta($the_id, 'dzsp_force_thumb_height', true) != '') { $iout .= ' data-forcethumbheight="' . get_post_meta($the_id, 'dzsp_force_thumb_height', true) . '"'; } if (is_array($post_terms)) { $ik = 0; $iout .= ' data-category="'; foreach ($post_terms as $post_term) { //print_r($post_term); echo 'ceva'; print_r($thecustomcats); //$cat $auxsw = false; foreach ($thecustomcats as $customcat) { $aux = get_term($customcat, $taxonomy); //print_r($aux); if ($aux->name == $post_term) { $auxsw = true; } } if ($margs['cats'] == '') { $auxsw = true; } if ($auxsw == false) { continue; } //print_r($thecustomcats); if ($ik > 0) { $iout .= ';'; } $post_term = str_replace('"', '', $post_term); $iout .= $post_term; $ik++; } $iout .= '"'; } if ($the_type == 'youtube') { $iout .= ' data-heroimage="' . $this->thepath . 'dzsportfolio/img/hero-type-video-youtube.png"'; } if ($the_type == 'vimeo') { $iout .= ' data-heroimage="' . $this->thepath . 'dzsportfolio/img/hero-type-video-vimeo.png"'; } if ($the_type == 'twitter') { $iout .= ' data-heroimage="' . $this->thepath . 'dzsportfolio/img/hero-type-twitter.png"'; } if ($the_type == 'link') { $iout .= ' data-heroimage="' . $this->thepath . 'dzsportfolio/img/hero-type-link.png"'; } $iout .= '>'; if ($the_type == 'gallery') { wp_enqueue_script('dzs.advancedscroller', $this->thepath . 'advancedscroller/plugin.js'); wp_enqueue_style('dzs.advancedscroller', $this->thepath . 'advancedscroller/plugin.css'); $iout .= '<div class="the-feature-data">'; $image_gallery_meta = get_post_meta($the_id, 'dzsp_image_gallery', true); $image_gallery_arr = explode(',', $image_gallery_meta); if (is_array($image_gallery_arr) && count($image_gallery_arr) > 0) { foreach ($image_gallery_arr as $img) { //echo ; $imgsrc = wp_get_attachment_image_src($img, 'full'); //echo $imgsrc; $iout .= '<img class="fullwidth" src="' . $imgsrc[0] . '"/>'; } } $iout .= '</div>'; } if ($the_type == 'testimonial') { //echo 'ceva'; $iout .= '<div class="the-feature-data">'; $iout .= get_post_meta($the_id, 'dzsp_featured_media', true); $iout .= '</div>'; } if ($the_type == 'twitter') { //echo 'ceva'; $iout .= '<div class="the-feature-data">'; include_once dirname(__FILE__) . '/twitterapiwrapper/twitterapi.php'; //==complete these with your twitter api key details $token = $this->db_mainoptions['twitter_token']; $token_secret = $this->db_mainoptions['twitter_token_secret']; $consumer_key = $this->db_mainoptions['twitter_consumer_key']; $consumer_secret = $this->db_mainoptions['twitter_consumer_secret']; $api1 = new TwitterAPI($token, $token_secret, $consumer_key, $consumer_secret); $query = array('screen_name' => get_post_meta($the_id, 'dzsp_featured_media', true), 'count' => '1'); $data = $api1->do_query($query); //print_r($data); if (isset($data->errors)) { print_r($data); //echo 'ceva'; } else { $iout .= $data[0]->text; } $iout .= '</div>'; } if ($the_type == 'audio') { wp_enqueue_script('dzs.audioplayer', $this->thepath . 'audioplayer/audioplayer.js'); wp_enqueue_style('dzs.audioplayer', $this->thepath . 'audioplayer/audioplayer.css'); } if ($the_type == 'video' || $the_type == 'youtube' || $the_type == 'vimeo') { wp_enqueue_script('dzs.vplayer', $this->thepath . "videogallery/vplayer.js"); wp_enqueue_style('dzs.vplayer', $this->thepath . 'videogallery/vplayer.css'); } $the_post_content = ''; $attachments = get_children(array('post_parent' => $the_id, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC')); //echo 'the post is ' . $the_id . "\n"; $str_items = ''; $image_gallery_meta = get_post_meta($the_id, 'dzsp_image_gallery', true); $image_gallery_arr = explode(',', $image_gallery_meta); if ($image_gallery_meta != '') { foreach ($image_gallery_arr as $img) { //echo ; $imgsrcarr = wp_get_attachment_image_src($img, 'full'); //echo $imgsrc; $str_items .= '<li class="item-tobe needs-loading"> <div class="imagediv" style="background-image: url(' . $imgsrcarr[0] . '); height:250px;"></div> </li>'; } } $aux_stripshortcodes = true; if ($maxlen === 1234567) { $striptags = false; $aux_stripshortcodes = false; } $the_post_content_inner = ''; $the_post_content_inner .= stripslashes(DZSHelpers::wp_get_excerpt($the_id, array('forceexcerpt' => false, 'readmore' => 'auto', 'stripshortcodes' => $aux_stripshortcodes, 'striptags' => $striptags, 'maxlen' => $maxlen, 'content' => $po_excerpt_content, 'aftercutcontent_html' => ' [...]'))); $the_post_content_inner = str_replace('{link_metaarea}', $link_metaarea, $the_post_content_inner); // echo 'ceva'.$the_post_content_inner.'END'; //we run the html through a parser to close unclosed tags if ($striptags == false && $the_post_content_inner != '' && class_exists('DOMDocument') && $maxlen !== 1234567) { $doc = new DOMDocument(); $doc->loadHTML($the_post_content_inner); $aux_body_html = ''; $children = $doc->childNodes; $scriptTags = $doc->getElementsByTagName('script'); foreach ($scriptTags as $script) { if ($script->childNodes->length && $script->firstChild->nodeType == 4) { $cdata = $script->removeChild($script->firstChild); $text = $doc->createTextNode($cdata->nodeValue); $script->appendChild($text); } } foreach ($children as $child) { // print_r($child); // echo $child->ownerDocument->saveXML( $child ); $aux_body_html .= $child->ownerDocument->saveXML($child); } $aux_body_html = str_replace('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html><body>', '', $aux_body_html); $aux_body_html = str_replace('</body></html>', '', $aux_body_html); $aux_body_html = str_replace(array('<![CDATA['), '', $aux_body_html); $aux_body_html = str_replace(array(' '), '', $aux_body_html); // $aux_body_html = preg_replace('>', 'dadahmm', $aux_body_html); // echo 'auxhtml'; echo $aux_body_html; $the_post_content_inner = $aux_body_html; } $excerpt_gallery_slider_str = ''; $the_project_meta_html = ''; if ($str_items != '') { $excerpt_gallery_slider_str .= '<div class="advancedscroller-con"> <div class="advancedscroller skin-agata-inset" style="width:100%;"><ul class="items">'; $excerpt_gallery_slider_str .= $str_items; $excerpt_gallery_slider_str .= '</ul></div></div>'; $excerpt_gallery_slider_str .= '<div class="toexecute"> (function() { var aux = window.dzsp_execute_target.find(".advancedscroller"); jQuery(document).ready(function($){ window.dzsas_init(aux,{ settings_mode: "onlyoneitem" ,design_arrowsize: "0" ,settings_swipe: "on" ,settings_swipeOnDesktopsToo: "on" ,settings_slideshow: "on" ,settings_slideshowTime: "15" }); }); })(); </div>'; } if ($che->post_excerpt != '') { $the_project_meta_html = $che->post_excerpt; } else { if ($excerpt_gallery_slider_str != '') { $the_project_meta_html .= '<div class="dzs-col-6">'; $the_project_meta_html .= $excerpt_gallery_slider_str; $the_project_meta_html .= '</div>'; $the_project_meta_html .= '<div class="dzs-col-6'; } else { $the_project_meta_html .= '<div class="dzs-col-12'; } if ($margs['skin'] == 'skin-accordion' || $margs['skin'] == 'skin-clean') { $the_project_meta_html .= ' project-meta-con'; } $the_project_meta_html .= '">'; $the_project_meta_html .= stripslashes(DZSHelpers::wp_get_excerpt($the_id, array('maxlen' => 4000, 'forceexcerpt' => false, 'readmore' => 'auto', 'stripshortcodes' => false, 'striptags' => false, 'maxlen' => $maxlen, 'aftercutcontent_html' => ' [...]'))); $the_project_meta_html .= '</div>'; } $the_project_meta_html = str_replace('{{dzsp_gallery_slider}}', $excerpt_gallery_slider_str, $the_project_meta_html); $the_project_meta_html = str_replace('{{dzsp_post_link}}', get_permalink($the_id), $the_project_meta_html); $str_big_content = ''; $str_big_content .= '<div class="the-content excerpt-content" style=""><div class="dzs-colcontainer">'; $str_big_content .= $the_project_meta_html; $str_big_content .= '</div></div>'; // echo 'ceva3'.$str_big_content; // echo $margs['skin'] . 'ceva'; if ($margs['skin'] == 'skin-corporate') { $iout .= '<div class="item-meta" style="margin-top: 15px;">'; } //echo 'ceva23'; echo $str_items; echo $str_items!=''; if ($margs['skin'] == 'skin-clean' || $margs['skin'] == 'skin-accordion') { if ($link_type_featuredmedia == 'content_opener') { $iout .= $str_big_content; } } //echo 'hmmceva'.$the_post_content_inner.'hmmalceva';; $the_post_content .= $the_post_content_inner; //===skins which have a slider if ($margs['skin'] == 'skin-accordion' || $margs['skin'] == 'skin-clean') { $the_post_content .= '</div>'; //===END skins which have a slider } // $the_post_content.='</div>'; //close row // echo $the_post_content; //==skin default and skin-nebula and skin-timeline have only title and desc //=== skin corporate has content but uses these too.. if (($margs['skin'] == 'skin-timeline' || $margs['skin'] == 'skin-nebula' || $margs['skin'] == 'skin-clean' || $margs['skin'] == 'skin-corporate' || $margs['skin'] == 'skin-default' || $margs['skin'] == 'skin-zero' || $margs['skin'] == 'skin-accordion' || $margs['skin'] == 'skin-boxed' || $margs['skin'] == 'skin-aura' || $margs['skin'] == 'skin-vintage' || $margs['skin'] == 'skin-commerce') && $meta_disable_title_subtitle != 'on') { if ($che->post_title) { $iout .= '<div class="the-title">'; if ($link_title != '') { $iout .= '<a href="' . $link_title . '">'; } $iout .= $che->post_title; if ($link_title != '') { $iout .= '</a>'; } $iout .= '</div>'; } if ($wpqargs['post_type'] == 'product' && ($margs['skin'] == 'skin-default' || $margs['skin'] == 'skin-commerce') && $the_subtitle == '') { $the_subtitle = ''; $old_price = ''; $sale_price = ''; $old_price = get_post_meta($the_id, '_regular_price', true); if (get_post_meta($the_id, '_sale_price', true)) { $sale_price = get_post_meta($the_id, '_sale_price', true); } //--- if woo commerce enabled if ($old_price && function_exists('get_woocommerce_currency_symbol')) { if ($sale_price) { $the_subtitle .= '<div class="price"><span class="real-price">' . get_woocommerce_currency_symbol(get_woocommerce_currency()) . $sale_price . '</span> <span class="old-price">' . get_woocommerce_currency_symbol(get_woocommerce_currency()) . $old_price . '</span></div>'; } else { $the_subtitle .= '<div class="price"><span class="real-price">' . get_woocommerce_currency_symbol(get_woocommerce_currency()) . $old_price . '</span></div>'; } $the_subtitle .= ' <div class="addtocart-con">'; if ($margs['skin'] == 'skin-default') { $the_subtitle .= '<div class="button-addtocart">'; } if ($margs['skin'] == 'skin-commerce') { $the_subtitle .= '<div class="addtocart-btn">'; } switch (get_post_meta($the_id, 'dzswc_link_purchase', true)) { case "customlink": $the_subtitle .= '<a href="' . get_post_meta($the_id, 'dzswc_customlink', true) . '">ADD TO CART</a>'; break; case 'none': $the_subtitle .= '<span>ADD TO CART</span>'; break; default: $the_subtitle .= '<a href="' . $the_link . '?add-to-cart=' . $che->ID . '">ADD TO CART</a>'; break; } $the_subtitle .= '</div></div>'; } } if ($the_subtitle != '' && $margs['skin'] != 'skin-boxed') { $iout .= '<div class="the-desc">'; $iout .= $the_subtitle; $iout .= '</div>'; } if ($margs['skin'] == 'skin-corporate') { $iout .= $the_post_content . ''; } } // echo 'cevahmm'.($margs['skin'] == 'skin-clean' || $margs['skin'] == 'skin-corporate' || $margs['skin'] == 'skin-accordion').' ; '.($meta_disable_content != 'on').' ; '.($the_post_content_inner!=''). $the_post_content_inner; if (($margs['skin'] == 'skin-boxed' || $margs['skin'] == 'skin-vintage') && $meta_disable_content != 'on' && $the_post_content_inner != '') { // echo 'hmmdadadada'; $iout .= '<div class="the-desc">'; if ($margs['skin'] == 'skin-boxed') { $iout .= '<hr class="separator-short">'; } $iout .= $the_post_content . ''; //echo $str_items; if ($str_items != '') { wp_enqueue_script('dzs.advancedscroller', $this->thepath . 'advancedscroller/plugin.js'); wp_enqueue_style('dzs.advancedscroller', $this->thepath . 'advancedscroller/plugin.css'); } $iout .= '</div>'; } if ($margs['skin'] === 'skin-corporate') { $iout .= '</div>'; ///===end item-meta } if (get_post_meta($the_id, 'dzsp_highlight_color', true) != '') { if ($margs['skin'] == 'skin-default') { $iout .= '<style>'; $iout .= ' #port' . $this->sliders_index . ' .portitem:nth-child(' . ($i + 1) . '):hover .the-title{ color: ' . get_post_meta($the_id, 'dzsp_highlight_color', true) . ';}'; $iout .= ' #port' . $this->sliders_index . ' .portitem:nth-child(' . ($i + 1) . '):hover:after{ border-bottom-color: ' . get_post_meta($the_id, 'dzsp_highlight_color', true) . '; }'; $iout .= ' #port' . $this->sliders_index . ' .portitem:nth-child(' . ($i + 1) . '):hover{ border-bottom: 1px solid ' . get_post_meta($the_id, 'dzsp_highlight_color', true) . ';}'; $iout .= '</style>'; } } //------------ //===skinblog custom markup if ($margs['skin'] == 'skin-blog') { ///===== skin blog $str_bg = ''; if (get_post_meta($the_id, 'dzsp_highlight_color', true) != '') { $str_bg = 'background-color:' . get_post_meta($the_id, 'dzsp_highlight_color', true) . ';'; } $str_datainittop = ''; if (get_post_meta($the_id, 'dzsp_infometa_top', true) != '') { $str_datainittop = ' data-inittop="' . get_post_meta($the_id, 'dzsp_infometa_top', true) . '"'; } //echo $str_datainittop; if ($meta_disable_content != 'on') { $iout .= '<div class="item-meta" ' . $str_datainittop . ' style="' . $str_bg . '">'; $iout .= '<div class="the-title">'; if ($the_link != '') { $iout .= '<a href="' . $the_link . '">'; } $iout .= $che->post_title; if ($the_link != '') { $iout .= '</a>'; } $iout .= '</div>'; $iout .= '<div class="the-post-meta">'; //==calendar $iout .= '<span class="meta-property">'; $iout .= '<span class="icon-meta-calendar"></span>'; $iout .= '<span class="meta-property-content">'; $iout .= get_the_time('Y-m-d', $the_id); $iout .= '</span>'; $iout .= '</span>'; $post_terms_ids = wp_get_post_terms($the_id, 'categoryportfolio', array("fields" => "ids")); $ik = 0; if (is_array($post_terms_ids)) { $iout .= '<span class="meta-property"><span class="icon-meta-category"></span><span class="meta-property-content">'; foreach ($post_terms_ids as $post_term) { if ($ik > 0) { $iout .= ', '; } $aux_term = get_term($post_term, 'categoryportfolio'); //print_r($aux_term); echo ' '; $term_link = get_term_link($aux_term->slug, 'categoryportfolio'); $iout .= '<a href="' . $term_link . '">' . $aux_term->name . '</a>'; $ik++; } $iout .= '</span></span>'; } if (comments_open($the_id)) { $num_comments = get_comments_number($the_id); if ($num_comments == 0) { } else { //==comments $iout .= '<span class="meta-property">'; $iout .= '<span class="icon-meta-comment"></span>'; $iout .= '<span class="meta-property-content""><a href="' . get_permalink($the_id) . '#comments">'; $iout .= $num_comments; $iout .= ' ' . __('comments', 'dzsp') . '</a></span>'; $iout .= '</span>'; } } $iout .= '</div>'; // dzs_get_excerpt($the_id,array('forceexcerpt' => false,'readmore' => 'on','maxlen' => $maxlen)) $iout .= '<div class="the-post-content">' . $the_post_content . '</div>'; $iout .= '</div>'; // END item-meta } } //$the_meta = $this->get_post_meta_all($the_id); //print_r($the_meta); // //echo $the_link; $iout .= '</div>'; // continue; // -------------------- ------ // --- layered construct - --- // ----- ------------- ------- if ($margs['skin'] == 'skin-default') { $iout = ''; $iout .= '<div class="portitem-tobe'; if (get_post_meta($the_id, 'dzsp_extra_classes', true) != '') { $iout .= ' ' . get_post_meta($the_id, 'dzsp_extra_classes', true); } $iout .= '" style="'; $iout .= $str_item_w; $iout .= $str_item_h; // if (get_post_meta($the_id,'dzsp_force_height',true) != '') { // $iout.=' data-forceheight="'.get_post_meta($the_id,'dzsp_force_height',true).'"'; // } // if (get_post_meta($the_id,'dzsp_force_thumb_width',true) != '') { // $iout.=' data-forcethumbwidth="'.get_post_meta($the_id,'dzsp_force_thumb_width',true).'"'; // } // if (get_post_meta($the_id,'dzsp_force_thumb_height',true) != '') { // $iout.=' data-forcethumbheight="'.get_post_meta($the_id,'dzsp_force_thumb_height',true).'"'; // } $iout .= '"'; if ($the_type == 'audio') { wp_enqueue_script('dzs.audioplayer', $this->thepath . 'audioplayer/audioplayer.js'); wp_enqueue_style('dzs.audioplayer', $this->thepath . 'audioplayer/audioplayer.css'); // print_r($the_src); // ------ if there is a featured image if ($the_src[0] != '') { $iout .= ' data-thumbnail="' . $the_src[0] . '"'; } $iout .= ' data-source_audio="' . get_post_meta($the_id, 'dzsp_featured_media', true) . '"'; if (get_post_meta($the_id, 'dzsp_sourceogg', true) != '') { $iout .= ' data-source_audio_ogg="' . get_post_meta($the_id, 'dzsp_sourceogg', true) . '"'; } } if ($the_type == 'youtube' || $the_type == 'vimeo' || $the_type == 'video') { // ---- videos wp_enqueue_script('dzs.vplayer', $this->thepath . "videogallery/vplayer.js"); wp_enqueue_style('dzs.vplayer', $this->thepath . 'videogallery/vplayer.css'); // ------ if there is a featured image if ($the_src[0] != '') { $iout .= ' data-thumbnail="' . $the_src[0] . '"'; } $iout .= ' data-source_video="' . get_post_meta($the_id, 'dzsp_featured_media', true) . '"'; } if (get_post_meta($the_id, 'dzsp_sourceogg', true) != '') { $iout .= ' data-source_video_ogg="' . get_post_meta($the_id, 'dzsp_sourceogg', true) . '"'; } if (is_array($post_terms)) { $ik = 0; $iout .= ' data-category="'; foreach ($post_terms as $post_term) { //print_r($post_term); echo 'ceva'; print_r($thecustomcats); //$cat $auxsw = false; foreach ($thecustomcats as $customcat) { $aux = get_term($customcat, $taxonomy); //print_r($aux); if ($aux->name == $post_term) { $auxsw = true; } } if ($margs['cats'] == '') { $auxsw = true; } if ($auxsw == false) { continue; } //print_r($thecustomcats); if ($ik > 0) { $iout .= ';'; } $post_term = str_replace('"', '', $post_term); $iout .= $post_term; $ik++; } $iout .= '"'; } $iout .= ' data-typefeaturedarea="' . $dataType . '"'; $iout .= '>'; if ($the_type == 'gallery') { wp_enqueue_script('dzs.advancedscroller', $this->thepath . 'advancedscroller/plugin.js'); wp_enqueue_style('dzs.advancedscroller', $this->thepath . 'advancedscroller/plugin.css'); $iout .= '<div class="the-feature-data">'; if (is_array($meta_image_gallery_images) && count($meta_image_gallery_images) > 0) { foreach ($meta_image_gallery_images as $img) { if ($img == '') { continue; } $aux_po = get_post($img); $the_src = ''; $the_thumb = ''; if ($aux_po && $aux_po->post_mime_type == 'video/mp4') { $the_src = $aux_po->guid; } else { $imgsrc = wp_get_attachment_image_src($img, 'full'); $the_src = $imgsrc[0]; $the_thumb = $the_src; } if (get_post_meta($img, '_attachment_video_thumb', true) != '') { $the_thumb = get_post_meta($img, '_attachment_video_thumb', true); } $iout .= '<img class="fullwidth" src="' . $the_src . '" style="'; $iout .= $str_thumb_h; $iout .= '"/>'; } } $iout .= '</div>'; } $iout .= '<div class="the-feature-con " style="'; $iout .= $str_thumb_w; $iout .= $str_thumb_h; $iout .= '"'; $iout .= '>'; if ($the_type == 'thumb' || $the_type == 'link') { $iout .= '<div class="the-feature" style="background-image: url(' . $thumbnail_src . ');"></div>'; } // if($dataType=='gallery'){ // $iout.='<div class="the-feature advancedscroller skin-inset type-'+$dataType+'" style=""><ul class="items">'; // // $iout.='</ul></div>'; // } if ($the_type == 'link') { $link_featuredmedia = $the_link; } $iout .= '<div class="the-overlay">'; // <a data-biggallerythumbnail="img/t2.jpg" data-biggallery="gal1" href="img/b1.jpg" class="the-overlay-anchor content-opener" data-src="img/b1.jpg"> // <div class="plus-image"></div> // </a> if ($link_featuredmedia != '') { if ($the_type == 'thumb' || $the_type == 'link') { $iout .= '<a '; // echo 'cevava' . $the_id . ' ' . $link_type_featuredmedia; if ($link_type_featuredmedia === 'bigimage' && get_post_meta($the_id, 'dzsp_open_big_image_in_lightbox', true) != 'off') { if ($margs['settings_lightboxlibrary'] == 'prettyphoto') { $iout .= ' rel="prettyPhoto[' . $meta_biggallery . ']" title="You can add caption to pictures."'; } else { $iout .= 'data-biggallerythumbnail="' . $thumbnail_src . '"'; if (isset($margs['settings_biggalleryall']) && $margs['settings_biggalleryall'] == 'on') { $iout .= ' data-biggallery="' . 'port1' . '"'; } else { if ($the_type == 'thumb' && $meta_biggallery != '') { $iout .= ' data-biggallery="' . $meta_biggallery . '"'; } } } } $iout .= ' href="' . $link_featuredmedia . '" class="the-overlay-anchor'; if ($link_type_featuredmedia === 'content_opener') { $iout .= ' content-opener'; } if ($link_type_featuredmedia === 'bigimage') { if ($margs['settings_lightboxlibrary'] == 'prettyphoto') { } else { $iout .= ' zoombox'; } } $iout .= '" data-src="' . $link_featuredmedia . '"> <div class="plus-image"></div> </a>'; } } $iout .= '</div>'; //--end the-overlay $iout .= '</div>'; // -- end the-feature-con if ($link_metaarea == '' || $link_metaarea == 'content_opener') { $iout .= '<div class="item-meta'; if ($link_metaarea == 'content_opener') { $iout .= ' content-opener'; } $iout .= '" style="">'; } else { $iout .= '<a href="' . $link_metaarea . '" class="item-meta" style="">'; } if ($meta_disable_title_subtitle != 'on') { if ($che->post_title) { $iout .= '<div class="the-title">'; if ($link_title != '') { $iout .= '<a href="' . $link_title . '">'; } $iout .= $che->post_title; if ($link_title != '') { $iout .= '</a>'; } $iout .= '</div>'; } if ($wpqargs['post_type'] == 'product' && ($margs['skin'] == 'skin-default' || $margs['skin'] == 'skin-commerce') && $the_subtitle == '') { $the_subtitle = ''; $old_price = ''; $sale_price = ''; $old_price = get_post_meta($the_id, '_regular_price', true); if (get_post_meta($the_id, '_sale_price', true)) { $sale_price = get_post_meta($the_id, '_sale_price', true); } //--- if woo commerce enabled if ($old_price && function_exists('get_woocommerce_currency_symbol')) { if ($sale_price) { $the_subtitle .= '<div class="price"><span class="real-price">' . get_woocommerce_currency_symbol(get_woocommerce_currency()) . $sale_price . '</span> <span class="old-price">' . get_woocommerce_currency_symbol(get_woocommerce_currency()) . $old_price . '</span></div>'; } else { $the_subtitle .= '<div class="price"><span class="real-price">' . get_woocommerce_currency_symbol(get_woocommerce_currency()) . $old_price . '</span></div>'; } $the_subtitle .= ' <div class="addtocart-con">'; if ($margs['skin'] == 'skin-default') { $the_subtitle .= '<div class="button-addtocart">'; } if ($margs['skin'] == 'skin-commerce') { $the_subtitle .= '<div class="addtocart-btn">'; } switch (get_post_meta($the_id, 'dzswc_link_purchase', true)) { case "customlink": $the_subtitle .= '<a href="' . get_post_meta($the_id, 'dzswc_customlink', true) . '">ADD TO CART</a>'; break; case 'none': $the_subtitle .= '<span>ADD TO CART</span>'; break; default: $the_subtitle .= '<a href="' . $the_link . '?add-to-cart=' . $che->ID . '">ADD TO CART</a>'; break; } $the_subtitle .= '</div></div>'; } } if ($the_subtitle != '' && $margs['skin'] != 'skin-boxed') { $iout .= '<div class="the-desc">'; $iout .= $the_subtitle; $iout .= '</div>'; } } // <div class="the-title">Paris Photoshoot</div> // <div class="the-desc">June 2013</div> if ($link_metaarea == '' || $link_metaarea == 'content_opener') { $iout .= '</div>'; } else { $iout .= '</a>'; } if ($link_metaarea == 'content_opener' || $link_featuredmedia == 'content_opener' || $link_title == 'content_opener') { $iout .= $str_big_content; } $iout .= '</div>'; //-- end portitem-tobe } // --- entering hidden thumbs for the lightbox library for project if ($the_type == 'thumb') { if (is_array($meta_image_gallery_images) && count($meta_image_gallery_images) > 0) { foreach ($meta_image_gallery_images as $img) { if ($img == '') { continue; } $aux_po = get_post($img); $the_src = ''; $the_thumb = ''; if ($aux_po && $aux_po->post_mime_type == 'video/mp4') { $the_src = $aux_po->guid; } else { $imgsrc = wp_get_attachment_image_src($img, 'full'); $the_src = $imgsrc[0]; $the_thumb = $the_src; } if (get_post_meta($img, '_attachment_video_thumb', true) != '') { $the_thumb = get_post_meta($img, '_attachment_video_thumb', true); } //echo $imgsrc; //echo 'ceva'; print_r($aux); if ($margs['settings_lightboxlibrary'] == 'prettyphoto') { $iout .= '<a href="' . $the_src . '" class="hidden" rel="prettyPhoto[' . $meta_biggallery . ']" title="You can add caption to pictures."><img src="' . $the_thumb . '" width="60" height="60" alt="Red round shape" /></a>'; } else { $iout .= '<a href="' . $the_src . '" class="hidden zoombox" data-biggallery="' . $meta_biggallery . '" data-biggallerythumbnail="' . $the_thumb . '"></a>'; } } } } $fout .= $iout; } return $fout; }
public static function tweets($username) { self::$error_msg = false; if (!self::started()) { self::$error_msg = 'Could not get Authorization'; return false; } $parameters['screen_name'] = $username; $data = http_build_query($parameters); if (Controller::$debug) { echo '<pre>http://api.twitter.com/1/statuses/user_timeline.json?' . $data . '</pre>'; } $returned = curl_request('http://api.twitter.com/1/statuses/user_timeline.json?' . $data, array(), array('cache' => 60 * 60 * 24)); //$returned = file_get_contents(APP_FOLDER . '/tweets.js'); if (Controller::$debug) { echo "<pre>{$returned}</pre>"; } if (!$returned) { self::$error_msg = 'Invalid Twitter API request'; return false; } else { if (!($result = json_decode($returned))) { self::$error_msg = 'Invalid JSON returned: ' . $returned; return false; } } if (array_key_exists('error', $result)) { self::$error_msg = $result->error; } else { return $result; } return false; }