'fb_groups_table', //Singular label 'plural' => 'fb_sales_tables', //plural label, also this well be one of the table css class 'ajax' => false //We won't support Ajax for this table ) ); add_action( 'admin_head', array( &$this, 'admin_header' ) ); } function extra_tablenav( $which ) { if ( $which == "top" ){ } if ( $which == "bottom" ){ } } function column_default($item, $column_name){ return $item[$column_name]; } function column_update_time($item){ $selectedTimezone = get_post_meta(999911113,'fbdomtimezone', TRUE); $epoch = $item['update_time']; $localtime = $epoch +$selectedTimezone*60*60; return date("Y-m-d H:i", $localtime); // output as RFC 2822 date } function column_name($item){ $name = $item['name']; $name = strtolower($name); if (strlen($name) > 60){ $name = substr($name, 0, 60); $name.=".."; } return $name; } function column_description($item){ $description = $item['description']; $description = strtolower($description); if (strlen($description) > 80){ $description = substr($description, 0,80); $description.=".."; } return $description; } function column_gid($item){ $gid = $item['gid']; $url = "facebook.com/".$gid; return "".$url.""; } function column_cb($item) { return sprintf( '', $item['gid'] ); } function get_columns() { return $columns= array( 'cb' => '', 'name'=>'Name', 'description'=>'Description', 'gid'=>'URL', 'update_time'=>'Last Updated', 'privacy'=>'Privacy' ); } function get_sortable_columns() { $sortable_columns = array( 'name' => array('name',false), 'description' => array('description',false), 'gid' => array('gid',false), 'update_time' => array('update_time',false), 'privacy' => array('privacy',false) ); return $sortable_columns; } function prepare_items($query, $querytype) { /** * First, lets decide how many records per page to show */ $per_page = 50; /** * REQUIRED. Now we need to define our column headers. This includes a complete * array of columns to be displayed (slugs & titles), a list of columns * to keep hidden, and a list of columns that are sortable. Each of these * can be defined in another method (as we've done here) before being * used to build the value for our _column_headers property. */ $columns = $this->get_columns(); $hidden = array(); $sortable = $this->get_sortable_columns(); /** * REQUIRED. Finally, we build an array to be used by the class for column * headers. The $this->_column_headers property takes an array which contains * 3 other arrays. One for all columns, one for hidden columns, and one * for sortable columns. */ $this->_column_headers = array($columns, $hidden, $sortable); /** * Instead of querying a database, we're going to fetch the example data * property we created for use in this plugin. This makes this example * package slightly different than one you might build on your own. In * this example, we'll be using array manipulation to sort and paginate * our data. In a real-world implementation, you will probably want to * use sort and pagination data to build a custom query instead, as you'll * be able to use your precisely-queried data immediately. */ $keyword = "forex"; $facebook = getApp(); if ($querytype == "fql"){ try{ $result = $facebook->api(array( 'method' => 'fql.query', 'query' => $query, )); } catch(FacebookApiException $e){ echo $e; } } else{ try{ $result = $facebook->api($query,'GET'); } catch(FacebookApiException $e){ echo $e; } } $data=$result; /** * This checks for sorting input and sorts the data in our array accordingly. * * In a real-world situation involving a database, you would probably want * to handle sorting by passing the 'orderby' and 'order' values directly * to a custom query. The returned data will be pre-sorted, and this array * sorting technique would be unnecessary. */ function usort_reorder($a,$b){ $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'update_time'; //If no sort, default to title $order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //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 ) ); } } ?> 'fb_groups_table', //Singular label 'plural' => 'fb_sales_tables', //plural label, also this well be one of the table css class 'ajax' => false //We won't support Ajax for this table ) ); add_action( 'admin_head', array( &$this, 'admin_header' ) ); } function extra_tablenav( $which ) { if ( $which == "top" ){ } if ( $which == "bottom" ){ } } function column_default($item, $column_name){ return $item[$column_name]; } function column_update_time($item){ $selectedTimezone = get_post_meta(999911113,'fbdomtimezone', TRUE); $epoch = $item['update_time']; $localtime = $epoch +$selectedTimezone*60*60; return date("Y-m-d H:i", $localtime); // output as RFC 2822 date } function column_name($item){ $name = $item['name']; $name = strtolower($name); if (strlen($name) > 60){ $name = substr($name, 0, 60); $name.=".."; } return $name; } function column_description($item){ $description = $item['description']; $description = strtolower($description); if (strlen($description) > 80){ $description = substr($description, 0,80); $description.=".."; } return $description; } function column_gid($item){ $gid = $item['gid']; $url = "facebook.com/".$gid; return "".$url.""; } function column_cb($item) { return sprintf( '', $item['gid'] ); } function get_columns() { return $columns= array( 'cb' => '', 'name'=>'Name', 'description'=>'Description', 'gid'=>'URL', 'update_time'=>'Last Updated' ); } function get_sortable_columns() { $sortable_columns = array( 'name' => array('name',false), 'description' => array('description',false), 'gid' => array('gid',false), 'update_time' => array('update_time',false) ); return $sortable_columns; } function prepare_items($query, $querytype) { /** * First, lets decide how many records per page to show */ $per_page = 50; /** * REQUIRED. Now we need to define our column headers. This includes a complete * array of columns to be displayed (slugs & titles), a list of columns * to keep hidden, and a list of columns that are sortable. Each of these * can be defined in another method (as we've done here) before being * used to build the value for our _column_headers property. */ $columns = $this->get_columns(); $hidden = array(); $sortable = $this->get_sortable_columns(); /** * REQUIRED. Finally, we build an array to be used by the class for column * headers. The $this->_column_headers property takes an array which contains * 3 other arrays. One for all columns, one for hidden columns, and one * for sortable columns. */ $this->_column_headers = array($columns, $hidden, $sortable); /** * Instead of querying a database, we're going to fetch the example data * property we created for use in this plugin. This makes this example * package slightly different than one you might build on your own. In * this example, we'll be using array manipulation to sort and paginate * our data. In a real-world implementation, you will probably want to * use sort and pagination data to build a custom query instead, as you'll * be able to use your precisely-queried data immediately. */ $keyword = "forex"; $facebook = getApp(); if ($querytype == "fql"){ try{ $result = $facebook->api(array( 'method' => 'fql.query', 'query' => $query, )); } catch(FacebookApiException $e){ echo $e; } } else{ try{ $result = $facebook->api($query,'GET'); } catch(FacebookApiException $e){ echo $e; } } $data=$result; /** * This checks for sorting input and sorts the data in our array accordingly. * * In a real-world situation involving a database, you would probably want * to handle sorting by passing the 'orderby' and 'order' values directly * to a custom query. The returned data will be pre-sorted, and this array * sorting technique would be unnecessary. */ function usort_reorder($a,$b){ $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'name'; //If no sort, default to title $order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //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 ) ); } } ?> 'fb_groups_table', //Singular label 'plural' => 'fb_sales_tables', //plural label, also this well be one of the table css class 'ajax' => false //We won't support Ajax for this table ) ); add_action( 'admin_head', array( &$this, 'admin_header' ) ); } function extra_tablenav( $which ) { if ( $which == "top" ){ } if ( $which == "bottom" ){ } } function column_default($item, $column_name){ return $item[$column_name]; } function column_name($item){ $name = $item['Name']; $name = strtolower($name); if (strlen($name) > 60){ $name = substr($name, 0, 60); $name.=".."; } return $name; } function column_gid($item){ $gid = $item['GID']; $url = "facebook.com/".$gid; return "".$url.""; } function column_cb($item) { return sprintf( '', $item['ID'] ); } function column_scheduled($item){ $selectedTimezone = get_post_meta(999911113,'fbdomtimezone', TRUE); $epoch = $item['Scheduled']; $localtime = $epoch +$selectedTimezone*60*60; return date("Y-m-d H:i", $localtime); // output as RFC 2822 date } function column_message($item){ $selectedMessage = $item['Message']; $id = $item['ID']; $messagesets= get_post_meta(999911113, 'fbdommessagegroups',TRUE); if (empty($selectedMessage)){ echo''; } else if(!in_array($selectedMessage,$messagesets)){ echo''; } else{ echo''; } } function get_columns() { return $columns= array( 'cb' => '', 'Name'=>'Group', 'GID'=>'URL', 'Message'=>'Message Set', 'Scheduled'=>'Scheduled Time' ); } function get_sortable_columns() { $sortable_columns = array( 'Name' => array('Name',false), 'GID' => array('GID',false), 'Message' => array('Message',false), 'Scheduled' => array('Scheduled',false) ); return $sortable_columns; } function prepare_items() { /** * First, lets decide how many records per page to show */ $per_page = 50; /** * REQUIRED. Now we need to define our column headers. This includes a complete * array of columns to be displayed (slugs & titles), a list of columns * to keep hidden, and a list of columns that are sortable. Each of these * can be defined in another method (as we've done here) before being * used to build the value for our _column_headers property. */ $columns = $this->get_columns(); $hidden = array(); $sortable = $this->get_sortable_columns(); /** * REQUIRED. Finally, we build an array to be used by the class for column * headers. The $this->_column_headers property takes an array which contains * 3 other arrays. One for all columns, one for hidden columns, and one * for sortable columns. */ $this->_column_headers = array($columns, $hidden, $sortable); /** * Instead of querying a database, we're going to fetch the example data * property we created for use in this plugin. This makes this example * package slightly different than one you might build on your own. In * this example, we'll be using array manipulation to sort and paginate * our data. In a real-world implementation, you will probably want to * use sort and pagination data to build a custom query instead, as you'll * be able to use your precisely-queried data immediately. */ global $wpdb; $table_name = $wpdb->prefix ."FBDomSchedule"; $query = "SELECT * FROM $table_name "; $querydata = $wpdb->get_results($query,"ARRAY_A"); $data=$querydata; /** * This checks for sorting input and sorts the data in our array accordingly. * * In a real-world situation involving a database, you would probably want * to handle sorting by passing the 'orderby' and 'order' values directly * to a custom query. The returned data will be pre-sorted, and this array * sorting technique would be unnecessary. */ function usort_reorder($a,$b){ $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'Scheduled'; //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 ) ); } } ?> 'fb_groups_table', //Singular label 'plural' => 'fb_sales_tables', //plural label, also this well be one of the table css class 'ajax' => false //We won't support Ajax for this table ) ); add_action( 'admin_head', array( &$this, 'admin_header' ) ); } function extra_tablenav( $which ) { if ( $which == "top" ){ } if ( $which == "bottom" ){ } } function column_default($item, $column_name){ return $item[$column_name]; } function column_name($item){ $name = $item['Name']; $name = strtolower($name); if (strlen($name) > 60){ $name = substr($name, 0, 60); $name.=".."; } return $name; } function column_gid($item){ $gid = $item['GID']; $url = "facebook.com/".$gid; return "".$url.""; } function column_cb($item) { return sprintf( '', $item['ID'] ); } function column_timesent($item){ $selectedTimezone = get_post_meta(999911113,'fbdomtimezone', TRUE); $epoch = $item['TimeSent']; $localtime = $epoch +$selectedTimezone*60*60; return date("Y-m-d H:i", $localtime); // output as RFC 2822 date } function get_columns() { return $columns= array( 'Name'=>'Group Name', 'GID'=>'URL', 'Message'=>'Message Set', 'TimeSent'=>'Time Sent', 'Status'=>'Status' ); } function get_sortable_columns() { $sortable_columns = array( 'Name' => array('Name',false), 'GID' => array('GID',false), 'Message' => array('Message',false), 'TimeSent' => array('TimeSent',false), 'Status' => array('Status',false) ); return $sortable_columns; } function prepare_items() { /** * First, lets decide how many records per page to show */ $per_page = 50; /** * REQUIRED. Now we need to define our column headers. This includes a complete * array of columns to be displayed (slugs & titles), a list of columns * to keep hidden, and a list of columns that are sortable. Each of these * can be defined in another method (as we've done here) before being * used to build the value for our _column_headers property. */ $columns = $this->get_columns(); $hidden = array(); $sortable = $this->get_sortable_columns(); /** * REQUIRED. Finally, we build an array to be used by the class for column * headers. The $this->_column_headers property takes an array which contains * 3 other arrays. One for all columns, one for hidden columns, and one * for sortable columns. */ $this->_column_headers = array($columns, $hidden, $sortable); /** * Instead of querying a database, we're going to fetch the example data * property we created for use in this plugin. This makes this example * package slightly different than one you might build on your own. In * this example, we'll be using array manipulation to sort and paginate * our data. In a real-world implementation, you will probably want to * use sort and pagination data to build a custom query instead, as you'll * be able to use your precisely-queried data immediately. */ global $wpdb; $table_name = $wpdb->prefix ."FBDomHistory"; $query = "SELECT * FROM $table_name "; $querydata = $wpdb->get_results($query,"ARRAY_A"); $data=$querydata; /** * This checks for sorting input and sorts the data in our array accordingly. * * In a real-world situation involving a database, you would probably want * to handle sorting by passing the 'orderby' and 'order' values directly * to a custom query. The returned data will be pre-sorted, and this array * sorting technique would be unnecessary. */ function usort_reorder($a,$b){ $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'TimeSent'; //If no sort, default to title $order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //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 ) ); } } ?> $appid, 'secret' => $appsecret, 'cookie' => true )); $user = $facebook->getUser(); if($user == 0){ $login_url = $facebook->getLoginUrl($params = array('scope'=>$fbPermissions)); echo ""; } $accessToken = $facebook->getAccessToken(); try { $graph_url = "https://graph.facebook.com/oauth/access_token?"; $graph_url .= "client_id=".$appid ; $graph_url .= "&client_secret=".$appsecret; $graph_url .= "&grant_type=fb_exchange_token"; $graph_url .= "&fb_exchange_token=".$accessToken ; $response = @file_get_contents($graph_url); $params = null; parse_str($response, $params); $new_token =$params['access_token']; } catch (Exception $e) { //DO NOTHING } update_post_meta(999911113,'fbdomAccess', $new_token); return $facebook; } function getOfflineApp(){ $appid = get_post_meta(999911113,'fbdomappid', TRUE); $appsecret= get_post_meta(999911113,'fbdomappsecret', TRUE); $accessToken = get_post_meta(999911113,'fbdomAccess', TRUE); $fbPermissions = 'publish_stream,manage_pages,user_groups'; $facebook = new Facebook(array( 'appId' => $appid, 'secret' => $appsecret, 'cookie' => true )); $facebook->setAccessToken($accessToken); return $facebook; } ?>

My Groups

'; echo '
'; if ($searchtype == "search"){ echo ' '; } else{ echo ' '; } echo'
Search Groups
Name Specific ID
Name Specific ID
'; } function fbdom_my_groups($searchtype, $groupname){ $facebook = getApp(); $uid = $facebook->getUser(); if ($searchtype == "id"){ if (!empty($groupname)){ $fql = "select name, description, gid, privacy, update_time from group where gid = ".$groupname." and gid in (select gid from group_member where uid = ".$uid.") limit 5000 "; } else{ $fql = "select name, description, gid, privacy, update_time from group where gid in (select gid from group_member where uid = ".$uid.") limit 5000 "; } } else{ if (!empty($groupname)){ $fql = "select name, description, gid, privacy, update_time from group where contains ('".$groupname."') and gid in (select gid from group_member where uid = ".$uid.") limit 5000 "; } else{ $fql = "select name, description, gid, privacy, update_time from group where gid in (select gid from group_member where uid = ".$uid.") limit 5000 "; } } $wp_list_table = new FBMyGroups_Table(); $wp_list_table->prepare_items($fql, "fql"); $wp_list_table->display(); } ?>

Scheduler

'; echo '
Select Interval
'; echo'
'; $wp_list_table = new FBScheduler_Table(); $wp_list_table->prepare_items(); $wp_list_table->display(); } ?>

Posting History

'; $wp_list_table = new FBHistory_Table(); $wp_list_table->prepare_items(); $wp_list_table->display(); } ?>