* Description: Posts to app.net with the help of ifttt.com
* Version: 0.1
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
+ * Status: Unsupported
*/
function appnetpost_install() {
$enabled = get_pconfig(local_user(),'appnetpost','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
+ $css = (($enabled) ? '' : '-disabled');
+
$def_enabled = get_pconfig(local_user(),'appnetpost','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$s .= '<span id="settings_appnetpost_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_appnetpost_expanded\'); openClose(\'settings_appnetpost_inflated\');">';
- $s .= '<h3>' . t('App.net Export') . '</h3>';
+ $s .= '<img class="connector'.$css.'" src="images/appnet.png" /><h3 class="connector">'. t('App.net Export').'</h3>';
$s .= '</span>';
$s .= '<div id="settings_appnetpost_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_appnetpost_expanded\'); openClose(\'settings_appnetpost_inflated\');">';
- $s .= '<h3>' . t('App.net Export') . '</h3>';
+ $s .= '<img class="connector'.$css.'" src="images/appnet.png" /><h3 class="connector">'. t('App.net Export').'</h3>';
$s .= '</span>';
$s .= '<div id="appnetpost-enable-wrapper">';
/* provide a submit button */
- $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="appnetpost-submit" name="appnetpost-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
+ $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="appnetpost-submit" name="appnetpost-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>';
$s .= '<p>Register an account at <a href="https://ifttt.com">IFTTT</a> and create a recipe with the following values:';
$s .= '<ul><li>If: New feed item (via RSS)</li>';
$s .= '<li>Then: Post an update (via app.net)</li>';
killme();
}
-if (! function_exists( 'short_link' )) {
-function short_link($url) {
- require_once('library/slinky.php');
- $slinky = new Slinky( $url );
- $yourls_url = get_config('yourls','url1');
- if ($yourls_url) {
- $yourls_username = get_config('yourls','username1');
- $yourls_password = get_config('yourls', 'password1');
- $yourls_ssl = get_config('yourls', 'ssl1');
- $yourls = new Slinky_YourLS();
- $yourls->set( 'username', $yourls_username );
- $yourls->set( 'password', $yourls_password );
- $yourls->set( 'ssl', $yourls_ssl );
- $yourls->set( 'yourls-url', $yourls_url );
- $slinky->set_cascade( array( $yourls, new Slinky_UR1ca(), new Slinky_Trim(), new Slinky_IsGd(), new Slinky_TinyURL() ) );
- } else {
- // setup a cascade of shortening services
- // try to get a short link from these services
- // in the order ur1.ca, trim, id.gd, tinyurl
- $slinky->set_cascade( array( new Slinky_UR1ca(), new Slinky_Trim(), new Slinky_IsGd(), new Slinky_TinyURL() ) );
- }
- return $slinky->short();
-} };
-
function appnetpost_feeditem($pid, $uid) {
global $a;
require_once('include/bbcode.php');
require_once("include/html2plain.php");
+ require_once("include/network.php");
$items = q("SELECT `uri`, `plink`, `author-link`, `author-name`, `created`, `edited`, `id`, `title`, `body` from `item` WHERE id=%d", intval($pid));
foreach ($items AS $item) {