Manuel modifikasyon yaparken kancalari nasil calistircaz nerede calistircaz?
Quote from: CaptainJack on February 14, 2024, 04:37:41 PMManuel modifikasyon yaparken kancalari nasil calistircaz nerede calistircaz?
https://wiki.simplemachines.org/w/index.php?title=Special%3ASearch&search=hooks&fulltext=Search (https://wiki.simplemachines.org/w/index.php?title=Special%3ASearch&search=hooks&fulltext=Search)
Cok karisik nasil yapicaz anlamadim. Bi örnek olsaydi keske
Öğrenmek için diğer projeleri örnek olarak kullanabilirsiniz. Örneğin, bir zamanlar Suki (https://custom.simplemachines.org/index.php?action=profile;u=245528), digger (https://custom.simplemachines.org/index.php?action=profile;u=97557) ve diğer birçok geliştiricinin modlarından öğrendim.
yok örnek yok nasıl yapıcam
Quote from: CaptainJack on February 17, 2024, 01:46:32 AMyok örnek yok nasıl yapıcam
tamamda buna sen karar vermen Lazım ne yazacağını bilememki ben
<?php
declare(strict_types=1);
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
elseif (!defined('SMF'))
exit('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
global $context;
$hookCall = !empty($context['uninstalling']) ? 'remove_integration_function' : 'add_integration_function';
// Everybody likes hooks
$hooks = [
'integrate_pre_include' => '$sourcedir/xxx.php',
'integrate_member_context' => 'xxxx',
'integrate_general_mod_settings' => 'xxx',
'integrate_prepare_display_context' => 'xxx',
'integrate_load_custom_profile_fields' => 'xxx',
];
foreach ($hooks as $hook => $function)
$hookCall($hook, $function);
https://custom.simplemachines.org/index.php?mod=4325
şu modun manuel kurulumunu örnek yaparmısınız
Abi bi yardim edin ya
Quote from: CaptainJack on February 18, 2024, 11:03:46 AMAbi bi yardim edin ya
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>Kira_:TgWaShare</id>
<name>Tg and Wa share post</name>
<version>1.0b</version>
<type>modification</type>
<install for="2.1.*">
<require-file name="TgWaShare.php" destination="$sourcedir" />
<require-dir name="languages" destination="$themedir" />
<require-file name="icons/Telegram.png" destination="$themedir/images/icons" />
<require-file name="icons/Whatsapp.png" destination="$themedir/images/icons" />
<hook hook="integrate_post_quickbuttons" function="post_quickbuttons" file="$sourcedir/TgWaShare.php" />
</install>
<uninstall for="2.1.*">
<hook hook="integrate_post_quickbuttons" function="post_quickbuttons" file="$sourcedir/TgWaShare.php" reverse="true" />
<remove-file name="$sourcedir/TgWaShare.php" />
<remove-file name="$languagedir/TgWaShare.english.php" />
<remove-file name="$languagedir/TgWaShare.russian.php" />
<remove-file name="$themedir/images/icons/Telegram.png" />
<remove-file name="$themedir/images/icons/Whatsapp.png" />
</uninstall>
</package-info><?php
if (!defined('SMF'))
die('Hacking attempt...');
function post_quickbuttons(&$list_items)
{
global $settings,$txt;
loadLanguage('TgWaShare');
$url=preg_replace('%(index.php\?)(.*)(msg=)%i', '$1$3', $list_items['more']['report']['href']);
$tg_button['tg_button']=array(
'label' => '<img style="width: 20px; margin-bottom: -5px;" src="'. $settings['images_url'] . '/icons/Telegram.png">'.$txt['TgWaShare'],
'href' => 'https://t.me/share/url?url='.rawurlencode($url),
'show' => true
);
$wa_button['wa_button']=array(
'label' => '<img style="width: 20px; margin-bottom: -5px;" src="'. $settings['images_url'] . '/icons/Whatsapp.png">'.$txt['TgWaShare'],
'href' => 'https://api.whatsapp.com/send?text='.rawurlencode($url),
'show' => true
);
$list_items['more']=array_merge($wa_button,$list_items['more']);
$list_items['more']=array_merge($tg_button,$list_items['more']);
}
?>
Abi o kodlari nereye yazicaz bi bastan anlatin
@webtiryaki
Quote from: webtiryaki on February 18, 2024, 11:32:55 AMQuote from: CaptainJack on February 18, 2024, 11:03:46 AMAbi bi yardim edin ya
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>Kira_:TgWaShare</id>
<name>Tg and Wa share post</name>
<version>1.0b</version>
<type>modification</type>
<install for="2.1.*">
<require-file name="TgWaShare.php" destination="$sourcedir" />
<require-dir name="languages" destination="$themedir" />
<require-file name="icons/Telegram.png" destination="$themedir/images/icons" />
<require-file name="icons/Whatsapp.png" destination="$themedir/images/icons" />
<hook hook="integrate_post_quickbuttons" function="post_quickbuttons" file="$sourcedir/TgWaShare.php" />
</install>
<uninstall for="2.1.*">
<hook hook="integrate_post_quickbuttons" function="post_quickbuttons" file="$sourcedir/TgWaShare.php" reverse="true" />
<remove-file name="$sourcedir/TgWaShare.php" />
<remove-file name="$languagedir/TgWaShare.english.php" />
<remove-file name="$languagedir/TgWaShare.russian.php" />
<remove-file name="$themedir/images/icons/Telegram.png" />
<remove-file name="$themedir/images/icons/Whatsapp.png" />
</uninstall>
</package-info>
<?php
if (!defined('SMF'))
die('Hacking attempt...');
function post_quickbuttons(&$list_items)
{
global $settings,$txt;
loadLanguage('TgWaShare');
$url=preg_replace('%(index.php\?)(.*)(msg=)%i', '$1$3', $list_items['more']['report']['href']);
$tg_button['tg_button']=array(
'label' => '<img style="width: 20px; margin-bottom: -5px;" src="'. $settings['images_url'] . '/icons/Telegram.png">'.$txt['TgWaShare'],
'href' => 'https://t.me/share/url?url='.rawurlencode($url),
'show' => true
);
$wa_button['wa_button']=array(
'label' => '<img style="width: 20px; margin-bottom: -5px;" src="'. $settings['images_url'] . '/icons/Whatsapp.png">'.$txt['TgWaShare'],
'href' => 'https://api.whatsapp.com/send?text='.rawurlencode($url),
'show' => true
);
$list_items['more']=array_merge($wa_button,$list_items['more']);
$list_items['more']=array_merge($tg_button,$list_items['more']);
}
?>
bu kodlari nereye yazicam
Bi yardim edin allah rizasi icin kafayi yicem. En basindan bi anlatin
Okumak istemiyorsanız bunu size nasıl açıklayabilirim? Bunu resimlerde deneyeceğim. Her modun, manuel kurulum prosedürünü görüntüleyen bir ayrıştırma düğmesi vardır.

(https://postimg.cc/mcm4TWDt)

(https://postimages.org/)
Kanca eklemek için forumun kök dizininde bir dosya oluşturun ve oraya aşağıdaki kodu ekleyin:
hooks.php:
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
elseif (!defined('SMF'))
exit('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
global $context;
$hookCall = !empty($context['uninstalling']) ? 'remove_integration_function' : 'add_integration_function';
$hooks = [
'integrate_post_quickbuttons' => '$sourcedir/TgWaShare.php|post_quickbuttons',
];
foreach ($hooks as $hook => $function)
$hookCall($hook, $function);
echo 'Ok';
Ardından tarayıcınızda aşağıdaki adresi açın: https://<forumunuz>/hooks.php
Bundan sonra hooks.php kaldırılabilir.
Quote from: Bugo on February 20, 2024, 10:36:08 AMOkumak istemiyorsanız bunu size nasıl açıklayabilirim? Bunu resimlerde deneyeceğim. Her modun, manuel kurulum prosedürünü görüntüleyen bir ayrıştırma düğmesi vardır.
(https://postimg.cc/mcm4TWDt)
(https://postimages.org/)
Kanca eklemek için forumun kök dizininde bir dosya oluşturun ve oraya aşağıdaki kodu ekleyin:
hooks.php:
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
elseif (!defined('SMF'))
exit('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
global $context;
$hookCall = !empty($context['uninstalling']) ? 'remove_integration_function' : 'add_integration_function';
$hooks = [
'integrate_post_quickbuttons' => '$sourcedir/TgWaShare.php|post_quickbuttons',
];
foreach ($hooks as $hook => $function)
$hookCall($hook, $function);
echo 'Ok';
Ardından tarayıcınızda aşağıdaki adresi açın: https://<forumunuz>/hooks.php
Bundan sonra hooks.php kaldırılabilir.
oldu çok teşekkür ederim.
Quote from: Bugo on February 20, 2024, 10:36:08 AMOkumak istemiyorsanız bunu size nasıl açıklayabilirim? Bunu resimlerde deneyeceğim. Her modun, manuel kurulum prosedürünü görüntüleyen bir ayrıştırma düğmesi vardır.
(https://postimg.cc/mcm4TWDt)
(https://postimages.org/)
Kanca eklemek için forumun kök dizininde bir dosya oluşturun ve oraya aşağıdaki kodu ekleyin:
hooks.php:
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
elseif (!defined('SMF'))
exit('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
global $context;
$hookCall = !empty($context['uninstalling']) ? 'remove_integration_function' : 'add_integration_function';
$hooks = [
'integrate_post_quickbuttons' => '$sourcedir/TgWaShare.php|post_quickbuttons',
];
foreach ($hooks as $hook => $function)
$hookCall($hook, $function);
echo 'Ok';
Ardından tarayıcınızda aşağıdaki adresi açın: https://<forumunuz>/hooks.php
Bundan sonra hooks.php kaldırılabilir.
bu kodları diğer modlarda da çalıştırabilir miyiz?
https://custom.simplemachines.org/index.php?mod=3473
@Bugo Bu modifikasyon için nasıl bir kod yazmalıyım? Örnek
@Bugo yardım lütfen
Quote from: CaptainJack on February 21, 2024, 02:26:22 PMhttps://custom.simplemachines.org/index.php?mod=3473
@Bugo
Bu modifikasyon için nasıl bir kod yazmalıyım? Örnek
Bazı değişikliklerin zaten hazır bir install.php veya hooks.php dosyası vardır, bunları forumun kök klasörüne taşımanız ve tarayıcınız üzerinden çalıştırmanız yeterlidir. Ancak, değişikliklerinizin neden normal şekilde, Paket Yöneticisi aracılığıyla yüklenmediğini anlamak daha iyidir.