本文整理汇总了PHP中Utils::array_get方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::array_get方法的具体用法?PHP Utils::array_get怎么用?PHP Utils::array_get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils
的用法示例。
在下文中一共展示了Utils::array_get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header_data
/**
* Header data for header section
*
* @return array
*/
public static function header_data()
{
$header_image = get_header_image();
$page_layout_class = ' .page-layout-' . Model_Page_Layout_Settings::get_layout() . ' .page-layout-width-' . Model_Page_Layout_Settings::get_width() . ' .page-layout-sidebar-width-' . Model_Page_Layout_Settings::get_sidebar_width();
$header = array('allowedtags' => $GLOBALS['allowedtags'], 'language_attributes' => get_language_attributes(), 'body_class' => implode(' ', get_body_class()) . $page_layout_class, 'charset' => get_bloginfo('charset'), 'ping_back_url' => get_bloginfo('pingback_url'), 'name' => get_bloginfo('name'), 'home_url' => esc_url(home_url('/')), 'description' => get_bloginfo('description'), 'favicon' => General_Site_Settings_Model::get_favicon(), 'touch_icon' => General_Site_Settings_Model::get_touch_icon(), 'custom_styles' => '', 'is_enabled_preloader' => Model_Logo_And_Favicon::is_enable_page_preloader(), 'logo' => General_Site_Settings_Model::get_logo(), 'socials' => View::make('blocks/socials', array('socials' => Social_Settings_Model::get_all_socials(), 'where' => 'header')), 'socials_show_header' => Social_Settings_Model::is_show_header(), 'disclimer' => Header_Settings_Model::get_disclimer(), 'search_box' => Header_Settings_Model::get_search_box(), 'header_style_layout' => Header_Settings_Model::get_header_style(), 'header_layout_view' => sprintf('header-%s', Header_Settings_Model::get_header_style()), 'header_image' => $header_image, 'header_slogan' => get_option('photolab_header_slogan'), 'header_class' => Header_Settings_Model::get_header_class(), 'static_class' => empty($header_image) ? 'static' : 'absolute', 'term_description' => term_description(), 'welcome_message' => get_option('photolab'), 'main_menu' => wp_nav_menu(array('theme_location' => 'main', 'container' => 'nav', 'container_class' => 'main-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-menu', 'walker' => new Photolab_Walker(), 'echo' => false)), 'top_menu' => wp_nav_menu(array('theme_location' => 'top', 'container' => 'nav', 'container_class' => 'top-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-top-menu', 'walker' => new Photolab_Walker(), 'echo' => false)));
$header['alt_mess'] = Utils::array_get($header['welcome_message'], 'welcome_title', get_bloginfo('name'));
return $header;
}
示例2: form
/**
* Admin view
*
* @param type $instance array.
*/
public function form($instance)
{
$title_field = new UI_Input_Fox(array('id' => $this->get_field_id('title'), 'name' => $this->get_field_name('title'), 'value' => Utils::array_get($instance, 'title'), 'placeholder' => __('Widget title', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Title', PHOTOLAB_BASE_TM_ALIAS)));
$title_html = $title_field->output();
$widget_id_field = new UI_Input_Fox(array('id' => $this->get_field_id('widget_id'), 'name' => $this->get_field_name('widget_id'), 'value' => Utils::array_get($instance, 'widget_id'), 'placeholder' => __('Set widget id', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Widget ID', PHOTOLAB_BASE_TM_ALIAS)));
$widget_id_html = $widget_id_field->output();
$screen_name_field = new UI_Input_Fox(array('id' => $this->get_field_id('screen_name'), 'name' => $this->get_field_name('screen_name'), 'value' => Utils::array_get($instance, 'screen_name'), 'placeholder' => __('Input your twitter name', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Twitter name', PHOTOLAB_BASE_TM_ALIAS)));
$screen_name_html = $screen_name_field->output();
echo View::make('widgets/back-end/twitter-timeline', array('title_html' => $title_html, 'widget_id_html' => $widget_id_html, 'screen_name_html' => $screen_name_html));
}
示例3: form
/**
* Back-end widget form.
*
* @see WP_Widget::form()
*
* @param array $instance Previously saved values from database.
*/
public function form($instance)
{
echo View::make('widgets/back-end/accordion', array('title' => Utils::array_get($instance, 'title'), 'post_ids' => Utils::array_get($instance, 'post_ids'), 'category' => Utils::array_get($instance, 'category'), 'field_id_title' => $this->get_field_id('title'), 'field_name_title' => $this->get_field_name('title'), 'field_id_post_ids' => $this->get_field_id('post_ids'), 'field_name_post_ids' => $this->get_field_name('post_ids'), 'field_id_category' => $this->get_field_id('category'), 'field_name_category' => $this->get_field_name('category'), 'dropdown_categories' => wp_dropdown_categories(array('show_option_all' => '', 'show_option_none' => 'All', 'option_none_value' => '', 'orderby' => 'ID', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => false, 'selected' => 0, 'hierarchical' => 0, 'name' => $this->get_field_name('category'), 'id' => $this->get_field_id('category'), 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => 'category', 'hide_if_empty' => false, 'value_field' => 'term_id'))));
}
示例4: form
/**
* Create admin form for widget
*
* @param type $instance array.
*/
public function form($instance)
{
// Include assets
$this->admin_assets();
$title_field = new UI_Input_Fox(array('id' => $this->get_field_id('title'), 'name' => $this->get_field_name('title'), 'value' => Utils::array_get($instance, 'title'), 'placeholder' => __('New title', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Title widget', PHOTOLAB_BASE_TM_ALIAS)));
$title_html = $title_field->output();
$categories_list = get_categories(array('hide_empty' => 0));
$categories_array = array('0' => 'not selected');
foreach ($categories_list as $category_item) {
$categories_array[$category_item->term_id] = $category_item->name;
}
$category_field = new UI_Select_Fox(array('id' => $this->get_field_id('categories'), 'name' => $this->get_field_name('categories'), 'default' => Utils::array_get($instance, 'categories'), 'options' => $categories_array));
$categories_html = $category_field->output();
$tags_list = get_tags(array('hide_empty' => 0));
$tags_array = array('0' => 'not selected');
foreach ($tags_list as $tag_item) {
$tags_array[$tag_item->term_id] = $tag_item->name;
}
$tag_field = new UI_Select_Fox(array('id' => $this->get_field_id('tags'), 'name' => $this->get_field_name('tags'), 'default' => Utils::array_get($instance, 'tags'), 'options' => $tags_array));
$tags_html = $tag_field->output();
$cols_count_field = new UI_Select_Fox(array('id' => $this->get_field_id('cols_count'), 'name' => $this->get_field_name('cols_count'), 'default' => Utils::array_get($instance, 'cols_count'), 'options' => array(2 => 2, 3 => 3)));
$cols_count_html = $cols_count_field->output();
$posts_count_field = new UI_Input_Fox(array('id' => $this->get_field_id('posts_count'), 'name' => $this->get_field_name('posts_count'), 'value' => Utils::array_get($instance, 'posts_count'), 'placeholder' => __('posts count', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Count of posts', PHOTOLAB_BASE_TM_ALIAS)));
$posts_count_html = $posts_count_field->output();
$posts_offset_field = new UI_Input_Fox(array('id' => $this->get_field_id('posts_offset'), 'name' => $this->get_field_name('posts_offset'), 'value' => Utils::array_get($instance, 'posts_offset'), 'placeholder' => __('posts offset', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Offset', PHOTOLAB_BASE_TM_ALIAS)));
$posts_offset_html = $posts_offset_field->output();
$title_length_field = new UI_Input_Fox(array('id' => $this->get_field_id('title_length'), 'name' => $this->get_field_name('title_length'), 'value' => Utils::array_get($instance, 'title_length'), 'placeholder' => __('title length', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Title length', PHOTOLAB_BASE_TM_ALIAS)));
$title_length_html = $title_length_field->output();
$padding_field = new UI_Input_Fox(array('id' => $this->get_field_id('padding'), 'name' => $this->get_field_name('padding'), 'value' => Utils::array_get($instance, 'padding'), 'placeholder' => __('padding', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Padding', PHOTOLAB_BASE_TM_ALIAS)));
$padding_html = $padding_field->output();
// Show view
echo View::make('widgets/back-end/image-grid', array('title_html' => $title_html, 'categories_html' => $categories_html, 'tags_html' => $tags_html, 'cols_count_html' => $cols_count_html, 'posts_count_html' => $posts_count_html, 'posts_offset_html' => $posts_offset_html, 'title_length_html' => $title_length_html, 'padding_html' => $padding_html));
}
示例5: form
/**
* Back-end widget form.
*
* @see WP_Widget::form()
*
* @param array $instance Previously saved values from database.
*/
public function form($instance)
{
echo View::make('widgets/back-end/google-plus', array('title' => Utils::array_get($instance, 'title'), 'page_id' => Utils::array_get($instance, 'page_id'), 'field_id_title' => $this->get_field_id('title'), 'field_name_title' => $this->get_field_name('title'), 'field_id_page_id' => $this->get_field_id('page_id'), 'field_name_page_id' => $this->get_field_name('page_id')));
}
示例6: form
/**
* Create admin form for widget
*
* @param type $instance array.
*/
public function form($instance)
{
foreach ($this->instance_default as $key => $value) {
$instance[$key] = !empty($instance[$key]) ? $instance[$key] : $value;
}
$this->admin_assets();
$title_field = new UI_Input_Fox(array('id' => $this->get_field_id('title'), 'class' => 'title', 'name' => $this->get_field_name('title'), 'value' => Utils::array_get($instance, 'title'), 'placeholder' => __('New title', PHOTOLAB_BASE_TM_ALIAS)));
$title_html = $title_field->output();
$categories_list = get_categories(array('hide_empty' => 0));
$categories_array = array('0' => 'not selected');
foreach ($categories_list as $category_item) {
$categories_array[$category_item->term_id] = $category_item->name;
}
$category_field = new UI_Select_Fox(array('id' => $this->get_field_id('categories'), 'name' => $this->get_field_name('categories'), 'default' => Utils::array_get($instance, 'categories'), 'options' => $categories_array));
$categories_html = $category_field->output();
$tags_list = get_tags(array('hide_empty' => 0));
$tags_array = array('0' => 'not selected');
foreach ($tags_list as $tag_item) {
$tags_array[$tag_item->term_id] = $tag_item->name;
}
$tag_field = new UI_Select_Fox(array('id' => $this->get_field_id('tags'), 'name' => $this->get_field_name('tags'), 'default' => Utils::array_get($instance, 'tags'), 'options' => $tags_array));
$tags_html = $tag_field->output();
$count_field = new UI_Input_Fox(array('id' => $this->get_field_id('count'), 'name' => $this->get_field_name('count'), 'value' => Utils::array_get($instance, 'count'), 'placeholder' => __('posts count', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Count of posts', PHOTOLAB_BASE_TM_ALIAS)));
$count_html = $count_field->output();
$title_length_field = new UI_Input_Fox(array('id' => $this->get_field_id('title_length'), 'name' => $this->get_field_name('title_length'), 'value' => Utils::array_get($instance, 'title_length'), 'placeholder' => __('symbols length', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Title length', PHOTOLAB_BASE_TM_ALIAS)));
$title_length_html = $title_length_field->output();
$excerpt_length_field = new UI_Input_Fox(array('id' => $this->get_field_id('excerpt_length'), 'name' => $this->get_field_name('excerpt_length'), 'value' => Utils::array_get($instance, 'excerpt_length'), 'placeholder' => __('symbols length', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Excerpt length', PHOTOLAB_BASE_TM_ALIAS)));
$excerpt_length_html = $excerpt_length_field->output();
$button_text_field = new UI_Input_Fox(array('id' => $this->get_field_id('button_text'), 'name' => $this->get_field_name('button_text'), 'value' => Utils::array_get($instance, 'button_text'), 'placeholder' => __('read more', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Button text', PHOTOLAB_BASE_TM_ALIAS)));
$button_text_html = $button_text_field->output();
$show_date_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('show_date'), 'class' => 'pull-right', 'name' => $this->get_field_name('show_date'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'show_date')));
$show_date_html = $show_date_field->output();
$show_author_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('show_author'), 'class' => 'pull-right', 'name' => $this->get_field_name('show_author'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'show_author')));
$show_author_html = $show_author_field->output();
$show_comments_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('show_comments'), 'class' => 'pull-right', 'name' => $this->get_field_name('show_comments'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'show_comments')));
$show_comments_html = $show_comments_field->output();
$show_categories_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('show_categories'), 'class' => 'pull-right', 'name' => $this->get_field_name('show_categories'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'show_categories')));
$show_categories_html = $show_categories_field->output();
$show_tags_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('show_tags'), 'class' => 'pull-right', 'name' => $this->get_field_name('show_tags'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'show_tags')));
$show_tags_html = $show_tags_field->output();
// Show view
echo View::make('widgets/back-end/custom-posts', array('title_html' => $title_html, 'categories_html' => $categories_html, 'tags_html' => $tags_html, 'count_html' => $count_html, 'title_length_html' => $title_length_html, 'excerpt_length_html' => $excerpt_length_html, 'button_text_html' => $button_text_html, 'show_date_html' => $show_date_html, 'show_author_html' => $show_author_html, 'show_comments_html' => $show_comments_html, 'show_categories_html' => $show_categories_html, 'show_tags_html' => $show_tags_html));
}
示例7: form
/**
* Create admin form for widget
*
* @param type $instance array.
*
* @since 1.1
*/
public function form($instance)
{
foreach ($this->instance_default as $key => $value) {
$instance[$key] = !empty($instance[$key]) ? $instance[$key] : $value;
}
$this->admin_assets();
$first_block_field = new UI_Select_Fox(array('id' => $this->get_field_id('first_block'), 'name' => $this->get_field_name('first_block'), 'default' => Utils::array_get($instance, 'first_block'), 'options' => $this->blocks_list));
$first_block_html = $first_block_field->output();
$subscribe_is_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('subscribe_is') . ' subscribe_is', 'class' => 'pull-right', 'name' => $this->get_field_name('subscribe_is'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'subscribe_is')));
$subscribe_is_html = $subscribe_is_field->output();
$subscribe_title_field = new UI_Input_Fox(array('id' => $this->get_field_id('subscribe_title'), 'name' => $this->get_field_name('subscribe_title'), 'value' => Utils::array_get($instance, 'subscribe_title'), 'label' => __('Subscribe title', PHOTOLAB_BASE_TM_ALIAS), 'placeholder' => __('Subscribe title', PHOTOLAB_BASE_TM_ALIAS)));
$subscribe_title_html = $subscribe_title_field->output();
$subscribe_description_field = new UI_Input_Fox(array('id' => $this->get_field_id('subscribe_description'), 'name' => $this->get_field_name('subscribe_description'), 'value' => Utils::array_get($instance, 'subscribe_description'), 'label' => __('Subscribe description', PHOTOLAB_BASE_TM_ALIAS), 'placeholder' => __('Subscribe description', PHOTOLAB_BASE_TM_ALIAS)));
$subscribe_description_html = $subscribe_description_field->output();
$api_key_field = new UI_Input_Fox(array('id' => $this->get_field_id('api_key'), 'name' => $this->get_field_name('api_key'), 'value' => Utils::array_get($instance, 'api_key'), 'label' => __('MailChimp ApiKey', PHOTOLAB_BASE_TM_ALIAS), 'placeholder' => __('MailChimp ApiKey', PHOTOLAB_BASE_TM_ALIAS)));
$api_key_html = $api_key_field->output();
$list_id_field = new UI_Input_Fox(array('id' => $this->get_field_id('list_id'), 'name' => $this->get_field_name('list_id'), 'value' => Utils::array_get($instance, 'list_id'), 'label' => __('MailChimp list id', PHOTOLAB_BASE_TM_ALIAS), 'placeholder' => __('MailChimp list id', PHOTOLAB_BASE_TM_ALIAS)));
$list_id_html = $list_id_field->output();
$success_message_field = new UI_Input_Fox(array('id' => $this->get_field_id('success_message'), 'name' => $this->get_field_name('success_message'), 'value' => Utils::array_get($instance, 'success_message'), 'label' => __('Success message', PHOTOLAB_BASE_TM_ALIAS), 'placeholder' => __('Success', PHOTOLAB_BASE_TM_ALIAS)));
$success_message_html = $success_message_field->output();
$failed_message_field = new UI_Input_Fox(array('id' => $this->get_field_id('failed_message'), 'name' => $this->get_field_name('failed_message'), 'value' => Utils::array_get($instance, 'failed_message'), 'label' => __('Failed message', PHOTOLAB_BASE_TM_ALIAS), 'placeholder' => __('Failed', PHOTOLAB_BASE_TM_ALIAS)));
$failed_message_html = $failed_message_field->output();
$social_is_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('social_is'), 'class' => 'pull-right', 'name' => $this->get_field_name('social_is'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'social_is')));
$social_is_html = $social_is_field->output();
$social_title_field = new UI_Input_Fox(array('id' => $this->get_field_id('social_title'), 'name' => $this->get_field_name('social_title'), 'value' => Utils::array_get($instance, 'social_title'), 'label' => __('Social title', PHOTOLAB_BASE_TM_ALIAS), 'placeholder' => __('Social title', PHOTOLAB_BASE_TM_ALIAS)));
$social_title_html = $social_title_field->output();
$social_description_field = new UI_Input_Fox(array('id' => $this->get_field_id('social_description'), 'name' => $this->get_field_name('social_description'), 'value' => Utils::array_get($instance, 'social_description'), 'label' => __('Social description', PHOTOLAB_BASE_TM_ALIAS), 'placeholder' => __('social description', PHOTOLAB_BASE_TM_ALIAS)));
$social_description_html = $social_description_field->output();
$social_items = array();
$social_buttons = Utils::array_get($instance, 'social_buttons');
if (is_array($social_buttons) && count($social_buttons) > 0) {
foreach ($social_buttons as $key => $button) {
$service_field = new UI_Input_Fox(array('id' => $this->get_field_id('service_' . $key), 'name' => $this->get_field_name('service[]'), 'value' => $button['service'], 'datalist' => $this->social_list, 'placeholder' => __('choose or input social media', PHOTOLAB_BASE_TM_ALIAS)));
$url_field = new UI_Input_Fox(array('id' => $this->get_field_id('url_' . $key), 'name' => $this->get_field_name('url[]'), 'value' => $button['url'], 'placeholder' => __('input url to your page', PHOTOLAB_BASE_TM_ALIAS)));
$social_items[] = array('service' => $service_field->output(), 'url' => $url_field->output());
}
}
$service_field = new UI_Input_Fox(array('id' => $this->get_field_id('service_new'), 'name' => $this->get_field_name('service_new[]'), 'value' => '', 'datalist' => $this->social_list, 'placeholder' => __('choose or input social media', PHOTOLAB_BASE_TM_ALIAS)));
$url_field = new UI_Input_Fox(array('id' => $this->get_field_id('url_new'), 'name' => $this->get_field_name('ur_newl[]'), 'value' => '', 'placeholder' => __('input url to your page', PHOTOLAB_BASE_TM_ALIAS)));
$social_new = array('service' => $service_field->output(), 'url' => $url_field->output());
// Show view
echo View::make('widgets/back-end/subscribe-and-social', array('first_block_html' => $first_block_html, 'subscribe_is_html' => $subscribe_is_html, 'subscribe_title_html' => $subscribe_title_html, 'subscribe_description_html' => $subscribe_description_html, 'api_key_html' => $api_key_html, 'list_id_html' => $list_id_html, 'success_message_html' => $success_message_html, 'failed_message_html' => $failed_message_html, 'social_is_html' => $social_is_html, 'social_title_html' => $social_title_html, 'social_description_html' => $social_description_html, 'social_items' => $social_items, 'social_new' => $social_new));
}
示例8: get_option
/**
* Get single option by key
*
* @return mixed --- option type.
*/
public static function get_option($key)
{
$logo_and_favicon = Utils::array_get((array) get_option('general_site_settings'), 'logo_and_favicon', array('logo_and_favicon' => array()));
return Utils::array_get((array) $logo_and_favicon, $key, '');
}
示例9: form
/**
* Create admin form for widget
*
* @param type $instance array.
* @since 1.1
*/
public function form($instance)
{
$this->admin_assets();
$title_field = new UI_Input_Fox(array('id' => $this->get_field_id('title'), 'name' => $this->get_field_name('title'), 'value' => Utils::array_get($instance, 'title'), 'placeholder' => __('New title', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Title widget', PHOTOLAB_BASE_TM_ALIAS)));
$title_html = $title_field->output();
$users_list = get_users();
foreach ($users_list as $user) {
$users[$user->ID] = $user->display_name;
}
$users_field = new UI_Select_Fox(array('id' => $this->get_field_id('user_id'), 'name' => $this->get_field_name('user_id'), 'default' => Utils::array_get($instance, 'user_id'), 'options' => $users));
$users_html = $users_field->output();
$url_field = new UI_Input_Fox(array('id' => $this->get_field_id('url'), 'name' => $this->get_field_name('url'), 'value' => Utils::array_get($instance, 'url'), 'placeholder' => __('detail url', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Detail url', PHOTOLAB_BASE_TM_ALIAS)));
$url_html = $url_field->output();
$text_link_field = new UI_Input_Fox(array('id' => $this->get_field_id('text_link'), 'name' => $this->get_field_name('text_link'), 'value' => Utils::array_get($instance, 'text_link'), 'placeholder' => __('link text', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Link text', PHOTOLAB_BASE_TM_ALIAS)));
$text_link_html = $text_link_field->output();
$upload_file_field = new UI_Input_Fox(array('id' => $this->get_field_id('upload_image_button'), 'class' => 'upload_image_button button-image', 'type' => 'button', 'name' => $this->get_field_name('upload_image_button'), 'value' => __('Upload image', PHOTOLAB_BASE_TM_ALIAS)));
$upload_html = $upload_file_field->output();
$image_url_field = new UI_Input_Fox(array('id' => $this->get_field_id('image'), 'class' => ' custom-image-url', 'type' => 'hidden', 'name' => $this->get_field_name('image'), 'value' => Utils::array_get($instance, 'image')));
$image_html = $image_url_field->output();
$delete_image_url_field = new UI_Input_Fox(array('id' => $this->get_field_id('delete_image'), 'class' => 'delete_image_url button-image', 'type' => 'button', 'name' => $this->get_field_name('delete_image'), 'value' => __('Delete image', PHOTOLAB_BASE_TM_ALIAS)));
$delete_image_html = $delete_image_url_field->output();
$user_info = get_userdata(Utils::array_get($instance, 'user_id'));
$default_avatar = Utils::assets_url() . '/images/default-avatar.png';
if (!empty($image)) {
$main_avatar = $image;
} else {
$main_avatar = $default_avatar;
}
echo View::make('widgets/back-end/about-author', array('title_html' => $title_html, 'users_html' => $users_html, 'url_html' => $url_html, 'text_link_html' => $text_link_html, 'upload_html' => $upload_html, 'delete_image_html' => $delete_image_html, 'image_html' => $image_html, 'avatar_id' => $this->get_field_id('avatar'), 'default_image' => $default_avatar, 'avatar' => $main_avatar));
}
示例10: form
/**
* Create admin form for widget
*
* @param type $instance array.
*/
public function form($instance)
{
foreach ($this->instance_default as $key => $value) {
$instance[$key] = !empty($instance[$key]) ? $instance[$key] : $value;
}
$title_field = new UI_Input_Fox(array('id' => $this->get_field_id('title'), 'class' => 'title', 'name' => $this->get_field_name('title'), 'value' => Utils::array_get($instance, 'title'), 'placeholder' => __('New title', PHOTOLAB_BASE_TM_ALIAS)));
$title_html = $title_field->output();
$categories_list = get_categories(array('hide_empty' => 0));
$categories_array = array('0' => 'not selected');
foreach ($categories_list as $category_item) {
$categories_array[$category_item->term_id] = $category_item->name;
}
$category_field = new UI_Select_Fox(array('id' => $this->get_field_id('categories'), 'name' => $this->get_field_name('categories'), 'default' => Utils::array_get($instance, 'categories'), 'options' => $categories_array));
$categories_html = $category_field->output();
$tags_list = get_tags(array('hide_empty' => 0));
$tags_array = array('0' => 'not selected');
foreach ($tags_list as $tag_item) {
$tags_array[$tag_item->term_id] = $tag_item->name;
}
$tag_field = new UI_Select_Fox(array('id' => $this->get_field_id('tags'), 'name' => $this->get_field_name('tags'), 'default' => Utils::array_get($instance, 'tags'), 'options' => $tags_array));
$tags_html = $tag_field->output();
$count_field = new UI_Input_Fox(array('id' => $this->get_field_id('count'), 'name' => $this->get_field_name('count'), 'value' => Utils::array_get($instance, 'count'), 'placeholder' => __('posts count', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Count of posts', PHOTOLAB_BASE_TM_ALIAS)));
$count_html = $count_field->output();
$slides_per_view_field = new UI_Input_Fox(array('id' => $this->get_field_id('slides_per_view'), 'name' => $this->get_field_name('slides_per_view'), 'value' => Utils::array_get($instance, 'slides_per_view'), 'placeholder' => __('slides per view', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Items per view', PHOTOLAB_BASE_TM_ALIAS)));
$slides_per_view_html = $slides_per_view_field->output();
$length_field = new UI_Input_Fox(array('id' => $this->get_field_id('length'), 'name' => $this->get_field_name('length'), 'value' => Utils::array_get($instance, 'length'), 'placeholder' => __('symbols length', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Symbols length', PHOTOLAB_BASE_TM_ALIAS)));
$length_html = $length_field->output();
// Show view
echo View::make('widgets/back-end/posts-carousel', array('title_html' => $title_html, 'categories_html' => $categories_html, 'tags_html' => $tags_html, 'count_html' => $count_html, 'slides_per_view_html' => $slides_per_view_html, 'length_html' => $length_html));
}
示例11: compile_statements_cllback
/**
* It's need for PHP 5.2
*
* @param [type] $match array.
* @return string
*/
public function compile_statements_cllback($match)
{
$compiler = $this;
if (method_exists($compiler, $method = 'compile' . ucfirst($match[1]))) {
$match[0] = $compiler->{$method}(Utils::array_get($match, 3));
}
return isset($match[3]) ? $match[0] : $match[0] . $match[2];
}
示例12: form
/**
* Create admin form for widget
*
* @param type $instance array.
*/
public function form($instance)
{
// Include assets
$this->admin_assets();
$title_field = new UI_Input_Fox(array('id' => $this->get_field_id('title'), 'class' => 'title', 'name' => $this->get_field_name('title'), 'value' => Utils::array_get($instance, 'title'), 'placeholder' => __('New title', PHOTOLAB_BASE_TM_ALIAS)));
$title_html = $title_field->output();
$theme_field = new UI_Select_Fox(array('id' => $this->get_field_id('theme'), 'name' => $this->get_field_name('theme'), 'default' => Utils::array_get($instance, 'theme'), 'options' => $this->themes));
$theme_html = $theme_field->output();
$switcher = new UI_Switcher_Fox(array('id' => $this->get_field_id('show_count'), 'class' => 'pull-right', 'name' => $this->get_field_name('show_count'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'show_count')));
$show_count_html = $switcher->output();
$categories_list = get_categories(array('hide_empty' => 0));
$categories_array = array('1' => 'default');
foreach ($categories_list as $category_item) {
$categories_array[$category_item->term_id] = $category_item->name;
}
// Universal
$default_image = Utils::assets_url() . '/images/default-image.jpg';
$categories = Utils::array_get($instance, 'categories');
$tiles_items = array();
if (is_array($categories) && count($categories) > 0) {
foreach ($categories as $key => $category_item) {
$category_field = new UI_Select_Fox(array('id' => $this->get_field_id('category_' . $key), 'name' => $this->get_field_name('category[]'), 'default' => $category_item['category'], 'options' => $categories_array));
$image_field = new UI_Input_Fox(array('id' => $this->get_field_id('image_' . $key), 'class' => 'custom-image-url', 'type' => 'hidden', 'name' => $this->get_field_name('image[]'), 'value' => $categories[$key]['image']));
$tiles_items[] = array('src' => $categories[$key]['image'], 'image' => $image_field->output(), 'category' => $category_field->output());
}
}
$category_field = new UI_Select_Fox(array('id' => $this->get_field_id('category_new'), 'name' => $this->get_field_name('category_new[]'), 'default' => 0, 'options' => $categories_array));
$image_field = new UI_Input_Fox(array('id' => $this->get_field_id('image_new'), 'class' => 'custom-image-url', 'type' => 'hidden', 'name' => $this->get_field_name('image_new[]'), 'value' => ''));
$tile_new = array('image' => $image_field->output(), 'category' => $category_field->output());
// show view
echo View::make('widgets/back-end/categories-tiles', array('title_html' => $title_html, 'theme_html' => $theme_html, 'show_count_html' => $show_count_html, 'tiles_items' => $tiles_items, 'default_image' => $default_image, 'tile_new' => $tile_new));
}
示例13: form
/**
* Back-end widget form.
*
* @see WP_Widget::form()
*
* @param array $instance Previously saved values from database.
*/
public function form($instance)
{
echo View::make('widgets/back-end/instagram', array('title' => Utils::array_get($instance, 'title'), 'user' => Utils::array_get($instance, 'user'), 'number_posts' => Utils::array_get($instance, 'number_posts'), 'client_id' => Utils::array_get($instance, 'client_id'), 'field_id_title' => $this->get_field_id('title'), 'field_name_title' => $this->get_field_name('title'), 'field_id_user' => $this->get_field_id('user'), 'field_name_user' => $this->get_field_name('user'), 'field_id_number_posts' => $this->get_field_id('number_posts'), 'field_name_number_posts' => $this->get_field_name('number_posts'), 'field_id_client_id' => $this->get_field_id('client_id'), 'field_name_client_id' => $this->get_field_name('client_id')));
}
示例14: form
/**
* Create admin form for widget
*
* @param type $instance array.
*/
public function form($instance)
{
foreach ($this->instance_default as $key => $value) {
$instance[$key] = !empty($instance[$key]) ? $instance[$key] : $value;
}
$title_field = new UI_Input_Fox(array('id' => $this->get_field_id('title'), 'class' => 'title', 'name' => $this->get_field_name('title'), 'value' => Utils::array_get($instance, 'title'), 'placeholder' => __('New title', PHOTOLAB_BASE_TM_ALIAS)));
$title_html = $title_field->output();
$categories_list = get_categories(array('hide_empty' => 0));
$categories_array = array('0' => 'not selected');
foreach ($categories_list as $category_item) {
$categories_array[$category_item->term_id] = $category_item->name;
}
$category_field = new UI_Select_Fox(array('id' => $this->get_field_id('categories'), 'name' => $this->get_field_name('categories'), 'default' => Utils::array_get($instance, 'categories'), 'options' => $categories_array));
$categories_html = $category_field->output();
$tags_list = get_tags(array('hide_empty' => 0));
$tags_array = array('0' => 'not selected');
foreach ($tags_list as $tag_item) {
$tags_array[$tag_item->term_id] = $tag_item->name;
}
$tag_field = new UI_Select_Fox(array('id' => $this->get_field_id('tags'), 'name' => $this->get_field_name('tags'), 'default' => Utils::array_get($instance, 'tags'), 'options' => $tags_array));
$tags_html = $tag_field->output();
$count_field = new UI_Input_Fox(array('id' => $this->get_field_id('count'), 'name' => $this->get_field_name('count'), 'value' => Utils::array_get($instance, 'count'), 'placeholder' => __('posts count', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Count of posts', PHOTOLAB_BASE_TM_ALIAS)));
$count_html = $count_field->output();
$button_is_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('button_is'), 'class' => 'pull-right', 'name' => $this->get_field_name('button_is'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'button_is')));
$button_is_html = $button_is_field->output();
$button_text_field = new UI_Input_Fox(array('id' => $this->get_field_id('button_text'), 'name' => $this->get_field_name('button_text'), 'value' => Utils::array_get($instance, 'button_text'), 'placeholder' => __('read more...', PHOTOLAB_BASE_TM_ALIAS), 'label' => __('Button text', PHOTOLAB_BASE_TM_ALIAS)));
$button_text_html = $button_text_field->output();
$arrows_is_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('arrows_is'), 'class' => 'pull-right', 'name' => $this->get_field_name('arrows_is'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'arrows_is')));
$arrows_is_html = $arrows_is_field->output();
$bullets_is_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('bullets_is'), 'class' => 'pull-right', 'name' => $this->get_field_name('bullets_is'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'bullets_is')));
$bullets_is_html = $bullets_is_field->output();
$thumbnails_is_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('thumbnails_is'), 'class' => 'pull-right', 'name' => $this->get_field_name('thumbnails_is'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'thumbnails_is')));
$thumbnails_is_html = $thumbnails_is_field->output();
$autoplay_field = new UI_Switcher_Fox(array('id' => $this->get_field_id('autoplay'), 'class' => 'pull-right', 'name' => $this->get_field_name('autoplay'), 'values' => array('true' => 'ON', 'false' => 'OFF'), 'default' => Utils::array_get($instance, 'autoplay')));
$autoplay_html = $autoplay_field->output();
// Show view
echo View::make('widgets/back-end/posts-slider', array('title_html' => $title_html, 'categories_html' => $categories_html, 'tags_html' => $tags_html, 'count_html' => $count_html, 'button_is_html' => $button_is_html, 'button_is' => $this->get_field_name('button_is'), 'button_text_html' => $button_text_html, 'arrows_is_html' => $arrows_is_html, 'bullets_is_html' => $bullets_is_html, 'thumbnails_is_html' => $thumbnails_is_html, 'autoplay_html' => $autoplay_html));
}
示例15: get_storage_folder_path
/**
* Get storage path
*
* @return string storage folder path
*/
public static function get_storage_folder_path()
{
$upload_dir = wp_upload_dir();
return sprintf('%2$s%1$sapp%1$s%3$s%1$s', DIRECTORY_SEPARATOR, Utils::array_get($upload_dir, 'basedir', ''), self::STORAGE_FOLDER);
}