Example #1
0
        $values = self::urlencode_rfc3986(array_values($params));
        $params = array_combine($keys, $values);
        // Parameters are sorted by name, using lexicographical byte value ordering.
        // Ref: Spec: 9.1.1 (1)
        uksort($params, 'strcmp');
        $pairs = array();
        foreach ($params as $parameter => $value) {
            if (is_array($value)) {
                // If two or more parameters share the same name, they are sorted by their value
                // Ref: Spec: 9.1.1 (1)
                natsort($value);
                foreach ($value as $duplicate_value) {
                    $pairs[] = $parameter . '=' . $duplicate_value;
                }
            } else {
                $pairs[] = $parameter . '=' . $value;
            }
        }
        // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
        // Each name-value pair is separated by an '&' character (ASCII code 38)
        return implode('&', $pairs);
    }
}
Sharepress::load();
#
# Don't be a dick. I like to eat, too.
# http://aaroncollegeman/sharepress/
#
if (Sharepress::unlocked()) {
    require 'pro.php';
}
Example #2
0
 function post($meta, $post)
 {
     if (Sharepress::debug()) {
         Sharepress::log(sprintf('SharepressPro::post(%s, %s)', $meta['message'], is_object($post) ? $post->post_title : $post));
         Sharepress::log(sprintf('SharepressPro::post => count(SharepressPro::pages()) = %s', count(self::pages())));
         Sharepress::log(sprintf('SharperessPro::post => $meta["targets"] = %s', serialize($meta['targets'])));
     }
     // loop over authorized pages
     foreach (self::pages() as $page) {
         if (in_array($page['id'], $meta['targets'])) {
             if (self::is_excluded_page($page)) {
                 continue;
             }
             $result = Sharepress::api($page['id'] . '/links', 'POST', array('access_token' => $page['access_token'], 'message' => $meta['message'], 'link' => Sharepress::load()->get_permalink($post->ID)));
             Sharepress::log(sprintf("posted to the page(%s): %s", $page['name'], serialize($result)));
             // store the ID for queuing
             $result['posted'] = time();
             add_post_meta($post->ID, Sharepress::META_RESULT, $result);
         }
     }
 }