mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-28 01:53:18 +00:00
add numfriends plugin, update a couple of tgz's
This commit is contained in:
parent
111f6717a8
commit
fe3ff56d7b
12 changed files with 104 additions and 104 deletions
4
buildtgz
4
buildtgz
|
@ -3,7 +3,7 @@
|
||||||
# without providing a Makefile in each one.
|
# without providing a Makefile in each one.
|
||||||
# So we will just manually find any source
|
# So we will just manually find any source
|
||||||
# directories which contain any files that
|
# directories which contain any files that
|
||||||
# are newer than are .tgz file and rebuild
|
# are newer than our .tgz file and rebuild
|
||||||
# it if any are found
|
# it if any are found
|
||||||
|
|
||||||
SUBDIRS=`ls -d [a-z]*/ | tr -d /`
|
SUBDIRS=`ls -d [a-z]*/ | tr -d /`
|
||||||
|
@ -11,11 +11,13 @@ for a in $SUBDIRS; do
|
||||||
TGZ=$a.tgz
|
TGZ=$a.tgz
|
||||||
if [[ ! -f $TGZ ]]; then
|
if [[ ! -f $TGZ ]]; then
|
||||||
echo "Building: " $TGZ
|
echo "Building: " $TGZ
|
||||||
|
# git log $a > $a/$a.log
|
||||||
tar zcvf $TGZ $a
|
tar zcvf $TGZ $a
|
||||||
else
|
else
|
||||||
TOUCHED=`find $a -cnewer $TGZ`
|
TOUCHED=`find $a -cnewer $TGZ`
|
||||||
if [[ -n $TOUCHED ]]; then
|
if [[ -n $TOUCHED ]]; then
|
||||||
echo "Building: " $TGZ
|
echo "Building: " $TGZ
|
||||||
|
# git log $a > $a/$a.log
|
||||||
tar zcvf $TGZ $a
|
tar zcvf $TGZ $a
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
BIN
editplain.tgz
BIN
editplain.tgz
Binary file not shown.
|
@ -20,7 +20,6 @@ function editplain_install() {
|
||||||
|
|
||||||
function editplain_uninstall() {
|
function editplain_uninstall() {
|
||||||
|
|
||||||
unregister_hook('post_local', 'addon/editplain/editplain.php', 'editplain_post_hook');
|
|
||||||
unregister_hook('plugin_settings', 'addon/editplain/editplain.php', 'editplain_settings');
|
unregister_hook('plugin_settings', 'addon/editplain/editplain.php', 'editplain_settings');
|
||||||
unregister_hook('plugin_settings_post', 'addon/editplain/editplain.php', 'editplain_settings_post');
|
unregister_hook('plugin_settings_post', 'addon/editplain/editplain.php', 'editplain_settings_post');
|
||||||
|
|
||||||
|
|
BIN
numfriends.tgz
Normal file
BIN
numfriends.tgz
Normal file
Binary file not shown.
14
numfriends/numfriends.css
Executable file
14
numfriends/numfriends.css
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#numfriends-label {
|
||||||
|
float: left;
|
||||||
|
width: 200px;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#numfriends {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
87
numfriends/numfriends.php
Executable file
87
numfriends/numfriends.php
Executable file
|
@ -0,0 +1,87 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Name: Numfriends
|
||||||
|
* Description: Change number of contacts shown of profile sidebar
|
||||||
|
* Version: 1.0
|
||||||
|
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function numfriends_install() {
|
||||||
|
|
||||||
|
register_hook('plugin_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings');
|
||||||
|
register_hook('plugin_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post');
|
||||||
|
|
||||||
|
logger("installed numfriends");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function numfriends_uninstall() {
|
||||||
|
|
||||||
|
unregister_hook('plugin_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings');
|
||||||
|
unregister_hook('plugin_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post');
|
||||||
|
|
||||||
|
|
||||||
|
logger("removed numfriends");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Callback from the settings post function.
|
||||||
|
* $post contains the $_POST array.
|
||||||
|
* We will make sure we've got a valid user account
|
||||||
|
* and if so set our configuration setting for this person.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function numfriends_settings_post($a,$post) {
|
||||||
|
if(! local_user() || (! x($_POST,'numfriends-submit')))
|
||||||
|
return;
|
||||||
|
|
||||||
|
set_pconfig(local_user(),'system','display_friend_count',intval($_POST['numfriends']));
|
||||||
|
info( t('Numfriends settings updated.') . EOL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Called from the Plugin Setting form.
|
||||||
|
* Add our own settings info to the page.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function numfriends_settings(&$a,&$s) {
|
||||||
|
|
||||||
|
if(! local_user())
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Add our stylesheet to the page so we can make our settings look nice */
|
||||||
|
|
||||||
|
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/numfriends/numfriends.css' . '" media="all" />' . "\r\n";
|
||||||
|
|
||||||
|
/* Get the current state of our config variable */
|
||||||
|
|
||||||
|
$numfriends = get_pconfig(local_user(),'system','display_friend_count');
|
||||||
|
if($numfriends === false)
|
||||||
|
$numfriends = 24;
|
||||||
|
|
||||||
|
/* Add some HTML to the existing form */
|
||||||
|
|
||||||
|
$s .= '<div class="settings-block">';
|
||||||
|
$s .= '<h3>' . t('Numfriends Settings') . '</h3>';
|
||||||
|
$s .= '<div id="numfriends-wrapper">';
|
||||||
|
$s .= '<label id="numfriends-label" for="numfriends">' . t('How many contacts to display on profile sidebar') . '</label>';
|
||||||
|
$s .= '<input id="numfriends-input" type="text" name="numfriends" value="' . intval($numfriends) . '" ' . '/>';
|
||||||
|
$s .= '</div><div class="clear"></div>';
|
||||||
|
|
||||||
|
/* provide a submit button */
|
||||||
|
|
||||||
|
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="numfriends-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
|
||||||
|
|
||||||
|
}
|
BIN
oembed.tgz
BIN
oembed.tgz
Binary file not shown.
|
@ -1,6 +0,0 @@
|
||||||
function oembed(){
|
|
||||||
var reply = prompt("$oembed_message:");
|
|
||||||
if(reply && reply.length) {
|
|
||||||
tinyMCE.execCommand('mceInsertRawHTML',false, "[embed]"+reply+"[/embed]" );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,89 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Name: OEmbed
|
|
||||||
* Description: OEmbed is a format for allowing an embedded representation of a URL on third party sites http://www.oembed.com/
|
|
||||||
* Version: 1.2
|
|
||||||
* Author: Fabio Comuni <http://kirgroup.com/profile/fabrix>
|
|
||||||
*/
|
|
||||||
|
|
||||||
require_once('include/oembed.php');
|
|
||||||
|
|
||||||
function oembed_install() {
|
|
||||||
register_hook('jot_tool', 'addon/oembed/oembed.php', 'oembed_hook_jot_tool');
|
|
||||||
register_hook('page_header', 'addon/oembed/oembed.php', 'oembed_hook_page_header');
|
|
||||||
register_hook('plugin_settings', 'addon/oembed/oembed.php', 'oembed_settings');
|
|
||||||
register_hook('plugin_settings_post', 'addon/oembed/oembed.php', 'oembed_settings_post');
|
|
||||||
}
|
|
||||||
|
|
||||||
function oembed_uninstall() {
|
|
||||||
unregister_hook('jot_tool', 'addon/oembed/oembed.php', 'oembed_hook_jot_tool');
|
|
||||||
unregister_hook('page_header', 'addon/oembed/oembed.php', 'oembed_hook_page_header');
|
|
||||||
unregister_hook('plugin_settings', 'addon/oembed/oembed.php', 'oembed_settings');
|
|
||||||
unregister_hook('plugin_settings_post', 'addon/oembed/oembed.php', 'oembed_settings_post');
|
|
||||||
}
|
|
||||||
|
|
||||||
function oembed_settings_post($a,$b){
|
|
||||||
if(! local_user())
|
|
||||||
return;
|
|
||||||
if (x($_POST,'oembed-submit')){
|
|
||||||
set_pconfig(local_user(), 'oembed', 'use_for_youtube', (x($_POST,'oembed_use_for_youtube')? intval($_POST['oembed_use_for_youtube']):0));
|
|
||||||
info( t('OEmbed settings updated') . EOL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function oembed_settings(&$a,&$o) {
|
|
||||||
if(! local_user())
|
|
||||||
return;
|
|
||||||
$uofy = intval(get_pconfig(local_user(), 'oembed', 'use_for_youtube' ));
|
|
||||||
|
|
||||||
$t = file_get_contents( dirname(__file__). "/settings.tpl" );
|
|
||||||
$o .= replace_macros($t, array(
|
|
||||||
'$submit' => t('Submit'),
|
|
||||||
'$title' => "OEmbed",
|
|
||||||
'$useoembed' => array('oembed_use_for_youtube', t('Use OEmbed for YouTube videos'), $uofy, ""),
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function oembed_hook_page_header($a, &$b){
|
|
||||||
$a->page['htmlhead'] .= sprintf('<script src="%s/oembed/oembed.js"></script>', $a->get_baseurl());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function oembed_hook_jot_tool($a, &$b) {
|
|
||||||
$b .= '
|
|
||||||
<div class="tool-wrapper" style="display: $visitor;" >
|
|
||||||
<img class="tool-link" src="addon/oembed/oembed.png" alt="Embed" title="Embed" onclick="oembed();" />
|
|
||||||
</div>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function oembed_module() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
function oembed_init(&$a) {
|
|
||||||
if ($a->argv[1]=='oembed.js'){
|
|
||||||
$tpl = file_get_contents('addon/oembed/oembed.js');
|
|
||||||
echo replace_macros($tpl, array(
|
|
||||||
'$oembed_message' => t('URL to embed:'),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($a->argv[1]=='b2h'){
|
|
||||||
$url = array( "", trim(hex2bin($_GET['url'])));
|
|
||||||
echo oembed_replacecb($url);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($a->argv[1]=='h2b'){
|
|
||||||
$text = trim(hex2bin($_GET['text']));
|
|
||||||
echo oembed_html2bbcode($text);
|
|
||||||
}
|
|
||||||
|
|
||||||
killme();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
Binary file not shown.
Before Width: | Height: | Size: 417 B |
|
@ -1,7 +0,0 @@
|
||||||
<div class="settings-block">
|
|
||||||
<h3 class="settings-heading">$title</h3>
|
|
||||||
{{ inc field_checkbox.tpl with $field=$useoembed }}{{ endinc }}
|
|
||||||
<div class="settings-submit-wrapper">
|
|
||||||
<input type="submit" value="$submit" class="settings-submit" name="oembed-submit" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
Binary file not shown.
Loading…
Reference in a new issue