'video', //singular name of the listed records
'plural' => 'videos', //plural name of the listed records
'ajax' => false //does this table support ajax?
) );
}
function column_default($item, $column_name){
switch($column_name){
case 'title':
// case 'director':
return $item[$column_name];
default:
return print_r($item,true); //Show the whole array for troubleshooting purposes
}
}
function column_title($item){
//Build row actions
$actions = array(
'edit' => sprintf('Edit ','prash_edit_video','edit',$item['id']),
'delete' => sprintf('Delete ','prash_delete_video','delete',$item['id']),
'get_full_video_code' => sprintf('Get Video Code(Full) ','prash_get_full_video_code','get_full_video_code',$item['id']),
'get_video_shortcode' => sprintf('Get Video Shortcode ','prash_get_video_shortcode','get_video_shortcode',$item['id']),
);
//Return the title contents
return sprintf('%1$s (id:%2$s) %3$s',
/*$1%s*/ $item['title'],
/*$2%s*/ $item['id'],
/*$3%s*/ $this->row_actions($actions)
);
}
function column_cb($item){
return sprintf(
' ',
/*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie")
/*$2%s*/ $item['id'] //The value of the checkbox should be the record's id
);
}
function get_columns(){
$columns = array(
'cb' => ' ', //Render a checkbox instead of text
'title' => 'Title'
);
return $columns;
}
function get_sortable_columns() {
$sortable_columns = array(
'title' => array('title',false) //true means it's already sorted
);
return $sortable_columns;
}
function get_bulk_actions() {
$actions = array(
'delete' => 'Delete'
);
return $actions;
}
function process_bulk_action() {
//Detect when a bulk action is being triggered...
if( 'delete'===$this->current_action() ) {
wp_die('Items deleted (or they would be if we had items to delete)!');
}
}
function prepare_items() {
global $wpdb; //This is used only if making any database queries
$all_videos_sql = "select id, title, vid from " . $wpdb->prefix . 'prash_videos';
$all_videos = $wpdb->get_results($all_videos_sql);
$all_videos_arr = array();
foreach($all_videos as $my_video){
$temp_array = array(
'id' => $my_video->id,
'title' => $my_video->title
);
array_push($all_videos_arr, $temp_array);
}
/**
* First, lets decide how many records per page to show
*/
$per_page = 5;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
$this->process_bulk_action();
$data = $this->example_data;
$data = $all_videos_arr;
function usort_reorder($a,$b){
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'title'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order==='asc') ? $result : -$result; //Send final sort direction to usort
}
usort($data, 'usort_reorder');
$current_page = $this->get_pagenum();
/**
* REQUIRED for pagination. Let's check how many items are in our data array.
* In real-world use, this would be the total number of items in your database,
* without filtering. We'll need this later, so you should always include it
* in your own package classes.
*/
$total_items = count($data);
/**
* The WP_List_Table class does not handle pagination for us, so we need
* to ensure that the data is trimmed to only the current page. We can use
* array_slice() to
*/
$data = array_slice($data,(($current_page-1)*$per_page),$per_page);
/**
* REQUIRED. Now we can add our *sorted* data to the items property, where
* it can be used by the rest of the class.
*/
$this->items = $data;
/**
* REQUIRED. We also have to register our pagination options & calculations.
*/
$this->set_pagination_args( array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages
) );
}
}
class Optinformtable extends WP_List_Table {
function __construct(){
global $status, $page;
//Set parent defaults
parent::__construct( array(
'singular' => 'video', //singular name of the listed records
'plural' => 'videos', //plural name of the listed records
'ajax' => false //does this table support ajax?
) );
}
/** ************************************************************************
* Recommended. This method is called when the parent class can't find a method
* specifically build for a given column. Generally, it's recommended to include
* one method for each column you want to render, keeping your package class
* neat and organized. For example, if the class needs to process a column
* named 'title', it would first see if a method named $this->column_title()
* exists - if it does, that method will be used. If it doesn't, this one will
* be used. Generally, you should try to use custom column methods as much as
* possible.
*
* Since we have defined a column_title() method later on, this method doesn't
* need to concern itself with any column with a name of 'title'. Instead, it
* needs to handle everything else.
*
* For more detailed insight into how columns are handled, take a look at
* WP_List_Table::single_row_columns()
*
* @param array $item A singular item (one full row's worth of data)
* @param array $column_name The name/slug of the column to be processed
* @return string Text or HTML to be placed inside the column
**************************************************************************/
function column_default($item, $column_name){
switch($column_name){
case 'title':
// case 'director':
return $item[$column_name];
default:
return print_r($item,true); //Show the whole array for troubleshooting purposes
}
}
/** ************************************************************************
* Recommended. This is a custom column method and is responsible for what
* is rendered in any column with a name/slug of 'title'. Every time the class
* needs to render a column, it first looks for a method named
* column_{$column_title} - if it exists, that method is run. If it doesn't
* exist, column_default() is called instead.
*
* This example also illustrates how to implement rollover actions. Actions
* should be an associative array formatted as 'slug'=>'link html' - and you
* will need to generate the URLs yourself. You could even ensure the links
*
*
* @see WP_List_Table::::single_row_columns()
* @param array $item A singular item (one full row's worth of data)
* @return string Text to be placed inside the column (movie title only)
**************************************************************************/
function column_title($item){
//Build row actions
$actions = array(
// 'edit' => sprintf('Edit ',$_REQUEST['page'],'edit',$item['id']),
// 'delete' => sprintf('Delete ',$_REQUEST['page'],'delete',$item['id']),
'edit' => sprintf('Edit ','prash_edit_optin','edit',$item['id']),
'delete' => sprintf('Delete ','prash_delete_optin','delete',$item['id']),
// 'add_action' => sprintf('Manage Actions ','prash_add_action','add_action',$item['id']),
);
//Return the title contents
return sprintf('%1$s (id:%2$s) %3$s',
/*$1%s*/ $item['title'],
/*$2%s*/ $item['id'],
/*$3%s*/ $this->row_actions($actions)
);
}
/** ************************************************************************
* REQUIRED if displaying checkboxes or using bulk actions! The 'cb' column
* is given special treatment when columns are processed. It ALWAYS needs to
* have it's own method.
*
* @see WP_List_Table::::single_row_columns()
* @param array $item A singular item (one full row's worth of data)
* @return string Text to be placed inside the column (movie title only)
**************************************************************************/
function column_cb($item){
return sprintf(
' ',
/*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie")
/*$2%s*/ $item['id'] //The value of the checkbox should be the record's id
);
}
/** ************************************************************************
* REQUIRED! This method dictates the table's columns and titles. This should
* return an array where the key is the column slug (and class) and the value
* is the column's title text. If you need a checkbox for bulk actions, refer
* to the $columns array below.
*
* The 'cb' column is treated differently than the rest. If including a checkbox
* column in your table you must create a column_cb() method. If you don't need
* bulk actions or checkboxes, simply leave the 'cb' entry out of your array.
*
* @see WP_List_Table::::single_row_columns()
* @return array An associative array containing column information: 'slugs'=>'Visible Titles'
**************************************************************************/
function get_columns(){
$columns = array(
'cb' => ' ', //Render a checkbox instead of text
'title' => 'Title'
);
return $columns;
}
/** ************************************************************************
* Optional. If you want one or more columns to be sortable (ASC/DESC toggle),
* you will need to register it here. This should return an array where the
* key is the column that needs to be sortable, and the value is db column to
* sort by. Often, the key and value will be the same, but this is not always
* the case (as the value is a column name from the database, not the list table).
*
* This method merely defines which columns should be sortable and makes them
* clickable - it does not handle the actual sorting. You still need to detect
* the ORDERBY and ORDER querystring variables within prepare_items() and sort
* your data accordingly (usually by modifying your query).
*
* @return array An associative array containing all the columns that should be sortable: 'slugs'=>array('data_values',bool)
**************************************************************************/
function get_sortable_columns() {
$sortable_columns = array(
'title' => array('title',false) //true means it's already sorted
);
return $sortable_columns;
}
/** ************************************************************************
* Optional. If you need to include bulk actions in your list table, this is
* the place to define them. Bulk actions are an associative array in the format
* 'slug'=>'Visible Title'
*
* If this method returns an empty value, no bulk action will be rendered. If
* you specify any bulk actions, the bulk actions box will be rendered with
* the table automatically on display().
*
* Also note that list tables are not automatically wrapped in
prefix . 'prash_optins';
$optin_id = $_REQUEST['id'];
$optin_edit = $wpdb->get_row("SELECT * FROM " . $optin_table . " where id = " .$optin_id);
?>
Edit Optin Form
** - Please select any autoresponder to save optin form
"; print_r($shortcode_tags); echo "";
?>
Create new Optin Form
Select from pre-created optin forms to start creating beautiful customizable forms for your videos.
** - Please select any autoresponder to create optin form. If there is no option to select any autoresponder then save your autoresponder credentials in Autoresponder Settings for selection.
Refresh Preview
Create actions
Actions are interactive elements/features that you can add to your videos. Select from the list below to create a new action.
prefix . "prash_videos";
$video_url = esc_html($_POST["youtube_url"]);
if(strpos($video_url, 'http') === 0) {
}else{
$video_url = "http://" . $video_url;
echo "inloop";
}
echo "video url: " . $video_url;
$videoid = getYouTubeVideoId($video_url);
echo "video id: " . $videoid;
$wpdb->show_errors();
if($videoid != "" && $videoid != null){
$save_check= $wpdb->insert($wpdb->prefix.'prash_videos', array(
'vid' => uniqid(),
'title' => esc_html($_POST["title"]),
'youtube' => $videoid,
'width' => $_POST["width"],
'height' => $_POST["height"],
'autoplay' => $_POST["autoplay"],
'dim' => $_POST["dim"],
'scroll_pause' => $_POST["scroll"],
'controls' => $_POST["show_controls"],
'auto_hide_cb' => $_POST["auto_hide_control_bar"],
'theme' => $_POST["player_theme"],
'vbordercolor' => $_POST["v_border_color"],
'social_share' => $_POST["s_share"],
'logo_brand_code' => $_POST["logo_brand"],
'logo_ps' => $_POST["logo_brand_position"],
'logo_pick' => $_POST["logo_pick"],
'logo_link' => $_POST["lk_logo"]
),
array(
'%s',
'%s',
'%s',
'%d',
'%d',
'%d',
'%d',
'%d',
'%d',
'%s',
'%s',
'%s',
'%d',
'%d',
'%d',
'%s',
'%s'
));
}else{
echo "Please check the Youtube video URL and try again." ;
// echo $wpdb->print_error();
return false;
}
if(0 < $save_check){
wp_redirect("admin.php?page=Prash_Video_List&success_msg=" . urlencode("Video Created Successfully")); exit();
// echo "Video Created Successfully";
return true;
}
else if(0 === $save_check){
wp_redirect("admin.php?page=Prash_Video_List&success_msg=" . urlencode("Video Created Successfully")); exit();
// echo "Video Created Successfully";
return true;
}else if(false === $save_check){
wp_redirect("admin.php?page=Prash_Video_List&error_msg=" . urlencode("Error creating video")); exit();
// echo "Error creating video";
return false;
}
else{
//Do Nothing
}
}
function prash_choose_action_form(){
?>
Choose Feature
Dim the background while playing
Google Analytics
Upgrade to the full version of Agile Video Player for awesome marketing features. Click here >>
Add New Video
show_errors();
$video_id = $_REQUEST['video'];
$mode = $_POST['mode'];
if($mode == 'add'){
$save_check= $wpdb->insert($wpdb->prefix.'prash_actions', array(
'vid_id' => stripslashes_deep($_POST['video']),
'form_id' => stripslashes_deep($_POST['form_id']),
'act_type' => stripslashes_deep($_POST['action_type']),
'show_seconds' => stripslashes_deep($_POST['seconds_in']),
'entry_anim' => stripslashes_deep($_POST['entry_anim']),
'exit_anim' => stripslashes_deep($_POST['exit_anim']),
'on_pause' => stripslashes_deep($_POST['show_pause']),
'on_end' => stripslashes_deep($_POST['show_end'])
),
array(
'%d',
'%d',
'%s',
'%d',
'%s',
'%s',
'%d',
'%d'
));
if(0 < $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&success_msg=" . urlencode("Action Created Successfully")); exit();
// echo "Action Created Successfully";
return true;
}
else if(0 === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&success_msg=" . urlencode("Action Created Successfully")); exit();
// echo "Action Created Successfully";
return true;
}else if(false === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&error_msg=" . urlencode("Error creating action")); exit();
// echo "Error creating action";
return false;
}
else{
//Do Nothing
}
}
$video_table = $wpdb->prefix.'prash_videos';
$optin_forms_table = $wpdb->prefix.'prash_optins';
$video_row = $wpdb->get_row("SELECT title FROM " . $video_table . " where id = " .$video_id);
$all_optins_sql = "select id, name from " . $optin_forms_table;
$all_optins = $wpdb->get_results($all_optins_sql);
?>
Add optin form to video
Add an optin form to your video. The optin form will be overlayed after the number of seconds entered below.
Video: title ?>
show_errors();
$video_id = $_REQUEST['video'];
$mode = $_REQUEST['mode'];
$action_id = $_REQUEST['id'];
if($mode == 'edit'){
$save_check = $wpdb->update(
$wpdb->prefix.'prash_actions',
array(
'vid_id' => stripslashes_deep($_POST['video']),
'form_id' => stripslashes_deep($_POST['form_id']),
'act_type' => stripslashes_deep($_POST['action_type']),
'show_seconds' => stripslashes_deep($_POST['seconds_in']),
'entry_anim' => stripslashes_deep($_POST['entry_anim']),
'exit_anim' => stripslashes_deep($_POST['exit_anim']),
'on_pause' => stripslashes_deep($_POST['show_pause']),
'on_end' => stripslashes_deep($_POST['show_end'])
),
array( 'ID' => $action_id ),
array(
'%d',
'%d',
'%s',
'%d',
'%s',
'%s',
'%d',
'%d'
),
array( '%d' )
);
if(0 < $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&success_msg=" . urlencode("Action Edited Successfully")); exit();
// echo "Action Edited Successfully";
return true;
}
else if(0 === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&success_msg=" . urlencode("Action Edited Successfully")); exit();
// echo "Action Edited Successfully";
return true;
}else if(false === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&error_msg=" . urlencode("Error editing action")); exit();
// echo "Error editing action";
return false;
}
else{
//Do Nothing
}
}
$video_table = $wpdb->prefix.'prash_videos';
$actions_table = $wpdb->prefix.'prash_actions';
$optin_forms_table = $wpdb->prefix.'prash_optins';
$video_row = $wpdb->get_row("SELECT title FROM " . $video_table . " where id = " .$video_id);
$all_optins_sql = "select * from " . $optin_forms_table ;
$all_optins = $wpdb->get_results($all_optins_sql);
$action_row = $wpdb->get_row("select * from " . $actions_table . " where id=" . $action_id);
?>
Edit optin form action
Video: title ?>
show_errors();
$fbappid = stripslashes_deep($_POST['fbappid']);
$seconds = stripslashes_deep($_POST['seconds']);
$vid_id = stripslashes_deep($_POST['video_id']);
$save_check = null;
if(strlen($fbappid) > 3){
$save_check= $wpdb->insert($wpdb->prefix.'prash_actions', array(
'vid_id' => stripslashes_deep($_POST['video_id']),
'act_type' => 'fblike',
'show_seconds' => stripslashes_deep($_POST['in_seconds']),
'skipfb' => stripslashes_deep($_POST['skipfblike']),
'skip_fb_text' => stripslashes_deep($_POST['fb_skip_text']),
'skip_fb_text_color' => stripslashes_deep($_POST['fb_skip_text_color']),
'fbid' => stripslashes_deep($_POST['fbappid']),
'fb_title' => stripslashes_deep($_POST['fb_title']),
'fb_title_color' => stripslashes_deep($_POST['fb_tcolor'])
), array('%s', '%s', '%d', '%d', '%s', '%s', '%s', '%s', '%s'));
if(0 < $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $vid_id ."&success_msg=" . urlencode("Saved successfully")); exit();
// echo "Saved successfully";
return true;
}
else if(0 === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $vid_id ."&success_msg=" . urlencode("Saved successfully")); exit();
// echo "Saved successfully";
return true;
}else if(false === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $vid_id ."&error_msg=" . urlencode("Error while saving form")); exit();
// echo "Error while saving form";
return false;
}
else{
//Do Nothing
}
}else{
$save_check= $wpdb->insert($wpdb->prefix.'prash_actions', array(
'vid_id' => stripslashes_deep($_POST['video_id']),
'act_type' => 'fblike',
'show_seconds' => stripslashes_deep($_POST['in_seconds']),
'skipfb' => stripslashes_deep($_POST['skipfblike']),
'skip_fb_text' => stripslashes_deep($_POST['fb_skip_text']),
'skip_fb_text_color' => stripslashes_deep($_POST['fb_skip_text_color']),
'fb_title' => stripslashes_deep($_POST['fb_title']),
'fb_title_color' => stripslashes_deep($_POST['fb_tcolor'])
), array('%s', '%s', '%d', '%d', '%s', '%s', '%s', '%s'));
if(0 < $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $vid_id ."&success_msg=" . urlencode("Saved successfully")); exit();
// echo "Saved successfully";
return true;
}
else if(0 === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $vid_id ."&success_msg=" . urlencode("Saved successfully")); exit();
// echo "Saved successfully";
return true;
}else if(false === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $vid_id ."&error_msg=" . urlencode("Error while saving form")); exit();
// echo "Error while saving form";
return false;
}
else{
//Do Nothing
}
}
}
function prash_add_cta_ok(){
global $wpdb;
$wpdb->show_errors();
$action_type = stripslashes_deep($_POST['cta_type']);
$video_id = $_REQUEST['video_id'];
if($action_type == 'ctat'){
$save_check= $wpdb->insert($wpdb->prefix.'prash_actions', array(
'vid_id' => stripslashes_deep($_POST['video_id']),
'act_type' => stripslashes_deep($_POST['cta_type']),
'cta_text' => stripslashes_deep($_POST['call_to_text']),
'img_link' => stripslashes_deep($_POST['img_link']),
'show_seconds' => stripslashes_deep($_POST['seconds_in']),
'cta_text_color' => stripslashes_deep($_POST['cta_text_color']),
'cta_bg_color' => stripslashes_deep($_POST['cta_bg_color']),
'buy_now_code' => stripslashes_deep($_POST['buy_now_req']),
'buy_now_tp' => stripslashes_deep($_POST['buy_now_bt']),
'buy_now_link' => stripslashes_deep($_POST['buy_now_link']),
'ct_bt_code' => stripslashes_deep($_POST['custom_bt_req']),
'ct_bt_bgcolor' => stripslashes_deep($_POST['custom_bt_color']),
'ct_bt_bcolor' => stripslashes_deep($_POST['custom_bt_border_color']),
'ct_bt_tcolor' => stripslashes_deep($_POST['custom_bt_text_color']),
'ct_bt_text' => stripslashes_deep($_POST['custom_bt_text']),
'ct_bt_link' => stripslashes_deep($_POST['custom_bt_link']),
'cta_template' => stripslashes_deep($_POST['cta_temp'])
),
array(
'%d',
'%s',
'%s',
'%s',
'%d',
'%s',
'%s',
'%d',
'%s',
'%s',
'%d',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s'
));
if(0 < $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&success_msg=" . urlencode("Call-To-Action added successfully")); exit();
// echo "Call-To-Action added successfully";
return true;
}
else if(0 === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&success_msg=" . urlencode("Call-To-Action added successfully")); exit();
// echo "Call-To-Action added successfully";
return true;
}else if(false === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&error_msg=" . urlencode("Error adding call to action")); exit();
// echo "Error adding call to action";
return false;
}
else{
//Do Nothing
}
}
}
function prash_edit_fblike_form(){
global $wpdb;
$wpdb->show_errors();
$video_id = $_REQUEST['video'];
$action_id = $_REQUEST['id'];
// echo "Action: " . $action_id;
// echo "Video: " . $video_id;
if($video_id == null || $action_id == null || $video_id == '' || $action_id == '' ){
echo "Error: Incomplete values. Please try again.";
}else {
if($_REQUEST['mode'] == 'edit'){
$save_check = $wpdb->update(
$wpdb->prefix.'prash_actions',
array(
'show_seconds' => stripslashes_deep($_POST['seconds_in']),
'skipfb' => stripslashes_deep($_POST['skipfblike']),
'skip_fb_text' => stripslashes_deep($_POST['fb_skip_text']),
'skip_fb_text_color' => stripslashes_deep($_POST['fb_skip_text_color']),
'fbid' => stripslashes_deep($_POST['fbappid']),
'fb_title' => stripslashes_deep($_POST['fb_title']),
'fb_title_color' => stripslashes_deep($_POST['fb_tcolor'])
),
array( 'id' => $action_id ),
array(
'%d',
'%d',
'%s',
'%s',
'%s',
'%s',
'%s'
),
array('%d')
);
if(0 < $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&success_msg=" . urlencode("Edited successfully")); exit();
// echo "Edited successfully";
return true;
}
else if(0 === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&success_msg=" . urlencode("Edited successfully")); exit();
// echo "Edited successfully";
return true;
}else if(false === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&error_msg=" . urlencode("Error editing Call to action. Please try again")); exit();
// echo "Error editing Call to action. Please try again";
return false;
}
else{
//Do Nothing
}
}
$action_table = $wpdb->prefix . 'prash_actions';
$action_row = $wpdb->get_row("SELECT * FROM " . $action_table . " where id = " .$action_id);
$video_table = $wpdb->prefix . 'prash_videos';
$video_row = $wpdb->get_row("SELECT title FROM " . $video_table . " where id = " .$video_id);
?>
Edit Facebook "Like" Button
Over video: title?>
update(
$wpdb->prefix.'prash_actions',
array(
'vid_id' => stripslashes_deep($_POST['video']),
'act_type' => stripslashes_deep($_POST['cta_type']),
'cta_text' => stripslashes_deep($_POST['call_to_text']),
'img_link' => stripslashes_deep($_POST['img_link']),
// 'img_url' => stripslashes_deep($_POST['img_url']),
'show_seconds' => stripslashes_deep($_POST['seconds_in']),
'cta_text_color' => stripslashes_deep($_POST['cta_text_color']),
'cta_bg_color' => stripslashes_deep($_POST['cta_bg_color']),
'buy_now_code' => stripslashes_deep($_POST['buy_now_req']),
'buy_now_tp' => stripslashes_deep($_POST['buy_now_bt']),
'buy_now_link' => stripslashes_deep($_POST['buy_now_link']),
'ct_bt_code' => stripslashes_deep($_POST['custom_bt_req']),
'ct_bt_bgcolor' => stripslashes_deep($_POST['custom_bt_color']),
'ct_bt_bcolor' => stripslashes_deep($_POST['custom_bt_border_color']),
'ct_bt_tcolor' => stripslashes_deep($_POST['custom_bt_text_color']),
'ct_bt_text' => stripslashes_deep($_POST['custom_bt_text']),
'ct_bt_link' => stripslashes_deep($_POST['custom_bt_link']),
'cta_template' => stripslashes_deep($_POST['cta_temp'])
),
array( 'ID' => $action_id ),
array(
'%d',
'%s',
'%s',
'%s',
// '%s',
'%d',
'%s',
'%s',
'%d',
'%s',
'%s',
'%d',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s'
),
array( '%d' )
);
if(0 < $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&success_msg=" . urlencode("Call to action edited successfully")); exit();
// echo "Call to action edited successfully";
return true;
}
else if(0 === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&success_msg=" . urlencode("Call to action edited successfully")); exit();
// echo "Call to action edited successfully";
return true;
}else if(false === $save_check){
wp_redirect("admin.php?page=prash_add_action&video=". $video_id ."&error_msg=" . urlencode("Error editing Call to action. Please try again")); exit();
// echo "Error editing Call to action. Please try again";
return false;
}
else{
//Do Nothing
}
}
$video_table = $wpdb->prefix . 'prash_videos';
$action_table = $wpdb->prefix . 'prash_actions';
$video_row = $wpdb->get_row("SELECT * FROM " . $video_table . " where id = " .$video_id);
$action_row = $wpdb->get_row("SELECT * FROM " . $action_table . " where id = " .$action_id);
?>
Edit Call-To-Action
On video: title?>
$video_id = substr($url['path'], 1);
}
elseif (strcasecmp($url['host'], 'www.youtube.com') === 0)
{
if (isset($url['query']))
{
parse_str($url['query'], $url['query']);
if (isset($url['query']['v']))
{
#### (dontcare)://www.youtube.com/(dontcare)?v=
$video_id = $url['query']['v'];
}
}
if ($video_id == false)
{
$url['path'] = explode('/', substr($url['path'], 1));
if (in_array($url['path'][0], array('e', 'embed', 'v')))
{
#### (dontcare)://www.youtube.com/(whitelist)/
$video_id = $url['path'][1];
}
}
}
return $video_id;
}
function prash_delete_video_do(){
global $wpdb;
$video_id = $_REQUEST['video'];
$delete_video = $wpdb->delete( $wpdb->prefix ."prash_videos", array('id' => $video_id ));
$delete_action_video = $wpdb->delete( $wpdb->prefix ."prash_actions", array('vid_id' => $video_id ));
if($delete_video){
wp_redirect("admin.php?page=Prash_Video_List&success_msg=" . urlencode ("Video deleted successfully.")); exit();
// echo "Video deleted successfully.";
return true;
}else{
wp_redirect("admin.php?page=Prash_Video_List&error_msg=" . urlencode("Error while deleting video")); exit();
// echo "Error while deleting video";
return false;
}
}
function prash_delete_video_form(){
global $wpdb;
$video_id = $_REQUEST['video'];
?>
Are you sure want to delete Video?
show_errors();
$tablename = $wpdb->prefix . 'prash_videos';
$video_url = esc_html($_POST["youtube_url"]);
if(isset($_POST['video'])){
$video_id = $_POST['video'];
$video_type = $_POST['video_type'];
if(strpos($video_url, 'http') === 0) {
}else{
$video_url = "http://" . $video_url;
echo "inloop";
}
echo "VIDEO URL: " . $video_url;
$youtube_id = getYouTubeVideoId($video_url);
echo "VIDEO ID: " . $youtube_id;
if($youtube_id == "" || null == $youtube_id){
echo "Please check the Youtube URL and try again.";
return false;
}
$save_check= $wpdb->update($wpdb->prefix.'prash_videos', array(
'title' => esc_html($_POST["title"]),
'vid' => uniqid(),
'youtube' => $youtube_id,
'width' => $_POST["width"],
'height' => $_POST["height"],
'autoplay' => $_POST["autoplay"],
'dim' => $_POST["dim"],
'scroll_pause' => $_POST["scroll_pause"],
'controls' => $_POST["show_controls"],
'auto_hide_cb' => $_POST["auto_hide_control_bar"],
'theme' => $_POST["player_theme"],
'vbordercolor' => $_POST["v_border_color"],
'social_share' => $_POST["s_share"],
'logo_brand_code' => $_POST["logo_brand"],
'logo_ps' => $_POST["logo_brand_position"],
'logo_pick' => $_POST["logo_pick"],
'logo_link' => $_POST["lk_logo"]
), array('id' => $video_id) , array('%s', '%s', '%s', '%d','%d','%d','%d','%d', '%d', '%s', '%s','%s', '%d', '%d', '%d', '%s', '%s') );
if(0 < $save_check){
wp_redirect("admin.php?page=Prash_Video_List&success_msg=" . urlencode("Video edited successfully")); exit();
// echo "Video edited successfully";
return true;
}
else if(0 === $save_check){
wp_redirect("admin.php?page=Prash_Video_List&success_msg=" . urlencode("Video edited successfully")); exit();
// echo "Video edited successfully";
return true;
}else if(false === $save_check){
wp_redirect("admin.php?page=Prash_Video_List&error_msg=" . urlencode("Error editing the video. Please try again")); exit();
// echo "Error editing the video. Please try again";
return false;
}
else{
//Do Nothing
}
}else{
echo "Video ID not found";
}
}
function prash_edit_video_form(){
?>
Add in-video optin forms and Facebook Like Buttons - Upgrade Now! >>
prefix . 'prash_videos';
$vid_id = null;
if(isset($_REQUEST['video'])){
$vid_id = $_REQUEST['video'];
}else{
echo "Video not found! Please try again.";
return false;
}
$video_edit = $wpdb->get_row("SELECT * FROM " . $tablename . " where id = " .$vid_id);
?>
Edit Video
Upgrade to the full version of Agile Video Player for awesome marketing features. Click here >>
prefix . 'prash_videos';
$actions_table = $wpdb->prefix . 'prash_actions';
$optins_table = $wpdb->prefix . 'prash_optins';
$youtube_video_record_sql = "SELECT * from " . $youtube_video_table. " WHERE id = " .$id;
$youtube_video_record = $wpdb->get_row($youtube_video_record_sql);
$ytid = $youtube_video_record->youtube;
$action_records_sql = "SELECT * from ". $actions_table . " where vid_id = " .$id;
$action_records = $wpdb->get_results($action_records_sql);
// $action_count = mysql_num_rows($action_records);
$action_count = count($action_records);
if($action_count == 0){
$yt_final_code = video_shortcode($id);
}else if($action_count == 1){
foreach($action_records as $single_action){
if($single_action->act_type == 'optin'){
$yt_final_code = video_optin_shortcode($id);
}
else if($single_action->act_type == 'fblike'){
$yt_final_code = video_fb_shortcode($id);
}
else{
$yt_final_code = video_cta_shortcode($id);
}
}
}else if($action_count == 2){
$rec1 = $action_records[0];
$rec1_type = $rec1->act_type;
$rec2 = $action_records[1];
$rec2_type = $rec2->act_type;
if($rec1_type == 'optin' || $rec2_type == 'optin'){
$yt_final_code = video_optin_plus_cta_shortcode($id);
}else{
$yt_final_code = video_fb_plus_cta_shortcode($id);
}
}
?>
Video Code
Upgrade to the full version of Agile Video Player for awesome marketing features. Click here >>
Video Shortcode:
Copy Paste the shortcode into page.
post_content, 'yt_video')) {
wp_register_style( 'font_cta', plugins_url( 'css/cta.css' , __FILE__ ) );
wp_enqueue_style( 'font_cta' );
wp_register_script(
'tubescript',
plugins_url( 'js/jQuery.tubeplayer.min.js' , __FILE__ ),
array( 'jquery' )
);
wp_enqueue_script( 'tubescript' );
wp_register_script(
'jscook',
plugins_url( 'js/jquery.cookie.js' , __FILE__ ),
array( 'jquery' )
);
wp_enqueue_script( 'jscook' );
wp_register_script(
'jsshare',
plugins_url( 'js/share.min.js' , __FILE__ ),
array( 'jquery' )
);
wp_enqueue_script( 'jsshare' );
}
}
add_action('wp_enqueue_scripts', 'load_video_scripts');
add_action( 'admin_enqueue_scripts', 'mw_enqueue_color_picker' );
function mw_enqueue_color_picker( $hook_suffix ) {
// first check that $hook_suffix is appropriate for your admin page
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'my-script-handle', plugins_url('my-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
wp_enqueue_media();
wp_enqueue_script( 'custom-header' );
}
/***** FOR SHORTCODE EDITOR *****/
/*Add this code to your functions.php file of current theme OR plugin file if you're making a plugin*/
//add the button to the tinymce editor
add_action('media_buttons_context','add_my_tinymce_media_button');
function add_my_tinymce_media_button($context){
$app_logo = plugins_url( 'js/app_logo.png' , __FILE__ );
return $context.=__("
");
}
add_action('admin_footer','my_shortcode_media_button_popup');
//Generate inline content for the popup window when the "my shortcode" button is clicked
function my_shortcode_media_button_popup(){
global $wpdb;
$youtube_video_table = $wpdb->prefix . 'prash_videos';
$youtube_video_record_sql = "SELECT * from " . $youtube_video_table ;
$video_records = $wpdb->get_results($youtube_video_record_sql);
?>
prefix . 'prash_videos';
$actions_table = $wpdb->prefix . 'prash_actions';
$optins_table = $wpdb->prefix . 'prash_optins';
extract(shortcode_atts( array('id' => ''), $atts));
$youtube_video_record_sql = "SELECT * from " . $youtube_video_table. " WHERE id = " .$id;
$youtube_video_record = $wpdb->get_row($youtube_video_record_sql);
$ytid = $youtube_video_record->youtube;
$action_records_sql = "SELECT * from ". $actions_table . " where vid_id = ". $id;
$action_records = $wpdb->get_results($action_records_sql);
// $action_count = mysql_num_rows($action_records);
$action_count = count($action_records);
if($action_count == 0){
$yt_final_code = video_shortcode($id);
}else if($action_count == 1){
foreach($action_records as $single_action){
if($single_action->act_type == 'optin'){
$yt_final_code = video_optin_shortcode($id);
}
else if($single_action->act_type == 'fblike'){
$yt_final_code = video_fb_shortcode($id);
}
else{
$yt_final_code = video_cta_shortcode($id);
}
}
}else if($action_count == 2){
$rec1 = $action_records[0];
$rec1_type = $rec1->act_type;
$rec2 = $action_records[1];
$rec2_type = $rec2->act_type;
if($rec1_type == 'optin' || $rec2_type == 'optin'){
$yt_final_code = video_optin_plus_cta_shortcode($id);
}else{
$yt_final_code = video_fb_plus_cta_shortcode($id);
}
}
return $yt_final_code;
}
add_shortcode('yt_video', 'youtube_video_shortcode');
function video_shortcode($v_id){
global $wpdb;
$youtube_video_table = $wpdb->prefix . 'prash_videos';
$actions_table = $wpdb->prefix . 'prash_actions';
$optins_table = $wpdb->prefix . 'prash_optins';
$youtube_video_record_sql = "SELECT * from " . $youtube_video_table. " WHERE id = " .$v_id;
$youtube_video_record = $wpdb->get_row($youtube_video_record_sql);
$ytid = $youtube_video_record->vid;
$yt_id_player = $youtube_video_record->youtube;
$ytw = $youtube_video_record->width;
$yth = $youtube_video_record->height;
$autoplay = $youtube_video_record->autoplay;
$show_controls = $youtube_video_record->controls;
$auto_hide_cb = $youtube_video_record->auto_hide_cb;
$player_theme = $youtube_video_record->theme;
$video_border_color = $youtube_video_record->vbordercolor;
$dim_flag = $youtube_video_record->dim;
$social_share = $youtube_video_record->social_share;
$logo_brand_code = $youtube_video_record->logo_brand_code;
$logo_brand_pick = $youtube_video_record->logo_pick;
$logo_brand_link = $youtube_video_record->logo_link;
$logo_brand_ps = $youtube_video_record->logo_ps;
if($dim_flag == 1){
$dim_image = plugins_url( 'images/dim.png' , __FILE__ );
$yt_dim_code = "
";
$yt_video_full .= $yt_dim_code;
}
$yt_video_full .= "
";
if($logo_brand_code == 1){
if($logo_brand_ps == 0){
$yt_logo_brand_code = "
";
}
else if($logo_brand_ps == 1){
$yt_logo_brand_code = "
";
}
else{
//Do Nothing
}
$yt_video_full .= $yt_logo_brand_code;
}
if($social_share == 1){
$share_image = plugins_url( 'images/share_video.png' , __FILE__ );
$fb_share_image = plugins_url( 'images/fb.png' , __FILE__ );
$tw_share_image = plugins_url( 'images/tw.png' , __FILE__ );
$gplus_share_image = plugins_url( 'images/gplus.png' , __FILE__ );
$close_share_image = plugins_url( 'images/close.png' , __FILE__ );
$yt_social_share = "
";
$yt_video_full .= $yt_social_share;
}
$yt_video_code = "
";
return $yt_video_full;
}
function video_optin_shortcode($v_id){
global $wpdb;
$youtube_video_table = $wpdb->prefix . 'prash_videos';
$actions_table = $wpdb->prefix . 'prash_actions';
$optins_table = $wpdb->prefix . 'prash_optins';
$youtube_video_record_sql = "SELECT * from " . $youtube_video_table. " WHERE id = " .$v_id;
$youtube_video_record = $wpdb->get_row($youtube_video_record_sql);
$ytid = $youtube_video_record->vid;
$yt_id_player = $youtube_video_record->youtube;
$ytw = $youtube_video_record->width;
$yth = $youtube_video_record->height;
$autoplay = $youtube_video_record->autoplay;
$show_controls = $youtube_video_record->controls;
$auto_hide_cb = $youtube_video_record->auto_hide_cb;
$player_theme = $youtube_video_record->theme;
$video_border_color = $youtube_video_record->vbordercolor;
$dim_flag = $youtube_video_record->dim;
$social_share = $youtube_video_record->social_share;
$logo_brand_code = $youtube_video_record->logo_brand_code;
$logo_brand_pick = $youtube_video_record->logo_pick;
$logo_brand_link = $youtube_video_record->logo_link;
$logo_brand_ps = $youtube_video_record->logo_ps;
if($dim_flag == 1){
$dim_image = plugins_url( 'images/dim.png' , __FILE__ );
$yt_dim_code = "
";
$yt_video_full .= $yt_dim_code;
}
$yt_video_full .= "
";
if($logo_brand_code == 1){
if($logo_brand_ps == 0){
$yt_logo_brand_code = "
";
}
else if($logo_brand_ps == 1){
$yt_logo_brand_code = "
";
}
else{
//Do Nothing
}
$yt_video_full .= $yt_logo_brand_code;
}
if($social_share == 1){
$share_image = plugins_url( 'images/share_video.png' , __FILE__ );
$fb_share_image = plugins_url( 'images/fb.png' , __FILE__ );
$tw_share_image = plugins_url( 'images/tw.png' , __FILE__ );
$gplus_share_image = plugins_url( 'images/gplus.png' , __FILE__ );
$close_share_image = plugins_url( 'images/close.png' , __FILE__ );
$yt_social_share = "
";
$yt_video_full .= $yt_social_share;
}
$yt_video_code = "
";
$yt_video_full .= $yt_video_code;
$optin_form_code = "";
$cta_code = "";
$entry_anim = "";
$exit_anim = "";
$form_bg = "";
$title_color = "";
$title_text = "";
$content_color = "";
$content_text = "";
$button_color = "";
$button_text = "";
$button_text_color = "";
$emailvalid_text_color = "";
$optin_border_color = "";
$optin_skip_text_color = "";
$show_seconds = 0;
$on_pause_show_optin = 0;
$on_end_show_optin = 0;
$optin_form_submit_url = "";
$youtube_actions_record_sql = "SELECT * from " . $actions_table. " WHERE vid_id = " .$v_id;
$actions_records = $wpdb->get_results($youtube_actions_record_sql);
foreach($actions_records as $single_action){
//set all variables to use
$entry_anim = $single_action->entry_anim;
$exit_anim = $single_action->exit_anim;
$on_pause = $single_action->on_pause;
$on_end_show_optin = $single_action->on_end;
$show_seconds = $single_action->show_seconds;
$on_pause_show_optin = $single_action->on_pause;
$optin_form_submit_url = plugins_url( 'emailmanager.php' , __FILE__ );
$optin_form_id = $single_action->form_id;
$optin_detail = $wpdb->get_row("SELECT * from " . $optins_table. " WHERE id = " .$single_action->form_id);
$form_bg = $optin_detail->bg;
$title_color = $optin_detail->headcolor;
$title_text = $optin_detail->headtext;
$content_color = $optin_detail->msgcolor;
$content_text = $optin_detail->msgtext;
$button_color = $optin_detail->butcolor;
$button_text = $optin_detail->buttext;
$button_text_color = $optin_detail->buttextcolor;
$emailvalid_text_color = $optin_detail->emailvalidtxtcolor;
$optin_border_color = $optin_detail->optinbordercolor;
$optin_skip_text_color = $optin_detail->optinskiptxtcolor;
$optin_skip_text = $optin_detail->skip_bt_text;
$optin_timer_value = $single_action->show_seconds;
$skip_optin_form = $optin_detail->skip_optin_text;
$ar_type_optin_form = $optin_detail->ar;
}
$optin_form_fragment1 = "
";
$yt_video_full .="";
return $yt_video_full;
}
function video_cta_shortcode($v_id){
global $wpdb;
$youtube_video_table = $wpdb->prefix . 'prash_videos';
$actions_table = $wpdb->prefix . 'prash_actions';
$optins_table = $wpdb->prefix . 'prash_optins';
$youtube_video_record_sql = "SELECT * from " . $youtube_video_table. " WHERE id = " .$v_id;
$youtube_video_record = $wpdb->get_row($youtube_video_record_sql);
$ytid = $youtube_video_record->vid;
$yt_id_player = $youtube_video_record->youtube;
$ytw = $youtube_video_record->width;
$yth = $youtube_video_record->height;
$autoplay = $youtube_video_record->autoplay;
$show_controls = $youtube_video_record->controls;
$auto_hide_cb = $youtube_video_record->auto_hide_cb;
$player_theme = $youtube_video_record->theme;
$video_border_color = $youtube_video_record->vbordercolor;
$dim_flag = $youtube_video_record->dim;
$social_share = $youtube_video_record->social_share;
$logo_brand_code = $youtube_video_record->logo_brand_code;
$logo_brand_pick = $youtube_video_record->logo_pick;
$logo_brand_link = $youtube_video_record->logo_link;
$logo_brand_ps = $youtube_video_record->logo_ps;
if($dim_flag == 1){
$dim_image = plugins_url( 'images/dim.png' , __FILE__ );
$yt_dim_code = "
";
$yt_video_full .= $yt_dim_code;
}
$yt_video_full .= "
";
if($logo_brand_code == 1){
if($logo_brand_ps == 0){
$yt_logo_brand_code = "
";
}
else if($logo_brand_ps == 1){
$yt_logo_brand_code = "
";
}
else{
//Do Nothing
}
$yt_video_full .= $yt_logo_brand_code;
}
if($social_share == 1){
$share_image = plugins_url( 'images/share_video.png' , __FILE__ );
$fb_share_image = plugins_url( 'images/fb.png' , __FILE__ );
$tw_share_image = plugins_url( 'images/tw.png' , __FILE__ );
$gplus_share_image = plugins_url( 'images/gplus.png' , __FILE__ );
$close_share_image = plugins_url( 'images/close.png' , __FILE__ );
$yt_social_share = "
";
$yt_video_full .= $yt_social_share;
}
$yt_video_code = "
";
$yt_video_full .= $yt_video_code;
$optin_form_code = "";
$cta_code = "";
$entry_anim = "";
$exit_anim = "";
$form_bg = "";
$title_color = "";
$title_text = "";
$content_color = "";
$content_text = "";
$button_color = "";
$button_text = "";
$button_text_color = "";
$emailvalid_text_color = "";
$optin_skip_text_color = "";
$buy_now_link = "";
$buy_now_tp = "";
$show_seconds = 0;
$on_pause_show_optin = 0;
$on_end_show_optin = 0;
$optin_form_submit_url = "";
$buy_now_show = "";
$youtube_actions_record_sql = "SELECT * from " . $actions_table. " WHERE vid_id = " .$v_id;
$actions_records = $wpdb->get_results($youtube_actions_record_sql);
foreach($actions_records as $single_action){
//set all variables to use
$entry_anim = $single_action->entry_anim;
$exit_anim = $single_action->exit_anim;
$on_pause = $single_action->on_pause;
$on_end_show_optin = $single_action->on_end;
$show_seconds = $single_action->show_seconds;
$on_pause_show_optin = $single_action->on_pause;
$optin_form_submit_url = plugins_url( 'emailmanager.php' , __FILE__ );
$optin_form_id = $single_action->form_id;
if($single_action->act_type == 'ctat'){
$cta_text = $single_action->cta_text;
$cta_link = $single_action->img_link;
$cta_bg_color = $single_action->cta_bg_color;
$cta_text_color = $single_action->cta_text_color;
$buy_now_link = $single_action->buy_now_link;
$buy_now_tp = $single_action->buy_now_tp;
$buy_now_show = $single_action->buy_now_code;
$custom_bt_code = $single_action->ct_bt_code;
$custom_bt_bgcolor = $single_action->ct_bt_bgcolor;
$custom_bt_bcolor = $single_action->ct_bt_bcolor;
$custom_bt_tcolor = $single_action->ct_bt_tcolor;
$custom_bt_text = $single_action->ct_bt_text;
$custom_bt_link = $single_action->ct_bt_link;
$ctat_fragment = "
";
$yt_video_full .= $ctat_fragment;
if($buy_now_show == 1){
$yt_video_full .= "
";
}
if($custom_bt_code == 1){
$yt_video_full .= "
{$custom_bt_text}
";
}
$yt_video_full .= "
{$cta_text}
";
}else if($single_action->act_type == 'ctai'){
$cta_image = $single_action->img_url;
$cta_link = $single_action->img_link;
$ctai_fragment = "
";
$yt_video_full .= $ctai_fragment;
}
}
$video_code = "";
return $yt_video_full;
}
function video_optin_plus_cta_shortcode($v_id){
global $wpdb;
$youtube_video_table = $wpdb->prefix . 'prash_videos';
$actions_table = $wpdb->prefix . 'prash_actions';
$optins_table = $wpdb->prefix . 'prash_optins';
$youtube_video_record_sql = "SELECT * from " . $youtube_video_table. " WHERE id = " .$v_id;
$youtube_video_record = $wpdb->get_row($youtube_video_record_sql);
$ytid = $youtube_video_record->vid;
$yt_id_player = $youtube_video_record->youtube;
$ytw = $youtube_video_record->width;
$yth = $youtube_video_record->height;
$autoplay = $youtube_video_record->autoplay;
$dim_flag = $youtube_video_record->dim;
$scroll_flag = $youtube_video_record->scroll_pause;
$show_controls = $youtube_video_record->controls;
$auto_hide_cb = $youtube_video_record->auto_hide_cb;
$player_theme = $youtube_video_record->theme;
$video_border_color = $youtube_video_record->vbordercolor;
$social_share = $youtube_video_record->social_share;
$logo_brand_code = $youtube_video_record->logo_brand_code;
$logo_brand_pick = $youtube_video_record->logo_pick;
$logo_brand_link = $youtube_video_record->logo_link;
$logo_brand_ps = $youtube_video_record->logo_ps;
if($dim_flag == 1){
$dim_image = plugins_url( 'images/dim.png' , __FILE__ );
$yt_dim = "
";
$yt_video_full .= $yt_dim;
}
$yt_video_full .= "
";
if($logo_brand_code == 1){
if($logo_brand_ps == 0){
$yt_logo_brand_code = "
";
}
else if($logo_brand_ps == 1){
$yt_logo_brand_code = "
";
}
else{
//Do Nothing
}
$yt_video_full .= $yt_logo_brand_code;
}
if($social_share == 1){
$share_image = plugins_url( 'images/share_video.png' , __FILE__ );
$fb_share_image = plugins_url( 'images/fb.png' , __FILE__ );
$tw_share_image = plugins_url( 'images/tw.png' , __FILE__ );
$gplus_share_image = plugins_url( 'images/gplus.png' , __FILE__ );
$close_share_image = plugins_url( 'images/close.png' , __FILE__ );
$yt_social_share = "
";
$yt_video_full .= $yt_social_share;
}
$yt_video_code = "
";
$yt_video_full .= $yt_video_code;
$optin_form_code = "";
$cta_code = "";
$entry_anim = "";
$exit_anim = "";
$form_bg = "";
$title_color = "";
$title_text = "";
$content_color = "";
$content_text = "";
$button_color = "";
$button_text = "";
$button_text_color = "";
$emailvalid_text_color = "";
$optin_border_color = "";
$optin_skip_text_color = "";
$buy_now_link = "";
$buy_now_tp = "";
$buy_now_show = "";
$show_seconds = 0;
$on_pause_show_optin = 0;
$on_end_show_optin = 0;
$optin_form_submit_url = "";
$youtube_actions_record_sql = "SELECT * from " . $actions_table. " WHERE vid_id = " .$v_id;
$actions_records = $wpdb->get_results($youtube_actions_record_sql);
foreach($actions_records as $single_action){
//set all variables to use
// $entry_anim = $single_action->entry_anim;
$exit_anim = $single_action->exit_anim;
$on_pause = $single_action->on_pause;
// $on_end_show_optin = $single_action->on_end;
$show_seconds = $single_action->show_seconds;
// $on_pause_show_optin = $single_action->on_pause;
$optin_form_submit_url = plugins_url( 'ext.php' , __FILE__ );
if($single_action->act_type == 'optin'){
$optin_form_id = $single_action->form_id;
$entry_anim = $single_action->entry_anim;
$on_pause_show_optin = $single_action->on_pause;
$on_end_show_optin = $single_action->on_end;
$optin_detail = $wpdb->get_row("SELECT * from " . $optins_table. " WHERE id = " .$single_action->form_id);
$form_bg = $optin_detail->bg;
$title_color = $optin_detail->headcolor;
$title_text = $optin_detail->headtext;
$content_color = $optin_detail->msgcolor;
$content_text = $optin_detail->msgtext;
$button_color = $optin_detail->butcolor;
$button_text = $optin_detail->buttext;
$button_text_color = $optin_detail->buttextcolor;
$emailvalid_text_color = $optin_detail->emailvalidtxtcolor;
$optin_border_color = $optin_detail->optinbordercolor;
$optin_skip_text_color = $optin_detail->optinskiptxtcolor;
$optin_skip_text = $optin_detail->skip_bt_text;
$skip_optin_form = $optin_detail->skip_optin_text;
$ar_type_optin_form = $optin_detail->ar;
}
else if($single_action->act_type == 'ctat'){
$cta_text = $single_action->cta_text;
$cta_link = $single_action->img_link;
$cta_bg_color = $single_action->cta_bg_color;
$cta_text_color = $single_action->cta_text_color;
$buy_now_link = $single_action->buy_now_link;
$buy_now_tp = $single_action->buy_now_tp;
$buy_now_show = $single_action->buy_now_code;
$custom_bt_code = $single_action->ct_bt_code;
$custom_bt_bgcolor = $single_action->ct_bt_bgcolor;
$custom_bt_bcolor = $single_action->ct_bt_bcolor;
$custom_bt_tcolor = $single_action->ct_bt_tcolor;
$custom_bt_text = $single_action->ct_bt_text;
$custom_bt_link = $single_action->ct_bt_link;
}
// else if($single_action->act_type == 'ctai'){
//
// $cta_image = $single_action->img_url;
// $cta_link = $single_action->img_link;
//
// }
}
$optin_form_fragment1 = "
";
if($buy_now_show == 1){
$yt_video_full .= "
";
}
if($custom_bt_code == 1){
$yt_video_full .= "
{$custom_bt_text}
";
}
$yt_video_full .="
{$cta_text}
";
$video_code = "";
return $yt_video_full;
}
function video_fb_shortcode($v_id){
global $wpdb;
$youtube_video_table = $wpdb->prefix . 'prash_videos';
$actions_table = $wpdb->prefix . 'prash_actions';
$optins_table = $wpdb->prefix . 'prash_optins';
$youtube_video_record_sql = "SELECT * from " . $youtube_video_table. " WHERE id = " .$v_id;
$youtube_video_record = $wpdb->get_row($youtube_video_record_sql);
$ytid = $youtube_video_record->vid;
$yt_id_player = $youtube_video_record->youtube;
$ytw = $youtube_video_record->width;
$yth = $youtube_video_record->height;
$autoplay = $youtube_video_record->autoplay;
$show_controls = $youtube_video_record->controls;
$auto_hide_cb = $youtube_video_record->auto_hide_cb;
$player_theme = $youtube_video_record->theme;
$video_border_color = $youtube_video_record->vbordercolor;
$dim_flag = $youtube_video_record->dim;
$social_share = $youtube_video_record->social_share;
$logo_brand_code = $youtube_video_record->logo_brand_code;
$logo_brand_pick = $youtube_video_record->logo_pick;
$logo_brand_link = $youtube_video_record->logo_link;
$logo_brand_ps = $youtube_video_record->logo_ps;
if($dim_flag == 1){
$dim_image = plugins_url( 'images/dim.png' , __FILE__ );
$yt_dim_code = "
";
$yt_video_full .= $yt_dim_code;
}
$yt_video_full .= "
";
if($logo_brand_code == 1){
if($logo_brand_ps == 0){
$yt_logo_brand_code = "
";
}
else if($logo_brand_ps == 1){
$yt_logo_brand_code = "
";
}
else{
//Do Nothing
}
$yt_video_full .= $yt_logo_brand_code;
}
if($social_share == 1){
$share_image = plugins_url( 'images/share_video.png' , __FILE__ );
$fb_share_image = plugins_url( 'images/fb.png' , __FILE__ );
$tw_share_image = plugins_url( 'images/tw.png' , __FILE__ );
$gplus_share_image = plugins_url( 'images/gplus.png' , __FILE__ );
$close_share_image = plugins_url( 'images/close.png' , __FILE__ );
$yt_social_share = "
";
$yt_video_full .= $yt_social_share;
}
$yt_video_code = "
";
$yt_video_full .= $yt_video_code;
$optin_form_code = "";
$cta_code = "";
$entry_anim = "";
$exit_anim = "";
$form_bg = "";
$skip_fblike = "";
$title_color = "";
$title_text = "";
$content_color = "";
$content_text = "";
$fbid = "";
$button_color = "";
$button_text = "";
$button_text_color = "";
$emailvalid_text_color = "";
$optin_border_color = "";
$optin_skip_text_color = "";
$show_seconds = 0;
$on_pause_show_optin = 0;
$on_end_show_optin = 0;
$optin_form_submit_url = "";
$youtube_actions_record_sql = "SELECT * from " . $actions_table. " WHERE vid_id = " .$v_id;
$actions_records = $wpdb->get_results($youtube_actions_record_sql);
foreach($actions_records as $single_action){
//set all variables to use
$entry_anim = $single_action->entry_anim;
$exit_anim = $single_action->exit_anim;
$on_pause = $single_action->on_pause;
$on_end_show_optin = $single_action->on_end;
$show_seconds = $single_action->show_seconds;
$on_pause_show_optin = $single_action->on_pause;
$skip_fblike = $single_action->skipfb;
$fbid = $single_action->fbid;
$fblike_show_seconds = $single_action->show_seconds;
$fblike_skip_text = $single_action->skip_fb_text;
$fblike_skip_text_color = $single_action->skip_fb_text_color;
$fblike_title = $single_action->fb_title;
$fblike_title_color = $single_action->fb_title_color;
$optin_form_submit_url = plugins_url( 'emailmanager.php' , __FILE__ );
$optin_form_id = $single_action->form_id;
$optin_detail = $wpdb->get_row("SELECT * from " . $optins_table. " WHERE id = " .$single_action->form_id);
$form_bg = $optin_detail->bg;
$title_color = $optin_detail->headcolor;
$title_text = $optin_detail->headtext;
$content_color = $optin_detail->msgcolor;
$content_text = $optin_detail->msgtext;
$button_color = $optin_detail->butcolor;
$button_text = $optin_detail->buttext;
$button_text_color = $optin_detail->buttextcolor;
$emailvalid_text_color = $optin_detail->emailvalidtxtcolor;
$optin_border_color = $optin_detail->optinbordercolor;
$optin_skip_text_color = $optin_detail->optinskiptxtcolor;
$optin_timer_value = $single_action->show_seconds;
$skip_optin_form = $optin_detail->skip_optin_text;
$ar_type_optin_form = $optin_detail->ar;
}
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
if($fbid == NULL || $fbid == 0 || $fbid == ''){
$fbid = "145148092322424";
}
$fb_form_fragment1 = "
{$fblike_title}
";
$yt_video_full .= $fb_form_fragment1;
if($skip_fblike == 1){
$yt_video_full .="
";
}
$yt_video_full .="
";
$yt_video_full .="";
return $yt_video_full;
}
function video_fb_plus_cta_shortcode($v_id){
global $wpdb;
$youtube_video_table = $wpdb->prefix . 'prash_videos';
$actions_table = $wpdb->prefix . 'prash_actions';
$optins_table = $wpdb->prefix . 'prash_optins';
$youtube_video_record_sql = "SELECT * from " . $youtube_video_table. " WHERE id = " .$v_id;
$youtube_video_record = $wpdb->get_row($youtube_video_record_sql);
$ytid = $youtube_video_record->vid;
$yt_id_player = $youtube_video_record->youtube;
$ytw = $youtube_video_record->width;
$yth = $youtube_video_record->height;
$autoplay = $youtube_video_record->autoplay;
$dim_flag = $youtube_video_record->dim;
$scroll_flag = $youtube_video_record->scroll_pause;
$show_controls = $youtube_video_record->controls;
$auto_hide_cb = $youtube_video_record->auto_hide_cb;
$player_theme = $youtube_video_record->theme;
$video_border_color = $youtube_video_record->vbordercolor;
$social_share = $youtube_video_record->social_share;
$logo_brand_code = $youtube_video_record->logo_brand_code;
$logo_brand_pick = $youtube_video_record->logo_pick;
$logo_brand_link = $youtube_video_record->logo_link;
$logo_brand_ps = $youtube_video_record->logo_ps;
if($dim_flag == 1){
$dim_image = plugins_url( 'images/dim.png' , __FILE__ );
$yt_dim = "
";
$yt_video_full .= $yt_dim;
}
$yt_video_full .= "
";
if($logo_brand_code == 1){
if($logo_brand_ps == 0){
$yt_logo_brand_code = "
";
}
else if($logo_brand_ps == 1){
$yt_logo_brand_code = "
";
}
else{
//Do Nothing
}
$yt_video_full .= $yt_logo_brand_code;
}
if($social_share == 1){
$share_image = plugins_url( 'images/share_video.png' , __FILE__ );
$fb_share_image = plugins_url( 'images/fb.png' , __FILE__ );
$tw_share_image = plugins_url( 'images/tw.png' , __FILE__ );
$gplus_share_image = plugins_url( 'images/gplus.png' , __FILE__ );
$close_share_image = plugins_url( 'images/close.png' , __FILE__ );
$yt_social_share = "
";
$yt_video_full .= $yt_social_share;
}
$yt_video_code = "
";
$yt_video_full .= $yt_video_code;
$optin_form_code = "";
$cta_code = "";
$entry_anim = "";
$exit_anim = "";
$form_bg = "";
$skip_fblike = "";
$fbid = "";
$title_color = "";
$title_text = "";
$content_color = "";
$content_text = "";
$button_color = "";
$button_text = "";
$button_text_color = "";
$emailvalid_text_color = "";
$optin_border_color = "";
$optin_skip_text_color = "";
$show_seconds = 0;
$buy_now_link = "";
$buy_now_tp = "";
$buy_now_show = "";
$on_pause_show_optin = 0;
$on_end_show_optin = 0;
$optin_form_submit_url = "";
$youtube_actions_record_sql = "SELECT * from " . $actions_table. " WHERE vid_id = " .$v_id;
$actions_records = $wpdb->get_results($youtube_actions_record_sql);
foreach($actions_records as $single_action){
//set all variables to use
// $entry_anim = $single_action->entry_anim;
$exit_anim = $single_action->exit_anim;
$on_pause = $single_action->on_pause;
// $on_end_show_optin = $single_action->on_end;
$show_seconds = $single_action->show_seconds;
// $on_pause_show_optin = $single_action->on_pause;
$optin_form_submit_url = plugins_url( 'ext.php' , __FILE__ );
if($single_action->act_type == 'fblike'){
$optin_form_id = $single_action->form_id;
$entry_anim = $single_action->entry_anim;
$on_pause_show_optin = $single_action->on_pause;
$on_end_show_optin = $single_action->on_end;
$skip_fblike = $single_action->skipfb;
$fbid = $single_action->fbid;
$fblike_skip_text = $single_action->skip_fb_text;
$fblike_skip_text_color = $single_action->skip_fb_text_color;
$fblike_title = $single_action->fb_title;
$fblike_title_color = $single_action->fb_title_color;
$optin_detail = $wpdb->get_row("SELECT * from " . $optins_table. " WHERE id = " .$single_action->form_id);
$form_bg = $optin_detail->bg;
$title_color = $optin_detail->headcolor;
$title_text = $optin_detail->headtext;
$content_color = $optin_detail->msgcolor;
$content_text = $optin_detail->msgtext;
$button_color = $optin_detail->butcolor;
$button_text = $optin_detail->buttext;
$button_text_color = $optin_detail->buttextcolor;
$emailvalid_text_color = $optin_detail->emailvalidtxtcolor;
$optin_border_color = $optin_detail->optinbordercolor;
$optin_skip_text_color = $optin_detail->optinskiptxtcolor;
$skip_optin_form = $optin_detail->skip_optin_text;
$ar_type_optin_form = $optin_detail->ar;
}
else if($single_action->act_type == 'ctat'){
$cta_text = $single_action->cta_text;
$cta_link = $single_action->img_link;
$cta_bg_color = $single_action->cta_bg_color;
$cta_text_color = $single_action->cta_text_color;
$buy_now_link = $single_action->buy_now_link;
$buy_now_tp = $single_action->buy_now_tp;
$buy_now_show = $single_action->buy_now_code;
$custom_bt_code = $single_action->ct_bt_code;
$custom_bt_bgcolor = $single_action->ct_bt_bgcolor;
$custom_bt_bcolor = $single_action->ct_bt_bcolor;
$custom_bt_tcolor = $single_action->ct_bt_tcolor;
$custom_bt_text = $single_action->ct_bt_text;
$custom_bt_link = $single_action->ct_bt_link;
}
// else if($single_action->act_type == 'ctai'){
//
// $cta_image = $single_action->img_url;
// $cta_link = $single_action->img_link;
//
// }
}
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
if($fbid == NULL || $fbid == 0 || $fbid == ''){
$fbid = "145148092322424";
}
$fb_form_fragment1 = "
{$fblike_title}
";
$yt_video_full .= $fb_form_fragment1;
if($skip_fblike == 1){
$yt_video_full .="
";
}
$yt_video_full .="
";
if($buy_now_show == 1){
$yt_video_full .= "
";
}
if($custom_bt_code == 1){
$yt_video_full .= "
{$custom_bt_text}
";
}
$yt_video_full .="
{$cta_text}
";
$video_code = "";
return $yt_video_full;
}