コード例 #1
0
ファイル: functions.php プロジェクト: sabdev1/ljcdevsab
/**
 * @since 3.0.2
 */
function awpcp_verify_renew_ad_hash($ad_id, $hash)
{
    return strcmp(awpcp_get_renew_ad_hash($ad_id), $hash) === 0;
}
コード例 #2
0
 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;
 }
コード例 #3
0
ファイル: routes.php プロジェクト: sabdev1/ljcdevsab
/**
 * Returns a link that can be used to initiate the Ad Renewal process.
 *
 * @since 2.0.7
 */
function awpcp_get_renew_ad_url($ad_id)
{
    $hash = awpcp_get_renew_ad_hash($ad_id);
    if (get_awpcp_option('enable-user-panel') == 1) {
        $url = awpcp_get_user_panel_url();
        $params = array('id' => $ad_id, 'action' => 'renew', 'awpcprah' => $hash);
    } else {
        $url = awpcp_get_page_url('renew-ad-page-name');
        $params = array('ad_id' => $ad_id, 'awpcprah' => $hash);
    }
    return add_query_arg(urlencode_deep($params), $url);
}