This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://stackoverflow.com/questions/6768793/get-the-full-url-in-php | |
function url_origin($s, $use_forwarded_host=false) | |
{ | |
$ssl = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on') ? true:false; | |
$sp = strtolower($s['SERVER_PROTOCOL']); | |
$protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : ''); | |
$port = $s['SERVER_PORT']; | |
$port = ((!$ssl && $port=='80') || ($ssl && $port=='443')) ? '' : ':'.$port; | |
$host = ($use_forwarded_host && isset($s['HTTP_X_FORWARDED_HOST'])) ? $s['HTTP_X_FORWARDED_HOST'] : (isset($s['HTTP_HOST']) ? $s['HTTP_HOST'] : null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach ($res as $mod) { | |
$db->update('mods', array( | |
'mod_icon' => lgsl_icon_game1($mod['short_name'], $mod['short_name']) | |
), | |
'short_name="' . $mod['short_name'] . '"' | |
); | |
$result = $db->getResult(); | |
print_r($result); | |
// echo '<img src="' . lgsl_icon_game1($mod['short_name'], $mod['short_name']) . '" /> <br/>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Source: http://stackoverflow.com/questions/467336/how-to-use-slidedown-or-show-function-on-a-table-row | |
// SlideUp | |
$('#my_table > tbody > tr.my_row') | |
.find('td') | |
.wrapInner('<div style="display: block;" />') | |
.parent() | |
.find('td > div') | |
.slideUp(700, function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Rcon | |
{ | |
public $host, $port, $pass; | |
private $fp, $challenge_number; | |
public function __construct($host, $pass) | |
{ | |
$_host = explode(":", $host); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rcon connection | |
$rcon = new Rcon("217.106.106.217:27015", "ddfgioijio34234knWEFSDknggd"); | |
if( $rcon->Connect() ) { | |
$result = $rcon->Command("status"); | |
$rcon->Disconnect(); | |
echo $result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (is_category()): | |
$this_category = get_category($cat); | |
endif; | |
?> | |
<?php | |
if($this_category->category_parent): | |
$this_category = wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->category_parent."&echo=0"); | |
else: | |
$this_category = wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID."&echo=0"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// abs path function | |
function url_origin($s, $use_forwarded_host = false){ | |
$ssl = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on') ? true:false; | |
$sp = strtolower($s['SERVER_PROTOCOL']); | |
$protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : ''); | |
$port = $s['SERVER_PORT']; | |
$port = ((!$ssl && $port=='80') || ($ssl && $port=='443')) ? '' : ':'.$port; | |
$host = ($use_forwarded_host && isset($s['HTTP_X_FORWARDED_HOST'])) ? $s['HTTP_X_FORWARDED_HOST'] : (isset($s['HTTP_HOST']) ? $s['HTTP_HOST'] : null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# https://wordpress.org/support/topic/how-to-only-show-the-posts-child-category-inside-the-loop | |
$post_child_cat = array(); | |
foreach( (get_the_category()) as $cats) { | |
$args = array( 'child_of' => $cats->cat_ID ); | |
$categories = get_categories( $args ); | |
if( $categories ) foreach( $categories as $category ) echo '<li><a href="/cat='. $category->cat_ID.'">' . $category->cat_name . '</a></li>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://stackoverflow.com/a/1278557/4897308 | |
$("#tableID").find('tbody') | |
.append($('<tr>') | |
.append($('<td>') | |
.append($('<img>') | |
.attr('src', 'img.png') | |
.text('Image cell') | |
) | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This function is operatin with tables. | |
* It created opens up new form after the row | |
* that is being cliked. It slideToggles each | |
* of the active tr (if required) and removes | |
* name="" attribute if it is required. | |
*/ | |
function createServerAdmin($this) { | |
// Element that is bein clicked | |
var thiz = $this; |
OlderNewer