protected function update_sort_order() { if (!($ids = \Util_Array::cast_values(explode(',', \Input::post('ids')), 'int', true))) { throw new \HttpInvalidInputException('Invalid input data.'); } return \Site_Model::update_sort_order($ids, \News\Model_NewsCategory::forge()); }
public function handleRquest() { if (!$this->checkSignature()) { return false; } /////////验证 开通开发者请求 if ($_GET['echostr']) { return $_GET['echostr']; } ////// $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; //获取raw post数据 if (!$postStr) { $result = ' '; } else { $this->postData = $postStr; $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); $postArray = Util_Array::ObjectToArray($postObj); $this->postArray = $postArray; $msgType = $postArray['MsgType']; $result = $this->handler->handleRquest($msgType, $postArray); } Log::Set($result); if (!$result) { return self::DEFAULT_OUTPUT; } $result = self::formatResult($result); return $result; }
private function getAllowedFileTypes() { $config = Zend_Registry::get('Zend_Config'); if (!isset($config->publish->filetypes->allowed)) { return null; } $allowed = explode(',', $config->publish->filetypes->allowed); Util_Array::trim($allowed); return $allowed; }
public static function setUpBeforeClass() { $query = Model_TimelineCache::query(); self::$total_count = $query->count(); $total_list = $query->get(); $total_first_obj = \Util_Array::get_first($total_list); self::$total_first_id = $total_first_obj->id; $total_last_obj = \Util_Array::get_last($total_list); self::$total_last_id = $total_last_obj->id; }
public static function GetShorTen($url, $one = true, $source = '5786724301') { $uTpl = 'https://api.weibo.com/2/short_url/shorten.json?source=%s&url_long=%s'; $link = sprintf($uTpl, $source, urlencode($url)); $ret = Util_HttpRequest::Get($link); if ($ret) { $ret = json_decode($ret, true); } $urls = array_get($ret, 'urls'); return $one ? Util_Array::GetFristItem($urls) : $urls; }
static function GetObject($tablename, $id, $pkname = "id") { $single = !is_array($id); settype($id, 'array'); $k = array(); foreach ($id as $oid) { $k[] = self::GetObjectKey($tablename, $oid, $pkname); } $r = Util_Array::AssColumn(self::Get($k), $pkname); return $single ? array_pop($r) : $r; }
public function createSign($method, $mqsHeaders, $date, $path) { $contentType = $this->contentType; $xMqsHeadersString = ''; $mqsHeaders = Util_Array::Sort($mqsHeaders); foreach ($mqsHeaders as $key => $value) { $xMqsHeadersString .= "{$key}:{$value}\n"; } $str2Sign = "{$method}\n\n{$contentType}\n{$date}\n{$xMqsHeadersString}{$path}"; $sig = base64_encode(hash_hmac('sha1', $str2Sign, $this->accessKey, true)); return "MNS " . $this->accessID . ":" . $sig; }
public static function get_model_field($table, $column, $label = '', $delete_rules = array()) { $model = Site_Model::get_model_name($table); $obj = $model::forge(); $props = $obj::get_property($column, $delete_rules); if (!$props || empty($props['form'])) { throw new \InvalidArgumentException('Second parameter is invalid.'); } if (!$label) { $label = !empty($props['label']) ? $props['label'] : ''; } return array('label' => $label, 'attributes' => $props['form'], 'rules' => !empty($props['validation']) ? Util_Array::convert_for_callback($props['validation']) : array()); }
/** * Detail action. * * @access public * @params integer * @return Response */ public function action_detail($id = null) { $id = (int) $id; $site_image = \Model_SiteImage::check_authority($id); $data = array('site_image' => $site_image); // 前後の id の取得 $ids = \Model_SiteImage::get_col_array('id', array('order_by' => array('id' => 'desc'))); list($data['before_id'], $data['after_id']) = \Util_Array::get_neighborings($id, $ids); $this->set_title_and_breadcrumbs(term('site.image', 'site.detail'), array('admin/content' => term('site.content', 'site.management'), 'admin/content/image' => term('site.image', 'site.management'))); $this->template->layout = 'wide'; $this->template->subtitle = \View::forge('content/image/_parts/detail_subtitle', array('site_image' => $site_image)); $this->template->post_footer = \View::forge('_parts/load_masonry'); $this->template->content = \View::forge('content/image/detail', $data); }
public static function get_notice_target_member_ids($member_id_to, $member_id_from, $foreign_table, $foreign_id, $type_key) { $notice_member_ids = \Util_Orm::conv_col2array(\Notice\Model_MemberWatchContent::get4foreign_data($foreign_table, $foreign_id), 'member_id'); if ($member_id_to && !in_array($member_id_to, $notice_member_ids)) { $notice_member_ids[] = $member_id_to; } $notice_member_ids = \Util_Array::unset_item($member_id_from, $notice_member_ids); if ($type_key == 'comment_like') { $type_key = 'like'; } if (!in_array($type_key, array('comment', 'like'))) { return $notice_member_ids; } $config_key = \Notice\Form_MemberConfig::get_name($type_key); return \Site_Member::get_member_ids4config_value($config_key, 1, $notice_member_ids); }
public function setTableInfo($key_array) { if (!Util_Array::IsArrayValue($key_array)) { return false; } $th_array = array(); $td_array = array(); foreach ($key_array as $index => $one) { if (is_numeric($index)) { $index = $one; } $th_array[$index] = $one; $td_array[$index] = $index; } $this->th_array = $th_array; $this->td_array = $td_array; }
public function getHtml() { $html = ""; $showPage = $this->getShowPage(); if (Util_Array::IsArrayValue($showPage)) { $url = $this->getUrl(); foreach ($showPage as $pageInfo) { $currentUrl = $url . "&page_no={$pageInfo['page_no']}"; $class = ''; if ($pageInfo['current']) { $html .= "<button class='btn btn-success'>{$pageInfo['title']}</button>"; } else { $html .= "<a href='{$currentUrl}'><button class='btn btn-default'>{$pageInfo['title']}</button></a>"; } } } $html = "<div style=''>{$html}</div>"; return $html; }
private function execute(\Orm\Model $obj) { // 親記事削除時 if (empty($this->_conditions['type'])) { // delete member_watch_content self::delete_member_watch_content($obj, $this->_conditions); } $notices = \Site_Model::get4relation('\\Notice\\Model_Notice', $this->_conditions, $obj); foreach ($notices as $notice) { // 親記事削除時 if (empty($this->_conditions['type'])) { $notice->delete(); } else { // delete notice_member_from if (self::delete_notice_member_from($notice->id, $obj->member_id)) { $parent_content_member_id = \Site_Model::get_value4table_and_id($notice->foreign_table, $notice->foreign_id, 'member_id'); if (!\Notice\Model_NoticeMemberFrom::get_count4notice_id($notice->id, $parent_content_member_id)) { $notice->delete(); } } } } // 親記事削除時 if (empty($this->_conditions['type'])) { $foreign_table = \Util_Array::get_first_key($this->_conditions['foreign_table']); $foreign_id = $obj->id; $notices = \Notice\Model_Notice::get4parent_data($foreign_table, $foreign_id); foreach ($notices as $notice) { $notice->delete(); } } else { $type = \Util_Array::get_first_key($this->_conditions['type']); // comment 削除時 if ($type == \Notice\Site_Util::get_notice_type('comment')) { $foreign_table = \Util_Array::get_first_key($this->_conditions['foreign_table']) . '_comment'; $foreign_id = $obj->id; $notices = \Notice\Model_Notice::get4foreign_data($foreign_table, $foreign_id); foreach ($notices as $notice) { $notice->delete(); } } } }
/** * @dataProvider insert_provider */ public function test_insert($public_flag, $timeline_public_flag_expected) { // timeline view cache 作成 if (self::$is_check_timeline_view_cache) { $timeline_view_cache_before = \Timeline\Site_Util::make_view_cache4foreign_table_and_foreign_id('album', $album->id, \Config::get('timeline.types.album_image')); } // insert self::$upload_file_path = self::setup_upload_file(); list($album_image, $file) = Model_AlbumImage::save_with_relations(self::$album->id, self::$member, $public_flag, self::$upload_file_path, 'album_image'); self::$add_count++; // 返り値の確認 $this->assertNotEmpty($album_image); $this->assertNotEmpty($file); // 件数 $this->assertEquals(self::$total_count + 1, \Util_Orm::get_count_all('\\Album\\Model_AlbumImage')); // 公開範囲 $this->assertEquals($public_flag, $album_image->public_flag); // timeline 関連 if (is_enabled('timeline')) { // 件数 $this->assertEquals(self::$timeline_count, \Util_Orm::get_count_all('\\Timeline\\Model_Timeline')); $this->assertEquals(self::$timeline_cache_count, \Util_Orm::get_count_all('\\Timeline\\Model_TimelineCache')); // timelines $timelines = \Timeline\Model_Timeline::get4foreign_table_and_foreign_ids('album', self::$album->id, \Config::get('timeline.types.album_image')); $this->assertCount(1, $timelines); $timeline = array_shift($timelines); // timeline_child_data $timeline_child_datas = \Timeline\Model_TimelineChildData::get4timeline_id($timeline->id); $this->assertCount(self::$add_count, $timeline_child_datas); $timeline_child_data = \Util_Array::get_last($timeline_child_datas); $this->assertEquals('album_image', $timeline_child_data->foreign_table); $this->assertEquals($album_image->id, $timeline_child_data->foreign_id); $this->assertEquals($timeline_public_flag_expected, $timeline->public_flag); $this->assertContains($timeline->sort_datetime, \Util_Date::get_datetime_list($album_image->created_at)); $this->assertTrue(\Util_Date::check_is_future($timeline->sort_datetime, self::$album->created_at)); // timeline view cache check if (self::$is_check_timeline_view_cache) { $this->assertEmpty(\Timeline\Site_Util::get_view_cache($timeline->id)); } } }
public static function get_file_tmps_uploaded($member_id = null, $check_selected = false, $type = 'img', $check_file_exists = true, $is_delete_not_exists_file = false) { $file_tmps = array(); $post_key = $type == 'img' ? 'image_tmp' : 'file_tmp'; if (!($file_tmps_posted = Input::post($post_key))) { if ($check_selected) { throw new HttpInvalidInputException('File not selected.'); } return array(); } if (!($file_tmp_ids = Util_Array::cast_values(array_keys($file_tmps_posted), 'int', true))) { throw new HttpInvalidInputException('Invalid input data.'); } if (!($file_tmps = Model_FileTmp::get4ids($file_tmp_ids))) { throw new FuelException('ファイルが選択されていません。'); } foreach ($file_tmps as $key => $file_tmp) { if ($member_id && $file_tmp->member_id != $member_id) { throw new HttpForbiddenException(); } if ($file_tmps_posted[$file_tmp->id] != $file_tmp->name) { throw new HttpInvalidInputException('Invalid input data.'); } $file_tmps_description_posted = Input::post($post_key . '_description'); if (isset($file_tmps_description_posted[$file_tmp->id])) { $file_tmps[$key]->description = trim($file_tmps_description_posted[$file_tmp->id]); } $file_tmp_path = Site_Upload::get_uploaded_file_path($file_tmp->name, 'raw', 'img', true); if (conf('upload.storageType') == 'normal' && !file_exists($file_tmp_path)) { if ($check_file_exists) { throw new HttpInvalidInputException('File not exists.'); } if ($is_delete_not_exists_file) { $file_tmp->delete(); } unset($file_tmps[$file_tmp->id]); } } return $file_tmps; }
private function execute($obj) { list($foreign_table, $foreign_id, $member_id_to, $member_id_from, $type_key) = self::get_variables($obj); if (self::check_already_executed($foreign_table, $foreign_id, $member_id_to, $member_id_from, $type_key)) { return; } if (!\Model_Member::check_is_active($member_id_to)) { $member_id_to = null; } // watch content if ($member_id_to && $member_id_from != $member_id_to) { \Notice\Site_Util::regiser_watch_content($member_id_from, $foreign_table, $foreign_id, $type_key); } // get mention targets $mentioned_member_ids = array(); if (conf('mention.isEnabled', 'notice') && \Notice\Site_Util::check_mention_target($foreign_table, $type_key)) { $body_porp = !empty($this->_update_properties['body_prop_name']) ? $this->_update_properties['body_prop_name'] : 'body'; $mentioned_member_ids = \Notice\Site_Model::get_mentioned_member_ids4body($obj->{$body_porp}); $mentioned_member_ids = \Util_Array::delete_in_array($mentioned_member_ids, array($member_id_from)); // 自分宛の mention は無効 } // get notice targets $notice_member_ids = \Notice\Site_Util::get_notice_target_member_ids($member_id_to, $member_id_from, $foreign_table, $foreign_id, $type_key); // 重複通知防止 $notice_member_ids = \Util_Array::delete_in_array($notice_member_ids, $mentioned_member_ids); if (!$notice_member_ids && !$mentioned_member_ids) { return; } // notice 実行 if ($notice_member_ids) { \Notice\Site_Model::execut_notice($foreign_table, $foreign_id, $type_key, $member_id_from, $notice_member_ids); } // mention 実行 if ($mentioned_member_ids) { $mention_type_key = $type_key == 'comment' ? 'comment_mention' : 'parent_mention'; \Notice\Site_Model::execut_notice($foreign_table, $foreign_id, $mention_type_key, $member_id_from, $mentioned_member_ids); } }
public function get_file_objects_from_related_model($model_objs, $image_names_posted = array()) { $files = array(); if (!$model_objs) { return $files; } $key = Util_Array::get_first_key($model_objs); $table = $model_objs[$key]->table(); $need_member_id_tables = array('album_image'); if (in_array($table, $need_member_id_tables) && !$this->options['member_id']) { throw new \FuelException('Need member_id.'); } $file_cate = $model_objs[$key]->get_image_prefix(); $cache_size = conf('upload.types.img.types.' . $file_cate . '.sizes.thumbnail'); foreach ($model_objs as $model_obj) { $file_name = $this->remove_filename_prefix($model_obj->file_name); if (!($file = $this->get_file_object($file_name))) { continue; } $file_obj = Model_File::get4name($model_obj->file_name); $file->is_tmp = false; $file->name_prefix = $this->options['filename_prefix']; $file->id = (int) $model_obj->id; $file->original_name = $file_obj->original_filename; $file->thumbnail_uri = Site_Upload::get_uploaded_file_path($model_obj->file_name, $cache_size, 'img', false, true); $file->description = $model_obj->name; if (isset($image_names_posted[$model_obj->id]) && strlen($image_names_posted[$model_obj->id])) { $file->description = $image_names_posted[$model_obj->id]; } if (!empty($this->options['accept_sizes'])) { $file->accept_sizes = $this->options['accept_sizes']; } $files[] = $file; } return $files; }
public function fetchListByUriId($uri_id) { $rows = $this->medoo()->select('mock', '*', ['uri_id' => $uri_id]); $rows = \Util_Array::column($rows, null, 'id'); return $rows; }
<?php $feed_options = array('link' => Uri::create($link_uri), 'caption' => strim(!empty($caption) ? $caption : FBD_SITE_DESCRIPTION, conf('service.facebook.shareDialog.caption.trimWidth'), null, false, true), 'name' => strim($name, conf('service.facebook.shareDialog.name.trimWidth'), null, false, true)); if (!empty($description)) { $feed_options['description'] = strim($description, conf('service.facebook.shareDialog.description.trimWidth'), null, false, true); } if (!empty($images)) { $image = Util_Array::get_last($images); if (empty($img_size_key)) { $img_size_key = 'thumbnail'; } $feed_options['picture'] = Uri::create(img_uri($image->get_image(), $img_size_key)); } echo btn('service.facebook.do_share', '#', 'js-facebook_feed', true, 'xs', 'primary', array('class' => 'mr10', 'data-options' => json_encode($feed_options)), null, null, null, false); ?> <span id="fb-root"></span>
$is_detail = false; $attr['data-list_id'] = $timeline_cache_id; $attr['data-comment_count'] = $comment_count; $attr['data-like_count'] = $like_count; } $access_from_member_relation = null; if (\Timeline\Site_Util::check_type_to_get_access_from($type)) { $access_from_member_relation = \Site_Member::get_access_from_member_relation($member_id, $self_member_id); } $member = Model_Member::check_authority($member_id); if (isset($liked_timeline_ids)) { echo Form::hidden('liked_timeline_ids', json_encode($liked_timeline_ids), array('id' => 'liked_timeline_ids')); } ?> <div <?php echo Util_Array::conv_array2attr_string($attr); ?> > <div class="row member_contents"> <div class="col-xs-1"><?php echo member_image($member); ?> </div> <div class="col-xs-11"> <div class="member_info"> <b class="fullname"><?php echo member_name($member, true, true); ?> </b> </div> <div class="main">
public static function BuildXML($data, $parentTag) { if (!Util_Array::IsArrayValue($data)) { return $data; } $xml = ''; foreach ($data as $index => $one) { if (is_array($one)) { if ($one['attribute']) { $attribute = ''; foreach ($one['attribute'] as $akey => $aval) { $attribute .= " {$akey}=\"{$aval}\""; } } $value = strval($one['value']); $xml .= "<{$index}{$attribute}>{$value}</{$index}>"; } else { $xml .= "<{$index}>{$one}</{$index}>"; } } $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><{$parentTag}> {$xml} </{$parentTag}>"; return $xml; }
/** * Loops through the roles to check for one that is allowed for the method. * * @param string $method, same as what Zend_Acl referers to as 'privilege' but 'method' used for REST context * @return boolean */ public function isAllowed($privilege, array $roleResourceId = null, array $resourceId = null) { // for regular resources the $roleResourceId can be specified and // it is used for the resource as well. For permission type resources // $roleResourceId should be passed as null and will be determined if (null !== $roleResourceId && null === $resourceId) { $resourceId = $roleResourceId; } $user = $this->getAclContextUser(); if (null === $user) { $roleSet = $this->getRoles(); } else { $roleResourceGeneral = $this->getRoleResourceId(); // first get the possible roles this user has with the resource if (null === $resourceId) { $sql = 'SELECT role FROM resource_role' . ' WHERE user_id = :userId' . ' AND resource = :roleResourceGeneral' . ' AND resource_id IS NULL' . ''; $query = $this->_getDbHandler()->query($sql); $query->execute(array( ':userId' => $user->id, ':roleResourceGeneral' => $roleResourceGeneral, )); } else { if (null === $roleResourceId) { $sql = 'SELECT role FROM resource_role' . ' WHERE user_id = :userId' . ' AND (' . ' resource = :roleResourceGeneral' . ' AND id = :resourceId' . ' )' . ''; $query = $this->_getDbHandler()->query($sql); $query->execute(array( ':userId' => $user->id, ':roleResourceGeneral' => $roleResourceGeneral, ':resourceId' => $resourceId['id'], )); } else { // include roles from specific case $roleResourceSpecific = $this->getSpecificRoleResourceId($roleResourceId); $sql = 'SELECT role FROM resource_role' . ' WHERE user_id = :userId' . ' AND (' . ' resource = :roleResourceGeneral' . ' AND (' . ' resource_id IS NULL' . ' OR resource_id = :roleResourceSpecific' . ' )' . ' )' . ''; $query = $this->_getDbHandler()->query($sql); $query->execute(array( ':userId' => $user->id, ':roleResourceGeneral' => $roleResourceGeneral, ':roleResourceSpecific' => $roleResourceSpecific, )); } } $rowSet = $query->fetchAll(PDO::FETCH_ASSOC); $roleSet = Util_Array::arrayFromKeyValuesOfSet('role', $rowSet); } // make sure 'default' role is in there if (!in_array('default', $roleSet)) { $roleSet[] = 'default'; } $resourceGeneral = $this->getResourceId(); if (null !== $resourceId && null !== $roleResourceId) { $resourceSpecific = $this->getSpecificResourceId($resourceId); // first check if against this specific resource things are // allowed or denied $roleVarKeyLookup = array(); foreach ($roleSet as $index => $role) { $roleVarKeyLookup[':role_' . $index] = $role; } $sql = 'SELECT p.id, p.permission, p.privilege, p.resource, p.role' . ' FROM permission AS p' . ' WHERE p.role IN (' . implode(', ', array_keys($roleVarKeyLookup)) . ')' . ' AND p.resource = :resourceGeneral' . ' AND p.resource_id = :resourceSpecific' . ' AND p.privilege = :privilege' . ' ORDER BY p.permission ASC' . ''; $query = $this->_getDbHandler()->prepare($sql); $query->execute(array_merge( array( ':resourceGeneral' => $resourceGeneral, ':resourceSpecific' => $resourceSpecific, ':privilege' => $privilege, ), $roleVarKeyLookup )); $row = $query->fetch(PDO::FETCH_ASSOC); if (false !== $row) { // able to say that this specific resource is either allowed or denied return $row['permission'] == 'allow'; } } // specific resource check wasn't definitive, check the general resource // add the default role $allowed = false; foreach ($roleSet as $role) { // check if a role is accepted if ($this->getAcl()->isAllowed($role, $resourceGeneral, $privilege)) { // if any role is found that allows, the whole thing allows return true; } } // no allows found in the general resource, so permission is denied return false; }
public function getCorpToken($corpId) { $api = sprintf('/service/get_corp_token?suite_access_token=%s', $this->suiteAccessToken); $corpId = $corpId ? $corpId : $this->corpId; $data = array(); $data['suite_id'] = $this->suiteId; $data['auth_corpid'] = $corpId; $data['permanent_code'] = $this->permanentCode; $data = Util_Array::JsonEncode($data); return $this->output($this->httpClient->post($api, $data)); }
if ($is_display_textarea) { ?> <p><?php echo Form::textarea(sprintf($prefix . '_description[%d]', $file->id), isset($file->description) ? $file->description : '', array('rows' => 2, 'placeholder' => '写真の説明', 'class' => 'form-control', 'id' => sprintf($prefix . '_description_%d', $file->id))); ?> </p> <?php } ?> <?php echo Form::hidden(sprintf($prefix . '[%d]', $file->id), $file->name_prefix . $file->name, array('class' => $prefix)); // select insert image size if (!empty($insert_target) && !empty($file->accept_sizes)) { ?> <p><?php echo field_select(null, $value = null, Util_Array::set_key_from_value($file->accept_sizes), array('id' => 'select_size_' . $file->id)); ?> </p> <?php } // insert image tag button. if (!empty($insert_target)) { $data = array('class' => 'js-insert_img', 'id' => 'img_insert_btn_' . $file->id, 'data-id' => $file->id, 'data-body' => $insert_target, 'data-file_name' => $file->name, 'data-file_name_prefix' => $file->name_prefix); echo btn('form.insert_picture', '#', '', true, 'sm', null, $data, null, 'button', null, false); } ?> </div><!-- caption --> </div><!-- thumbnail --> <?php } ?>
<?php $dropdown_btn_group_attr = array('id' => 'btn_dropdown_' . $album_image->id, 'class' => array('dropdown', 'boxBtn')); $get_uri = sprintf('album/image/api/menu/%d.html', $album_image->id); $dropdown_btn_attr = array('class' => 'js-dropdown_content_menu', 'data-uri' => sprintf('album/image/api/menu/%d.html', $album_image->id), 'data-member_id' => $album_image->album->member_id, 'data-menu' => '#menu_' . $album_image->id, 'data-loaded' => 0); $menus = array(array('icon_term' => 'site.show_detail', 'href' => 'album/image/' . $album_image->id)); echo btn_dropdown('noterm.dropdown', $menus, false, 'xs', null, true, $dropdown_btn_group_attr, $dropdown_btn_attr, false); ?> </div><!-- imgBox --> <?php if (empty($is_simple_view) && $comments) { $comment_list_attr = array('class' => 'comment_list list_album_image_comment', 'id' => 'comment_list_' . $album_image->id); ?> <div <?php echo Util_Array::conv_array2attr_string($comment_list_attr); ?> > <?php $data = array('parent' => !empty($album) ? $album : $album_image->album, 'list' => $comments, 'next_id' => $comment_next_id, 'uri_for_all_comments' => sprintf('album/image/%d?limit=all#comments', $album_image->id), 'delete_uri' => 'album/image/comment/api/delete.json', 'trim_width' => Config::get('album.articles.comment.trim_width'), 'counter_selector' => '#comment_count_' . $album_image->id, 'list_more_box_attrs' => array('id' => 'listMoreBox_comment_' . $album_image->id, 'data-uri' => sprintf('album/image/comment/api/list/%s.json', $album_image->id), 'data-list' => '#comment_list_' . $album_image->id), 'is_hide_reply_link' => true, 'like_api_uri_prefix' => 'album/image/comment', 'liked_ids' => conf('like.isEnabled') && \Auth::check() && $comments ? \Site_Model::get_liked_ids('album_image_comment', $u->id, $comments) : array()); echo render('_parts/comment/list', $data); ?> </div> <?php } ?> </div><!-- image_item --> <?php } ?> </div><!-- image_list -->
<?php $block_attrs_default = array('class' => array('modal', 'fade'), 'tabindex' => '-1', 'role' => 'dialog', 'aria-hidden' => 'true'); $block_attrs = Util_Array::conv_arrays2str(array_merge_recursive($block_attrs_default, isset($block_attrs) ? $block_attrs : array())); if (!isset($is_display_footer_close_btn)) { $is_display_footer_close_btn = false; } ?> <!-- Modal --> <div <?php echo Util_Array::conv_array2attr_string($block_attrs); ?> > <div class="modal-dialog<?php if (!empty($size)) { ?> modal-<?php echo $size; } ?> "> <div class="modal-content"> <?php if (!empty($is_display_header_close_btn) || !empty($title) || !empty($header_subinfo)) { ?> <div class="modal-header clearfix"> <?php if (!empty($is_display_header_close_btn)) { ?> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <?php
if (!empty($label)) { $label_class = 'col-sm-' . $offset_size; $label_class .= ' control-label'; $offset = ''; } else { $offset = $offset_size ? 'col-sm-offset-' . $offset_size : ''; } $col = 'col-sm-' . (12 - $offset_size); if ($optional_link) { $link_attr_default = array('class' => array('btn', 'btn-default', 'btn-sm', 'pull-right')); if (!isset($optional_link['attr'])) { $optional_link['attr'] = array(); } $link_attr = array_merge_recursive($link_attr_default, $optional_link['attr']); $optional_link_attr = Util_Array::conv_arrays2str($link_attr); } ?> <div class="form-group"> <?php if (!empty($label)) { ?> <?php echo Form::label($label, null, array('class' => $label_class)); } ?> <div class="form-text <?php echo $col; if ($offset) { ?> <?php
<?php echo icon('group', 'fa fa-', 'i', array('class' => 'icon')); ?> <span class="badge">99</span> </button> <button class="btn btn-default navbar-inverse" type="button"> <?php echo icon('comments', 'fa fa-', 'i', array('class' => 'icon')); ?> <span class="badge">99</span> </button> */ if (is_enabled('notice')) { $notice_btn_attr = array('class' => 'btn btn-default navbar-inverse js-modal', 'type' => 'button', 'data-uri' => 'notice/api/list.json', 'data-get_data' => array('limit' => Config::get('notice.modalArticles.limit')), 'data-target' => '#modal_notice_navbar', 'data-tmpl' => '#notices-template', 'data-is_list' => 1, 'id' => 'btn_notice_navbar'); if (!empty($notification_counts['notice'])) { $notice_btn_attr['class'] .= ' notified'; } ?> <button <?php echo Util_Array::conv_array2attr_string($notice_btn_attr); ?> > <?php echo icon('info-circle', 'fa fa-', 'i', array('class' => 'icon')); if (!empty($notification_counts['notice'])) { ?> <span class="badge" id="badge_notice"><?php echo $notification_counts['notice']; ?> </span> <?php } ?> </button> <?php
public function fetchList() { $rows = $this->medoo()->select('uri', ['id', 'uri']); $rows = \Util_Array::column($rows, null, 'id'); return $rows; }
<?php if (empty($size)) { $size = 'sm'; } $default_attrs = array('class' => array('btn', 'btn-default', 'js-update_toggle', 'btn-' . $size), 'id' => 'btn_follow_' . $member_id_to, 'data-uri' => sprintf('member/relation/api/update/%d/follow.json', $member_id_to)); if (!isset($attrs)) { $attrs = array(); } $attrs = array_merge_recursive($default_attrs, $attrs); if (empty($name)) { $name = $default_attrs['id']; } if (Model_MemberRelation::check_relation('follow', $member_id_from, $member_id_to)) { $label = '<span class="glyphicon glyphicon-ok"></span> ' . term('followed'); $attrs['class'][] = 'btn-primary'; } else { $label = term('do_follow'); $attrs['class'][] = 'btn-default'; } $attrs = Util_Array::conv_arrays2str($attrs); echo Form::button($name, $label, $attrs);