function awpcp_send_listing_to_facebook_helper() { return new AWPCP_SendListingToFacebookHelper(AWPCP_Facebook::instance(), awpcp_send_to_facebook_helper(), awpcp_listings_collection(), awpcp_listings_metadata(), awpcp()->settings); }
public function get_bulk_actions() { $actions = array(); if (awpcp_current_user_is_admin()) { $actions = array('bulk-enable' => __('Enable', 'AWPCP'), 'bulk-disable' => __('Disable', 'AWPCP'), 'bulk-make-featured' => __('Make Featured', 'AWPCP'), 'bulk-remove-featured' => __('Make Non Featured', 'AWPCP'), 'bulk-renew' => __('Renew', 'AWPCP'), 'bulk-spam' => __('Mark as SPAM', 'AWPCP')); $fb = AWPCP_Facebook::instance(); if ($fb->get('page_token')) { $actions['bulk-send-to-facebook'] = __('Send to Facebook', 'AWPCP'); } } $actions['bulk-delete'] = __('Delete', 'AWPCP'); return $actions; }
public function actions($ad, $filter = false) { $is_moderator = awpcp_current_user_is_moderator(); $actions = array(); $actions['view'] = array(__('View', 'AWPCP'), $this->url(array('action' => 'view', 'id' => $ad->ad_id))); $actions['edit'] = array(__('Edit', 'AWPCP'), $this->url(array('action' => 'edit', 'id' => $ad->ad_id))); $actions['trash'] = array(__('Delete', 'AWPCP'), $this->url(array('action' => 'delete', 'id' => $ad->ad_id))); if ($is_moderator) { if ($ad->disabled) { $actions['enable'] = array(__('Enable', 'AWPCP'), $this->url(array('action' => 'enable', 'id' => $ad->ad_id))); } else { $actions['disable'] = array(__('Disable', 'AWPCP'), $this->url(array('action' => 'disable', 'id' => $ad->ad_id))); } if ($ad->flagged) { $actions['unflag'] = array(__('Unflag', 'AWPCP'), $this->url(array('action' => 'unflag', 'id' => $ad->ad_id))); } if (get_awpcp_option('useakismet')) { $actions['spam'] = array('SPAM', $this->url(array('action' => 'spam', 'id' => $ad->ad_id))); } $has_featured_ads = function_exists('awpcp_featured_ads'); if ($has_featured_ads && $ad->is_featured_ad) { $actions['remove-featured'] = array(__('Remove Featured', 'AWPCP'), $this->url(array('action' => 'remove-featured', 'id' => $ad->ad_id))); } else { if ($has_featured_ads) { $actions['make-featured'] = array(__('Make Featured', 'AWPCP'), $this->url(array('action' => 'make-featured', 'id' => $ad->ad_id))); } } $actions['send-key'] = array(__('Send Access Key', 'AWPCP'), $this->url(array('action' => 'send-key', 'id' => $ad->ad_id))); } if ($ad->is_about_to_expire() || $ad->has_expired()) { $hash = awpcp_get_renew_ad_hash($ad->ad_id); $params = array('action' => 'renew', 'id' => $ad->ad_id, 'awpcprah' => $hash); $actions['renwew-ad'] = array(__('Renew Ad', 'AWPCP'), $this->url($params)); } if ($images = $ad->count_image_files()) { $label = __('Manage Images', 'AWPCP'); $url = $this->url(array('action' => 'manage-images', 'id' => $ad->ad_id)); $actions['manage-images'] = array($label, array('', $url, " ({$images})")); } else { if (awpcp_are_images_allowed()) { $actions['add-image'] = array(__('Add Images', 'AWPCP'), $this->url(array('action' => 'add-image', 'id' => $ad->ad_id))); } } if ($is_moderator && !$ad->disabled) { $fb = AWPCP_Facebook::instance(); if (!awpcp_get_ad_meta($ad->ad_id, 'sent-to-facebook') && $fb->get('page_id')) { $actions['send-to-facebook'] = array(__('Send to Facebook', 'AWPCP'), $this->url(array('action' => 'send-to-facebook', 'id' => $ad->ad_id))); } else { if (!awpcp_get_ad_meta($ad->ad_id, 'sent-to-facebook-group') && $fb->get('group_id')) { $actions['send-to-facebook'] = array(__('Send to Facebook Group', 'AWPCP'), $this->url(array('action' => 'send-to-facebook', 'id' => $ad->ad_id))); } } } $actions = apply_filters('awpcp-admin-listings-table-actions', $actions, $ad, $this); if ($is_moderator && isset($_REQUEST['filterby']) && $_REQUEST['filterby'] == 'new') { $actions['mark-reviewed'] = array(__('Mark Reviewed', 'AWPCP'), $this->url(array('action' => 'mark-reviewed', 'id' => $ad->ad_id))); } if (is_array($filter)) { $actions = array_intersect_key($actions, array_combine($filter, $filter)); } return $actions; }
function awpcp_send_to_facebook_helper() { return new AWPCP_SendToFacebookHelper(AWPCP_Facebook::instance(), awpcp_listings_metadata(), awpcp_media_api()); }
private function save_config() { $awpcp_fb = AWPCP_Facebook::instance(); $config = $awpcp_fb->get_config(); $app_id = isset($_POST['app_id']) ? trim($_POST['app_id']) : ''; $app_secret = isset($_POST['app_secret']) ? trim($_POST['app_secret']) : ''; $user_token = isset($_POST['user_token']) ? trim($_POST['user_token']) : ''; $page = isset($_POST['page']) ? trim($_POST['page']) : ''; $group = isset($_POST['group']) ? trim($_POST['group']) : ''; $config['app_id'] = $app_id; $config['app_secret'] = $app_secret; $config['user_token'] = $user_token; if ($page == 'none') { $config['page_id'] = ''; $config['page_token'] = ''; } else { if (!empty($page)) { $parts = explode('|', $page); $page_id = $parts[0]; $page_token = $parts[1]; $config['page_id'] = $page_id; $config['page_token'] = $page_token; } } if ($group == 'none') { $config['group_id'] = ''; } else { if (!empty($group)) { $config['group_id'] = $group; } } $awpcp_fb->set_config($config); if ($last_error = $awpcp_fb->get_last_error()) { $message = __('There was an error trying to contact Facebook servers: "%s".', 'AWPCP'); $errors[] = sprintf($message, $last_error->message); } else { $errors = array(); } return $this->display_settings($errors); }
public static function instance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; }
function awpcp_send_listing_to_facebook_admin_page() { return new AWPCP_SendListingToFacebookAdminPage(awpcp_listings_collection(), AWPCP_Facebook::instance(), awpcp_send_to_facebook_helper(), awpcp_request()); }