Simple Machines Community Forum

SMF Support => Language Specific Support => Türkçe Bölümü (Turkish) => Topic started by: CaptainJack on February 14, 2024, 04:37:41 PM

Title: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 14, 2024, 04:37:41 PM
Manuel modifikasyon yaparken kancalari nasil calistircaz nerede calistircaz?
Title: Re: Integration hookslar nedir nasil yapilir
Post by: webtiryaki on February 16, 2024, 03:27:27 AM
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)
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 16, 2024, 04:41:51 AM
Cok karisik nasil yapicaz anlamadim. Bi örnek olsaydi keske
Title: Re: Integration hookslar nedir nasil yapilir
Post by: Bugo on February 16, 2024, 05:54:08 AM
Öğ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.
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 17, 2024, 01:46:32 AM
yok örnek yok nasıl yapıcam
Title: Re: Integration hookslar nedir nasil yapilir
Post by: webtiryaki on February 17, 2024, 03:12:26 AM
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);
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 17, 2024, 07:33:23 AM
https://custom.simplemachines.org/index.php?mod=4325

şu modun manuel kurulumunu örnek yaparmısınız
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 18, 2024, 11:03:46 AM
Abi bi yardim edin ya
Title: Re: Integration hookslar nedir nasil yapilir
Post by: webtiryaki on February 18, 2024, 11:32:55 AM
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']);
}
?>
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 18, 2024, 12:14:58 PM
Abi o kodlari nereye yazicaz bi bastan anlatin @webtiryaki
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 19, 2024, 04:13:48 PM
Quote from: webtiryaki on February 18, 2024, 11:32:55 AM
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']);
}
?>
bu kodlari nereye yazicam
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 20, 2024, 10:02:46 AM
Bi yardim edin allah rizasi icin kafayi yicem. En basindan bi anlatin
Title: Re: Integration hookslar nedir nasil yapilir
Post by: Bugo on February 20, 2024, 10:36:08 AM
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.
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 20, 2024, 11:37:07 AM
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.
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 20, 2024, 11:48:18 AM
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?
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 21, 2024, 02:26:22 PM
https://custom.simplemachines.org/index.php?mod=3473

@Bugo

Bu modifikasyon için nasıl bir kod yazmalıyım? Örnek
Title: Re: Integration hookslar nedir nasil yapilir
Post by: CaptainJack on February 23, 2024, 03:54:56 PM
@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
Title: Re: Integration hookslar nedir nasil yapilir
Post by: Bugo on February 23, 2024, 09:03:14 PM
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.