PHP Функция array_values - примеры использования

На этой странице представлены лучшие примеры PHP кода для метода array_values, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Пример #1
Показать файл Файл: SymfonyStyle.php Проект: a53ali/CakePhP
0
 /**
  * Formats a message as a block of text.
  *
  * @param string|array $messages The message to write in the block
  * @param string|null $type The block type (added in [] on first line)
  * @param string|null $style The style to apply to the whole block
  * @param string $prefix The prefix for the block
  * @param bool $padding Whether to add vertical padding
  */
 public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
 {
     $this->autoPrependBlock();
     $messages = is_array($messages) ? array_values($messages) : array($messages);
     $lines = array();
     // add type
     if (null !== $type) {
         $messages[0] = sprintf('[%s] %s', $type, $messages[0]);
     }
     // wrap and add newlines for each element
     foreach ($messages as $key => $message) {
         $message = OutputFormatter::escape($message);
         $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - Helper::strlen($prefix), PHP_EOL, true)));
         if (count($messages) > 1 && $key < count($messages) - 1) {
             $lines[] = '';
         }
     }
     if ($padding && $this->isDecorated()) {
         array_unshift($lines, '');
         $lines[] = '';
     }
     foreach ($lines as &$line) {
         $line = sprintf('%s%s', $prefix, $line);
         $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
         if ($style) {
             $line = sprintf('<%s>%s</>', $style, $line);
         }
     }
     $this->writeln($lines);
     $this->newLine();
 }
Пример #2
Показать файл Файл: ProductController.php Проект: samuelcar/os2woo
0
 /**
  * Display a listing of the resource.
  *
  * @param Store $store
  *
  * @return Response
  */
 public function index(Store $store)
 {
     // ImportedProduct::truncate();
     // ErrorProduct::truncate();
     JavaScript::put(['url' => '/products', 'os_total' => OsProduct::count(), 'imported_total' => ImportedProduct::count(), 'resource' => array_values(array_diff(OsProduct::orderBy('products_id', 'desc')->lists('products_id')->toArray(), ImportedProduct::orderBy('os_id', 'desc')->lists('os_id')->toArray(), ErrorProduct::orderBy('os_id', 'desc')->lists('os_id')->toArray()))]);
     return view('importer.index', ['resource' => 'Products']);
 }
Пример #3
Показать файл Файл: Valid.php Проект: steffomix/isim-beo
0
 /**
  * Checks whether a string is a valid number with optional prefix ~, + or -.
  * Allow only EN . delimiter
  * 
  * @param   string  $str    input string
  * @return  boolean
  */
 public static function numeric_variable($str)
 {
     // Get the decimal point for the current locale
     list($decimal) = array_values(localeconv());
     // A lookahead is used to make sure the string contains at least one digit (before or after the decimal point)
     return (bool) preg_match('/^[~\\+-]?\\d*\\.?\\d*$/', (string) $str);
 }
Пример #4
Показать файл Файл: FileProfilerStorage.php Проект: keneanung/gw2spidy
0
 /**
  * {@inheritdoc}
  */
 public function find($ip, $url, $limit, $method)
 {
     $file = $this->getIndexFilename();
     if (!file_exists($file)) {
         return array();
     }
     $file = fopen($file, 'r');
     fseek($file, 0, SEEK_END);
     $result = array();
     while ($limit > 0) {
         $line = $this->readLineFromFile($file);
         if (false === $line) {
             break;
         }
         if ($line === '') {
             continue;
         }
         list($csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent) = str_getcsv($line);
         if ($ip && false === strpos($csvIp, $ip) || $url && false === strpos($csvUrl, $url) || $method && false === strpos($csvMethod, $method)) {
             continue;
         }
         $result[$csvToken] = array('token' => $csvToken, 'ip' => $csvIp, 'method' => $csvMethod, 'url' => $csvUrl, 'time' => $csvTime, 'parent' => $csvParent);
         --$limit;
     }
     fclose($file);
     return array_values($result);
 }
Пример #5
Показать файл Файл: Grid.php Проект: ReeceCrossland/essua-m2epro
0
 protected function _prepareColumns()
 {
     /** @var Ess_M2ePro_Model_Amazon_Listing_Product_Variation_Manager_Type_Relation_Parent $parentType */
     $parentType = $this->getListingProduct()->getChildObject()->getVariationManager()->getTypeModel();
     $channelAttributesSets = $parentType->getChannelAttributesSets();
     $productAttributes = $parentType->getProductAttributes();
     if ($parentType->hasMatchedAttributes()) {
         $productAttributes = array_keys($parentType->getMatchedAttributes());
         $channelAttributes = array_values($parentType->getMatchedAttributes());
     } else {
         if (!empty($channelAttributesSets)) {
             $channelAttributes = array_keys($channelAttributesSets);
         } else {
             $channelAttributes = array();
         }
     }
     $this->addColumn('product_options', array('header' => Mage::helper('M2ePro')->__('Magento Variation'), 'align' => 'left', 'width' => '210px', 'sortable' => false, 'index' => 'additional_data', 'filter_index' => 'additional_data', 'frame_callback' => array($this, 'callbackColumnProductOptions'), 'filter' => 'M2ePro/adminhtml_grid_column_filter_attributesOptions', 'options' => $productAttributes, 'filter_condition_callback' => array($this, 'callbackProductOptions')));
     $this->addColumn('channel_options', array('header' => Mage::helper('M2ePro')->__('Amazon Variation'), 'align' => 'left', 'width' => '210px', 'sortable' => false, 'index' => 'additional_data', 'filter_index' => 'additional_data', 'frame_callback' => array($this, 'callbackColumnChannelOptions'), 'filter' => 'M2ePro/adminhtml_grid_column_filter_attributesOptions', 'options' => $channelAttributes, 'filter_condition_callback' => array($this, 'callbackChannelOptions')));
     $this->addColumn('sku', array('header' => Mage::helper('M2ePro')->__('SKU'), 'align' => 'left', 'type' => 'text', 'index' => 'sku', 'filter_index' => 'sku', 'frame_callback' => array($this, 'callbackColumnAmazonSku')));
     $this->addColumn('general_id', array('header' => Mage::helper('M2ePro')->__('ASIN / ISBN'), 'align' => 'left', 'width' => '100px', 'type' => 'text', 'index' => 'general_id', 'filter_index' => 'general_id', 'frame_callback' => array($this, 'callbackColumnGeneralId')));
     $this->addColumn('online_qty', array('header' => Mage::helper('M2ePro')->__('QTY'), 'align' => 'right', 'width' => '70px', 'type' => 'number', 'index' => 'online_qty', 'filter_index' => 'online_qty', 'frame_callback' => array($this, 'callbackColumnAvailableQty'), 'filter' => 'M2ePro/adminhtml_common_amazon_grid_column_filter_qty', 'filter_condition_callback' => array($this, 'callbackFilterQty')));
     $this->addColumn('online_price', array('header' => Mage::helper('M2ePro')->__('Price'), 'align' => 'right', 'width' => '70px', 'type' => 'number', 'index' => 'online_price', 'filter_index' => 'online_price', 'frame_callback' => array($this, 'callbackColumnPrice'), 'filter_condition_callback' => array($this, 'callbackFilterPrice')));
     $this->addColumn('status', array('header' => Mage::helper('M2ePro')->__('Status'), 'width' => '100px', 'index' => 'status', 'filter_index' => 'status', 'type' => 'options', 'sortable' => false, 'options' => array(Ess_M2ePro_Model_Listing_Product::STATUS_UNKNOWN => Mage::helper('M2ePro')->__('Unknown'), Ess_M2ePro_Model_Listing_Product::STATUS_NOT_LISTED => Mage::helper('M2ePro')->__('Not Listed'), Ess_M2ePro_Model_Listing_Product::STATUS_LISTED => Mage::helper('M2ePro')->__('Active'), Ess_M2ePro_Model_Listing_Product::STATUS_STOPPED => Mage::helper('M2ePro')->__('Inactive'), Ess_M2ePro_Model_Listing_Product::STATUS_BLOCKED => Mage::helper('M2ePro')->__('Inactive (Blocked)')), 'frame_callback' => array($this, 'callbackColumnStatus')));
     return parent::_prepareColumns();
 }
Пример #6
Показать файл Файл: class.flagging.plugin.php Проект: seedbank/old-repo
0
 /**
  * Save Email.Flag preference list in config for easier access.
  */
 public function UserModel_BeforeSaveSerialized_Handler($Sender)
 {
     if (Gdn::Session()->CheckPermission('Plugins.Flagging.Notify')) {
         if ($Sender->EventArguments['Column'] == 'Preferences' && is_array($Sender->EventArguments['Name'])) {
             // Shorten our arguments
             $UserID = $Sender->EventArguments['UserID'];
             $Prefs = $Sender->EventArguments['Name'];
             $FlagPref = GetValue('Email.Flag', $Prefs, NULL);
             if ($FlagPref !== NULL) {
                 // Add or remove user from config array
                 $NotifyUsers = C('Plugins.Flagging.NotifyUsers', array());
                 $IsNotified = array_search($UserID, $NotifyUsers);
                 // beware '0' key
                 if ($IsNotified !== FALSE && !$FlagPref) {
                     // Remove from NotifyUsers
                     unset($NotifyUsers[$IsNotified]);
                 } elseif ($IsNotified === FALSE && $FlagPref) {
                     // Add to NotifyUsers
                     $NotifyUsers[] = $UserID;
                 }
                 // Save new list of users to notify
                 SaveToConfig('Plugins.Flagging.NotifyUsers', array_values($NotifyUsers));
             }
         }
     }
 }
Пример #7
Показать файл Файл: ExportableValues.php Проект: coldtrick/csv_exporter
0
 /**
  * Get the default exportable values
  *
  * @param string $hook         the name of the hook
  * @param string $type         the type of the hook
  * @param array  $return_value the current return value
  * @param array  $params       supplied params
  *
  * @return void|array
  */
 public static function getExportableValues($hook, $type, $return_value, $params)
 {
     if (empty($params) || !is_array($params)) {
         return;
     }
     $content_type = elgg_extract('type', $params);
     $readable = (bool) elgg_extract('readable', $params, false);
     // default exportable values
     $defaults = [elgg_echo('csv_exporter:exportable_value:owner_name') => 'csv_exporter_owner_name', elgg_echo('csv_exporter:exportable_value:owner_username') => 'csv_exporter_owner_username', elgg_echo('csv_exporter:exportable_value:owner_email') => 'csv_exporter_owner_email', elgg_echo('csv_exporter:exportable_value:owner_url') => 'csv_exporter_owner_url', elgg_echo('csv_exporter:exportable_value:container_name') => 'csv_exporter_container_name', elgg_echo('csv_exporter:exportable_value:container_username') => 'csv_exporter_container_username', elgg_echo('csv_exporter:exportable_value:container_email') => 'csv_exporter_container_email', elgg_echo('csv_exporter:exportable_value:container_url') => 'csv_exporter_container_url', elgg_echo('csv_exporter:exportable_value:time_created_readable') => 'csv_exporter_time_created_readable', elgg_echo('csv_exporter:exportable_value:time_updated_readable') => 'csv_exporter_time_updated_readable', elgg_echo('csv_exporter:exportable_value:url') => 'csv_exporter_url'];
     $content_fields = [];
     switch ($content_type) {
         case 'object':
             $content_fields = self::getObjectExportableValues();
             break;
         case 'user':
             $content_fields = self::getUserExportableValues();
             break;
         case 'group':
             $content_fields = self::getGroupExportableValues();
             break;
     }
     // combine default and type fields
     $fields = array_merge($defaults, $content_fields);
     // which version did we want
     if (!$readable) {
         $fields = array_values($fields);
     }
     return array_merge($return_value, $fields);
 }
Пример #8
Показать файл Файл: ModelFactory.php Проект: jocoonopa/lubri
0
 /**
  * The model method will be override in deifferent way between different import way
  * 
  * @param  \App\Utility\Chinghwa\Flap\POS_Member\Import\ImportHandler\Lyin\Adapter $adapter   
  * @return PosMemberImportContent   $model
  */
 public function create($adapter)
 {
     $dataHolder = $adapter->getDataHolder();
     $memberData = $this->fetchExistOrEmpty($dataHolder);
     list($serNo, $code, $serNoI) = NULL !== $memberData ? array_values($memberData) : NULL;
     $model = new PosMemberImportContent();
     $model->serno = $serNo;
     $model->code = $code;
     $model->sernoi = $serNoI;
     $model->name = DataHolder::getByProxy($dataHolder->getName());
     $model->email = DataHolder::getByProxy($dataHolder->getEmail());
     $model->cellphone = DataHolder::getByProxy($dataHolder->getCellphone());
     $model->hometel = DataHolder::getByProxy($dataHolder->getHometel());
     $model->officetel = DataHolder::getByProxy($dataHolder->getOfficetel());
     $model->birthday = DataHolder::getByProxy($dataHolder->getBirthday());
     $model->homeaddress = DataHolder::getByProxy($dataHolder->getAddress());
     $model->hospital = DataHolder::getByProxy($dataHolder->getHospital());
     $model->state_id = $this->_getStateId($dataHolder);
     $model->distinction = $adapter->getOptions()[Import::OPTIONS_DISTINCTION];
     $model->category = $adapter->getOptions()[Import::OPTIONS_CATEGORY];
     $model->pos_member_import_task_id = $adapter->getOptions()[Import::OPTIONS_TASK]->id;
     $model->period_at = $this->_getPeriodAt($dataHolder);
     $model->sex = Import::FEMALE_SEX_TEXT;
     $model->flags = $model->getFlags();
     $model->memo = $model->genMemo();
     $model->is_exist = !empty($serNo);
     $model->fixStatus();
     return $model;
 }
Пример #9
Показать файл Файл: CurlFactoryTest.php Проект: hilmysyarif/sic
0
function curl_setopt_array($handle, array $options)
{
    if (array_values($options) != [null, null, null, null]) {
        $_SERVER['last_curl'] = $options;
    }
    \curl_setopt_array($handle, $options);
}
Пример #10
Показать файл Файл: class-aal-notifications.php Проект: leogopal/wordpress-aryo-activity-log
0
 public function process_notifications($args)
 {
     $enabled_handlers = $this->get_enabled_handlers();
     // if we can't find any enabled event handlers, bail.
     if (empty($enabled_handlers)) {
         return;
     }
     // calculate if this type event is set in the rules
     $options = AAL_Main::instance()->settings->get_options();
     // if there are no rules set, bail.
     if (empty($options['notification_rules']) || !is_array($options['notification_rules'])) {
         return;
     }
     $notification_matched_rules = array();
     // loop through the set of rules, and figure out if this current action meets a set rule
     foreach ($options['notification_rules'] as $notification_rule) {
         list($n_key, $n_condition, $n_value) = array_values($notification_rule);
         switch ($n_key) {
             case 'action-type':
                 if ($n_value == $args['object_type']) {
                     $notification_matched_rules[] = $notification_rule;
                 }
                 break;
         }
     }
     // did we find any matches? if not, let's pretend as if nothing has happened here ;)
     if (!empty($notification_matched_rules)) {
         // cycle through enabled handlers and trigger them
         foreach ($enabled_handlers as $enabled_handler) {
             $enabled_handler->trigger($args);
         }
     }
 }
Пример #11
Показать файл Файл: Filtersfeature.php Проект: vgrish/dvelum
0
 public function __toString()
 {
     $this->_config->setXType('');
     $this->_config->setFType('filters');
     $this->_config->filters = "[\n\t" . Utils_String::addIndent(implode(",\n", array_values($this->_filters)), 2) . "\n]";
     return parent::__toString();
 }
Пример #12
Показать файл Файл: options.class.php Проект: xmandxx/Teahouse-Wordpress-Theme
0
 public function element_value($value = '')
 {
     $value = $this->value;
     if (is_array($this->multilang) && is_array($value)) {
         $current = $this->multilang['current'];
         if (isset($value[$current])) {
             $value = $value[$current];
         } else {
             if ($this->multilang['current'] == $this->multilang['default']) {
                 $value = $this->value;
             } else {
                 $value = '';
             }
         }
     } else {
         if (!is_array($this->multilang) && isset($this->value['multilang']) && is_array($this->value)) {
             $value = array_values($this->value);
             $value = $value[0];
         } else {
             if (is_array($this->multilang) && !is_array($value) && $this->multilang['current'] != $this->multilang['default']) {
                 $value = '';
             }
         }
     }
     return $value;
 }
Пример #13
Показать файл Файл: adminer-wp-login.php Проект: vrkansagara/wordpress-plugin-construction
0
 private function replace_path_consts($source, $path)
 {
     $replacements = array('__FILE__' => "'{$path}'", '__DIR__' => "'" . dirname($path) . "'");
     $old = array_keys($replacements);
     $new = array_values($replacements);
     return str_replace($old, $new, $source);
 }
Пример #14
Показать файл Файл: ReporteDatosdelaEmpresa.php Проект: javierlov/FuentesWeb
0
 function Header()
 {
     $this->Print_Logo();
     $this->SetDrawColor(0);
     $this->SetLineWidth(0);
     $this->SetXY($this->margenDerecho, 10);
     $this->SetFont('Arial', 'B', 16);
     $this->Cell(0, 0, 'Datos de la Empresa', 0, 0, 'C');
     $psiniestro = $_SESSION["ReportesSiniestros"]["ID"];
     $porden = $_SESSION["ReportesSiniestros"]["ORDEN"];
     $this->SetFont('Arial', "I", 6);
     //$ahora = ["FECHASERVER"];
     date_default_timezone_set('UTC');
     $this->SetXY(5, 5);
     $ahora = date("d/m/Y");
     $this->Cell(0, 0, $ahora . "  ", 0, 0, 'L');
     $this->Ln(15);
     $this->SetX($this->margenDerecho);
     $this->RellenaFondoLinea(192, 192, 192);
     /*
     	$this->SetFillColor(192, 192, 192);
     	$x=$this->GetX();
     	$y=$this->GetY();
     	$anchofijo = $this->w - 15;
     	$this->Rect($x, $y+0.2, $anchofijo, 5, "F");
     	$this->SetFillColor(0, 0, 0);
     */
     $this->SetTextColor(0, 0, 0);
     $this->SetFontAlignGeneral();
     $Newrow = array_values($this->arrayTitulos);
     $this->Row($Newrow);
     // $this->LineaSepara();
     $this->Ln(5);
 }
Пример #15
Показать файл Файл: xmlappend.php Проект: KVSun/core_api
0
 /**
  * Append any supported $content to $parent
  *
  * @param  DOMNode $parent  Node to append to
  * @param  mixed   $content Content to append
  * @return self
  */
 protected function XMLAppend(\DOMNode &$parent = null, $content = null)
 {
     if (is_null($parent)) {
         $parent = $this->root;
     }
     if (is_string($content) or is_numeric($content) or is_object($content) and method_exists($content, '__toString')) {
         $parent->appendChild($this->createTextNode("{$content}"));
     } elseif (is_object($content) and is_subclass_of($content, '\\DOMNode')) {
         $parent->appendChild($content);
     } elseif (is_array($content) or is_object($content) and $content = get_object_vars($content)) {
         array_map(function ($node, $value) use(&$parent) {
             if (is_string($node)) {
                 if (substr($node, 0, 1) === '@') {
                     $parent->setAttribute(substr($node, 1), $value);
                 } else {
                     $node = $parent->appendChild($this->createElement($node));
                     if (is_string($value)) {
                         $this->XMLAppend($node, $this->createTextNode($value));
                     } else {
                         $this->XMLAppend($node, $value);
                     }
                 }
             } else {
                 $this->XMLAppend($parent, $value);
             }
         }, array_keys($content), array_values($content));
     } elseif (is_bool($content)) {
         $parent->appendChild($this->createTextNode($content ? 'true' : 'false'));
     } else {
         throw new \InvalidArgumentException(sprintf('Unable to append unknown content [%s] to %s', get_class($content), get_class($this)));
     }
     return $this;
 }
Пример #16
Показать файл Файл: BaseBibPerspectiveForm.class.php Проект: njch/PatBati
0
 public function saveRelIdentPerspectivesList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['rel_ident_perspectives_list'])) {
         // somebody has unset this widget
         return;
     }
     if (is_null($con)) {
         $con = $this->getConnection();
     }
     $existing = $this->object->RelIdentPerspectives->getPrimaryKeys();
     $values = $this->getValue('rel_ident_perspectives_list');
     if (!is_array($values)) {
         $values = array();
     }
     $unlink = array_diff($existing, $values);
     if (count($unlink)) {
         $this->object->unlink('RelIdentPerspectives', array_values($unlink));
     }
     $link = array_diff($values, $existing);
     if (count($link)) {
         $this->object->link('RelIdentPerspectives', array_values($link));
     }
 }
Пример #17
Показать файл Файл: TwigTemplateProperty.php Проект: alexisfroger/pim-community-dev
0
 /**
  * {@inheritdoc}
  */
 public function initialize()
 {
     $checkInvalidArgument = array_intersect(array_keys($this->getOr(self::CONTEXT_KEY, [])), $this->reservedKeys);
     if (count($checkInvalidArgument)) {
         throw new \InvalidArgumentException(sprintf('Context of template "%s" includes reserved key(s) - (%s)', $this->get(self::TEMPLATE_KEY), implode(', ', array_values($checkInvalidArgument))));
     }
 }
Пример #18
Показать файл Файл: mysqlimodel.class.php Проект: laiello/ffphp
0
 private function read($arg)
 {
     $sql = 'SELECT ';
     $fields = array();
     if ($arg == null) {
         $this->fields = array_values($this->modelInfo['fields']);
         foreach ($this->modelInfo['fields'] as $k => $v) {
             array_push($fields, $k . ' as ' . $v);
         }
     } else {
         $args = explode(',', $arg);
         $this->fields = $args;
         foreach ($args as $v) {
             array_push($fields, array_search($v, $this->modelInfo['fields']) . ' as ' . $v);
         }
     }
     $sql .= join(',', $fields);
     $sql .= ' FROM ' . join(',', $this->modelInfo['tables']);
     $sql .= ' WHERE ' . join(' and ', $this->modelInfo['links']);
     if ($this->where) {
         $sql .= ' and ' . $this->where;
     }
     if ($this->order) {
         $sql .= ' ORDER BY ' . $this->order;
     }
     if ($this->limit) {
         $sql .= ' LIMIT ' . $this->limit;
     }
     DEVE and debug::$sql[] = $sql;
     $mysqli = $this->mysqli->prepare($sql) or debug::error('没有查询到数据!', 113004);
     $mysqli->execute();
     $mysqli->store_result();
     return $mysqli;
 }
Пример #19
Показать файл Файл: ConduitAPI_differential_getrevision_Method.php Проект: nexeck/phabricator
0
 protected function execute(ConduitAPIRequest $request)
 {
     $diff = null;
     $revision_id = $request->getValue('revision_id');
     $revision = id(new DifferentialRevision())->load($revision_id);
     if (!$revision) {
         throw new ConduitException('ERR_BAD_REVISION');
     }
     $revision->loadRelationships();
     $reviewer_phids = array_values($revision->getReviewers());
     $diffs = $revision->loadDiffs();
     $diff_dicts = array();
     foreach ($diffs as $diff) {
         $diff->attachChangesets($diff->loadChangesets());
         // TODO: We could batch this to improve performance.
         foreach ($diff->getChangesets() as $changeset) {
             $changeset->attachHunks($changeset->loadHunks());
         }
         $diff_dicts[] = $diff->getDiffDict();
     }
     $commit_dicts = array();
     $commit_phids = $revision->loadCommitPHIDs();
     $handles = id(new PhabricatorObjectHandleData($commit_phids))->loadHandles();
     foreach ($commit_phids as $commit_phid) {
         $commit_dicts[] = array('fullname' => $handles[$commit_phid]->getFullName(), 'dateCommitted' => $handles[$commit_phid]->getTimestamp());
     }
     $auxiliary_fields = $this->loadAuxiliaryFields($revision);
     $dict = array('id' => $revision->getID(), 'phid' => $revision->getPHID(), 'authorPHID' => $revision->getAuthorPHID(), 'uri' => PhabricatorEnv::getURI('/D' . $revision->getID()), 'title' => $revision->getTitle(), 'status' => $revision->getStatus(), 'statusName' => ArcanistDifferentialRevisionStatus::getNameForRevisionStatus($revision->getStatus()), 'summary' => $revision->getSummary(), 'testPlan' => $revision->getTestPlan(), 'lineCount' => $revision->getLineCount(), 'reviewerPHIDs' => $reviewer_phids, 'diffs' => $diff_dicts, 'commits' => $commit_dicts, 'auxiliary' => $auxiliary_fields);
     return $dict;
 }
Пример #20
Показать файл Файл: ConstraintAddition.php Проект: vokson/scad.constructor.php
0
 public static function add($object)
 {
     // GET NODES
     $nodes = array_values(\Classes\Factory\Model\Model::getNodes());
     //GET RESTRAINT TABLE
     $resTable = \Classes\Factory\Model\Model::getRestraintTable();
     // RESTRAINT
     $restraint = new \Classes\Factory\Connection\SixFreedomConnection\RestraintConnection($object->getProperty('fix')->get());
     // RESTRAINT POINT
     $resPoint = new \Classes\Utils\AbstractInstance\Point($object->getProperty('x')->get(), $object->getProperty('y')->get(), $object->getProperty('z')->get());
     // TRY TO FIND NODE FOR RESTRAINT'S APPLICATION
     $isFound = FALSE;
     $i = 0;
     while ($isFound === FALSE && $i < count($nodes)) {
         $node = $nodes[$i];
         // NODE POINT
         $nodePoint = new \Classes\Utils\AbstractInstance\Point($node->getProperty('x')->get(), $node->getProperty('y')->get(), $node->getProperty('z')->get());
         if (\Classes\Utils\Math\Points::isPointSame($nodePoint, $resPoint)) {
             // ADD CONNECTION
             $resTable->setConnection($node->getUin(), $restraint);
             $isFound = TRUE;
         }
         $i++;
     }
 }
Пример #21
Показать файл Файл: Japanese.php Проект: 2d-gate/FanHuaJi_modules
0
 public function __construct($options = null)
 {
     $encoding =& $this->encoding;
     $gojuon =& $this->gojuon;
     $toyokanji =& $this->toyokanji;
     $extraKanji =& $this->extraKanji;
     $extraKanji2 =& $this->extraKanji2;
     $kanjiMustBeJpn =& $this->kanjiMustBeJpn;
     $punctuations =& $this->punctuations;
     $numbers =& $this->numbers;
     $jpnChars =& $this->jpnChars;
     $mayBeJpnChars =& $this->mayBeJpnChars;
     $mustBeJpn =& $this->mustBeJpn;
     // merge options
     if (is_array($options)) {
         $this->options = array_merge($this->optionsDefault, $options);
     } else {
         $this->options = $this->optionsDefault;
     }
     // generate $this->symbolsRegex
     $symbols = "{$this->symbols}{$this->charPreserved}";
     if ($this->options['ignoreNewLines']) {
         $symbols .= $this->newLineChars;
     }
     $this->symbolsRegex = "/([{$symbols}]+)/uimS";
     // generate $this->jpnChars, $this->mayBeJpnChars, $this->mustBeJpn
     $mayBeJpnKanji = $this->stringUnique(implode('', array_merge(array_keys($this->fixesJpnChar), array_values($this->fixesJpnChar), array_keys($this->fixesChiWord))));
     $jpnChars = "{$gojuon}{$toyokanji}{$extraKanji}{$extraKanji2}{$punctuations}{$numbers}";
     $mayBeJpnChars = "{$jpnChars}{$mayBeJpnKanji}";
     $mustBeJpn = "{$gojuon}{$kanjiMustBeJpn}";
     // multi-byte strings
     $this->mbMustBeJpn = new MbString($mustBeJpn, $encoding);
     $this->mbMayBeJpnChars = new MbString($mayBeJpnChars, $encoding);
 }
Пример #22
Показать файл Файл: ResourceLoaderStartUpModule.php Проект: schwarer2006/wikia
0
 /**
  * @param $context ResourceLoaderContext
  * @return array
  */
 protected function getConfig($context)
 {
     global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension, $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgVersion, $wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgEnableMWSuggest, $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgCookiePrefix, $wgResourceLoaderMaxQueryLength;
     $mainPage = Title::newMainPage();
     /**
      * Namespace related preparation
      * - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
      * - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
      */
     $namespaceIds = $wgContLang->getNamespaceIds();
     $caseSensitiveNamespaces = array();
     foreach (MWNamespace::getCanonicalNamespaces() as $index => $name) {
         $namespaceIds[$wgContLang->lc($name)] = $index;
         if (!MWNamespace::isCapitalized($index)) {
             $caseSensitiveNamespaces[] = $index;
         }
     }
     // Build list of variables
     $vars = array('wgLoadScript' => $wgLoadScript, 'debug' => $context->getDebug(), 'skin' => $context->getSkin(), 'stylepath' => $wgStylePath, 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $wgArticlePath, 'wgScriptPath' => $wgScriptPath, 'wgScriptExtension' => $wgScriptExtension, 'wgScript' => $wgScript, 'wgVariantArticlePath' => $wgVariantArticlePath, 'wgActionPaths' => (object) $wgActionPaths, 'wgServer' => $wgServer, 'wgUserLanguage' => $context->getLanguage(), 'wgContentLanguage' => $wgContLang->getCode(), 'wgVersion' => $wgVersion, 'wgEnableAPI' => $wgEnableAPI, 'wgEnableWriteAPI' => $wgEnableWriteAPI, 'wgDefaultDateFormat' => $wgContLang->getDefaultDateFormat(), 'wgMonthNames' => $wgContLang->getMonthNamesArray(), 'wgMonthNamesShort' => $wgContLang->getMonthAbbreviationsArray(), 'wgMainPageTitle' => $mainPage ? $mainPage->getPrefixedText() : null, 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $namespaceIds, 'wgSiteName' => $wgSitename, 'wgFileExtensions' => array_values($wgFileExtensions), 'wgDBname' => $wgDBname, 'wgFileCanRotate' => BitmapHandler::canRotate(), 'wgAvailableSkins' => Skin::getSkinNames(), 'wgExtensionAssetsPath' => $wgExtensionAssetsPath, 'wgCookiePrefix' => $wgCookiePrefix, 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength, 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, 'wgSassParams' => SassUtil::getSassSettings());
     if ($wgUseAjax && $wgEnableMWSuggest) {
         $vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate();
     }
     wfRunHooks('ResourceLoaderGetConfigVars', array(&$vars));
     return $vars;
 }
Пример #23
Показать файл Файл: mod.query.php Проект: stb74/eeguide
0
 function __construct()
 {
     // Extract the query from the tag chunk
     if (($sql = ee()->TMPL->fetch_param('sql')) === FALSE) {
         return FALSE;
     }
     // Rudimentary check to see if it's a SELECT query, most definitely not
     // bulletproof
     if (substr(strtolower(trim($sql)), 0, 6) != 'select') {
         return FALSE;
     }
     $query = ee()->db->query($sql);
     $results = $query->result_array();
     if ($query->num_rows() == 0) {
         return $this->return_data = ee()->TMPL->no_results();
     }
     // Start up pagination
     ee()->load->library('pagination');
     $pagination = ee()->pagination->create();
     ee()->TMPL->tagdata = $pagination->prepare(ee()->TMPL->tagdata);
     $per_page = ee()->TMPL->fetch_param('limit', 0);
     // Disable pagination if the limit parameter isn't set
     if (empty($per_page)) {
         $pagination->paginate = FALSE;
     }
     if ($pagination->paginate) {
         $pagination->build($query->num_rows(), $per_page);
         $results = array_slice($results, $pagination->offset, $pagination->per_page);
     }
     $this->return_data = ee()->TMPL->parse_variables(ee()->TMPL->tagdata, array_values($results));
     if ($pagination->paginate === TRUE) {
         $this->return_data = $pagination->render($this->return_data);
     }
 }
Пример #24
Показать файл Файл: content.class.php Проект: brij420/Restful-API-native-PHP5
0
 function checkAssoc($array)
 {
     if (is_array($array)) {
         return $array !== array_values($array);
     }
     return false;
 }
Пример #25
Показать файл Файл: Extensions.php Проект: sop/x509
0
 /**
  * Generate ASN.1 structure.
  *
  * @return Sequence
  */
 public function toASN1()
 {
     $elements = array_values(array_map(function ($ext) {
         return $ext->toASN1();
     }, $this->_extensions));
     return new Sequence(...$elements);
 }
Пример #26
Показать файл Файл: ValuePart.php Проект: addiks/phpsql
0
 public function resolve()
 {
     $lastIndex = count($this->chain) - 1;
     do {
         $this->chain = array_values($this->chain);
         foreach ($this->chain as $index => $chainValue) {
             if ($chainValue instanceof ConditionJob) {
                 if (!$chainValue->hasLastParameter() && $index < $lastIndex) {
                     $parameter = $this->chain[$index + 1];
                     unset($this->chain[$index + 1]);
                     $chainValue->setLastParameter($parameter);
                     continue 2;
                 }
                 if (!$chainValue->hasFirstParameter() && $index > 0) {
                     $parameter = $this->chain[$index - 1];
                     unset($this->chain[$index - 1]);
                     $chainValue->setFirstParameter($parameter);
                     continue 2;
                 }
             }
             if ($chainValue instanceof Part) {
                 $chainValue->resolve();
             }
         }
         break;
     } while (true);
     parent::resolve();
 }
Пример #27
Показать файл Файл: books2.php Проект: alerque/bibledit
0
 /**
  * Constructs a book dialog
  * $action - GET or POST action to take.
  * $inclusions - NULL (in which case it does nothing), or an array of book IDs to include.
  * $exclusions - NULL (in which case it does nothing), or an array of book IDs to exclude.
  */
 public function __construct($header, $info_top, $info_bottom, $action, $inclusions, $exclusions)
 {
     $this->view = new Assets_View(__FILE__);
     $caller = $_SERVER["PHP_SELF"] . "?" . http_build_query(array());
     $this->view->view->caller = $caller;
     $this->view->view->header = $header;
     $this->view->view->info_top = $info_top;
     $this->view->view->info_bottom = $info_bottom;
     $this->view->view->action = $action;
     $database_books = Database_Books::getInstance();
     $book_ids = $database_books->getIDs();
     if (is_array($inclusions)) {
         $book_ids = $inclusions;
     }
     if (is_array($exclusions)) {
         $book_ids = array_diff($book_ids, $exclusions);
         $book_ids = array_values($book_ids);
     }
     foreach ($book_ids as $id) {
         $book_names[] = $database_books->getEnglishFromId($id);
     }
     $this->view->view->book_ids = $book_ids;
     $this->view->view->book_names = $book_names;
     $this->view->render("books2.php");
     Assets_Page::footer();
     die;
 }
Пример #28
Показать файл Файл: index.php Проект: ChaosExAnima/WP_Query_Multisite
0
 function pre_get_posts($query)
 {
     if ($query->get('multisite')) {
         global $wpdb, $blog_id;
         $this->loop_end = false;
         $this->blog_id = $blog_id;
         $site_IDs = $wpdb->get_col("select blog_id from {$wpdb->blogs}");
         if ($query->get('sites__not_in')) {
             foreach ($site_IDs as $key => $site_ID) {
                 if (in_array($site_ID, $query->get('sites__not_in'))) {
                     unset($site_IDs[$key]);
                 }
             }
         }
         if ($query->get('sites__in')) {
             foreach ($site_IDs as $key => $site_ID) {
                 if (!in_array($site_ID, $query->get('sites__in'))) {
                     unset($site_IDs[$key]);
                 }
             }
         }
         $site_IDs = array_values($site_IDs);
         $this->sites_to_query = $site_IDs;
     }
 }
Пример #29
Показать файл Файл: App.php Проект: browar777/crawler
0
 public function __construct()
 {
     //funkcja parseUrl() znajduje sie ponizej
     $url = $this->parseUrl();
     //////////////////////
     //testowanie postowany danych
     if (!empty($_POST)) {
         $url[1] = 'post';
     }
     /////////////////////////////
     if (!$url == NULL) {
         if (file_exists('../app/controllers/' . $url[0] . '.php')) {
             $this->controller = $url[0];
             unset($url[0]);
         } else {
             $this->controller = 'error';
             unset($url[0]);
         }
     }
     require_once '../app/controllers/' . $this->controller . '.php';
     $this->controller = new $this->controller();
     if (isset($url[1])) {
         if (method_exists($this->controller, $url[1])) {
             $this->method = $url[1];
             unset($url[1]);
         }
     }
     $this->params = $url ? array_values($url) : [];
     call_user_func_array([$this->controller, $this->method], $this->params);
 }
Пример #30
Показать файл Файл: AdminStylesController.php Проект: hoalangoc/ftf
0
 public function indexAction()
 {
     $this->view->form = $form = new Ynnotification_Form_Admin_Style();
     $values = Engine_Api::_()->getApi('settings', 'core')->getSetting('avdnotification.customcssobj', 0);
     $values = Zend_JSON::decode($values);
     if ($values) {
         $form->populate($values);
     }
     if ($this->getRequest()->isPost() && $form->isValid($this->_getAllParams())) {
         $values = $form->getValues();
         if (isset($_POST['submit'])) {
             // $str = $this->view->partial("_css.tpl");
             $arr_keys = array_keys($values);
             $arr_values = array_values($values);
             $arr_keys = array_map(array($this, 'map'), $arr_keys);
             $str = str_replace($arr_keys, $arr_values, $str);
             Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification.customcssobj', Zend_JSON::encode($values));
             Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification', $str);
             $form->addNotice('Your changes have been saved.');
         } else {
             if (isset($_POST['clear'])) {
                 Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification.customcssobj', '');
                 Engine_Api::_()->getApi('settings', 'core')->setSetting('avdnotification', '');
                 $form->populate(array('mes_background' => '79B4D4', 'text_color' => ''));
                 $form->addNotice('You have set default styles.');
             }
         }
     }
 }