kopia lustrzana https://github.com/friendica/friendica
rework autocomplete: polishing class and methods naming
rodzic
2bd60075ae
commit
0e531e148e
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file include/dir_fns.php
|
||||
* @file include/dir.php
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief This class handels directory related functions
|
||||
*/
|
||||
class dir {
|
||||
class DirSearch {
|
||||
|
||||
/**
|
||||
* @brief Search global contact table by nick or name
|
|
@ -8,7 +8,7 @@
|
|||
* This class contains functions to handle smiles
|
||||
*/
|
||||
|
||||
class smilies {
|
||||
class Smilies {
|
||||
|
||||
/**
|
||||
* @brief Function to list all smilies
|
||||
|
@ -21,7 +21,7 @@ class smilies {
|
|||
*
|
||||
* @hook smilie ('texts' => smilies texts array, 'icons' => smilies html array)
|
||||
*/
|
||||
public static function list_smilies() {
|
||||
public static function get_list() {
|
||||
|
||||
$texts = array(
|
||||
'<3',
|
||||
|
@ -128,10 +128,10 @@ class smilies {
|
|||
|| (local_user() && intval(get_pconfig(local_user(),'system','no_smilies'))))
|
||||
return $s;
|
||||
|
||||
$s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','self::smile_encode',$s);
|
||||
$s = preg_replace_callback('/<code>(.*?)<\/code>/ism','self::smile_encode',$s);
|
||||
$s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','self::encode',$s);
|
||||
$s = preg_replace_callback('/<code>(.*?)<\/code>/ism','self::encode',$s);
|
||||
|
||||
$params = self::list_smilies();
|
||||
$params = self::get_list();
|
||||
$params['string'] = $s;
|
||||
|
||||
if($sample) {
|
||||
|
@ -145,17 +145,17 @@ class smilies {
|
|||
$s = str_replace($params['texts'],$params['icons'],$params['string']);
|
||||
}
|
||||
|
||||
$s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','self::smile_decode',$s);
|
||||
$s = preg_replace_callback('/<code>(.*?)<\/code>/ism','self::smile_decode',$s);
|
||||
$s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','self::decode',$s);
|
||||
$s = preg_replace_callback('/<code>(.*?)<\/code>/ism','self::decode',$s);
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
private function smile_encode($m) {
|
||||
private function encode($m) {
|
||||
return(str_replace($m[1],base64url_encode($m[1]),$m[0]));
|
||||
}
|
||||
|
||||
private function smile_decode($m) {
|
||||
private function decode($m) {
|
||||
return(str_replace($m[1],base64url_decode($m[1]),$m[0]));
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
require_once("include/contact_selectors.php");
|
||||
require_once("include/contact_widgets.php");
|
||||
require_once("include/dir_fns.php");
|
||||
require_once("include/DirSearch.php");
|
||||
require_once("include/features.php");
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
|
@ -687,7 +687,7 @@ function navbar_complete(&$a) {
|
|||
$search = substr($search,1);
|
||||
|
||||
if($localsearch) {
|
||||
$x = dir::global_search_by_name($search, $mode);
|
||||
$x = DirSearch::global_search_by_name($search, $mode);
|
||||
return $x;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require_once("include/template_processor.php");
|
||||
require_once("include/friendica_smarty.php");
|
||||
require_once("include/smilies.php");
|
||||
require_once("include/Smilies.php");
|
||||
require_once("include/map.php");
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
|
@ -1396,7 +1396,7 @@ function prepare_text($text) {
|
|||
if(stristr($text,'[nosmile]'))
|
||||
$s = bbcode($text);
|
||||
else
|
||||
$s = smilies::replace(bbcode($text));
|
||||
$s = Smilies::replace(bbcode($text));
|
||||
|
||||
return trim($s);
|
||||
}}
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
* @file mod/smilies.php
|
||||
*/
|
||||
|
||||
require_once("include/smilies.php");
|
||||
require_once("include/Smilies.php");
|
||||
|
||||
function smilies_content(&$a) {
|
||||
if ($a->argv[1]==="json"){
|
||||
$tmp = smilies::list_smilies();
|
||||
$tmp = Smilies::get_list();
|
||||
$results = array();
|
||||
for($i = 0; $i < count($tmp['texts']); $i++) {
|
||||
$results[] = array('text' => $tmp['texts'][$i], 'icon' => $tmp['icons'][$i]);
|
||||
|
|
Ładowanie…
Reference in New Issue