本文整理汇总了PHP中ThemeHelper类的典型用法代码示例。如果您正苦于以下问题:PHP ThemeHelper类的具体用法?PHP ThemeHelper怎么用?PHP ThemeHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ThemeHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getPost
function getPost()
{
$data = new stdClass();
$categoryId = (int) get_query_var('cat');
if (is_tag()) {
$data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
$tagQuery = get_query_var('tag');
$tagData = get_tags(array('slug' => $tagQuery));
$data->post->post_title = esc_html($tagData[0]->name);
} elseif (is_category($categoryId)) {
$category = get_category($categoryId);
$data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
$data->post->post_title = ThemeHelper::esc_html($category->name);
} elseif (is_day()) {
$data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
$data->post->post_title = get_the_date();
} elseif (is_archive()) {
$data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
$data->post->post_title = single_month_title(' ', false);
} elseif (is_search()) {
$data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
$data->post->post_title = sprintf(__('Search result for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
} elseif (is_404()) {
$data->post = get_post(ThemeOption::getOption('page_404_page_id'));
$data->post->post_title = $data->post->post_title;
} else {
return false;
}
return $data;
}
开发者ID:annguyenit,项目名称:HawaiiEducation,代码行数:30,代码来源:Theme.Post.class.php
示例2: createPagination
function createPagination($query)
{
global $wp_rewrite;
$total = $query->max_num_pages;
$current = max(1, ThemeHelper::getPageNumber());
$Validation = new ThemeValidation();
$pagination = array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'current' => $current, 'total' => $total, 'next_text' => __(' >', THEME_CONTEXT), 'prev_text' => __('< ', THEME_CONTEXT));
if ($wp_rewrite->using_permalinks()) {
$pagination['base'] = user_trailingslashit(trailingslashit(remove_query_arg('s', get_pagenum_link(1))) . 'page/%#%/', 'paged');
}
if (is_search()) {
$pagination['add_args'] = array('s' => urlencode(get_query_var('s')));
}
$html = paginate_links($pagination);
if ($Validation->isNotEmpty($html)) {
$html = '
<div class="theme-blog-pagination-box">
<div class="theme-blog-pagination">
' . $html . '
</div>
</div>
';
}
return $html;
}
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:25,代码来源:Theme.Blog.class.php
示例3: theme_settings_form
public function theme_settings_form()
{
$settings = Setting::first();
$user = Auth::user();
$data = array('settings' => $settings, 'admin_user' => $user, 'theme_settings' => ThemeHelper::getThemeSettings());
return View::make('Theme::includes.settings', $data);
}
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:7,代码来源:AdminThemeSettingsController.php
示例4: outputWP
function outputWP($format = false)
{
ob_start();
include locate_template($this->path);
$value = ob_get_clean();
if ($format) {
$value = ThemeHelper::formatCode($value);
}
return $value;
}
开发者ID:slavai,项目名称:sadick,代码行数:10,代码来源:Theme.Template.class.php
示例5: adminSaveMetaBox
function adminSaveMetaBox($postId)
{
if ($_POST) {
if (ThemeHelper::checkSavePost($postId, THEME_CONTEXT . '_meta_box_widget_area_noncename', 'adminSaveMetaBox') === false) {
return false;
}
$option = ThemeHelper::getPostOption('widget_area');
update_post_meta($postId, THEME_OPTION_PREFIX, $option);
}
}
开发者ID:slavai,项目名称:sadick,代码行数:10,代码来源:Theme.WidgetArea.class.php
示例6: index
public function index()
{
if (\Input::get('theme')) {
\Cookie::queue('theme', \Input::get('theme'), 100);
return Redirect::to('/')->withCookie(cookie('theme', \Input::get('theme'), 100));
}
$data = array('videos' => Video::where('active', '=', '1')->orderBy('created_at', 'DESC')->simplePaginate($this->videos_per_page), 'current_page' => 1, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'pagination_url' => '/videos', 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
//dd($data['videos']);
return View::make('Theme::home', $data);
}
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:10,代码来源:ThemeHomeController.php
示例7: index
public function index()
{
$search_value = Input::get('value');
if (empty($search_value)) {
return Redirect::to('/');
}
$videos = Video::where('active', '=', 1)->where('title', 'LIKE', '%' . $search_value . '%')->orderBy('created_at', 'desc')->get();
$posts = Post::where('active', '=', 1)->where('title', 'LIKE', '%' . $search_value . '%')->orderBy('created_at', 'desc')->get();
$data = array('videos' => $videos, 'posts' => $posts, 'search_value' => $search_value, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
return View::make('Theme::search-list', $data);
}
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:11,代码来源:ThemeSearchController.php
示例8: category
public function category($category)
{
$page = Input::get('page');
if (!empty($page)) {
$page = Input::get('page');
} else {
$page = 1;
}
$cat = PostCategory::where('slug', '=', $category)->first();
$data = array('posts' => Post::where('active', '=', '1')->where('post_category_id', '=', $cat->id)->orderBy('created_at', 'DESC')->simplePaginate($this->posts_per_page), 'current_page' => $page, 'category' => $cat, 'page_title' => 'Posts - ' . $cat->name, 'page_description' => 'Page ' . $page, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'pagination_url' => '/posts/category/' . $category, 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
return View::make('Theme::post-list', $data);
}
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:12,代码来源:ThemePostController.php
示例9: form
function form($instance)
{
$data = array();
if (is_array($instance['_data']['field'])) {
foreach ($instance['_data']['field'] as $value) {
ThemeHelper::removeUIndex($instance, $value);
ThemeHelper::removeUIndex($data['option'][$value], 'id', 'name', 'value');
$data['option'][$value]['id'] = $this->get_field_id($value);
$data['option'][$value]['name'] = $this->get_field_name($value);
$data['option'][$value]['value'] = $instance[$value];
}
}
$Template = new ThemeTemplate($data, THEME_PATH_TEMPLATE . 'admin/' . $instance['_data']['file']);
echo $Template->output(true);
}
开发者ID:annguyenit,项目名称:fable.local,代码行数:15,代码来源:Theme.Widget.class.php
示例10: import
function import()
{
$response = array('global' => array('error' => 1));
$Notice = new ThemeNotice();
$result = $this->download();
if ($result) {
$response['global']['error'] = 0;
} else {
$Notice->addError(ThemeHelper::getFormName('import_google_font', false), ThemeHelper::esc_html('Cannot import list of fonts'));
$response['local'] = $Notice->getError();
}
$response['global']['notice'] = $Notice->createHTML(THEME_PATH_TEMPLATE . 'notice.php');
echo json_encode($response);
exit;
}
开发者ID:annguyenit,项目名称:fable.local,代码行数:15,代码来源:Theme.GoogleFont.class.php
示例11: show_favorites
public function show_favorites()
{
if (!Auth::guest()) {
$page = Input::get('page');
if (empty($page)) {
$page = 1;
}
$favorites = Favorite::where('user_id', '=', Auth::user()->id)->orderBy('created_at', 'desc')->get();
$favorite_array = array();
foreach ($favorites as $key => $fave) {
array_push($favorite_array, $fave->video_id);
}
$videos = Video::where('active', '=', '1')->whereIn('id', $favorite_array)->paginate(12);
$data = array('videos' => $videos, 'page_title' => ucfirst(Auth::user()->username) . '\'s Favorite Videos', 'current_page' => $page, 'page_description' => 'Page ' . $page, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'pagination_url' => '/favorites', 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
return View::make('Theme::video-list', $data);
} else {
return Redirect::to('videos');
}
}
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:19,代码来源:ThemeFavoriteController.php
示例12: start_el
function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
{
$this->iconClass = null;
if ($depth == 0) {
$this->icon = $object->icon;
$this->mega_menu_layout_column_index = 0;
$this->mega_menu_enable = $object->mega_menu_enable;
$this->mega_menu_layout = $object->mega_menu_layout;
if ($object->icon != '-1') {
$this->iconClass = 'pb-menu-icon pb-menu-icon-' . ThemeHelper::createHash($object->icon);
}
}
if ($this->mega_menu_enable == 1) {
if ($depth == 0 || $depth == 2) {
$output .= '<li class="' . join(' ', (array) $object->classes) . ($depth == 0 ? ' sf-mega-enable-1' : null) . ' ' . $this->iconClass . ' ' . '">';
}
if ($depth == 1) {
$Layout = new ThemeLayout();
$class = array('sf-mega-section', $Layout->getLayoutColumnCSSClass($this->mega_menu_layout, $this->mega_menu_layout_column_index, 'theme-layout-column-'));
$output .= '
<div' . ThemeHelper::createClassAttribute($class) . '>
';
$this->mega_menu_layout_column_index++;
}
if ($depth == 1) {
$output .= '
<span class="sf-mega-header">' . esc_html($object->title) . '</span>
';
} else {
$output .= '
<a href="' . esc_attr($object->url) . '"><span></span>' . $object->title . '</a>
';
}
} else {
$output .= '
<li class="' . join(' ', (array) $object->classes) . ($depth == 0 ? ' sf-mega-enable-0' : null) . ' ' . $this->iconClass . ' ' . '">
<a href="' . esc_attr($object->url) . '"><span></span>' . $object->title . '</a>
';
}
}
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:40,代码来源:Theme.MenuWalker.class.php
示例13: init
function init()
{
if (is_admin()) {
return;
}
if (ThemeOption::getOption('maintenance_mode_enable') != 1) {
return;
}
$user = wp_get_current_user();
if (in_array($user->data->ID, (array) ThemeOption::getOption('maintenance_mode_user_id'))) {
return;
}
$address = array_map('trim', mb_split("\n", ThemeOption::getOption('maintenance_mode_ip_address')));
if (in_array(ThemeHelper::getVisitorIP(), $address)) {
return;
}
$page = get_post((int) ThemeOption::getOption('maintenance_mode_post_id'));
if (is_null($page)) {
return;
}
add_action('wp_head', array($this, 'filterWPHead'));
}
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:22,代码来源:Theme.MaintenanceMode.class.php
示例14: ThemeValidation
$Validation = new ThemeValidation();
$WidgetArea = new ThemeWidgetArea();
$widgetAreaData = $WidgetArea->getWidgetAreaByPost($fable_parentPost->post, true, true);
$query = $Blog->getPost();
$postCount = count($query->posts);
if ($postCount) {
?>
<div class="theme-clear-fix">
<ul class="theme-reset-list theme-clear-fix theme-blog">
<?php
while ($query->have_posts()) {
$query->the_post();
$excerpt = apply_filters('the_content', get_the_excerpt());
$option = ThemeOption::getPostMeta($post);
ThemeHelper::removeUIndex($option, 'post_type');
$visibleOption = array();
$visibleOption['post_tag_visible'] = ThemeOption::getGlobalOption($post, 'post_tag_visible');
$visibleOption['post_author_visible'] = ThemeOption::getGlobalOption($post, 'post_author_visible');
$visibleOption['post_category_visible'] = ThemeOption::getGlobalOption($post, 'post_category_visible');
$visibleOption['post_comment_count_visible'] = ThemeOption::getGlobalOption($post, 'post_comment_count_visible') && comments_open(get_the_id());
?>
<li id="post-<?php
the_ID();
?>
" <?php
post_class('theme-clear-fix theme-post theme-post-type-' . (is_sticky() ? 'sticky' : $option['post_type']));
?>
>
<?php
$Post->formatPostDate($post->post_date, $day, $month, $year);
开发者ID:slavai,项目名称:sadick,代码行数:31,代码来源:blog-content.php
示例15: esc_html_e
?>
</h5>
<span class="to-legend"><?php
esc_html_e('Line height with selected unit.', THEME_DOMAIN);
?>
</span>
<div>
<input type="text" name="<?php
ThemeHelper::getFormName('font_h5_line_height');
?>
" id="<?php
ThemeHelper::getFormName('font_h5_line_height');
?>
" value="<?php
echo ThemeHelper::esc_attr($this->data['option']['font_h5_line_height']);
?>
" maxlength="255"/>
</div>
</li>
</ul>
<script type="text/javascript">
jQuery(document).ready(function($)
{
var element=$('.to').themeOptionElement();;
element.createGoogleFontAutocomplete('#<?php
ThemeHelper::getFormName('font_h5_family_google');
?>
');
});
</script>
开发者ID:slavai,项目名称:sadick,代码行数:31,代码来源:font_header_h5.php
示例16: setPostMetaDefault
function setPostMetaDefault(&$meta, $part = 'all')
{
if (in_array($part, array('general', 'all'))) {
ThemeHelper::setDefaultOption($meta, 'widget_area_footer_layout', '33x33x33');
}
}
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:6,代码来源:Theme.WidgetArea.class.php
示例17: index
/**
* Setup the layout used by the controller.
*
* @return void
*/
public function index()
{
$data = array('admin_user' => Auth::user(), 'themes' => ThemeHelper::get_themes(), 'active_theme' => Setting::first()->theme);
return View::make('admin.themes.index', $data);
}
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:10,代码来源:AdminThemesController.php
示例18: activatorImage
/**
* One stop shop for adding activate/deactivate functionality to your ActiveRecord
*
* @param ActiveRecord object that has 'active' in its table
*/
public static function activatorImage($ARobject, $opts = NULL)
{
global $siteDomain;
if (!is_null($opts)) {
extract($opts);
if ($success) {
$success = ", " . $success;
}
}
if (!in_array('active', array_keys($ARobject->getColumns()))) {
throw new Exception('This object does not have an \'active\' column.');
}
if (AccelObject::backend()) {
$activeToggleUrl = "http://" . ThemeHelper::singleton()->siteDomain() . "/accelsite/admin/?adminAction=activeToggle&adminLayout=empty";
} else {
$activeToggleUrl = "/?ado=genericActiveToggle&layout=empty";
}
$js = "\n \$('.activeToggle').click(function() {\n \$(this).html('" . str_replace('\'', '\\\'', self::adminIcon('activeToggleLoader')) . "');\n \$(this).load('{$activeToggleUrl}&ajax=true&activeToggle=' + \$(this).attr('myID') + '&toggleClass=' + \$(this).attr('myClass') {$success});\n return false;\n });";
AccelJS::findThis()->ready($js);
return "<a href='#' myID='" . $ARobject->id() . "' myClass='" . $ARobject->getClass() . "' class='activeToggle'>" . self::activeImage($ARobject->active()) . "</a>";
}
开发者ID:netacceleration,项目名称:accelpress,代码行数:26,代码来源:FormBuilder.php
示例19: addComment
function addComment()
{
global $wpdb;
$Validation = new ThemeValidation();
$response = array('error' => 0, 'info' => null, 'changeURL' => '');
$data = array('author' => null, 'email' => null, 'url' => null, 'comment' => null, 'comment_post_ID' => 0, 'comment_parent' => 0);
foreach ($data as $index => $value) {
if (array_key_exists($index, $_POST)) {
$data[$index] = $_POST[$index];
}
}
if (!is_user_logged_in()) {
if ($Validation->isEmpty($data['author']) && get_option('require_name_email') == 1) {
$response['error'] = 1;
$response['info'][] = array('fieldId' => 'author', 'message' => esc_html__('Please enter your name.', THEME_DOMAIN));
}
if (!$Validation->isEmailAddress($data['email']) && get_option('require_name_email') == 1) {
$response['error'] = 1;
$response['info'][] = array('fieldId' => 'email', 'message' => esc_html__('Please enter valid e-mail address.', THEME_DOMAIN));
}
if (!$Validation->isURL($data['url'], true)) {
$response['error'] = 1;
$response['info'][] = array('fieldId' => 'url', 'message' => esc_html__('Please enter valid URL address.', THEME_DOMAIN));
}
}
if ($Validation->isEmpty($data['comment'])) {
$response['error'] = 1;
$response['info'][] = array('fieldId' => 'comment', 'message' => esc_html__('Please enter your message.', THEME_DOMAIN));
}
if ($response['error'] == 1) {
$this->createResponse($response);
}
$data = ThemeHelper::stripslashesPOST($data);
$insertData = array('comment_post_ID' => (int) $data['comment_post_ID'], 'comment_content' => $data['comment'], 'comment_parent' => (int) $data['comment_parent'], 'comment_date' => current_time('mysql'), 'comment_approved' => $this->comment_moderation);
if (!is_user_logged_in()) {
$insertData['comment_author'] = $data['author'];
$insertData['comment_author_url'] = ThemeHelper::addProtocolName($data['url']);
$insertData['comment_author_email'] = $data['email'];
} else {
$user = wp_get_current_user();
$insertData['comment_author'] = $user->display_name;
$insertData['comment_author_email'] = $user->user_email;
}
$commentId = wp_insert_comment($insertData);
if ($commentId) {
query_posts('p=' . (int) $data['comment_post_ID'] . '&post_type=post');
if (have_posts()) {
the_post();
if ((int) $data['comment_parent'] == 0 || $this->thread_comments == 0) {
$query = 'select count(*) as count from ' . $wpdb->comments . ' where comment_approved=1 and comment_post_ID=' . (int) get_the_ID() . ($this->thread_comments == 1 ? ' and comment_parent=0' : null);
$parent = $wpdb->get_row($query);
if ($this->comments_per_page > 0) {
$_GET['cpage'] = ceil($parent->count / $this->comments_per_page);
} else {
$_GET['cpage'] = 1;
}
$response['changeURL'] = '#cpage-' . $_GET['cpage'];
} else {
$_GET['cpage'] = (int) $_POST['cpage'];
}
$response['cpage'] = (int) $_GET['cpage'];
$response['commentId'] = (int) $commentId;
ob_start();
comments_template();
$response['html'] = ob_get_contents();
ob_end_clean();
}
$response['comment_id'] = $commentId;
$response['error'] = 0;
$response['info'][] = array('fieldId' => 'submit', 'message' => esc_html__('Your comment has been added.', THEME_DOMAIN));
} else {
$response['error'] = 1;
$response['info'][] = array('fieldId' => 'submit', 'message' => esc_html__('Your comment could not be added.', THEME_DOMAIN));
}
$this->createResponse($response);
}
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:76,代码来源:Theme.Comment.class.php
示例20: esc_html_e
<ul class="to-form-field-list">
<li>
<h5><?php
esc_html_e('404 error page', THEME_DOMAIN);
?>
</h5>
<span class="to-legend"><?php
esc_html_e('Get settings for 404 page from selected page.', THEME_DOMAIN);
?>
</span>
<div class="to-clear-fix">
<select name="<?php
ThemeHelper::getFormName('page_404_page_id');
?>
" id="<?php
ThemeHelper::getFormName('page_404_page_id');
?>
">
<?php
foreach ($this->data['dictionary']['page'] as $value) {
echo '<option value="' . ThemeHelper::esc_attr($value->ID) . '" ' . ThemeHelper::selectedIf($this->data['option']['page_404_page_id'], $value->ID, false) . '>' . ThemeHelper::esc_html($value->post_title) . '</option>';
}
?>
</select>
</div>
</li>
</ul>
开发者ID:slavai,项目名称:sadick,代码行数:27,代码来源:general_page.php
注:本文中的ThemeHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论