/** * Currency switcher * * @access public * @return void|bool|string */ public static function currencies($atts) { $atts = shortcode_atts(array(), $atts, 'realia_currencies'); if (!current_theme_supports('realia-currencies')) { return; } $currencies = get_theme_mod('realia_currencies'); if ($currencies == false) { $currencies = array(array('symbol' => '$', 'code' => 'USD', 'show_after' => false, 'money_decimals' => 2, 'money_dec_point' => '.', 'money_thousands_separator' => ',')); } elseif (!is_array($currencies)) { return false; } array_splice($currencies, get_theme_mod('realia_currencies_other', 0) + 1); $result = ''; if (!empty($currencies) && is_array($currencies)) { ksort($currencies); $currency_code = Realia_Currencies::get_current_currency_code(); $result = ''; ob_start(); include Realia_Template_Loader::locate('misc/currencies'); $result = ob_get_contents(); ob_end_clean(); } return $result; }
/** * Removes the '..' and '.' segments from the path component * * @param string Path component of the URL, possibly with '.' and '..' segments * @return string Path component of the URL with '.' and '..' segments removed * @access private */ function _normalizePath($path) { $pathAry = explode('/', $path); $i = 1; do { if ('.' == $pathAry[$i]) { if ($i < count($pathAry) - 1) { array_splice($pathAry, $i, 1); } else { $pathAry[$i] = ''; $i++; } } elseif ('..' == $pathAry[$i] && $i > 1 && '..' != $pathAry[$i - 1]) { if ($i < count($pathAry) -1) { array_splice($pathAry, $i - 1, 2); $i--; } else { array_splice($pathAry, $i - 1, 2, ''); } } else { $i++; } } while ($i < count($pathAry)); return implode('/', $pathAry); }
function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { // $repeated = parent::get_per_answer_fields($mform, $label, $gradeoptions, $repeatedoptions, $answersoption); $repeated = array(); $repeated[] =& $mform->createElement('header', 'answerhdr', $label); // if ($this->editasmultichoice == 1){ $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 50)); $repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions); $repeated[] =& $mform->createElement('editor', 'feedback', get_string('feedback', 'quiz'), null, $this->editoroptions); $repeatedoptions['answer']['type'] = PARAM_RAW; $repeatedoptions['fraction']['default'] = 0; $answersoption = 'answers'; $mform->setType('answer', PARAM_NOTAGS); $addrepeated = array(); $addrepeated[] =& $mform->createElement('hidden', 'tolerance'); $addrepeated[] =& $mform->createElement('hidden', 'tolerancetype', 1); $repeatedoptions['tolerance']['type'] = PARAM_NUMBER; $repeatedoptions['tolerance']['default'] = 0.01; $addrepeated[] =& $mform->createElement('select', 'correctanswerlength', get_string('correctanswershows', 'qtype_calculated'), range(0, 9)); $repeatedoptions['correctanswerlength']['default'] = 2; $answerlengthformats = array('1' => get_string('decimalformat', 'quiz'), '2' => get_string('significantfiguresformat', 'quiz')); $addrepeated[] =& $mform->createElement('select', 'correctanswerformat', get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats); array_splice($repeated, 3, 0, $addrepeated); $repeated[1]->setLabel('...<strong>{={x}+..}</strong>...'); return $repeated; }
public function validate($aIP, $config, $context) { if (!$this->ip4) { $this->_loadRegex(); } $original = $aIP; $hex = '[0-9a-fA-F]'; $blk = '(?:' . $hex . '{1,4})'; $pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))'; // /0 - /128 // prefix check if (strpos($aIP, '/') !== false) { if (preg_match('#' . $pre . '$#s', $aIP, $find)) { $aIP = substr($aIP, 0, 0 - strlen($find[0])); unset($find); } else { return false; } } // IPv4-compatiblity check if (preg_match('#(?<=:' . ')' . $this->ip4 . '$#s', $aIP, $find)) { $aIP = substr($aIP, 0, 0 - strlen($find[0])); $ip = explode('.', $find[0]); $ip = array_map('dechex', $ip); $aIP .= $ip[0] . $ip[1] . ':' . $ip[2] . $ip[3]; unset($find, $ip); } // compression check $aIP = explode('::', $aIP); $c = count($aIP); if ($c > 2) { return false; } elseif ($c == 2) { list($first, $second) = $aIP; $first = explode(':', $first); $second = explode(':', $second); if (count($first) + count($second) > 8) { return false; } while (count($first) < 8) { array_push($first, '0'); } array_splice($first, 8 - count($second), 8, $second); $aIP = $first; unset($first, $second); } else { $aIP = explode(':', $aIP[0]); } $c = count($aIP); if ($c != 8) { return false; } // All the pieces should be 16-bit hex strings. Are they? foreach ($aIP as $piece) { if (!preg_match('#^[0-9a-fA-F]{4}$#s', sprintf('%04s', $piece))) { return false; } } return $original; }
public function build($data) { list($team, $year) = $data; $redirect = path('player_attach_ncaa_ids', array('slug' => $team->getSlug())); $this->setPlayerNcaaIdsForTeam($team, $year); $form = $this->form = $this->CI->form->open(path('player_attach_ncaa_ids_for_year', array('slug' => $team->getSlug(), 'year' => $year)), null, 'class="form-horizontal"'); $globalError = false; foreach ($team->getPlayers($year) as $player) { $class = ''; if (count($player->getAllNcaaIds())) { foreach ($player->getAllNcaaIds() as $ncaaId) { if (in_array($ncaaId, array_splice(array_keys($this->players), 1))) { $class = 'success'; } } if (!$class) { $class = 'error'; $globalError = true; } } else { $class = ''; if (!$this->matchNameInArray($player)) { $globalError = true; } } $form->html(sprintf('<div class="control-group %s form-inline"><label class="control-label">%s, %s</label>', $class, $player->getLastName(), $player->getFirstName()))->select(sprintf('player[%s]', $player->getId()), $this->players, null, $this->matchNameInArray($player), null, 'class="span8"')->html('</div>'); } $form->html('<div class="form-actions">')->submit('Save Changes', 'submit', 'class="btn btn-primary"')->html('</div>')->model('document', 'validate', 'team/edit')->onsuccess('redirect', $redirect); if (!$globalError) { $this->save($form, $data, $redirect); } return $form; }
public function handle_api_requests() { WPI_Log::get_instance()->log('wpi api request : ' . 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); global $wp; if (isset($_GET['wpi-api'])) { $wp->query_vars['wpi-api'] = $_GET['wpi-api']; } if (isset($wp->query_vars['wpi-api'])) { $this->server = new WPI_Server(); $n = strpos($wp->query_vars['wpi-api'], '/'); if (!empty($n)) { $qs = explode('/', $wp->query_vars['wpi-api']); $api = $qs[0]; $method = $qs[1]; if (file_exists(WPI_DIR . '/api/class-wpi-' . $api . ".php")) { include_once WPI_DIR . '/api/class-wpi-' . $api . ".php"; $args = array_splice($qs, 2, 2); call_user_func_array(array($api, $method), $args); } else { $this->server->response_failure('api not found !'); } } else { $api = $wp->query_vars['wpi-api']; if (file_exists(WPI_DIR . '/api/class-wpi-' . $api . '.php')) { include_once WPI_DIR . '/api/class-wpi-' . $api . '.php'; } else { $this->server->response_failure('api not found !'); } } WPI_Log::get_instance()->close(); die; } }
public function handleRequest($request) { if (empty($this->catchAll)) { list($route, $params) = $request->resolve(); } else { $route = $this->catchAll[0]; $params = array_splice($this->catchAll, 1); } try { LuLu::trace("Route requested: '{$route}'", __METHOD__); $this->requestedRoute = $route; $actionsResult = $this->runAction($route, $params); $result = $actionsResult instanceof ActionResult ? $actionsResult->result : $actionsResult; if ($result instanceof \yii\web\Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result; } return $response; } } catch (InvalidRouteException $e) { throw new NotFoundHttpException(Yii::t('yii', 'Page not found.'), $e->getCode(), $e); } }
/** * Dequeues one or several values from the beginning of the Queue * * When called without argument, returns a single value, else returns an array. * If there is not anough elements in the queue, all the elements are returned * without raising any error. * * @param int $quantity * * @return mixed */ public function dequeue($quantity = 1) { if (!func_num_args()) { return array_pop($this->elements); } return array_splice($this->elements, max(0, count($this->elements) - $quantity), $quantity, []); }
function get_files($dir) { static $extension = null; if (!$extension) { $extension = pathinfo(__FILE__, PATHINFO_EXTENSION); } $files = array(); if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (substr($file, 0, 1) != '.') { $files[] = "{$dir}/{$file}"; } } closedir($dh); usort($files, array(&$this, 'sort_files')); foreach ($files as $file) { if (is_dir($file)) { array_splice($files, array_search($file, $files), 0, $this->get_files($file)); } if (pathinfo($file, PATHINFO_EXTENSION) != $extension) { unset($files[array_search($file, $files)]); } } } return $files; }
/** * Function will calculate the top publisher results * from the performance table * @return Array of Top Earners */ public static function topEarners($users, $dateQuery = [], $count = 10) { $pubClicks = []; $result = []; foreach ($users as $u) { $perf = \Performance::calculate($u, $dateQuery); $clicks = $perf['clicks']; if ($clicks === 0) { continue; } if (!array_key_exists($clicks, $pubClicks)) { $pubClicks[$clicks] = []; } $pubClicks[$clicks][] = AM::toObject(['name' => $u->name, 'clicks' => $clicks]); } if (count($pubClicks) === 0) { return $result; } krsort($pubClicks); array_splice($pubClicks, $count); $i = 0; foreach ($pubClicks as $key => $value) { foreach ($value as $u) { $result[] = $u; $i++; if ($i >= $count) { break 2; } } } return $result; }
/** * Main function, adding the item to input menuItems array * * @param ClickMenu $backRef References to parent clickmenu objects. * @param array $menuItems Array of existing menu items accumulated. New element added to this. * @param string $table Table name of the element * @param int $uid Record UID of the element * @return array Modified menuItems array */ public function main(&$backRef, $menuItems, $table, $uid) { $localItems = array(); if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) { // Returns directly, because the clicked item was not from the pages table if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { return $menuItems; } // Adds the regular item $LL = $this->includeLL(); // "Versioning" element added: $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid)); $localItems[] = $backRef->linkItem($GLOBALS['LANG']->getLLL('title', $LL), $backRef->excludeIcon($this->iconFactory->getIcon('actions-version-open', Icon::SIZE_SMALL)->render()), $backRef->urlRefForCM($url), true); // Find position of "delete" element: $c = 0; foreach ($menuItems as $k => $value) { $c++; if ($k === 'delete') { break; } } // .. subtract two (delete item + divider line) $c -= 2; // ... and insert the items just before the delete element. array_splice($menuItems, $c, 0, $localItems); } return $menuItems; }
public static function schedulingTasksFroMinTimeRang(array $tasks, $minTimeRange, $maxInterval) { $count = count($tasks); if ($maxInterval * $count > $minTimeRange) { $repeat = 0; do { $repeat++; $maxInterval = $repeat * $minTimeRange / $count; $maxInterval = floor($maxInterval); } while ($maxInterval < 1); } $times = []; $lastTime = 0; do { $times[] = $lastTime; $lastTime += $maxInterval; } while ($lastTime < $minTimeRange); $timesCount = count($times); $repeat = $count / $timesCount; $repeat = floor($repeat); $rest = $count - $timesCount * $repeat; $scheduledData = []; foreach ($times as $index => $time) { $itemRepeat = $repeat; if ($rest >= $index + 1) { $itemRepeat++; } $scheduledData[$time] = array_splice($tasks, 0, $itemRepeat); if (empty($tasks)) { break; } } return $scheduledData; }
/** * Load the RSS feed and items before the block is rendered * */ protected function _beforeToHtml() { parent::_beforeToHtml(); $this->setFeedReady(false); if ($this->getFeedUrl() !== false) { if (($feed = $this->_getRssFeed($this->getFeedUrl())) !== false) { $this->setFeedTitle($feed->getTitle()); $this->setFeedLink($feed->getLink()); $this->setFeedDescription($feed->getDescription()); $buffer = $feed->getItem(); if (count($buffer) > 0) { if (!isset($buffer[0]) && isset($buffer['title'])) { $buffer = array($buffer); } $items = array(); foreach ($buffer as $item) { if (($item = $this->_prepareFeedItem($item)) !== false) { $items[] = $item; $this->setFeedReady(true); } } if (count($items) > $this->getMaxFeedItems()) { $items = array_splice($items, 0, $this->getMaxFeedItems()); } $this->setFeedItems($items); } } } return $this; }
public function replace($content, $replace = '*') { // 计算文本内容长度 $cLength = mb_strlen($content, 'UTF-8'); $words = array(); // 对每个字符进行关键词检查 for ($i = 0; $i < $cLength; $i++) { $words[] = mb_substr($content, $i, 1, 'UTF-8'); } // 对每个字符进行关键词检查 foreach ($words as $i => $word) { // 首字符是否在过滤关键词分类中存在 if (isset($this->classArr[$word])) { // 如果存在则将该分类下的所有关键词遍历,依次对文本内容中与每一个关键词位置长度相对应的字符串进行比较 foreach ($this->classArr[$word] as $v) { // 过滤关键词长度 $filterWordLength = mb_strlen($v, 'UTF-8'); // 获取文本中对应位置,相同长度的字符串 $contentEqPostionWord = mb_substr($content, $i, $filterWordLength, 'UTF-8'); // 对两个字符串进行比较 if ($contentEqPostionWord == $v) { // 如果相同,则将该段字符串替换成相应长度的 * array_splice($words, $i, $filterWordLength, array_fill(0, $filterWordLength, $replace)); } } } } return implode('', $words); }
/** * Add another playlist into the current starting from $offset. Invalid items from $playlist * will be silently filtered out. This method assigns existing items to new offsets * * @param integer $offset * @param Streamwide_Engine_Media_Playlist $playlist * @return void */ public function addPlaylistAt($offset, Streamwide_Engine_Media_Playlist $playlist) { if ($playlist->isEmpty()) { return; } array_splice($this->_collection, $offset, 0, $playlist->toArray()); }
function td_mce_buttons_2($buttons) { //if ( 'content' != $id ) return $buttons; array_splice($buttons, 4, 0, 'backcolor'); array_unshift($buttons, 'styleselect'); return $buttons; }
/** * Remove a value from the collection * @param integer $index index to remove * @throws OutOfRangeException if index is out of range */ public function remove($index) { if ($index >= $this->count()) { throw new OutOfRangeException('Index out of range'); } array_splice($this->_collection, $index, 1); }
function add_column($columns) { $this->prepare_items(); $labels = $this->ctype->get('current', 'labels'); $title = isset($labels->column_title) ? $labels->column_title : $this->ctype->get('current', 'title'); return array_splice($columns, 0, -1) + array($this->column_id => $title) + $columns; }
/** * Save model data. * If model is new PK is null - we generate INSERT SQL request. * If model data already exists in DB, PK > 0 - we generate UPDATE request. * Method return true if model data saved successfully. False if error. */ public function save($validate = true) { if ($validate === true && $this->validate() === false) { return false; } $columns = $this->getClearColumns(); $values = array(); foreach ($columns as $column) { $values[] = $this->{$column}; } $keyPosition = array_search($this->pkColumnName(), $columns); array_splice($columns, $keyPosition, 1); array_splice($values, $keyPosition, 1); if ((int) $this->{$this->pkColumnName()} > 0) { $query = new Query("update"); $query->addTable($this->tableName()); foreach ($columns as $key => $column) { $query->addField($column, $values[$key]); } $query->where->add($this->pkColumnName() . " = " . $this->{$this->pkColumnName()}); $result = $query->exec(); } else { $query = new Query("insert"); $query->addTable($this->tableName()); foreach ($columns as $key => $column) { $query->addField($column, $values[$key]); } $result = $query->exec(); $this->ADDRESSID = $query->last_insert_id(); } return $result; }
/** * @param $path * @return string */ public static function normalize($path) { if (!strlen($path)) { return "."; } $isAbsolute = $path[0]; $trailingSlash = $path[strlen($path) - 1]; $up = 0; $pieces = array_values(array_filter(explode("/", $path), function ($n) { return !!$n; })); for ($i = count($pieces) - 1; $i >= 0; $i--) { $last = $pieces[$i]; if ($last == ".") { array_splice($pieces, $i, 1); } else { if ($last == "..") { array_splice($pieces, $i, 1); $up++; } else { if ($up) { array_splice($pieces, $i, 1); $up--; } } } } $path = implode("/", $pieces); if ($path && $trailingSlash == "/") { $path .= "/"; } return ($isAbsolute == "/" ? "/" : "") . $path; }
/** * Parse REQUEST_URI to extract request parts: {controller}/{action}/{params} * @return array holding: 'controller' (string), 'action' (string) and * 'params' (array of strings). When controller / action is not available, * returns the default controller 'home' / action 'index'. */ function parseRequest() : array { $requestPath = $_SERVER['REQUEST_URI']; // holds /blog/home/index or /home/index if (substr($requestPath, 0, strlen(APP_ROOT . '/')) != APP_ROOT . '/') { die('APP_ROOT is incorrectly defined in config.php. Use "" or "/blog".'); } $requestPath = substr($requestPath, strlen(APP_ROOT)); // remove APP_ROOT prefix $requestParts = explode('/', $requestPath); // Extract the controller from {controller}/{action}/{params} $controller = DEFAULT_CONTROLLER; if (count($requestParts) >= 2 && $requestParts[1] != '') { $controller = $requestParts[1]; } // Extract the action from {controller}/{action}/{params} $action = DEFAULT_ACTION; if (count($requestParts) >= 3 && $requestParts[2] != '') { $action = $requestParts[2]; } // Extract the action parameters from {controller}/{action}/{params} $params = array_splice($requestParts, 3); $requestParsed = ['controller' => $controller, 'action' => $action, 'params' => $params]; return $requestParsed; }
public static function initializerHandlerRegister($callback = null, $add = true) { static $handles = array(); if ($callback) { if (is_callable($callback)) { if ($add) { // add if (!in_array($callback)) { $handles[] = $callback; return true; } } else { // remove $key = array_search($callback, $handles); if (is_int($key)) { array_splice($handles, $key, 1); return true; } } } } else { // get return array_reverse($handles); } return false; }
/** * {@inheritdoc} */ public function getFunctions() { $compiler = function () { throw new LogicException('Compilation not supported.'); }; return [new ExpressionFunction('url', $compiler, function ($arguments, $url) { return $url; }), new ExpressionFunction('link', $compiler, function ($arguments, $selector) { return $arguments['_crawler']->selectLink($selector); }), new ExpressionFunction('button', $compiler, function ($arguments, $selector) { return $arguments['_crawler']->selectButton($selector); }), new ExpressionFunction('status_code', $compiler, function ($arguments) { return $arguments['_response']->getStatusCode(); }), new ExpressionFunction('headers', $compiler, function ($arguments) { $headers = []; foreach ($arguments['_response']->getHeaders() as $key => $value) { $headers[$key] = $value[0]; } return $headers; }), new ExpressionFunction('body', $compiler, function ($arguments) { return (string) $arguments['_response']->getBody(); }), new ExpressionFunction('header', $compiler, function ($arguments, $name) { $name = str_replace('_', '-', strtolower($name)); if (!$arguments['_response']->hasHeader($name)) { return; } return $arguments['_response']->getHeader($name)[0]; }), new ExpressionFunction('scalar', $compiler, function ($arguments, $scalar) { return $scalar; }), new ExpressionFunction('join', $compiler, function ($arguments, $value, $glue) { if ($value instanceof \Traversable) { $value = iterator_to_array($value, false); } return implode($glue, (array) $value); }), new ExpressionFunction('fake', $compiler, function ($arguments, $provider) { $arguments = func_get_args(); return $this->faker->format($provider, array_splice($arguments, 2)); }), new ExpressionFunction('regex', $compiler, function ($arguments, $regex) { $ret = @preg_match($regex, (string) $arguments['_response']->getBody(), $matches); if (false === $ret) { throw new InvalidArgumentException(sprintf('Regex "%s" is not valid: %s.', $regex, error_get_last()['message'])); } return isset($matches[1]) ? $matches[1] : null; }), new ExpressionFunction('css', $compiler, function ($arguments, $selector) { if (null === $arguments['_crawler']) { throw new LogicException(sprintf('Unable to get "%s" CSS selector as the page is not crawlable.', $selector)); } return $arguments['_crawler']->filter($selector); }), new ExpressionFunction('xpath', $compiler, function ($arguments, $selector) { if (null === $arguments['_crawler']) { throw new LogicException(sprintf('Unable to get "%s" XPATH selector as the page is not crawlable.', $selector)); } return $arguments['_crawler']->filterXPath($selector); }), new ExpressionFunction('json', $compiler, function ($arguments, $selector) { if (null === ($data = json_decode((string) $arguments['_response']->getBody(), true))) { throw new LogicException(sprintf(' Unable to get the "%s" JSON path as the Response body does not seem to be JSON.', $selector)); } return JmesPath::search($selector, $data); })]; }
/** * Display the database migration log * * @return void */ public function displayTask() { // Set any errors foreach ($this->getErrors() as $error) { $this->view->setError($error); } $this->view->filters = array(); // Paging $this->view->filters['limit'] = Request::getState($this->_option . '.' . $this->_controller . '.limit', 'limit', Config::get('list_limit'), 'int'); $this->view->filters['start'] = Request::getState($this->_option . '.' . $this->_controller . '.limitstart', 'limitstart', 0, 'int'); $this->view->rows = array(); $this->view->total = 0; $migrations = json_decode(Cli::migration(true, true)); if ($migrations && count($migrations) > 0) { foreach ($migrations as $status => $files) { $files = array_reverse($files); foreach ($files as $entry) { $row = array('entry' => $entry, 'status' => $status); $this->view->rows[] = $row; } } $this->view->total = count($this->view->rows); $this->view->rows = array_splice($this->view->rows, $this->view->filters['start'], $this->view->filters['limit']); } // Output the HTML $this->view->display(); }
/** * add featured image column * @param column $columns set up new column to show featured image for taxonomies/posts/etc. * * @since 2.0.0 */ public function add_column($columns) { $new_columns = $columns; array_splice($new_columns, 1); $new_columns['featured_image'] = __('Featured Image', 'display-featured-image-genesis'); return array_merge($new_columns, $columns); }
public function getDataByIdAction() { // check for lock if (Element\Editlock::isLocked($this->getParam("id"), "document")) { $this->_helper->json(array("editlock" => Element\Editlock::getByElement($this->getParam("id"), "document"))); } Element\Editlock::lock($this->getParam("id"), "document"); $snippet = Document\Snippet::getById($this->getParam("id")); $modificationDate = $snippet->getModificationDate(); $snippet = $this->getLatestVersion($snippet); $snippet->setVersions(array_splice($snippet->getVersions(), 0, 1)); $snippet->getScheduledTasks(); $snippet->idPath = Element\Service::getIdPath($snippet); $snippet->userPermissions = $snippet->getUserPermissions(); $snippet->setLocked($snippet->isLocked()); $snippet->setParent(null); if ($snippet->getContentMasterDocument()) { $snippet->contentMasterDocumentPath = $snippet->getContentMasterDocument()->getRealFullPath(); } $this->minimizeProperties($snippet); // unset useless data $snippet->setElements(null); if ($snippet->isAllowed("view")) { $this->_helper->json($snippet); } $this->_helper->json(false); }
/** * @param Psc\UI\jqx\Tab $tab * @chainable */ public function removeTab(Tab $tab) { if (($key = array_search($tab, $this->tabs, TRUE)) !== FALSE) { array_splice($this->tabs, $key, 1); } return $this; }
/** * Removes installer * * @param InstallerInterface $installer installer instance */ public function removeInstaller(InstallerInterface $installer) { if (false !== ($key = array_search($installer, $this->installers, true))) { array_splice($this->installers, $key, 1); $this->cache = array(); } }
function plugin_preview_action() { global $vars; $page = isset($vars['page']) ? $vars['page'] : ''; $modified = 0; $response = new Response(); if (!empty($page)) { $wiki = Factory::Wiki($page); if ($wiki->isReadable()) { $source = $wiki->get(); array_splice($source, 10); $response->setStatusCode(Response::STATUS_CODE_200); $response->setContent('<' . '?xml version="1.0" encoding="UTF-8"?' . ">\n" . RendererFactory::factory($source)); $headers = Header::getHeaders('text/xml', $wiki->time()); } else { $response->setStatusCode(Response::STATUS_CODE_404); $headers = Header::getHeaders('text/xml'); } } else { $response->setStatusCode(Response::STATUS_CODE_404); $headers = Header::getHeaders('text/xml'); } $response->getHeaders()->addHeaders($headers); header($response->renderStatusLine()); foreach ($response->getHeaders() as $_header) { header($_header->toString()); } echo $response->getBody(); exit; }
public function removeChild(NodeInterface $child) { if ($pos = array_search($child, $this->children)) { $child->setParent(null); array_splice($this->children, $pos, 1); } }