/** * Destroy the specific tag by ID. * * @param mixed $id The ID. * * @access public * * @return mixed Value. */ public function delete_destroy($id) { $tag = Slendertag::find($id); if ($tag !== null) { $tag->delete(); } else { return; } }
/** * Handle various tag types. * * @param mixed $type The type. * @param mixed $name The name. * @param string $desc The description. * @param mixed $global Show this tag regardless of what page it was created on. * * @access private * @static * * @return mixed Value. */ private static function handlr($type, $name, $desc, $global) { // Get the current page. $page = URL::current(); // Attempt to grab the tag if it exists. if ($global === false) { $tag = Slendertag::where_name($name)->where_page($page)->first(); } else { $tag = Slendertag::where_name($name)->first(); } // If tag does not exist, create a new one. if ($tag === null) { $tag = new Slendertag(); $tag->type = $type; $tag->name = $name; $tag->page = $page; $tag->description = $desc === '' ? 'No Description.' : $desc; $tag->save(); } // Update the description if it has changed. if ($desc !== '' && $tag->description !== $desc) { $tag->description = $desc; $tag->save(); } // Display the associated content if the tag is enabled. if ($tag->enabled === 1) { call_user_func('static::' . $tag->type . '_handlr', $tag->contents, $tag->alt); } }