Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WildcardSearch committed Jun 23, 2019
1 parent d1c696a commit 08ba9c3
Show file tree
Hide file tree
Showing 22 changed files with 4,231 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Smile Menu
## Smile Menu 0.0.1 ALPHA

A plugin for MyBB 1.8.x that adds autocomplete for smilies
Binary file added Upload/admin/styles/default/images/sm/donate.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Upload/admin/styles/default/images/sm/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Upload/admin/styles/default/images/sm/settings.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions Upload/inc/languages/english/admin/sm.lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/*
* Plugin Name: Smile Menu for MyBB 1.8.x
* Copyright 2019 WildcardSearch
* https://www.rantcentralforums.com
*
* this file contains language definitions for Smile Menu (English)
*/

$l['sm'] = 'Smile Menu';
$l['sm_logo'] = 'Smile Menu Logo';

$l['sm_description'] = 'autocomplete for smilies';

// settings
$l['sm_plugin_settings'] = 'Plugin Settings';
$l['sm_plugin_settings_title'] = 'Smile Menu Settings';

$l['sm_settingsgroup_description'] = 'edit plugin options';

$l['sm_max_items_title'] = 'Maximum Items In Popup';
$l['sm_max_items_description'] = 'This setting will limit the size of the popup';

$l['sm_min_width_title'] = 'Minimum Width';
$l['sm_min_width_description'] = 'This setting will provide a minimum width for the popup, in pixels';

$l['sm_full_text_search_title'] = 'Full Text Search?';
$l['sm_full_text_search_description'] = 'YES to match characters in the autocomplete popup anywhere in the tag, NO (default) to search for tags that start with the typed characters';

$l['sm_lock_selection_title'] = 'Lock Selection To Top?';
$l['sm_lock_selection_description'] = 'YES (default) to keep the selected item on top when possible in the autocomplete popup, NO to scroll freely';

$l['sm_minify_js_title'] = 'Minify JavaScript?';
$l['sm_minify_js_desc'] = 'YES (default) to serve client-side scripts minified to increase performance, NO to serve beautiful, commented code ;)';

?>
15 changes: 15 additions & 0 deletions Upload/inc/languages/english/sm.lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/*
* Plugin Name: Smile Menu for MyBB 1.8.x
* Copyright 2019 WildcardSearch
* https://www.rantcentralforums.com
*
* this file contains language definitions for Smile Menu (English)
*/

$l['sm'] = 'Smile Menu';

// autocomplete
$l['sm_autocomplete_instructions'] = 'type a user name';

?>
45 changes: 45 additions & 0 deletions Upload/inc/plugins/sm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/*
* Plugin Name: Smile Menu for MyBB 1.8.x
* Copyright 2019 WildcardSearch
* https://www.rantcentralforums.com
*
* this is the main plugin file
*/

// disallow direct access to this file for security reasons.
if (!defined('IN_MYBB')) {
die('Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.');
}

// checked by other plugin files
define('SMILEMENU_VERSION', '0.0.1');

// register custom class autoloader
spl_autoload_register('smClassAutoLoad');

// load install routines only if in ACP
if (defined('IN_ADMINCP')) {
global $mybb;
if ($mybb->input['module'] == 'config-plugins' ||
$mybb->input['module'] == 'config-settings') {
require_once MYBB_ROOT . 'inc/plugins/sm/install.php';
}
} else {
require_once MYBB_ROOT . 'inc/plugins/sm/forum.php';
}

/**
* class autoloader
*
* @param string the name of the class to load
*/
function smClassAutoLoad($className) {
$path = MYBB_ROOT . "inc/plugins/sm/classes/{$className}.php";

if (file_exists($path)) {
require_once $path;
}
}

?>
37 changes: 37 additions & 0 deletions Upload/inc/plugins/sm/classes/SmileMenuCache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/*
* Plugin Name: Smile Menu for MyBB 1.8.x
* Copyright 2019 WildcardSearch
* https://www.rantcentralforums.com
*
* wrapper to handle our plugin's cache
*/

class SmileMenuCache extends WildcardPluginCache010300
{
/**
* @var string cache key
*/
protected $cacheKey = 'wildcard_plugins';

/**
* @var string cache sub key
*/
protected $subKey = 'sm';

/**
* @return instance of the child class
*/
static public function getInstance()
{
static $instance;

if (!isset($instance)) {
$instance = new SmileMenuCache;
}

return $instance;
}
}

?>
35 changes: 35 additions & 0 deletions Upload/inc/plugins/sm/classes/SmileMenuInstaller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* Plugin Name: Smile Menu for MyBB 1.8.x
* Copyright 2019 WildcardSearch
* https://www.rantcentralforums.com
*
* wrapper to handle our plugin's installation
*/

class SmileMenuInstaller extends WildcardPluginInstaller020001
{
static public function getInstance()
{
static $instance;

if (!isset($instance)) {
$instance = new SmileMenuInstaller();
}

return $instance;
}

/**
* link the installer to our data file
*
* @param string path to the install data
* @return void
*/
public function __construct($path = '')
{
parent::__construct(MYBB_ROOT . 'inc/plugins/sm/install_data.php');
}
}

?>
159 changes: 159 additions & 0 deletions Upload/inc/plugins/sm/classes/WildcardPluginCache010300.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?php
/**
* Wildcard Helper Classes - Plugin Cache
*
* this file defines a wrapper class for the caching functions
*/

abstract class WildcardPluginCache010300 implements WildcardPluginCacheInterface010200
{
/**
* @const version
*/
const VERSION = '1.3';

/**
* @var array cache data
*/
protected $cacheData = array();

/**
* create a new cache wrapper instance
*
* @return void
*/
public function __construct()
{
global $cache;
$this->cacheData = $cache->read($this->cacheKey);
}

/**
* retrieve an individual cache entry
*
* @param string the name of the entry
* @return bool
*/
public function read($key = null)
{
if ($key === null) {
if ($this->subKey) {
return $this->cacheData[$this->subKey];
}
return $this->cacheData;
}

if ($this->subKey &&
isset($this->cacheData[$this->subKey][$key])) {
return $this->cacheData[$this->subKey][$key];
} elseif (isset($this->cacheData[$key])) {
return $this->cacheData[$key];
}
return false;
}

/**
* update the value of a single cache entry
*
* @param string the name of the entry
* @param mixed the value of the entry
* @param bool true to save immediately or
* false (default) to wait till shut down
* @param bool true (default) to update the
* entire cache in the db
* @return void
*/
public function update($key = null, $val, $hard = false)
{
if ($key === null) {
if ($this->subKey) {
$this->cacheData[$this->subKey] = $val;
} else {
$this->cacheData = $val;
}
} else {
if ($this->subKey) {
$this->cacheData[$this->subKey][$key] = $val;
} else {
$this->cacheData[$key] = $val;
}
}
$this->hasChanged($hard);
}

/**
* save the entire cache to the db
*
* @return void
*/
public function save()
{
global $cache;
$cache->update($this->cacheKey, $this->cacheData);
}

/**
* clear the entire cache
*
* @param bool true to clear and save immediately or
* false (default) to wait till shut down
* @return void
*/
public function clear($hard = false)
{
if ($this->subKey) {
$this->cacheData[$this->subKey] = null;
} else {
$this->cacheData = null;
}
$this->hasChanged($hard);
}

/**
* mark the cache as in need of saving if shut
* down functionality is enabled, or save immediately
* if not
*
* @param bool true to clear and save immediately or
* false (default) to wait till shut down
* @return void
*/
protected function hasChanged($hard = false)
{
global $mybb;
if ($hard ||
!$mybb->use_shutdown) {
$this->save();
return;
}

add_shutdown(array($this, 'save'));
}

/**
* get the cached version
*
* @return string|int
*/
public function getVersion()
{
$version = trim($this->read('version'));
if (!$version) {
$version = 0;
}
return $version;
}

/**
* set the cached version
*
* @param string
* @return string|int
*/
public function setVersion($version)
{
$this->update('version', trim($version));
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/*
* Plugin Name: MentionMe for MyBB 1.8.x
* Copyright 2014 WildcardSearch
* http://www.rantcentralforums.com
*
* this file defines an interface for the caching class
*/

interface WildcardPluginCacheInterface010200
{
public function read($key = null);
public function update($key = null, $val, $hard = false);
public function save();
public function clear($hard = false);
public function getVersion();
public function setVersion($version);
}

?>
Loading

0 comments on commit 08ba9c3

Please sign in to comment.