Ejemplo n.º 1
18
 public function getSingleton()
 {
     if (!isset($this->instance)) {
         $this->instance = call_user_func_array([$this, 'getInstance'], func_get_args());
     }
     return $this->instance;
 }
Ejemplo n.º 2
14
 function apply_filters_ref_array($tag, $args)
 {
     global $wp_filter, $merged_filters, $wp_current_filter;
     // Do 'all' actions first
     if (isset($wp_filter['all'])) {
         $wp_current_filter[] = $tag;
         $all_args = func_get_args();
         _wp_call_all_hook($all_args);
     }
     if (!isset($wp_filter[$tag])) {
         if (isset($wp_filter['all'])) {
             array_pop($wp_current_filter);
         }
         return $args[0];
     }
     if (!isset($wp_filter['all'])) {
         $wp_current_filter[] = $tag;
     }
     // Sort
     if (!isset($merged_filters[$tag])) {
         ksort($wp_filter[$tag]);
         $merged_filters[$tag] = true;
     }
     reset($wp_filter[$tag]);
     do {
         foreach ((array) current($wp_filter[$tag]) as $the_) {
             if (!is_null($the_['function'])) {
                 $args[0] = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
             }
         }
     } while (next($wp_filter[$tag]) !== false);
     array_pop($wp_current_filter);
     return $args[0];
 }
Ejemplo n.º 3
9
 public function SendMessage($To, $Key, $Pre = null)
 {
     $Args = func_get_args();
     array_shift($Args);
     $Message = call_user_func_array(array(new Lang($this->LangSection), 'Get'), $Args);
     if ($Message !== false) {
         return $this->SendRawMessage($To, (is_array($Pre) && !empty($Pre[0]) ? $Pre[0] : null) . $Message);
     } else {
         if ($Key === 'message:module::not_loaded') {
             return $this->SendRawMessage($To, 'That module doesn\'t exists. Try !help to see a list of available modules');
         } elseif ($Key === 'message:not_admin') {
             return $this->SendRawMessage($To, 'You need admin rights in order to do that');
         } elseif ($Key === 'message:module::not_enabled') {
             return $this->SendRawMessage($To, 'That module is loaded, but is disabled. Ask the admin about it');
         } elseif ($Key === 'message:internal_error') {
             return $this->SendRawMessage($To, 'Internal error');
         } elseif ($Key === 'message:internal_error:wrong_response_code') {
             return $this->SendRawMessage($To, 'Internal error. The code (' . var_export($Pre, true) . ') returned by the module is wrong');
         } elseif ($Key === 'message:module::load_error') {
             return $this->SendRawMessage($To, 'That module is loaded, but there are some troubles (at reload, json-php not readable/lint). If you are the admin, see the logs!');
         } else {
             array_shift($Args);
             return $this->SendLangError($To, $Key, $Args);
         }
     }
 }
Ejemplo n.º 4
4
 function command_dd()
 {
     $args = func_get_args();
     $options = $this->get_options();
     $dd = kernel::single('dev_docbuilder_dd');
     if (empty($args)) {
         $dd->export();
     } else {
         foreach ($args as $app_id) {
             $dd->export_tables($app_id);
         }
     }
     if ($filename = $options['result-file']) {
         ob_start();
         $dd->output();
         $out = ob_get_contents();
         ob_end_clean();
         if (!is_dir(dirname($filename))) {
             throw new Exception('cannot find the ' . dirname($filename) . 'directory');
         } elseif (is_dir($filename)) {
             throw new Exception('the result-file path is a directory.');
         }
         file_put_contents($options['result-file'], $out);
         echo 'data dictionary doc export success.';
     } else {
         $dd->output();
     }
 }
Ejemplo n.º 5
1
 /**
  * Displays a view
  *
  * @param mixed What page to display
  * @return void
  * @throws NotFoundException When the view file could not be found
  *	or MissingViewException in debug mode.
  */
 public function display()
 {
     $path = func_get_args();
     //debug($path);
     $count = count($path);
     //debug($count);
     if (!$count) {
         return $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     //debug(Inflector::humanize($path[$count - 1]));
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     //debug($this->render(implode('/', $path)));
     //debug($page);
     //debug($subpage);
     //debug($title_for_layout);
     try {
         $this->render(implode('/', $path));
     } catch (MissingViewException $e) {
         if (Configure::read('debug')) {
             throw $e;
         }
         throw new NotFoundException();
     }
 }
Ejemplo n.º 6
0
 /**
  * Returns an instance of the singleton.
  * 
  * Passes args to constructor
  */
 public static final function instance()
 {
     if (null === static::$_instance) {
         static::$_instance = new self(func_get_args());
     }
     return self::$_instance;
 }
Ejemplo n.º 7
0
 /**
  * Set asset url path
  *
  * @param string     $path
  * @param null       $packageName
  * @param null       $version
  * @param bool|false $absolute
  * @param bool|false $ignorePrefix
  *
  * @return string
  */
 public function getUrl($path, $packageName = null, $version = null)
 {
     // Dirty hack to work around strict notices with parent::getUrl
     $absolute = $ignorePrefix = false;
     if (func_num_args() > 3) {
         $args = func_get_args();
         $absolute = $args[3];
         if (isset($args[4])) {
             $ignorePrefix = $args[4];
         }
     }
     // if we have http in the url it is absolute and we can just return it
     if (strpos($path, 'http') === 0) {
         return $path;
     }
     // otherwise build the complete path
     if (!$ignorePrefix) {
         $assetPrefix = $this->getAssetPrefix(strpos($path, '/') !== 0);
         $path = $assetPrefix . $path;
     }
     $url = parent::getUrl($path, $packageName, $version);
     if ($absolute) {
         $url = $this->getBaseUrl() . $url;
     }
     return $url;
 }
Ejemplo n.º 8
0
 /**
  * Translate a phrase
  *
  * @return string
  */
 public function __()
 {
     $args = func_get_args();
     $expr = new Mage_Core_Model_Translate_Expr(array_shift($args), $this->_getRealModuleName());
     array_unshift($args, $expr);
     return AO::app()->getTranslator()->translate($args);
 }
 /**
  * Returns all of the attributes in the collection
  *
  * If an optional mask array is passed, this only
  * returns the keys that match the mask
  *
  * @param array $mask  The parameter mask array
  * @access public
  * @return array
  */
 public function all($mask = null)
 {
     if (null !== $mask) {
         // Support a more "magical" call
         if (!is_array($mask)) {
             $mask = func_get_args();
         }
         /*
          * Remove all of the keys from the attributes
          * that aren't in the passed mask
          */
         $attributes = array_intersect_key($this->attributes, array_flip($mask));
         /*
          * Make sure that each key in the mask has at least a
          * null value, since the user will expect the key to exist
          */
         foreach ($mask as $key) {
             if (!isset($attributes[$key])) {
                 $attributes[$key] = null;
             }
         }
         return $attributes;
     }
     return $this->attributes;
 }
Ejemplo n.º 10
0
 function plugin_fusen_convert()
 {
     $prms = func_get_args();
     if (isset($prms[0]) && $prms[0] === 'spliter' && isset($prms[1])) {
         $id = intval($prms[1]);
         return '<!--NA-->' . $this->conf['spliter'] . $id . '<!--/NA-->';
     }
     $base = '';
     $divclass = 'xpwiki_' . $this->root->mydirname;
     $res = array();
     if ($this->root->render_mode === 'render') {
         return '';
     } else {
         if ($this->root->render_mode === 'block') {
             if (empty($GLOBALS['Xpwiki_' . $this->root->mydirname]['is_read']) || !empty($GLOBALS['Xpwiki_' . $this->root->mydirname]['cache']['fusen']['loaded'])) {
                 return '';
             }
             $res = $this->func->set_current_page($GLOBALS['Xpwiki_' . $this->root->mydirname]['page']);
             $base = 'xpwiki_body';
             $divclass = 'xpwiki_b_' . $this->root->mydirname;
             $this->root->pagecache_min = 0;
         }
     }
     $html = $this->get_html(func_get_args(), $base, $divclass);
     if ($res) {
         $this->func->set_current_page($res['page']);
     }
     return $html;
 }
Ejemplo n.º 11
0
 /**
  * Query database
  *
  * @param   string        $sql          SQL Query
  * @param   array|string  $replacement  Replacement
  * @return  mixed
  */
 public function query()
 {
     $args = func_get_args();
     $sql = array_shift($args);
     // Menerapkan $replacement ke pernyataan $sql
     if (!empty($args)) {
         $sql = vsprintf($sql, $args);
     }
     try {
         // Return 'false' kalo belum ada koneksi
         if (!$this->_db) {
             $this->connect();
         }
         $this->_sql = $sql;
         // Eksekusi SQL Query
         if ($results = $this->_db->query($sql)) {
             if (is_bool($results)) {
                 return $results;
             }
             $this->_results = $results;
             $this->_num_rows = $this->_results->num_rows;
             return $this;
         } else {
             App::error($this->_db->error . '<br>' . $this->_sql);
         }
     } catch (Exception $e) {
         setAlert('error', $e->getMessage());
         return false;
     }
 }
Ejemplo n.º 12
0
 public function process()
 {
     $argList = func_get_args();
     $section = $argList[0];
     $this->_section = $section;
     parent::process();
 }
Ejemplo n.º 13
0
 public function index()
 {
     $this->load->model('printing_model');
     $this->load->model('settings_model');
     $this->load->model('contests_model');
     $arg_list = func_get_args();
     $contest = $this->contests_model->getCurrentContest();
     $points_table_used = $this->contests_model->getPointsUsed();
     if (!$this->contests_model->table_exists($points_table_used) or $this->contests_model->tableEmpty($points_table_used)) {
         redirect("/competitors?redirected_from='site.php'");
     }
     $data['all_input_tables'] = $this->printing_model->allWrittenInputTables($contest);
     $data['all_charters'] = $this->printing_model->allWrittenCharters($contest);
     $data['gcp_status'] = $this->settings_model->getGCPStatus();
     if (!$this->printing_model->printerConfigured()) {
         $data['printer_set_up'] = FALSE;
     }
     if ($this->input->get('class_selection') and $this->input->get('print_function')) {
         $this->load->model('classes_model');
         $data['class_selection']['class_id'] = $this->input->get('class_selection');
         $data['class_selection']['class_name'] = $this->classes_model->getClassName($data['class_selection']['class_id']);
         $data['print_function'] = $this->input->get('print_function');
     }
     if (isset($arg_list[0]['input_tables']['printing']['status']['completed']) && $arg_list[0]['input_tables']['printing']['status']['completed']) {
         $data['input_tables']['printing']['status']['completed'] = $arg_list[0]['input_tables'];
     }
     if (isset($arg_list[0]['error']['uncomplete']) && $arg_list[0]['error']['uncomplete']) {
         $data['error']['uncomplete'] = true;
     }
     $data['main_content'] = 'printing_view.php';
     $this->load->view('/includes/template.php', $data);
 }
Ejemplo n.º 14
0
 /**
  * Default constructor
  * @param value some value
  */
 function __construct()
 {
     $args = func_get_args();
     if (func_num_args() == 1) {
         $this->init($args[0]);
     }
 }
Ejemplo n.º 15
0
 /**
  * Save RGB value into the classes.
  *
  * There are 4 way to associate color with this classes :
  *  1. Gives 3 parameters int (R, G, B)
  *  2. Gives 1 parameter string hex value (#ff0000) (preceding with #)
  *  3. Gives 1 parameter int hex value (0xff0000)
  *  4. Gives 1 parameter string color code (white, black, orange...)
  *
  * @param mixed ...
  */
 public function __construct()
 {
     $args = func_get_args();
     $c = count($args);
     if ($c === 3) {
         $this->r = intval($args[0]);
         $this->g = intval($args[1]);
         $this->b = intval($args[2]);
     } elseif ($c === 1) {
         if (is_string($args[0]) && strlen($args[0]) === 7 && $args[0][0] === '#') {
             // Hex Value in String
             $this->r = intval(substr($args[0], 1, 2), 16);
             $this->g = intval(substr($args[0], 3, 2), 16);
             $this->b = intval(substr($args[0], 5, 2), 16);
         } else {
             if (is_string($args[0])) {
                 $args[0] = self::getColor($args[0]);
             }
             $args[0] = intval($args[0]);
             $this->r = ($args[0] & 0xff0000) >> 16;
             $this->g = ($args[0] & 0xff00) >> 8;
             $this->b = $args[0] & 0xff;
         }
     } else {
         $this->r = $this->g = $this->b = 0;
     }
 }
Ejemplo n.º 16
0
 /**
  * @dataProvider providerCodePage
  */
 public function testCodePageNumberToName()
 {
     $args = func_get_args();
     $expectedResult = array_pop($args);
     $result = call_user_func_array(array('PHPExcel_Shared_CodePage', 'NumberToName'), $args);
     $this->assertEquals($expectedResult, $result);
 }
Ejemplo n.º 17
0
 /**
  * Nette\Diagnostics\Debugger::dump() shortcut.
  * @tracySkipLocation
  */
 function dump($var)
 {
     foreach (func_get_args() as $arg) {
         Debugger::dump($arg);
     }
     return $var;
 }
Ejemplo n.º 18
0
 private function _activeHook($type)
 {
     if (!isset($this->_hooks[$type])) {
         return null;
     }
     $hook =& $this->_hooks[$type];
     global $_G;
     if (!in_array($hook['plugin'], $_G['setting']['plugins']['available'])) {
         return null;
     }
     if (!preg_match("/^[\\w\\_]+\$/i", $hook['plugin']) || !preg_match('/^[\\w\\_\\.]+\\.php$/i', $hook['include'])) {
         return null;
     }
     include_once DISCUZ_ROOT . 'source/plugin/' . $hook['plugin'] . '/' . $hook['include'];
     if (!class_exists($hook['class'], false)) {
         return null;
     }
     if (!isset($this->classes[$hook['class']])) {
         $this->classes[$hook['class']] = new $hook['class']();
     }
     if (!method_exists($this->classes[$hook['class']], $hook['method'])) {
         return null;
     }
     $param = func_get_args();
     array_shift($param);
     return $this->classes[$hook['class']]->{$hook}['method']($param);
 }
 public function getAttributesByKey()
 {
     $_aParams = func_get_args() + array(0 => '');
     $_sKey = $_aParams[0];
     $_bIsMultiple = '' !== $_sKey;
     return $this->getElement($this->aAttributes, $_sKey, array()) + array('type' => 'checkbox', 'id' => $this->aAttributes['id'] . '_' . $_sKey, 'checked' => $this->getElement($this->aAttributes, array('value', $_sKey), null) ? 'checked' : null, 'value' => 1, 'name' => $_bIsMultiple ? "{$this->aAttributes['name']}[{$_sKey}]" : $this->aAttributes['name'], 'data-id' => $this->aAttributes['id']) + $this->aAttributes;
 }
Ejemplo n.º 20
0
 /**
  * Dump & Die
  *
  * @codeCoverageIgnore
  */
 function dd()
 {
     array_map(function ($x) {
         var_dump($x);
     }, func_get_args());
     die;
 }
Ejemplo n.º 21
0
 /**
  * Sets validator options
  *
  * @param  integer|array|Zend_Config $options
  * @return void
  */
 public function __construct($options = array())
 {
     if ($options instanceof Zend_Config) {
         $options = $options->toArray();
     } else {
         if (!is_array($options)) {
             $options = func_get_args();
             $temp['min'] = array_shift($options);
             if (!empty($options)) {
                 $temp['max'] = array_shift($options);
             }
             if (!empty($options)) {
                 $temp['encoding'] = array_shift($options);
             }
             $options = $temp;
         }
     }
     if (!array_key_exists('min', $options)) {
         $options['min'] = 0;
     }
     $this->setMin($options['min']);
     if (array_key_exists('max', $options)) {
         $this->setMax($options['max']);
     }
     if (array_key_exists('encoding', $options)) {
         $this->setEncoding($options['encoding']);
     }
 }
Ejemplo n.º 22
0
 /**
  * {@inheritDoc}
  */
 public function query(Query $query)
 {
     $this->logger->startCall(__FUNCTION__, func_get_args(), array('fetchDepth' => $this->transport->getFetchDepth()));
     $result = $this->transport->query($query);
     $this->logger->stopCall();
     return $result;
 }
Ejemplo n.º 23
0
 /**
  * Benchmarks a function.
  *
  * @access public
  */
 function run()
 {
     $arguments = func_get_args();
     $iterations = array_shift($arguments);
     $function_name = array_shift($arguments);
     if (strstr($function_name, '::')) {
         $function_name = explode('::', $function_name);
         $objectmethod = $function_name[1];
     }
     // If we're calling a method on an object use call_user_func
     if (strstr($function_name, '->')) {
         $function_name = explode('->', $function_name);
         $objectname = $function_name[0];
         global ${$objectname};
         $objectmethod = $function_name[1];
         for ($i = 1; $i <= $iterations; $i++) {
             $this->setMarker('start_' . $i);
             call_user_func_array(array(${$objectname}, $function_name[1]), $arguments);
             $this->setMarker('end_' . $i);
         }
         return 0;
     }
     for ($i = 1; $i <= $iterations; $i++) {
         $this->setMarker('start_' . $i);
         call_user_func_array($function_name, $arguments);
         $this->setMarker('end_' . $i);
     }
 }
Ejemplo n.º 24
0
 /**
  * Gets or sets the inner value
  *
  * @param string $value
  * @return string
  */
 public function value()
 {
     if ($args = func_get_args()) {
         $this->__value = $args[0];
     }
     return $this->__value;
 }
Ejemplo n.º 25
0
function ckBox()
{
    $args = func_get_args();
    foreach ($args as $a) {
        echo "<input type=\"checkbox\" name=\"weather[]\" value=\"{$a}\" />" . ucwords($a) . "<br />\n";
    }
}
Ejemplo n.º 26
0
function TR()
{
    // writes a table row using row_data to fill the td's.
    // nothing else is needed, since colors and fonts will be
    // determined by the style sheet.
    //
    // Optionally a 2nd parameter may be provided, tr_param,
    // which can contain any parameters to the <tr> tag..
    $arg = func_get_args();
    if (count($arg) > 1) {
        list($row_data, $tr_param) = $arg;
    } else {
        $row_data = $arg[0];
        $tr_param = null;
    }
    echo "<tr";
    if ($tr_param) {
        echo " {$tr_param}";
    }
    echo ">\n";
    foreach ($row_data as $td_data) {
        echo "\t<td>{$td_data}</td>\n";
    }
    echo "</tr>\n";
}
Ejemplo n.º 27
0
 /**
  * Constructor
  *
  * @param string|array|Zend_Config $options OPTIONAL
  */
 public function __construct($options = null)
 {
     if ($options instanceof Zend_Config) {
         $options = $options->toArray();
     } elseif (!is_array($options)) {
         $options = func_get_args();
         $temp = array();
         if (!empty($options)) {
             $temp['type'] = array_shift($options);
         }
         if (!empty($options)) {
             $temp['casting'] = array_shift($options);
         }
         if (!empty($options)) {
             $temp['locale'] = array_shift($options);
         }
         $options = $temp;
     }
     if (array_key_exists('type', $options)) {
         $this->setType($options['type']);
     }
     if (array_key_exists('casting', $options)) {
         $this->setCasting($options['casting']);
     }
     if (array_key_exists('locale', $options)) {
         $this->setLocale($options['locale']);
     }
 }
Ejemplo n.º 28
0
/**
 * Add single page action
 * 
 * You can use set of two params where first param is title and second one
 * is URL (the default set) and you can use array of actions as first
 * parram mapped like $title => $url
 *
 * @access public
 * @param string $title
 * @param string $url
 * @return PageAction
 */
function add_page_action()
{
    $args = func_get_args();
    if (!is_array($args) || !count($args)) {
        return;
    }
    // Array of data as first param mapped like $title => $url
    if (is_array(array_var($args, 0))) {
        foreach (array_var($args, 0) as $title => $url) {
            if (!empty($title) && !empty($url)) {
                PageActions::instance()->addAction(new PageAction($title, $url));
            }
            // if
        }
        // foreach
        // Two string params, title and URL
    } else {
        $title = array_var($args, 0);
        $url = array_var($args, 1);
        if (!empty($title) && !empty($url)) {
            PageActions::instance()->addAction(new PageAction($title, $url));
        }
        // if
    }
    // if
}
Ejemplo n.º 29
0
 function plugin_skype_inline()
 {
     $options = $this->conf['options'];
     $args = func_get_args();
     $alias = array_pop($args);
     $this->fetch_options($options, $args, array('id'));
     if (!$options['id']) {
         return FALSE;
     } else {
         $id = $this->func->htmlspecialchars($options['id']);
     }
     if (!$alias) {
         $alias = $id;
     }
     foreach ($this->conf['modes'] as $mode) {
         if (!empty($options[$mode])) {
             break;
         }
     }
     if ($options['status']) {
         foreach ($this->conf['statuses'] as $status) {
             if ($options['status'] === $status) {
                 break;
             }
         }
     } else {
         $status = '';
     }
     $image = '';
     if ($status) {
         $image = '<img src="http://mystatus.skype.com/' . $status . '/' . $id . '" />';
     }
     $link = 'skype:' . $id . '?' . $mode;
     return str_replace(array('$image', '$link', '$alias'), array($image, $link, $alias), $this->conf['format']);
 }
Ejemplo n.º 30
0
 /**
  * execute query - show be regarded as private to insulate the rest of
  * the application from sql differences
  * @access private
  */
 function query($sql)
 {
     global $CONF;
     if (is_null($this->dblink)) {
         $this->_connect();
     }
     //been passed more parameters? do some smart replacement
     if (func_num_args() > 1) {
         //query contains ? placeholders, but it's possible the
         //replacement string have ? in too, so we replace them in
         //our sql with something more unique
         $q = md5(uniqid(rand(), true));
         $sql = str_replace('?', $q, $sql);
         $args = func_get_args();
         for ($i = 1; $i <= count($args); $i++) {
             $sql = preg_replace("/{$q}/", "'" . preg_quote(mysql_real_escape_string($args[$i])) . "'", $sql, 1);
         }
         //we shouldn't have any $q left, but it will help debugging if we change them back!
         $sql = str_replace($q, '?', $sql);
     }
     $this->dbresult = mysql_query($sql, $this->dblink);
     if (!$this->dbresult) {
         die("Query failure: " . mysql_error() . "<br />{$sql}");
     }
     return $this->dbresult;
 }