Skip to content

Instantly share code, notes, and snippets.

View Uriel29's full-sized avatar

Uriel dos Santos Souza Uriel29

View GitHub Profile
@Uriel29
Uriel29 / ragexSeblod.php
Created September 12, 2014 17:02
Removendo acentos, convertendo espaços em hífen e convertendo para minúsculos utilizando Regex, strtolower e strtr no seblod.
<?php
$variavel = $cck->getValue('seu_campo');
$variavel_limpa = strtolower( ereg_replace("[^a-zA-Z0-9-]", "-", strtr(utf8_decode(trim($variavel)), utf8_decode("áàãâéêíóôõúüñçÁÀÃÂÉÊÍÓÔÕÚÜÑÇ"),"aaaaeeiooouuncAAAAEEIOOOUUNC-")) );
echo $variavel_limpa;
?>
@Uriel29
Uriel29 / Mainbody.php
Created September 16, 2014 18:25
Botões editar e apagar um dado do Seblod. (campos Icon do seblod)
<?php
// No Direct Access
defined( '_JEXEC' ) or die;
?>
<div>
<a href="<?php echo $cck->getLink('editar'); ?> "> <img src="images/editar.png"/></a>
</div>
<a href="<?php echo $cck->getLink('deletar'); ?> " onclick="if(!confirm('Você tem certeza que quer apagar este item ?')){return false;}"><img src="images/apagar.png"/></a>
@Uriel29
Uriel29 / Add_custom_tags_seblodmainbody.php
Last active August 29, 2015 14:09
Adicionar tags ao content do Seblod. Para redes sociais (facebook) e outros (google)
<?php
$imagefile = $cck->getValue('imagem');//campo de imagem
$descri = substr ($cck->get('descricao')->value ,0,170); //qualquer campo que diga do que se trata o conteúdo
$urlsite = JURI::current(); //pega a URL do artigo current (ao vivo)
$usua2 = $cck->getValue('usuario'); //caso vc tenha algo relacionado ao autor do conteúdo
$doc =& JFactory::getDocument();
$doc->addCustomTag( '<meta property="og:url" content="'.$urlsite.'" />' );
@Uriel29
Uriel29 / like.php
Last active August 29, 2015 14:10
Get likes facebook page PHP
<?php
$url = 'http://graph.facebook.com/oceanoliterario'; //Page link
echo '['.$url.']: '.json_decode(file_get_contents($url))->{'likes'};
?>
//add variable
@Uriel29
Uriel29 / getlikesURL.php
Created November 20, 2014 16:25
Get likes facebook page URL
<?php
function get_fb_likes($url)
{
$query = "select total_count,like_count,comment_count,share_count,click_count from link_stat where url='{$url}'";
$call = "https://api.facebook.com/method/fql.query?query=" . rawurlencode($query) . "&format=json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $call);
@Uriel29
Uriel29 / installlamp.txt
Created March 7, 2015 01:10
Instalar Lamp
sudo apt-get install apache2
sudo apt-get install mysql-client-5.5 mysql-server-5.5 php5-mysql
sudo apt-get install php5 php5-cli php5-dev php5-mcrypt php5-curl php5-gd libapache2-mod-php5
@Uriel29
Uriel29 / Listacoluna.php
Created May 11, 2015 20:36
Listar tudo que tem em uma coluna com PHP.
<?php
$db = JFactory::getDBO();
$query = ( 'SELECT bairro FROM `#__cck_store_form_article` ' );
$db->setQuery($query);
$items = $db->loadObjectList();
@Uriel29
Uriel29 / autocomplete.php
Last active August 29, 2015 14:20
Autocomplete com PHP e Jquery o mais simples que achei.
//chamando o Jquery
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<?php
//php para listar algo do banco isto para Joomla (pode ser usado em qualquer sistema )
@Uriel29
Uriel29 / htaccess.txt
Created June 19, 2015 03:07
htaccess for Joomla in openShifit. Joomla 3.X
##
# @package Joomla
# @copyright Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
# @license GNU General Public License version 2 or later; see LICENSE.txt
##
########## Inicio - RewriteEngine ativado
RewriteEngine On
@Uriel29
Uriel29 / configurationfile.txt
Last active August 29, 2015 14:23
Configuration file Nginx for Joomla!
server {
listen 80;
server_name site.com www.site.com;
server_name_in_redirect off;
access_log /var/log/nginx/localhost.access_log;
error_log /var/log/nginx/localhost.error_log info;
root /usr/share/nginx/html/directory files site;
index index.php index.html index.htm default.html default.htm;