• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP TextHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中TextHelper的典型用法代码示例。如果您正苦于以下问题:PHP TextHelper类的具体用法?PHP TextHelper怎么用?PHP TextHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TextHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: update_position

 private function update_position($request)
 {
     $fields_list = json_decode(TextHelper::html_entity_decode($request->get_value('tree')));
     foreach ($fields_list as $position => $tree) {
         PersistenceContext::get_querier()->inject("UPDATE " . DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST . " SET \r\n\t\t\t\tposition = :position\r\n\t\t\t\tWHERE id = :id", array('position' => $position, 'id' => $tree->id));
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:7,代码来源:AdminExtendedFieldsMemberListController.class.php


示例2: load_lang

 protected function load_lang(HTTPRequestCustom $request)
 {
     $locale = TextHelper::htmlspecialchars($request->get_string('lang', UpdateController::DEFAULT_LOCALE));
     LangLoader::set_locale($locale);
     UpdateUrlBuilder::set_locale($locale);
     $this->lang = LangLoader::get('update', 'update');
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:7,代码来源:UpdateController.class.php


示例3: getValue

 function getValue($filtered = true)
 {
     $values = explode($this->separator, $this->_value);
     $tags = array();
     foreach ($values as &$value) {
         $value = trim($value);
         if ($value != '') {
             if ($this->_filter && $filtered) {
                 $value = call_user_func($this->_filter, $value, $this->getName());
             }
             $tags[] = $value;
         }
     }
     $ids = array();
     foreach ($tags as $tag) {
         $ds = new TableReader('blog_tag');
         $id = $ds->select('blog_tag_id')->where('tag', $tag)->fetchScalar();
         if (!$id) {
             $writer = new TableWriter('blog_tag');
             $id = $writer->insert(array('tag' => $tag, 'url_tag' => TextHelper::urlize($tag)));
         }
         $ids[] = $id;
     }
     return $ids;
 }
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:25,代码来源:taglist.input.php


示例4: register_archive

 private static function register_archive($language_type, $title, $contents, $id_cat)
 {
     $number_subscribers = self::number_subscribers($id_cat);
     $title = TextHelper::strprotect($title, TextHelper::HTML_NO_PROTECT, TextHelper::ADDSLASHES_FORCE);
     $contents = TextHelper::strprotect($contents, HTML_NO_PROTECT, ADDSLASHES_FORCE);
     self::$db_querier->inject("INSERT INTO " . NewsletterSetup::$newsletter_table_archive . " (id_cat, title, contents, timestamp, type, subscribers)\r\n\t\t\tVALUES (:id_cat, :title, :contents, :timestamp, :type, :field_type, :subscribers)", array('id_cat' => $id_cat, 'title' => $title, 'contents' => $contents, 'timestamp' => time(), 'type' => $language_type, 'subscribers' => 0));
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:7,代码来源:NewsletterMailService.class.php


示例5: build_table

    private function build_table()
    {
        $table_model = new SQLHTMLTableModel(CalendarSetup::$calendar_events_table, 'table', array(new HTMLTableColumn(LangLoader::get_message('form.title', 'common'), 'title'), new HTMLTableColumn(LangLoader::get_message('category', 'categories-common'), 'id_category'), new HTMLTableColumn(LangLoader::get_message('author', 'common'), 'display_name'), new HTMLTableColumn(LangLoader::get_message('date', 'date-common'), 'start_date'), new HTMLTableColumn($this->lang['calendar.titles.repetition']), new HTMLTableColumn('')), new HTMLTableSortingRule('start_date', HTMLTableSortingRule::ASC));
        $table_model->set_caption($this->lang['calendar.events_list']);
        $table_model->add_permanent_filter('parent_id = 0');
        $table_model->add_filter(new HTMLTableDateTimeGreaterThanOrEqualsToSQLFilter('start_date', 'filter1', $this->lang['calendar.labels.start_date'] . ' ' . TextHelper::lowercase_first(LangLoader::get_message('minimum', 'common'))));
        $table_model->add_filter(new HTMLTableDateTimeLessThanOrEqualsToSQLFilter('start_date', 'filter2', $this->lang['calendar.labels.start_date'] . ' ' . TextHelper::lowercase_first(LangLoader::get_message('maximum', 'common'))));
        $table = new HTMLTable($table_model);
        $table->set_filters_fieldset_class_HTML();
        $results = array();
        $result = $table_model->get_sql_results('event
			LEFT JOIN ' . CalendarSetup::$calendar_events_content_table . ' event_content ON event_content.id = event.content_id
			LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = event_content.author_id');
        foreach ($result as $row) {
            $event = new CalendarEvent();
            $event->set_properties($row);
            $category = $event->get_content()->get_category();
            $user = $event->get_content()->get_author_user();
            $edit_link = new LinkHTMLElement(CalendarUrlBuilder::edit_event(!$event->get_parent_id() ? $event->get_id() : $event->get_parent_id()), '', array('title' => LangLoader::get_message('edit', 'common')), 'fa fa-edit');
            $delete_link = new LinkHTMLElement(CalendarUrlBuilder::delete_event($event->get_id()), '', array('title' => LangLoader::get_message('delete', 'common'), 'data-confirmation' => !$event->belongs_to_a_serie() ? 'delete-element' : ''), 'fa fa-delete');
            $user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true);
            $author = $user->get_id() !== User::VISITOR_LEVEL ? new LinkHTMLElement(UserUrlBuilder::profile($user->get_id()), $user->get_display_name(), !empty($user_group_color) ? array('style' => 'color: ' . $user_group_color) : array(), UserService::get_level_class($user->get_level())) : $user->get_display_name();
            $br = new BrHTMLElement();
            $results[] = new HTMLTableRow(array(new HTMLTableRowCell(new LinkHTMLElement(CalendarUrlBuilder::display_event($category->get_id(), $category->get_rewrited_name(), $event->get_id(), $event->get_content()->get_rewrited_title()), $event->get_content()->get_title()), 'left'), new HTMLTableRowCell(new SpanHTMLElement($category->get_name(), array('style' => $category->get_id() != Category::ROOT_CATEGORY && $category->get_color() ? 'color:' . $category->get_color() : ''))), new HTMLTableRowCell($author), new HTMLTableRowCell(LangLoader::get_message('from_date', 'main') . ' ' . $event->get_start_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . $br->display() . LangLoader::get_message('to_date', 'main') . ' ' . $event->get_end_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE)), new HTMLTableRowCell($event->belongs_to_a_serie() ? $this->get_repeat_type_label($event) . ' - ' . $event->get_content()->get_repeat_number() . ' ' . $this->lang['calendar.labels.repeat_times'] : LangLoader::get_message('no', 'common')), new HTMLTableRowCell($edit_link->display() . $delete_link->display())));
        }
        $table->set_rows($table_model->get_number_of_matching_rows(), $results);
        $this->view->put('table', $table->display());
    }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:28,代码来源:CalendarEventsListController.class.php


示例6: parse

 public function parse()
 {
     $this->content = TextHelper::html_entity_decode($this->content);
     foreach (static::$parsers as $parser) {
         $this->content = $parser->unparse($this->content);
     }
 }
开发者ID:DrJoey,项目名称:MarkUp,代码行数:7,代码来源:MarkUpUnparser.class.php


示例7: getAchievementsDefinitions

 public static function getAchievementsDefinitions()
 {
     $dir = Config::$achievementsDefinitionsDirectory;
     $imgFiles = scandir(Config::$imageDirectory . DIRECTORY_SEPARATOR . 'achievement');
     $definitions = array_fill_keys(Media::getConstList(), []);
     foreach (glob($dir . DIRECTORY_SEPARATOR . '*.json') as $file) {
         $definition = TextHelper::loadJson($file);
         $prevAch = null;
         foreach ($definition->achievements as &$ach) {
             foreach ($imgFiles as $f) {
                 if (preg_match('/' . $ach->id . '[^0-9a-zA-Z_-]/', $f)) {
                     $ach->path = $f;
                 }
             }
             $ach->next = null;
         }
         foreach ($definition->achievements as &$ach) {
             if ($prevAch !== null) {
                 $prevAch->next = $ach;
             }
             $ach->prev = $prevAch;
             $prevAch =& $ach;
         }
         unset($ach);
         unset($prevAch);
         $definitions[$definition->media][] = $definition;
     }
     foreach (Media::getConstList() as $key) {
         uasort($definitions[$key], function ($a, $b) {
             return $a->order - $b->order;
         });
     }
     return $definitions;
 }
开发者ID:asmdz,项目名称:malgraph,代码行数:34,代码来源:UserControllerAchievementsModule.php


示例8: find_by_criteria

 /**
  * @desc Builds a list of alerts matching the required criteria(s). You can specify many criterias. When you use several of them, it's a AND condition.
  * It will only return the alert which match all the criterias.
  * @param int $id_in_module Id in the module. 
  * @param string $type Alert type.
  * @param string $identifier Alert identifier.
  * @return AdministratorAlert[] The list of the matching alerts.
  */
 public static function find_by_criteria($id_in_module = null, $type = null, $identifier = null)
 {
     $criterias = array();
     if ($id_in_module != null) {
         $criterias[] = "id_in_module = '" . intval($id_in_module) . "'";
     }
     if ($type != null) {
         $criterias[] = "type = '" . TextHelper::strprotect($type) . "'";
     }
     if ($identifier != null) {
         $criterias[] = "identifier = '" . TextHelper::strprotect($identifier) . "'";
     }
     //Restrictive criteria
     if (!empty($criterias)) {
         $array_result = array();
         $result = self::$db_querier->select("SELECT id, entitled, fixing_url, current_status, creation_date, identifier, id_in_module, type, priority, description\n\t\t\tFROM " . DB_TABLE_EVENTS . "\n\t\t\tWHERE contribution_type = '" . ADMINISTRATOR_ALERT_TYPE . "' AND " . implode($criterias, " AND "));
         while ($row = $result->fetch()) {
             $alert = new AdministratorAlert();
             $alert->build($row['id'], $row['entitled'], $row['description'], $row['fixing_url'], $row['current_status'], new Date($row['creation_date'], Timezone::SERVER_TIMEZONE), $row['id_in_module'], $row['identifier'], $row['type'], $row['priority']);
             $array_result[] = $alert;
         }
         $result->dispose();
         return $array_result;
     } else {
         return AdministratorAlertCache::load()->get_all_alerts_number();
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:35,代码来源:AdministratorAlertService.class.php


示例9: parse

 static function parse($path, $replacements = array(), &$substitutions = array())
 {
     $path = self::replaceUploadsDir($path);
     $matches1 = array();
     preg_match_all('/{(appd|uploads|public|random|date|root)(?:\\[([0-9a-zA-Z-_]+)\\])?}/', $path, $matches1, PREG_SET_ORDER);
     $matches2 = array();
     $expression = implode('|', array_keys($replacements));
     preg_match_all('/{(' . $expression . ')(?:\\[([0-9a-zA-Z-_]+)\\])?}/', $path, $matches2, PREG_SET_ORDER);
     $matches = array_merge($matches1, $matches2);
     foreach ($matches as $match) {
         if (isset($replacements[$match[1]])) {
             $substitutions[$match[0]] = $replacements[$match[1]];
             if (isset($match[2])) {
                 if (is_numeric($match[2])) {
                     $substitutions[$match[0]] = substr($substitutions[$match[0]], 0, $match[2]);
                 } elseif (is_callable($match[2])) {
                     $substitutions[$match[0]] = call_user_func($match[2], $substitutions[$match[0]]);
                 } elseif ($match[2] == 'url') {
                     $substitutions[$match[0]] = TextHelper::urlize($substitutions[$match[0]]);
                 }
             }
         } else {
             $param = isset($match[2]) ? $match[2] : null;
             $substitutions[$match[0]] = self::replace($match[1], $param);
         }
     }
     return str_replace(array_keys($substitutions), array_values($substitutions), $path);
 }
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:28,代码来源:path.helper.php


示例10: test_named_cycles

 function test_named_cycles()
 {
     $this->assertEqual('odd', TextHelper::cycle(array('odd', 'even', 'name' => '1st')));
     $this->assertEqual('red', TextHelper::cycle('red', 'black'));
     $this->assertEqual('even', TextHelper::cycle(array('odd', 'even', 'name' => '1st')));
     $this->assertEqual('black', TextHelper::cycle('red', 'black'));
 }
开发者ID:ratbird,项目名称:hope,代码行数:7,代码来源:text_helper_test.php


示例11: __construct

 public function __construct($error_message = '')
 {
     if (empty($error_message)) {
         $error_message = LangLoader::get_message('form.doesnt_match_tel_regex', 'status-messages-common');
     }
     $this->set_validation_error_message($error_message);
     parent::__construct(self::$regex, TextHelper::to_js_string(self::$js_regex), $error_message);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:8,代码来源:FormFieldConstraintTel.class.php


示例12: load_lang

 protected function load_lang(HTTPRequestCustom $request)
 {
     $locale = TextHelper::htmlspecialchars($request->get_string('lang', self::DEFAULT_LOCALE));
     $locale = in_array($locale, InstallationServices::get_available_langs()) ? $locale : self::DEFAULT_LOCALE;
     LangLoader::set_locale($locale);
     InstallUrlBuilder::set_locale($locale);
     $this->lang = LangLoader::get('install', 'install');
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:8,代码来源:InstallController.class.php


示例13: Add_msg

 function Add_msg($idtopic, $idcat, $contents, $title, $last_page, $last_page_rewrite, $new_topic = false)
 {
     global $LANG;
     ##### Insertion message #####
     $last_timestamp = time();
     $result = PersistenceContext::get_querier()->insert(PREFIX . 'forum_msg', array('idtopic' => $idtopic, 'user_id' => AppContext::get_current_user()->get_id(), 'contents' => FormatingHelper::strparse($contents), 'timestamp' => $last_timestamp, 'timestamp_edit' => 0, 'user_id_edit' => 0, 'user_ip' => AppContext::get_request()->get_ip_address()));
     $last_msg_id = $result->get_last_inserted_id();
     //Topic
     PersistenceContext::get_querier()->inject("UPDATE " . PREFIX . "forum_topics SET " . ($new_topic ? '' : 'nbr_msg = nbr_msg + 1, ') . "last_user_id = '" . AppContext::get_current_user()->get_id() . "', last_msg_id = '" . $last_msg_id . "', last_timestamp = '" . $last_timestamp . "' WHERE id = '" . $idtopic . "'");
     //On met à jour le last_topic_id dans la catégorie dans le lequel le message a été posté
     PersistenceContext::get_querier()->update(ForumSetup::$forum_cats_table, array('last_topic_id' => $idtopic), 'WHERE id = :id', array('id' => $idcat));
     //Mise à jour du nombre de messages du membre.
     PersistenceContext::get_querier()->inject("UPDATE " . DB_TABLE_MEMBER . " SET posted_msg = posted_msg + 1 WHERE user_id = '" . AppContext::get_current_user()->get_id() . "'");
     //On marque le topic comme lu.
     mark_topic_as_read($idtopic, $last_msg_id, $last_timestamp);
     ##### Gestion suivi du sujet mp/mail #####
     if (!$new_topic) {
         //Message précédent ce nouveau message.
         $previous_msg_id = 0;
         try {
             $previous_msg_id = PersistenceContext::get_querier()->get_column_value(PREFIX . "forum_msg", 'MAX(id)', 'WHERE idtopic = :idtopic AND id < :id', array('idtopic' => $idtopic, 'id' => $last_msg_id));
         } catch (RowNotFoundException $e) {
         }
         $title_subject = TextHelper::html_entity_decode($title);
         $title_subject_pm = $title_subject;
         if (AppContext::get_current_user()->get_id() > 0) {
             $pseudo = '';
             try {
                 $pseudo = PersistenceContext::get_querier()->get_column_value(DB_TABLE_MEMBER, 'display_name', 'WHERE user_id = :id', array('id' => AppContext::get_current_user()->get_id()));
             } catch (RowNotFoundException $e) {
             }
             $pseudo_pm = '<a href="' . UserUrlBuilder::profile(AppContext::get_current_user()->get_id())->rel() . '">' . $pseudo . '</a>';
         } else {
             $pseudo = $LANG['guest'];
             $pseudo_pm = $LANG['guest'];
         }
         $next_msg_link = '/forum/topic' . url('.php?id=' . $idtopic . $last_page, '-' . $idtopic . $last_page_rewrite . '.php') . ($previous_msg_id ? '#m' . $previous_msg_id : '');
         $preview_contents = substr($contents, 0, 300);
         //Récupération des membres suivant le sujet.
         $max_time = time() - SessionsConfig::load()->get_active_session_duration();
         $result = PersistenceContext::get_querier()->select("SELECT m.user_id, m.display_name, m.email, tr.pm, tr.mail, v.last_view_id\n\t\t\tFROM " . PREFIX . "forum_track tr\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = tr.user_id\n\t\t\tLEFT JOIN " . PREFIX . "forum_view v ON v.idtopic = :idtopic AND v.user_id = tr.user_id\n\t\t\tWHERE tr.idtopic = :idtopic AND v.last_view_id IS NOT NULL AND m.user_id != :user_id", array('idtopic' => $idtopic, 'user_id' => AppContext::get_current_user()->get_id()));
         while ($row = $result->fetch()) {
             //Envoi un Mail à ceux dont le last_view_id est le message précedent.
             if ($row['last_view_id'] == $previous_msg_id && $row['mail'] == '1') {
                 AppContext::get_mail_service()->send_from_properties($row['email'], $LANG['forum_mail_title_new_post'], sprintf($LANG['forum_mail_new_post'], $row['display_name'], $title_subject, AppContext::get_current_user()->get_display_name(), $preview_contents, HOST . DIR . $next_msg_link, HOST . DIR . '/forum/action.php?ut=' . $idtopic . '&trt=1', 1));
             }
             //Envoi un MP à ceux dont le last_view_id est le message précedent.
             if ($row['last_view_id'] == $previous_msg_id && $row['pm'] == '1') {
                 $content = sprintf($LANG['forum_mail_new_post'], $row['display_name'], $title_subject_pm, AppContext::get_current_user()->get_display_name(), $preview_contents, '<a href="' . $next_msg_link . '">' . $next_msg_link . '</a>', '<a href="/forum/action.php?ut=' . $idtopic . '&trt=2">/forum/action.php?ut=' . $idtopic . '&trt=2</a>');
                 PrivateMsg::start_conversation($row['user_id'], $LANG['forum_mail_title_new_post'], nl2br($content), '-1', PrivateMsg::SYSTEM_PM);
             }
         }
         $result->dispose();
         forum_generate_feeds();
         //Regénération du flux rss.
     }
     return $last_msg_id;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:58,代码来源:Forum.class.php


示例14: get_message

 private function get_message()
 {
     $msg = $this->error_message;
     if ($this->input != null) {
         $msg .= "\n" . 'line ' . $this->tpl_line . ' offset ' . $this->offset . ' near';
         $msg .= ' "...' . TextHelper::htmlentities($this->input->to_string(-100, 200)) . '..."';
     }
     return $msg;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:9,代码来源:TemplateRenderingException.class.php


示例15: modelTranslator

 public static function modelTranslator($json, $lang)
 {
     if (TextHelper::isJson($json)) {
         $array = json_decode($json, true);
         return $array[$lang];
     } else {
         return $json;
     }
 }
开发者ID:skullyframework,项目名称:skully,代码行数:9,代码来源:TextHelper.php


示例16: __construct

 public function __construct($label, $link, $css_class_image = '')
 {
     $full_label = '';
     if (!empty($css_class_image)) {
         $full_label = '<i class="' . $css_class_image . '" title="' . $label . '"></i>';
     } else {
         $full_label = $label;
     }
     parent::__construct('button', $full_label, '', 'window.location=' . TextHelper::to_js_string(Url::to_rel($link)), 'image');
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:10,代码来源:FormButtonLinkCssImg.class.php


示例17: block_format

 /**
 * Uses TextHelper::format to take the text and format it, indented two spaces for
 * each line, and wrapped at 72 columns.
 */
  function block_format($text)
  {
      $formatted = '';
      $paragraphs = split("(\n|\r){2,}",$text);
      foreach ((array)$paragraphs as $paragraph){
          $formatted .= TextHelper::format($paragraph, array('columns' => 72, 'first_indent' => 2, 'body_indent' => 2));
      }
      // Make list points stand on their own line
      return preg_replace("/[ ]*([*]+) ([^*]*)/"," $1 $2\n", preg_replace("/[ ]*([#]+) ([^#]*)/"," $1 $2\n",$formatted));
  }
开发者ID:joeymetal,项目名称:v1,代码行数:14,代码来源:mail_helper.php


示例18: __construct

 public function __construct($label, $link, $img = '')
 {
     $full_label = '';
     if (!empty($img)) {
         $full_label = '<img src="' . $img . '" alt="' . $label . '" title="' . $label . '" />';
     } else {
         $full_label = $label;
     }
     parent::__construct('button', $full_label, '', 'window.location=' . TextHelper::to_js_string(Url::to_rel($link)), !empty($img) ? 'image' : '');
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:10,代码来源:FormButtonLink.class.php


示例19: __construct

 public function __construct($field_id = 0, $error_message = '')
 {
     if (!empty($field_id)) {
         $this->field_id = $field_id;
     }
     if (empty($error_message)) {
         $error_message = LangLoader::get_message('message.field_name_already_used', 'common', 'contact');
     }
     $this->set_validation_error_message($error_message);
     $this->error_message = TextHelper::to_js_string($error_message);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:11,代码来源:ContactConstraintFieldExist.class.php


示例20: work

 public static function work(&$controllerContext, &$viewContext)
 {
     $viewContext->viewName = 'user-profile';
     $viewContext->meta->title = $viewContext->user->name . '\'s profile &#8212; ' . Config::$title;
     $viewContext->meta->description = $viewContext->user->name . '\'s profile.';
     WebMediaHelper::addEntries($viewContext);
     WebMediaHelper::addMiniSections($viewContext);
     WebMediaHelper::addCustom($viewContext);
     $viewContext->yearsOnMal = null;
     if (intval($viewContext->user->join_date)) {
         list($year, $month, $day) = explode('-', $viewContext->user->join_date);
         $time = mktime(0, 0, 0, $month, $day, $year);
         $diff = time() - $time;
         $diff /= 3600 * 24;
         $viewContext->yearsOnMal = $diff / 361.25;
     }
     $viewContext->friends = $viewContext->user->getFriends();
     $viewContext->finished = [];
     $viewContext->meanUserScore = [];
     $viewContext->meanGlobalScore = [];
     $viewContext->franchiseCount = [];
     $viewContext->mismatchedCount = [];
     foreach (Media::getConstList() as $media) {
         $list = $viewContext->user->getMixedUserMedia($media);
         $listFinished = UserMediaFilter::doFilter($list, UserMediaFilter::finished());
         $viewContext->finished[$media] = count($listFinished);
         unset($listFinished);
         $listNonPlanned = UserMediaFilter::doFilter($list, UserMediaFilter::nonPlanned());
         $viewContext->meanUserScore[$media] = RatingDistribution::fromEntries($listNonPlanned)->getMeanScore();
         $franchises = Model_MixedUserMedia::getFranchises($listNonPlanned);
         $viewContext->franchiseCount[$media] = count(array_filter($franchises, function ($franchise) {
             return count($franchise->ownEntries) > 1;
         }));
         unset($franchises);
         unset($listNonPlanned);
         if ($media == Media::Anime) {
             $viewContext->episodes = array_sum(array_map(function ($mixedMediaEntry) {
                 return $mixedMediaEntry->finished_episodes;
             }, $list));
         } else {
             $viewContext->chapters = array_sum(array_map(function ($mixedMediaEntry) {
                 return $mixedMediaEntry->finished_chapters;
             }, $list));
         }
         $mismatched = $viewContext->user->getMismatchedUserMedia($list);
         $viewContext->mismatchedCount[$media] = count($mismatched);
         unset($mismatched);
         unset($list);
         $globalsCache = file_exists(Config::$globalsCachePath) ? TextHelper::loadJson(Config::$globalsCachePath, true) : [];
         $viewContext->meanGlobalScore[$media] = array_map(function ($v) {
             return RatingDistribution::fromArray($v);
         }, $globalsCache['rating-dist'])[$media]->getMeanScore();
     }
 }
开发者ID:asmdz,项目名称:malgraph,代码行数:54,代码来源:UserControllerProfileModule.php



注:本文中的TextHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TextPropertyItem类代码示例发布时间:2022-05-23
下一篇:
PHP TextField类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap