public function event($atts)
 {
     require_once WT_PLUGIN_PATH . 'admin/template.php';
     require_once WT_PLUGIN_PATH . 'admin/handlers.php';
     require_once WT_PLUGIN_PATH . 'dwoo/dwooAutoload.php';
     $dwoo = new Dwoo();
     if ($atts["id"]) {
         $event = new WT_Event($atts["id"]);
         $event->retrieve();
         if ($event->data) {
             $theme = new WT_Theme();
             return $theme->post_event($event->template(), false);
         }
     }
     return "";
 }
Exemple #2
0
function get_comment_row_html($row)
{
    global $wpdb, $_wt_options;
    $row = (array) $row;
    $comment_id = $row["comment_id"];
    $author = $row["comment_author"];
    $email = $row["comment_author_email"];
    $content = $row["comment_content"];
    $date = $row["comment_date"];
    $event_id = $row["comment_event_id"];
    $comment_total = get_comment_total_by_event($event_id);
    $total = $comment_total["total"];
    $pending = $comment_total["total_pending"];
    $status = $row["comment_approved"] ? "approved" : "unapproved";
    $user_id = $row["comment_user_id"];
    $avatar = get_avatar($user_id, 32);
    ///$event_title = get_event_title($event_id);
    $event = new WT_Event($event_id);
    $event->retrieve();
    $event_data = $event->db_out();
    $response_to = "{$event_data['event_start_date']} at the {$event_data['venue_name']}";
    $unapprove_class = "action-unapprove_comment:comment_id-{$comment_id}:event_id-{$event_id}:_nonce-" . wp_create_nonce(WT_Comment::NONCE_UNAPPROVE);
    $edit_class = "comment_id-{$comment_id}";
    $approve_class = "action-approve_comment:comment_id-{$comment_id}:event_id-{$event_id}:_nonce-" . wp_create_nonce(WT_Comment::NONCE_APPROVE);
    $delete_class = "action-delete_comment:comment_id-{$comment_id}:event_id-{$event_id}:_nonce-" . wp_create_nonce(WT_Comment::NONCE_DELETE);
    $html = "<tr class='{$status}'>\n\t\t\t\t<th class='check-column' scope='row'>\n\t\t\t\t\t<input type='checkbox' value='{$comment_id}'/>\n\t\t\t\t</th>\n\t\t\t\t<td class='author column-author'>\n\t\t\t\t\t<strong>{$avatar} {$author}</strong>\n\t\t\t\t</td>\n\t\t\t\t<td class='comment column-comment'>\n\t\t\t\t\t<div id='submitted-on'>Submitted on <a href='#'>{$date}</a></div>\n\t\t\t\t\t<p><b>{$title}</b><br/>{$content}</p>\n\t\t\t\t\t<div class='row-actions' id='comment-row-actions'>\n\t\t\t\t\t\t<span class='approve'>\n\t\t\t\t\t\t\t<a title='Approve this comment' href='#' class='{$approve_class}'>Approve</a> | \n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span class='unapprove'>\n\t\t\t\t\t\t\t<a title='Unapprove this comment' class='{$unapprove_class}' href='#'>Unapprove</a> | \n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<span class='quickedit'> \n\t\t\t\t\t\t\t<a class='{$edit_class}' title='Edit comment' href='#'>Edit</a>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span class='delete'> | \n\t\t\t\t\t\t<a class='{$delete_class}' href='#'>Delete Permanently</a>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t\t<td class='response column-response'>\n\t\t\t\t\t<div class='response-links'>\n\t\t\t\t\t\t<span class='post-com-count-wrapper'>\n\t\t\t\t\t\t\t<a href='" . admin_url("admin.php?page=wordtour/navigation.php&action=edit&event_id=") . "{$event_id}'>{$response_to}<a/><br/>\n\t\t\t\t\t\t\t<a href='" . admin_url("admin.php?page=wt_comments") . "&e={$event_id}' class='post-com-count'>\n\t\t\t\t\t\t\t\t<span class='comment-count'>{$total}</span>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>";
    return $html;
}
 public function save_event($data = array())
 {
     $event_id = $data["eventbrite_event_id"];
     $event = new WT_Event($event_id);
     $event->retrieve();
     if ($this->is_init() && $event->data) {
         $social = new WT_Social();
         // check if event social type is exist
         $social_row = $social->get_by_event($data[eventbrite_event_id], "ebevent");
         // if exist get eventbrite event id
         $eb_event_id = $social_row ? $social_row["social_ref_id"] : 0;
         // check if event exist - by id
         $r = wt_file_get_contents("http://www.eventbrite.com/json/event_get?app_key={$this->app_key}&user_key={$this->user_key}&id={$eb_event_id}");
         // event exist in system - need to update
         if ($this->is_valid_response($r)) {
             $is_event = 1;
         } else {
             try {
                 // event doesnt exist in system - need to add new
                 if ($this->response["error"]["error_type"] == "Not Found") {
                     $is_event = 0;
                 } else {
                     return 0;
                 }
             } catch (Exception $e) {
                 return 0;
             }
         }
         $param = array("title" => $data["eventbrite_title"], "start_date" => $event->data["event_start_date"] . " " . $event->data["event_start_time"], "end_date" => $event->data["event_end_date"] . " " . ($event->data["event_end_time"] == "00:00:01" ? $event->data["event_start_time"] : $event->data["event_end_time"]), "timezone" => "GMT" . (get_option("gmt_offset") > 0 ? "+" . get_option("gmt_offset") : get_option("gmt_offset")), "privacy" => $data["eventbrite_privacy"], "personalized_url" => $data["personalized_url"], "status" => $data["eventbrite_status"], "description" => $data["eventbrite_description"], "organizer_id" => $this->get_organizer_id());
         $venue_id = $this->get_venue_id($event->data["event_venue_id"]);
         if ($venue_id) {
             $param["venue_id"] = $venue_id;
             if (!$is_event) {
                 $action = "event_new";
             } else {
                 $action = "event_update";
                 $param["event_id"] = $eb_event_id;
             }
             $r = wt_file_get_contents("http://www.eventbrite.com/json/{$action}?app_key={$this->app_key}&user_key={$this->user_key}&" . http_build_query($param));
             if ($this->is_valid_response($r)) {
                 if (!$social_row) {
                     $eb_event_id = $this->response["process"]["id"];
                     $social->insert(wp_create_nonce(WT_SOCIAL::NONCE_INSERT), "ebevent", $event_id, $eb_event_id, "event");
                     return $eb_event_id;
                 } else {
                     $social->update(wp_create_nonce(WT_SOCIAL::NONCE_INSERT), $social_row["social_id"], "ebevent", $event_id, $eb_event_id, "event");
                     return $eb_event_id;
                 }
             } else {
                 if ($this->response["error"]["error_type"] == "Not Found") {
                     global $wpdb;
                     $wpdb->query("DELETE FROM " . WORDTOUR_SOCIAL . " WHERE social_type='ebevent' AND social_parent_id={$event_id} AND social_parent_type='event' AND social_ref_id={$eb_event_id}");
                 }
             }
         }
         return 0;
     }
 }
Exemple #4
0
    ?>
	<div class="wordtour-selectable">
		
		<?php 
    foreach ($genres as $genre) {
        $genre = ucwords($genre);
        echo "<a class='ui-selectee' href='#'><strong>{$genre}</strong></a>";
    }
    ?>
	</div>	
	
<?php 
}
if ($_GET["page"] == "twitter") {
    $event = new WT_Event($_GET["event_id"]);
    $data = $event->retrieve();
    $event_id = $_GET["event_id"];
    $nonce = wp_create_nonce(WT_SOCIAL::NONCE_INSERT);
    if ($options["twitter_template"]) {
        $tpl = array();
        foreach ($event->template($data) as $key => $value) {
            $tpl["%" . $key . "%"] = $value;
        }
        $status = strtr($options["twitter_template"], $tpl);
    }
    ?>
<form>
	<div id="dialog-alert" class='wordtour-alert'></div>
	<input type="hidden" name="_twitter_nonce" value="<?php 
    echo $nonce;
    ?>
     $rsvp->panel_markup($_POST["event_id"]);
     break;
 case "delete-rsvp":
     if ($_POST["rsvp_id"]) {
         $rsvp = new WT_RSVP($_POST["rsvp_id"]);
         $rsvp->remove();
         $rsvp->db_response("json");
         //echo json_encode(array("type"=>"success"));
     }
     break;
     // EVENTS
 // EVENTS
 case "get_event":
     $event = new WT_Event($_POST["event_id"]);
     if (!empty($_POST["event_id"])) {
         $event->retrieve();
     } else {
         $event->defaults();
     }
     echo json_encode($event->db_out(null, 0));
     break;
 case "insert_event":
     $event = new WT_Event();
     $event->insert($_POST);
     $event->db_response("json");
     break;
 case "update_event":
     $event = new WT_Event($_POST["event_id"]);
     $event->update($_POST);
     $event->db_response("json");
     break;