本文整理汇总了PHP中do_command_help函数的典型用法代码示例。如果您正苦于以下问题:PHP do_command_help函数的具体用法?PHP do_command_help怎么用?PHP do_command_help使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_command_help函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('find_codes', array('h'), array(true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'find_codes'));
}
$path = get_custom_file_base() . '/sources/';
$files = array();
if (is_dir($path)) {
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..') {
if (!is_dir($path . $file)) {
$contents = file_get_contents($path . $file, FILE_TEXT);
if (strpos($contents, $parameters[0]) !== false) {
$files[] = $path . $file;
}
}
unset($contents);
// Got to be careful with that memory :-(
}
}
return array('', do_template('OCCLE_FIND_CODES', array('_GUID' => '3374d1a80727aecc271722f2184743d0', 'FILES' => $files)), '', '');
} else {
return array('', '', '', do_lang('INCOMPLETE_ERROR'));
}
// Directory doesn't exist
}
}
示例2: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param object A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('rmdir', array('h', 'f'), array(true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'rmdir'));
} else {
$parameters[0] = $occle_fs->_pwd_to_array($parameters[0]);
}
if (!$occle_fs->_is_dir($parameters[0])) {
return array('', '', '', do_lang('NOT_A_DIR', '1'));
}
if (!array_key_exists('f', $options)) {
$listing = $occle_fs->listing($parameters[0]);
if (count($listing[0]) != 0 || count($listing[1]) != 0) {
return array('', '', '', do_lang('NOT_EMPTY_FORCE', '1'));
}
}
$success = $occle_fs->remove_directory($parameters[0]);
if ($success) {
return array('', '', do_lang('SUCCESS'), '');
} else {
return array('', '', '', do_lang('INCOMPLETE_ERROR'));
}
}
}
示例3: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param object A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('rm', array('h'), array(true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'rm'));
}
$success = true;
foreach ($parameters as $i => $param) {
$param = $occle_fs->_pwd_to_array($param);
if (!$occle_fs->_is_file($param)) {
$success = false;
if ($i == 0 && count($parameters) == 1) {
return array('', '', '', do_lang('NOT_A_FILE', strval($i + 1)));
}
}
$success = $success && $occle_fs->remove_file($param);
}
}
if ($success) {
return array('', '', do_lang('SUCCESS'), '');
} else {
return array('', '', '', do_lang('INCOMPLETE_ERROR'));
}
}
示例4: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('watch_chatroom', array('h', 'u'), array(true)), '', '');
} else {
require_code('chat');
if (array_key_exists('u', $options) || array_key_exists('unwatch', $options)) {
delete_value('occle_watched_chatroom');
$_chatroom = do_lang('SUCCESS');
} elseif (array_key_exists(0, $parameters)) {
if (is_numeric($parameters[0])) {
$chatroom = $parameters[0];
} else {
$chatroom = get_chatroom_id($parameters[0]);
}
if (is_null($chatroom)) {
return array('', '', '', do_lang('MISSING_RESOURCE'));
}
set_value('occle_watched_chatroom', $chatroom);
$_chatroom = get_chatroom_name($chatroom);
} else {
$_chatroom = get_chatroom_name(intval(get_value('occle_watched_chatroom')), true);
if (is_null($_chatroom)) {
return array('', '', '', do_lang('MISSING_RESOURCE'));
}
}
return array('', '', $_chatroom, '');
}
}
示例5: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param object A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('grep', array('h'), array(true, true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'grep'));
}
if (!array_key_exists(1, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '2', 'grep'));
} else {
$parameters[1] = $occle_fs->_pwd_to_array($parameters[1]);
}
if (!$occle_fs->_is_file($parameters[1])) {
return array('', '', '', do_lang('NOT_A_FILE', '2'));
}
$_lines = unixify_line_format($occle_fs->read_file($parameters[1]));
$lines = explode("\n", $_lines);
if ($parameters[0] == '' || $parameters[0][0] != '#' && $parameters[0][0] != '/') {
$parameters[0] = '#' . $parameters[0] . '#';
}
$matches = preg_grep($parameters[0], $lines);
$output = '';
foreach ($matches as $value) {
$output .= $value . "\n";
}
return array('', '', $output, '');
}
}
示例6: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('send_chatmessage', array('h'), array(true, true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'send_chatmessage'));
}
if (!array_key_exists(1, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '2', 'send_chatmessage'));
}
require_code('chat');
if (is_numeric($parameters[0])) {
$chatroom = $parameters[0];
} elseif ($parameters[0] == 'first-watched') {
$_chatroom = get_value('occle_watched_chatroom');
$chatroom = is_null($_chatroom) ? $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'id', NULL, 'ORDER BY id') : intval($_chatroom);
} else {
$chatroom = get_chatroom_id($parameters[0]);
}
if (is_null($chatroom)) {
return array('', '', '', do_lang('MISSING_RESOURCE'));
}
chat_post_message($chatroom, $parameters[1], get_option('chat_default_post_font'), get_option('chat_default_post_colour'));
return array('', '', do_lang('SUCCESS'), '');
}
}
示例7: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param object A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('cat', array('h'), array('l')), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'cat'));
}
$line_numbers = array_key_exists('l', $options);
$output = '';
for ($i = 0; $i < count($parameters); $i++) {
$parameters[$i] = $occle_fs->_pwd_to_array($parameters[$i]);
if (!$occle_fs->_is_file($parameters[$i])) {
return array('', '', '', do_lang('NOT_A_FILE', integer_format($i + 1)));
}
$lines = explode(chr(10), $occle_fs->read_file($parameters[$i]));
foreach ($lines as $j => $line) {
if ($line_numbers) {
$output .= str_pad(strval($j + 1), strlen(strval(count($lines)))) . ' ';
}
$output .= $line . chr(10);
}
}
return array('', '', $output, '');
}
}
示例8: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return ~array Array of stdcommand, stdhtml, stdout, and stderr responses (false: error)
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('ban_member', array('h', 'u'), array(true, true)), '', '');
} else {
if (get_forum_type() != 'ocf') {
return array('', '', '', do_lang('NO_OCF'));
}
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'ban_member'));
}
require_code('ocf_members_action');
require_code('ocf_members_action2');
require_lang('ocf');
if (is_numeric($parameters[0])) {
$member_id = $parameters[0];
} else {
$member_id = $GLOBALS['FORUM_DRIVER']->get_member_from_username($parameters[0]);
}
if (is_null($member_id)) {
return array('', '', '', do_lang('USER_NO_EXIST'));
}
if (array_key_exists('u', $options) || array_key_exists('unban', $options)) {
ocf_unban_member($member_id);
} else {
ocf_ban_member($member_id);
}
return array('', '', do_lang('SUCCESS'), '');
}
}
示例9: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param object A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('find', array('h', 'p', 'r', 'f', 'd'), array(true, true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'find'));
}
if (!(array_key_exists('d', $options) || array_key_exists('directories', $options))) {
$directories = false;
} elseif (array_key_exists('d', $options)) {
$directories = $options['d'] == '1';
} else {
$directories = $options['directories'] == '1';
}
if (!(array_key_exists('f', $options) || array_key_exists('files', $options))) {
$files = true;
} elseif (array_key_exists('f', $options)) {
$files = $options['f'] == '1';
} else {
$files = $options['files'] == '1';
}
if (!array_key_exists(1, $parameters)) {
$parameters[1] = $occle_fs->print_working_directory(true);
} else {
$parameters[1] = $occle_fs->_pwd_to_array($parameters[1]);
}
if (!$occle_fs->_is_dir($parameters[1])) {
return array('', '', '', do_lang('NOT_A_DIR', '2'));
}
$listing = $occle_fs->search($parameters[0], array_key_exists('p', $options) || array_key_exists('preg', $options), array_key_exists('r', $options) || array_key_exists('recursive', $options), $files, $directories, $parameters[1]);
return array('', do_template('OCCLE_LS', array('DIRECTORY' => $occle_fs->_pwd_to_string($parameters[1]), 'DIRECTORIES' => $listing[0], 'FILES' => $listing[1])), '', '');
}
}
示例10: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param object A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('mv', array('h'), array(true, true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'mv'));
} else {
$parameters[0] = $occle_fs->_pwd_to_array($parameters[0]);
}
if (!array_key_exists(1, $parameters)) {
$parameters[1] = $occle_fs->print_working_directory(true);
} else {
$parameters[1] = $occle_fs->_pwd_to_array($parameters[1]);
}
if (!$occle_fs->_is_file($parameters[0])) {
return array('', '', '', do_lang('NOT_A_FILE', '1'));
}
if (!$occle_fs->_is_dir($parameters[1])) {
return array('', '', '', do_lang('NOT_A_DIR', '2'));
}
$success = $occle_fs->move_file($parameters[0], $parameters[1]);
if ($success) {
return array('', '', do_lang('SUCCESS'), '');
} else {
return array('', '', '', do_lang('INCOMPLETE_ERROR'));
}
}
}
示例11: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param object A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('pwd', array('h'), array()), '', '');
} else {
return array('', '', $occle_fs->print_working_directory(), '');
}
}
示例12: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('date', array('h'), array()), '', '');
} else {
return array('', '', get_timezoned_date(time(), true, true), '');
}
}
示例13: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('bsod', array('h'), array()), '', '');
} else {
return array('bsod();', '', '', '(A(*$&(*!$*$!£@$!£*$NO CARRIER');
}
}
示例14: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('clear', array('h'), array()), '', '');
} else {
return array('clear_cl();', '', do_lang('SUCCESS'), '');
}
}
示例15: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('exit', array('h'), array()), '', '');
} else {
return array('if (document.getElementById(\'occle_box\')) load_occle(); else window.location.href=\'' . xmlentities(addslashes(static_evaluate_tempcode(build_url(array('page' => ''), '')))) . '\';', '', do_lang('SUCCESS'), '');
}
}