Jump to content
  • 0

Question

Posted

Salut!

Cum sa scot sursa dintr-un plugin, ca sa ma intelegeti mai bine, de exemplu: Pluginul TOPIC STARTER 

Din acest plugin sa scot sursa si sa o instalez pe forum, fara a instala pluginul.

Sper ca ati inteles ce am avut in vedere.

Multumesc.

Acesta este codul din plugin

<?xml version="1.0" encoding="UTF-8"?>
<plugin name="Topic Starter Info In Topic View" version_long="20001" version_human="2.0.1" author="Ahmed Zayed" website="https://invisioncommunity.com/profile/189809-a-zayed/" update_check=""><hooks><hook type="S" class="\IPS\Theme\class_forums_front_topics" filename="TSITopicView"><![CDATA[//<?php

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	exit;
}

class hook4 extends _HOOK_CLASS_
{

/* !Hook Data - DO NOT REMOVE */
public static function hookData() {
 return array_merge_recursive( array (
  'postContainer' => 
  array (
    'ks' => 
    array (
      'selector' => 'article > aside.ipsComment_author.cAuthorPane.ipsColumn.ipsColumn_medium.ipsResponsive_hidePhone',
      'type' => 'add_inside_start',
      'content' => '{{$tStarterId = \IPS\Db::i()->select( "starter_id", "forums_topics", "tid = $comment->topic_id")->first();}}
{{if settings.TSITV_Loc == "aboveMT"}}
	  	  {{if $comment->mapped(\'first\') && \IPS\Settings::i()->TSITV_Allow_First_Post == "0"}}
	      {{else}}
          {{if $comment->author()->member_id == $tStarterId}}
              <span style=\'background: {setting="TSITV_BGColor"}; margin-bottom: 10px;\' class=\'ipsBadge {setting="TSITV_Size"} ipsBadge_positive\'><i class=\'fa {setting="TSITV_Icon"}\'></i> {setting="TSITV_Title"}</span>
          {{endif}}
		  {{endif}}
{{endif}}',
    ),
    0 => 
    array (
      'selector' => 'article > aside.ipsComment_author.cAuthorPane.ipsColumn.ipsColumn_medium.ipsResponsive_hidePhone > ul.cAuthorPane_info.ipsList_reset',
      'type' => 'add_inside_start',
      'content' => '{{if settings.TSITV_Loc == "belowMT"}}
	  	  {{if $comment->mapped(\'first\') && \IPS\Settings::i()->TSITV_Allow_First_Post == "0"}}
	      {{else}}
          {{if $comment->author()->member_id == $tStarterId}}
              <li><span style="background: {setting="TSITV_BGColor"}; margin-bottom: 10px;" class="ipsBadge {setting="TSITV_Size"} ipsBadge_positive"><i class=\'fa {setting="TSITV_Icon"}\'></i> {setting="TSITV_Title"}</span></li>
          {{endif}}
		  {{endif}}
{{endif}}',
    ),
    1 => 
    array (
      'selector' => 'article > aside.ipsComment_author.cAuthorPane.ipsColumn.ipsColumn_medium.ipsResponsive_hidePhone > ul.cAuthorPane_info.ipsList_reset > li.cAuthorPane_photo',
      'type' => 'add_after',
      'content' => '{{if settings.TSITV_Loc == "belowAV"}}
	  	  {{if $comment->mapped(\'first\') && \IPS\Settings::i()->TSITV_Allow_First_Post == "0"}}
	      {{else}}
          {{if $comment->author()->member_id == $tStarterId}}
              <li><span style=\'background: {setting="TSITV_BGColor"}; margin-bottom: 5px;\' class=\'ipsBadge {setting="TSITV_Size"} ipsBadge_positive\'><i class=\'fa {setting="TSITV_Icon"}\'></i> {setting="TSITV_Title"}</span></li>
          {{endif}}
		  {{endif}}
{{endif}}',
    ),
  ),
), parent::hookData() );
}
/* End Hook Data */


}
]]></hook></hooks><settings><setting><key>TSITV_Title</key><default>Topic Starter</default></setting><setting><key>TSITV_Icon</key><default>fa-star</default></setting><setting><key>TSITV_Size</key><default>5</default></setting><setting><key>TSITV_BGColor</key><default>#f09348</default></setting><setting><key>TSITV_Loc</key><default>belowMT</default></setting><setting><key>TSITV_Allow_First_Post</key><default>1</default></setting></settings><settingsCode><![CDATA[//<?php

        $form->add( new \IPS\Helpers\Form\Text( 'TSITV_Title', isset( \IPS\Settings::i()->TSITV_Title ) ? \IPS\Settings::i()->TSITV_Title : 'Topic Starter', TRUE ) );
 		$form->add( new \IPS\Helpers\Form\Text( 'TSITV_Icon', isset( \IPS\Settings::i()->TSITV_Icon ) ? \IPS\Settings::i()->TSITV_Icon : 'fa-star', TRUE ) );

		$form->add( new \IPS\Helpers\Form\Color( 'TSITV_BGColor', isset( \IPS\Settings::i()->TSITV_BGColor ) ? \IPS\Settings::i()->TSITV_BGColor : '', TRUE, array(
		    'disabled' => false,
		) ) );
		$form->add( new \IPS\Helpers\Form\Select( 'TSITV_Size', isset( \IPS\Settings::i()->TSITV_Size ) ? \IPS\Settings::i()->TSITV_Size : '', FALSE, array(
		    'options'=> array( 'ipsBadge_normal' => 'Normal', 'ipsBadge_medium' => 'Medium', 'ipsBadge_large' => 'Large', 'ipsBadge_veryLarge' => 'Very Large' ),
		) ) );	
		$form->add( new \IPS\Helpers\Form\Select( 'TSITV_Loc', isset( \IPS\Settings::i()->TSITV_Loc ) ? \IPS\Settings::i()->TSITV_Loc : '', FALSE, array(
		    'options'=> array( 'aboveMT' => 'Above Member Title', 'belowMT' => 'Below Member Title', 'belowAV' => 'Below Avatar', ),
		) ) );
		$form->add( new \IPS\Helpers\Form\YesNo( 'TSITV_Allow_First_Post', \IPS\Settings::i()->TSITV_Allow_First_Post, FALSE, array(), NULL, NULL, NULL, 'TSITV_Allow_First_Post') );

if ( $values = $form->values() )
{
	$form->saveAsSettings();
	return TRUE;
}

return $form;]]></settingsCode><tasks/><htmlFiles/><cssFiles/><jsFiles/><resourcesFiles/><lang><word key="TSITV_Title" js="0">Badge Title</word><word key="TSITV_Icon" js="0">Badge Icon [Font Awesome Icon]</word><word key="TSITV_Icon_desc" js="0"><![CDATA[Must be in the form of [fa-ICON_NAME], you can choose icons from <a href='http://fontawesome.io/icons/' target='_blank'>here</a>]]></word><word key="TSITV_BGColor" js="0">Badge Background</word><word key="TSITV_Size" js="0">Badge Size</word><word key="TSITV_Loc" js="0">Badge Location</word><word key="TSITV_Allow_First_Post" js="0">View 'Topic Stater' badge in first post?</word></lang><versions><version long="10000" human="1.0.0"><![CDATA[//<?php


/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * Install Code
 */
class ips_plugins_setup_install
{
	/**
	 * ...
	 *
	 * @return	array	If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
	 */
	public function step1()
	{
		

		return TRUE;
	}
	
	// You can create as many additional methods (step2, step3, etc.) as is necessary.
	// Each step will be executed in a new HTTP request
}]]></version><version long="10001" human="1.0.1"><![CDATA[//<?php


/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * 1.0.1 Upgrade Code
 */
class ips_plugins_setup_upg_10001
{
	/**
	 * ...
	 *
	 * @return	array	If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
	 */
	public function step1()
	{
		

		return TRUE;
	}
	
	// You can create as many additional methods (step2, step3, etc.) as is necessary.
	// Each step will be executed in a new HTTP request
}]]></version><version long="10010" human="1.1.0"><![CDATA[//<?php


/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * 1.1.0 Upgrade Code
 */
class ips_plugins_setup_upg_10010
{
	/**
	 * ...
	 *
	 * @return	array	If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
	 */
	public function step1()
	{
		

		return TRUE;
	}
	
	// You can create as many additional methods (step2, step3, etc.) as is necessary.
	// Each step will be executed in a new HTTP request
}]]></version><version long="10020" human="1.2.0"><![CDATA[//<?php


/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * 1.2.0 Upgrade Code
 */
class ips_plugins_setup_upg_10020
{
	/**
	 * ...
	 *
	 * @return	array	If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
	 */
	public function step1()
	{
		

		return TRUE;
	}
	
	// You can create as many additional methods (step2, step3, etc.) as is necessary.
	// Each step will be executed in a new HTTP request
}]]></version><version long="20000" human="2.0.0"><![CDATA[//<?php


/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * 2.0.0 Upgrade Code
 */
class ips_plugins_setup_upg_20000
{
	/**
	 * ...
	 *
	 * @return	array	If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
	 */
	public function step1()
	{
		

		return TRUE;
	}
	
	// You can create as many additional methods (step2, step3, etc.) as is necessary.
	// Each step will be executed in a new HTTP request
}]]></version><version long="20001" human="2.0.1"><![CDATA[//<?php


/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * 2.0.1 Upgrade Code
 */
class ips_plugins_setup_upg_20001
{
	/**
	 * ...
	 *
	 * @return	array	If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
	 */
	public function step1()
	{
		

		return TRUE;
	}
	
	// You can create as many additional methods (step2, step3, etc.) as is necessary.
	// Each step will be executed in a new HTTP request
}]]></version></versions></plugin>

 

3 answers to this question

Recommended Posts

  • 0
Posted
1 hour ago, shadyfx said:

Eu tot n-am inteles, ne lasi forumu sau o poza macar la ce te referi?

Legandu-ma de ceea ce a spus el "TOPIC STARTER" ar trebuii sa fie un plugin(nu neaparat) care sa evidentieze autorul unui topic. 

Cred ca te poate ajuta mai degraba @dOc MFX el are asa ceva pe o tema a lui. Daca vrea.

  • 0
Posted

Daca nu vrei sa folosesti plugin, adaugi  unde vrei sa apara

{{if $comment->author()->member_id and $item->author()->member_id == $comment->author()->member_id}}
<div class="tstarter"><p>TOPIC STARTER </p></div>
{{endif}}

iar clasei tstarter ii faci ce customizari doresti in css!

WWW.TECTONICPX.COM [ Professional Web Design Services ]

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.