how to convert all links posted into download buttons.

Started by nfmovil, August 12, 2016, 01:41:40 PM

Previous topic - Next topic

nfmovil

how to convert all links posted into download buttons?

When a user post a Link http://blablabla

to

[ download ] http://blablabla [ / download ]

BR

Illori

why? some explaination on what you are doing or want to do and maybe we can help you.

nfmovil

Quote from: Illori on August 12, 2016, 01:46:47 PM
why? some explaination on what you are doing or want to do and maybe we can help you.

Because I have groups and links is only for a group not for guest.
After a numbers required of post the guest can see the links.

But if this button is just a text link the Guest user can download too.

Kindred

you mean, like this?
http://custom.simplemachines.org/mods/index.php?mod=342


instead of assuming that you know the best way to do something, it is recommended that you explain the reasoning and the goal -- most of the time, there is a better way than your assumption.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

nfmovil

No, like this.



into



Because I explain to user, "please, user the green button to convert to download button" and they say, where, wich one, I don´t know , is complicated.

So, I want to convert every link in button automatically

Dhayzon


nfmovil

Yes, I am using that...
I need to convert every link into button automatically without user intervention.

Dhayzon

remplace   Subs-DownloadButton.php    find on dir    /source/ Subs-DownloadButton.php


First backup Subs-DownloadButton.php





nfmovil

#8
MMmm, is working but is not woking.
I am using Votes/Likes to give access to this buttons.

So I need [download] at the beginning and the end [/download]

http://www.link.com

to

[download]http://www.link.com[/download]

nfmovil

<?php
/***********************************************************************************
* download Button  Â© 2012-2014, DhaYzon             *
************************************************************************************
* Subs-DownloadButton.php    *
************************************************************************************
* License http://creativecommons.org/licenses/by-nc-nd/3.0/deed.ru CC BY-NC-ND     *
* Support and updates for this software can be found at http://DhaYzon.com         *
***********************************************************************************/

if (!defined('SMF'))
die('Hacking attempt...');

function 
dbutton_load_theme()
{
global $txt$modSettings$context$settings;

loadLanguage('DownloadButton');


if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'showoperations') return;

loadTemplate(false'download');

}


function 
dbutton_bbc_codes(&$codes){

global $modsettings$settings$context$txt;

// Remove url tag
foreach ($codes as $tag => $dump) {
if ($dump['tag'] == 'url')
unset($codes[$tag]);
}

if (allowedTo('view_downloadButton'))
{
$codes[] = array(
'tag' => 'download',
'before' => '<div href="#" class="a-btn"><span class="a-btn-symbol"><img src="'.$settings['images_url'].'/arrow_down_black.png" atl="" title=""  /></span><span class="a-btn-text">'.(!empty($modsettings['dbutton_title']) ? $modsettings['dbutton_title'] : $txt['download_now']).'</span><span class="a-btn-slide-text">'.(!empty($context['forum_name']) ? $context['forum_name'] : $txt['forum_name']) .'</span><span class="a-btn-slide-icon"></span><div class="download-content">',
'after' => '</div></div>',
'block_level' => true,
 );
$codes[] = array(
'tag' => 'download',
'type' => 'unparsed_equals',
'before' => '<div href="#" class="a-btn"><span class="a-btn-symbol"><img src="'.$settings['images_url'].'/arrow_down_black.png" atl="" title=""/></span><span class="a-btn-text">$1</span><span class="a-btn-slide-text">'.(!empty($context['forum_name']) ? $context['forum_name'] : $txt['forum_name']) .'</span><span class="a-btn-slide-icon"></span><div class="download-content">',
'after' => '</div></div>',
'block_level' => true,

);
$codes[] = array(
'tag' => 'url',
'type' => 'unparsed_content',
'content' =>  '<div href="#" class="a-btn"><span class="a-btn-symbol"><img src="'.$settings['images_url'].'/arrow_down_black.png" atl="" title=""/></span><span class="a-btn-text">$1</span><span class="a-btn-slide-text">'.(!empty($context['forum_name']) ? $context['forum_name'] : $txt['forum_name']) .'</span><span class="a-btn-slide-icon"></span><div class="download-content"></a></div></div>',
'validate' => create_function('&$tag, &$data, $disabled'
 global  $modSettings, $context; 
  $data = strtr($data, array(\'<br />\' => \'\'));
  if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
  $data = \'http://\' . $data;
'
)
);
$codes[] = array(
'tag' => 'url',
'type' => 'unparsed_equals',
'before' => '<div href="#" class="a-btn"><span class="a-btn-symbol"><img src="'.$settings['images_url'].'/arrow_down_black.png" atl="" title=""/></span><span class="a-btn-text">$1</span><span class="a-btn-slide-text">'.(!empty($context['forum_name']) ? $context['forum_name'] : $txt['forum_name']) .'</span><span class="a-btn-slide-icon"></span><div class="download-content">',
'after' => '</div></div>',
'validate' => create_function('&$tag, &$data, $disabled'
 global  $modSettings, $context;


  $data = strtr($data, array(\'<br />\' => \'\'));
  if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
  $data = \'http://\' . $data;
'
)
);


}
else{

$codes[] = array(

'tag' => 'download',
'type' => 'unparsed_content',
'content' => '<div  class="a-btn centertext"><span class="no-view">'.$txt['no_view'].'</span></div>',
'block_level' => true,
 );
$codes[] = array(
'tag' => 'download',
'type' => 'unparsed_equals_content',
'content'  => '<div  class="a-btn centertext"><span class="no-view">'.$txt['no_view'].'</span></div>',
'block_level' => true,

);
}

}

function 
dbutton_bbc_buttons(&$buttons){

   global $txt;

   $buttons [count($buttons) - 1][] = array(
'image' => 'cloud-download',
'code' => 'download',
'before' => '[download]',
'after' => '[/download]',
'description' =>  $txt['download_now']
);
}

function 
dbuttonm_buffer(&$buffer)
{
global $context$settings;

if (isset($_REQUEST['xml']) || $context['current_action'] == 'printpage') return $buffer;

$dbutton 'sImage: ' JavaScriptEscape($settings['images_url'] . '/bbc/cloud-download.gif');
$default 'sImage: ' JavaScriptEscape($settings['default_images_url'] . '/bbc/cloud-download.gif');
$replacements[$dbutton] = $default;

return str_replace(array_keys($replacements), array_values($replacements), $buffer);
}


function 
dbutton_permissions(&$permissionGroups, &$permissionList)
{
$permissionList['membergroup']['view_downloadButton'] = array(false'general''view_basic_info');
}

function 
dbutton_settings(&$config_vars)
{
global $modSettings$txt;

if (isset($config_vars[0])) $config_vars[] = array('title''dbutton_settings');
if (empty($modSettings['dbutton_title'])) updateSettings(array('dbutton_title' =>  $txt['download_now']));

$config_vars[] = array('text''dbutton_title');
$config_vars[] = array('permissions''view_downloadButton');
}

?>


Can u help me to put download within the link?

Advertisement: