本文整理汇总了PHP中get_page_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_page_link函数的具体用法?PHP get_page_link怎么用?PHP get_page_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_page_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cached_page_links
/**
* Page links needed for Constants.
*
* Page links are cached into the s2Member options on 15 min intervals.
* This allows the API Constants to provide quick access to them without being
* forced to execute {@link http://codex.wordpress.org/Function_Reference/get_page_link get_page_link()}
* all the time, which piles up DB queries.
*
* @package s2Member\Cache
* @since 3.5
*
* @return array Array of cached Page links.
*/
public static function cached_page_links()
{
do_action("ws_plugin__s2member_before_cached_page_links", get_defined_vars());
/**/
$lwp = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
$mop = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
$fdlep = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
/**/
$lwp_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
$mop_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
$fdlep_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
/**/
$links = array("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
/**/
if (isset($lwp_cache["page"], $lwp_cache["time"], $lwp_cache["link"]) && $lwp_cache["page"] === $lwp && $lwp_cache["time"] >= strtotime("-15 minutes") && $lwp_cache["link"]) {
$links["login_welcome_page"] = $lwp_cache["link"];
} else {
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $lwp;
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = time();
$links["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link($lwp);
/**/
$cache_needs_updating = true;
/* Flag for cache update. */
}
/**/
if (isset($mop_cache["page"], $mop_cache["time"], $mop_cache["link"]) && $mop_cache["page"] === $mop && $mop_cache["time"] >= strtotime("-15 minutes") && $mop_cache["link"]) {
$links["membership_options_page"] = $mop_cache["link"];
} else {
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $mop;
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = time();
$links["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link($mop);
/**/
$cache_needs_updating = true;
/* Flag for cache update. */
}
/**/
if (isset($fdlep_cache["page"], $fdlep_cache["time"], $fdlep_cache["link"]) && $fdlep_cache["page"] === $fdlep && $fdlep_cache["time"] >= strtotime("-15 minutes") && $fdlep_cache["link"]) {
$links["file_download_limit_exceeded_page"] = $fdlep_cache["link"];
} else {
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $fdlep;
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = time();
$links["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link($fdlep);
/**/
$cache_needs_updating = true;
/* Flag for cache update. */
}
/**/
if ($cache_needs_updating) {
update_option("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
}
/**/
$scheme = is_ssl() ? "https" : "http";
/* SSL mode? */
foreach ($links as &$link) {
/* Conversions for SSL and non-SSL mode. */
$link = preg_replace("/^https?\\:\\/\\//i", $scheme . "://", $link);
}
/**/
return apply_filters("ws_plugin__s2member_cached_page_links", $links, get_defined_vars());
}
示例2: widget
/**
* Echo the widget content.
*
* @param array $args Display arguments including `before_title`, `after_title`,
* `before_widget`, and `after_widget`.
* @param array $instance The settings for the particular instance of the widget.
*/
function widget($args, $instance)
{
// Merge with defaults.
$instance = wp_parse_args((array) $instance, $this->defaults);
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title'];
}
$text = '';
if (!empty($instance['alignment'])) {
$text .= '<span class="align' . esc_attr($instance['alignment']) . '">';
}
$text .= get_avatar($instance['user'], $instance['size']);
if (!empty($instance['alignment'])) {
$text .= '</span>';
}
if ('text' === $instance['author_info']) {
$text .= $instance['bio_text'];
} else {
$text .= get_the_author_meta('description', $instance['user']);
}
$text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), $instance['page_link_text']) : '';
echo wpautop($text);
// If posts link option checked, add posts link to output.
$display_name = get_the_author_meta('display_name', $instance['user']);
$user_name = !empty($display_name) && genesis_a11y('screen-reader-text') ? '<span class="screen-reader-text">' . $display_name . ': </span>' : '';
if ($instance['posts_link']) {
printf('<div class="posts_link posts-link"><a href="%s">%s%s</a></div>', get_author_posts_url($instance['user']), $user_name, __('View My Blog Posts', 'genesis'));
}
echo $args['after_widget'];
}
示例3: url_shortcode
function url_shortcode($atts)
{
// Attributes
extract(shortcode_atts(array('type' => '', 'id' => '0', 'path' => '', 'title' => '', 'action' => '', 'class' => ''), $atts));
if (!$id && !$path && !$title && !$action) {
return home_url();
} else {
$page_id = 0;
if ($id && is_numeric($id)) {
$page_id = $id;
}
if ($path != '') {
$page_id = get_page_by_path($path);
}
if ($title != '') {
$page_id = get_page_by_title($title);
}
if ($action != '') {
if ($action == 'logout') {
return wp_logout_url();
}
}
if ($page_id) {
return get_page_link($page_id);
} else {
return null;
}
}
}
示例4: ti_course
/**
* Handle the course shortcode.
*/
function ti_course($args, $content)
{
global $ti_course_items;
$ti_course_items = array();
do_shortcode($content);
$tab = 0;
if (array_key_exists("tab", $_REQUEST) && $_REQUEST["tab"]) {
$tab = $_REQUEST["tab"];
}
$s = "<div class='content-tab-wrapper'>";
$s .= "<ul class='content-tab-list'>";
$index = 0;
foreach ($ti_course_items as $courseItem) {
$link = get_page_link($current->ID) . "?tab=" . $index;
$sel = "";
if ($index == $tab) {
$sel = "class='selected'";
}
$s .= "<li {$sel}>";
$s .= "<a href='{$link}'>{$courseItem[title]}</a>";
$s .= "</li>";
$index++;
}
$s .= "</ul>";
$s .= "<div class='content-tab-content'>";
$s .= do_shortcode($ti_course_items[$tab]["content"]);
$s .= "</div>";
$s .= '</div>';
return $s;
}
示例5: run_checks
/**
* Runs checks for necessary config options.
*
* @return void Method does not return.
*/
public function run_checks()
{
$role = get_role('administrator');
$current_user = get_userdata(get_current_user_id());
if (!is_object($role) || !is_object($current_user) || !$role->has_cap('manage_ai1ec_options') || defined('DOING_AJAX') && DOING_AJAX) {
return;
}
do_action('ai1ec_env_check');
global $plugin_page;
$settings = $this->_registry->get('model.settings');
$option = $this->_registry->get('model.option');
$notification = $this->_registry->get('notification.admin');
$created_calendar_page = false;
// check if is set calendar page
if (!$settings->get('calendar_page_id')) {
$calendar_page_id = wp_insert_post(array('post_title' => 'Calendar', 'post_type' => 'page', 'post_status' => 'publish', 'comment_status' => 'closed'));
$settings->set('calendar_page_id', $calendar_page_id);
$created_calendar_page = true;
}
if ($plugin_page !== AI1EC_PLUGIN_NAME . '-settings' && $created_calendar_page) {
if ($current_user->has_cap('manage_ai1ec_options')) {
$msg = sprintf(Ai1ec_I18n::__('The plugin is successfully installed! <a href="%s">Add some events</a> and see them on your <a href="%s">Calendar page</a>.<br />Visit the <a href="%s">Settings page</a> to configure the plugin and get most of it.'), 'post-new.php?post_type=ai1ec_event', get_page_link($calendar_page_id), ai1ec_admin_url(AI1EC_SETTINGS_BASE_URL));
$notification->store($msg, 'updated', 2, array(Ai1ec_Notification_Admin::RCPT_ADMIN));
} else {
$msg = Ai1ec_I18n::__('The plugin is installed, but has not been configured. Please log in as an Administrator to set it up.');
$notification->store($msg, 'updated', 2, array(Ai1ec_Notification_Admin::RCPT_ALL));
}
return;
}
// Tell user to sign in to API in order to use Feeds
$ics_current_db_version = $option->get(Ai1ecIcsConnectorPlugin::ICS_OPTION_DB_VERSION);
if ($ics_current_db_version != null && $ics_current_db_version != '') {
$rows = $this->_registry->get('dbi.dbi')->select('ai1ec_event_feeds', array('feed_id'));
$api_reg = $this->_registry->get('model.api.api-registration');
$is_signed = $api_reg->is_signed();
if (0 < count($rows) && !$is_signed) {
$msg = Ai1ec_I18n::__('<b>ACTION REQUIRED!</b> Please, <a href="edit.php?post_type=ai1ec_event&page=all-in-one-event-calendar-settings">sign</a> into Timely Network to continue syncing your imported events.');
$notification->store($msg, 'error', 0, array(Ai1ec_Notification_Admin::RCPT_ADMIN), false);
}
}
// Check for needed PHP extensions.
if (!function_exists('iconv') && !$option->get('ai1ec_iconv_notification')) {
$msg = Ai1ec_I18n::__('PHP extension "iconv" needed for All-In-One-Event-Calendar is missing. Please, check your PHP configuration.<br />');
$notification->store($msg, 'error', 0, array(Ai1ec_Notification_Admin::RCPT_ADMIN), true);
$option->set('ai1ec_iconv_notification', true);
}
if (!function_exists('mb_check_encoding') && !$option->get('ai1ec_mbstring_notification')) {
$msg = Ai1ec_I18n::__('PHP extension "mbstring" needed for All-In-One-Event-Calendar is missing. Please, check your PHP configuration.<br />');
$notification->store($msg, 'error', 0, array(Ai1ec_Notification_Admin::RCPT_ADMIN), true);
$option->set('ai1ec_mbstring_notification', true);
}
global $wp_rewrite;
$option = $this->_registry->get('model.option');
$rewrite = $option->get('ai1ec_force_flush_rewrite_rules');
if (!$rewrite || !is_object($wp_rewrite) || !isset($wp_rewrite->rules) || 0 === count($wp_rewrite->rules)) {
return;
}
$this->_registry->get('rewrite.helper')->flush_rewrite_rules();
$option->set('ai1ec_force_flush_rewrite_rules', false);
}
示例6: jobman_gxs_buildmap
function jobman_gxs_buildmap()
{
global $wpdb;
$options = get_option('jobman_options');
if (!$options['plugins']['gxs']) {
return;
}
$generatorObject =& GoogleSitemapGenerator::GetInstance();
if (NULL == $generatorObject) {
// GXS doesn't seem to be here. Abort.
return;
}
// Add each job if individual jobs are displayed
if ('summary' == $options['list_type']) {
$jobs = get_posts('post_type=jobman_job');
if (count($jobs) > 0) {
foreach ($jobs as $job) {
$generatorObject->AddUrl(get_page_link($job->ID), time(), "daily", 0.5);
}
}
}
// Add the categories
$categories = get_terms('jobman_category', 'hide_empty=0');
if (count($categories) > 0) {
foreach ($categories as $cat) {
$generatorObject->AddUrl(get_term_link($cat->slug, 'jobman_category'), time(), "daily", 0.5);
}
}
}
示例7: widget
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
* @since 1.0.0
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
function widget($args, $instance)
{
// Extract args
extract($args, EXTR_SKIP);
$title = apply_filters('widget_title', $instance['title']);
$parent_page = icl_object_id($instance['parent_page'], true);
$depth = $instance['depth'];
$order_by = $instance['order_by'];
$sort_by = $instance['sort_by'];
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
if ($depth) {
$args = array('sort_order' => $order_by, 'sort_column' => $sort_by, 'child_of' => $parent_page, 'parent' => $parent_page, 'hierarchical' => 0);
} else {
$args = array('child_of' => $parent_page);
}
$child_pages = get_pages($args);
if ($child_pages) {
$body_widget = '<ul>' . "\n";
foreach ($child_pages as $page) {
$body_widget .= '<li><a href="' . get_page_link($page->ID) . '">' . $page->post_title . '</a></li>';
}
$body_widget .= '</ul>' . "\n";
}
echo $body_widget;
echo $after_widget;
return $instance;
}
示例8: widget
function widget($args, $instance)
{
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => '', 'alignment' => 'left', 'user' => '', 'size' => '45', 'author_info' => '', 'bio_text' => '', 'page' => '', 'posts_link' => ''));
echo $before_widget;
if (!empty($instance['title'])) {
echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
}
$text = '';
if (!empty($instance['alignment'])) {
$text .= '<span class="align' . esc_attr($instance['alignment']) . '">';
}
$text .= get_avatar($instance['user'], $instance['size']);
if (!empty($instance['alignment'])) {
$text .= '</span>';
}
if ($instance['author_info'] == 'text') {
global $_genesis_formatting_allowedtags;
$text .= wp_kses($instance['bio_text'], $_genesis_formatting_allowedtags);
} else {
$text .= get_the_author_meta('description', $instance['user']);
}
$text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), sprintf(__('[Read More %s]', 'genesis'), g_ent('…'))) : '';
$text .= $instance['posts_link'] ? sprintf('<div class="posts_link"><a href="%s">%s</a></div>', get_author_posts_url($instance['user']), __('View My Blog Posts', 'genesis')) : '';
echo wpautop($text);
echo $after_widget;
}
示例9: processRequest
function processRequest($page_id, $cid, $request)
{
global $editCustomerLink;
switch ($request) {
case "delete":
echo "<table><tr><td width=\"50%\">";
echo "<h3 style=\"color:red;text-align:center\">WARNING</h3>\n";
echo "Deleting customers is BAD! When you delete an customer, all of the\n";
echo "history about the customer goes away. It should only be used\n";
echo "in extreme circumstances. Normally, you should do <strong>CANCEL</strong>\n";
echo "for customers instead of deleting them.\n";
echo "<P>\n";
echo "DELETING AN CUSTOMER CANNOT BE UNDONE!";
echo "<P>\n";
echo "One more thing, for the current version of this system, deleting\n";
echo "an customer will also delete the associated customer record.\n";
echo "</td><td>\n";
echo prettyButton($page_id, $cid, "CONFIRM DELETE", "delete", "confirm");
echo "<P>\n";
echo prettyButton($page_id, $cid, "Go Back");
echo "</td></tr></table>\n";
break;
case "edit":
$magicLink = get_page_link($editCustomerLink) . "&CID={$cid}";
echo "<script> window.location.href = \"{$magicLink}\"; </script>";
break;
default:
echo "Dude. Somehow there was a bad request.\n";
}
}
示例10: start_el
/**
* @see Walker::start_el()
* @since 2.1.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $page Page data object.
* @param int $depth Depth of page in reference to parent pages. Used for padding.
* @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element.
*/
function start_el(&$output, $page, $depth, $args = array(), $current_page = NULL)
{
if ($depth) {
$indent = str_repeat("\t", $depth);
} else {
$indent = '';
}
$defaults = array('link_before' => '', 'link_after' => '');
$args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP);
$css_class = array('page_item', 'page-item-' . $page->ID);
if (!empty($current_page)) {
$_current_page = get_page($current_page);
if (isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors)) {
$css_class[] = 'current_page_ancestor';
}
if ($page->ID == $current_page) {
$css_class[] = 'current_page_item';
} elseif ($_current_page && $page->ID == $_current_page->post_parent) {
$css_class[] = 'current_page_parent';
}
} elseif ($page->ID == get_option('page_for_posts')) {
$css_class[] = 'current_page_parent';
}
$css_class = implode(' ', apply_filters('page_css_class', $css_class, $page));
$output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" ><span>' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</span></a>';
if (!empty($show_date)) {
if ('modified' == $show_date) {
$time = $page->post_modified;
} else {
$time = $page->post_date;
}
$output .= " " . mysql2date($date_format, $time);
}
}
示例11: get_permalink
function get_permalink($id = false)
{
global $post, $wpdb, $wp_id;
global $permalink_cache;
global $siteurl;
$id = intval($id);
$rewritecode = array('%year%', '%monthnum%', '%day%', '%hour%', '%minute%', '%second%', '%postname%', '%post_id%', '%category%', '%author%', '%pagename%');
if ($id) {
if (!isset($permalink_cache[$wp_id]) || !isset($permalink_cache[$wp_id][$id])) {
$permalink_cache[$wp_id][$id] = $wpdb->get_row("SELECT ID, post_date, post_name, post_status, post_author FROM {$wpdb->posts[$wp_id]} WHERE ID = {$id}");
}
$idpost = $permalink_cache[$wp_id][$id];
} else {
$idpost = $post;
}
if ($idpost->post_status == 'static') {
return get_page_link();
}
$permalink = get_settings('permalink_structure');
if ('' != $permalink) {
$unixtime = strtotime($idpost->post_date);
$cats = get_the_category($idpost->ID);
$category = $cats[0]->category_nicename;
$authordata = get_userdata($idpost->post_author);
$author = $authordata->user_login;
$rewritereplace = array(date('Y', $unixtime), date('m', $unixtime), date('d', $unixtime), date('H', $unixtime), date('i', $unixtime), date('s', $unixtime), $idpost->post_name, $idpost->ID, $category, $author, $idpost->post_name);
return $siteurl . str_replace($rewritecode, $rewritereplace, $permalink);
} else {
return $siteurl . '/index.php?p=' . $idpost->ID;
}
}
示例12: is_cookie_set_for_current_page
/**
* Check if a cookie is set for the current page
*
* @return Ai1ec_Cookie_Present_Dto
*/
public static function is_cookie_set_for_current_page()
{
$cookie_dto = Ai1ec_Dto_Factory::create_cookie_present_dto_instance();
$ai1ec_settings = Ai1ec_Settings::get_instance();
$calendar_url = get_page_link($ai1ec_settings->calendar_page_id);
$requested_page_url = Ai1ec_Wp_Uri_Helper::get_current_url(true);
$cookie_set = isset($_COOKIE['ai1ec_saved_filter']);
if (false !== $cookie_set) {
$cookie = json_decode(stripslashes($_COOKIE['ai1ec_saved_filter']), true);
if ($calendar_url === $requested_page_url && isset($cookie['calendar_page']) && $cookie['calendar_page'] !== $calendar_url) {
$cookie_dto->set_calendar_cookie($cookie['calendar_page']);
$cookie_dto->set_is_cookie_set_for_calendar_page(true);
$cookie_dto->set_is_a_cookie_set_for_this_page(true);
} else {
if (isset($cookie[$requested_page_url])) {
$cookie_dto->set_shortcode_cookie($cookie[$requested_page_url]);
$cookie_dto->set_is_cookie_set_for_shortcode(true);
$cookie_dto->set_is_a_cookie_set_for_this_page(true);
} else {
if (strpos($requested_page_url, $calendar_url) === 0 && isset($cookie['calendar_page']) && is_page($ai1ec_settings->calendar_page_id)) {
// This is the case after a redirect from the calendar page
$cookie_dto->set_is_a_cookie_set_for_this_page(true);
$cookie_dto->set_calendar_cookie($cookie['calendar_page']);
}
}
}
}
return $cookie_dto;
}
示例13: ninja_forms_register_form_settings_basic_metabox
function ninja_forms_register_form_settings_basic_metabox()
{
if (isset($_REQUEST['form_id'])) {
$form_id = absint($_REQUEST['form_id']);
$form_data = Ninja_Forms()->form($form_id)->get_all_settings();
} else {
$form_id = '';
$form_row = '';
$form_data = '';
}
$pages = get_pages();
$pages_array = array();
$append_array = array();
array_push($pages_array, array('name' => __('- None', 'ninja-forms'), 'value' => ''));
array_push($append_array, array('name' => __('- None', 'ninja-forms'), 'value' => ''));
foreach ($pages as $pagg) {
array_push($pages_array, array('name' => $pagg->post_title, 'value' => get_page_link($pagg->ID)));
array_push($append_array, array('name' => $pagg->post_title, 'value' => $pagg->ID));
}
if (isset($form_data['ajax'])) {
$ajax = $form_data['ajax'];
} else {
$ajax = 0;
}
$args = apply_filters('ninja_forms_form_settings_basic', array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'basic_settings', 'title' => __('Display', 'ninja-forms'), 'state' => 'closed', 'settings' => array(array('name' => 'form_title', 'type' => 'text', 'label' => __('Form Title', 'ninja-forms')), array('name' => 'show_title', 'type' => 'checkbox', 'label' => __('Display Form Title', 'ninja-forms')), array('name' => 'append_page', 'type' => 'select', 'desc' => '', 'label' => __('Add form to this page', 'ninja-forms'), 'display_function' => '', 'help' => '', 'options' => $append_array), array('name' => 'ajax', 'type' => 'checkbox', 'desc' => '', 'label' => __('Submit via AJAX (without page reload)?', 'ninja-forms'), 'display_function' => '', 'help' => ''), array('name' => 'clear_complete', 'type' => 'checkbox', 'desc' => '', 'label' => __('Clear successfully completed form?', 'ninja-forms'), 'display_function' => '', 'desc' => __('If this box is checked, Ninja Forms will clear the form values after it has been successfully submitted.', 'ninja-forms'), 'default_value' => 1), array('name' => 'hide_complete', 'type' => 'checkbox', 'desc' => '', 'label' => __('Hide successfully completed form?', 'ninja-forms'), 'display_function' => '', 'desc' => __('If this box is checked, Ninja Forms will hide the form after it has been successfully submitted.', 'ninja-forms'), 'default_value' => 1))));
ninja_forms_register_tab_metabox($args);
$args = apply_filters('ninja_forms_form_settings_restrictions', array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'restrictions', 'title' => __('Restrictions', 'ninja-forms'), 'state' => 'closed', 'settings' => array(array('name' => 'logged_in', 'type' => 'checkbox', 'desc' => '', 'label' => __('Require user to be logged in to view form?', 'ninja-forms'), 'display_function' => '', 'help' => ''), array('name' => 'not_logged_in_msg', 'type' => 'rte', 'label' => __('Not Logged-In Message', 'ninja-forms'), 'desc' => __('Message shown to users if the "logged in" checkbox above is checked and they are not logged-in.', 'ninja-forms'), 'tr_class' => ''), array('name' => 'sub_limit_number', 'type' => 'number', 'desc' => '', 'label' => __('Limit Submissions', 'ninja-forms'), 'display_function' => '', 'desc' => __('Select the number of submissions that this form will accept. Leave empty for no limit.', 'ninja-forms'), 'default_value' => '', 'tr_class' => '', 'min' => 0), array('name' => 'sub_limit_msg', 'type' => 'rte', 'label' => __('Limit Reached Message', 'ninja-forms'), 'desc' => __('Please enter a message that you want displayed when this form has reached its submission limit and will not accept new submissions.', 'ninja-forms'), 'tr_class' => ''))));
ninja_forms_register_tab_metabox($args);
}
示例14: widget
/**
* Echo the widget content.
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget
*/
function widget($args, $instance)
{
extract($args);
//* Merge with defaults
$instance = wp_parse_args((array) $instance, $this->defaults);
echo $before_widget;
if (!empty($instance['title'])) {
echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
}
$text = '';
if (!empty($instance['alignment'])) {
$text .= '<span class="align' . esc_attr($instance['alignment']) . '">';
}
$text .= get_avatar($instance['user'], $instance['size']);
if (!empty($instance['alignment'])) {
$text .= '</span>';
}
if ('text' === $instance['author_info']) {
$text .= $instance['bio_text'];
} else {
$text .= get_the_author_meta('description', $instance['user']);
}
$text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), $instance['page_link_text']) : '';
//* Echo $text
echo wpautop($text);
//* If posts link option checked, add posts link to output
if ($instance['posts_link']) {
printf('<div class="posts_link posts-link"><a href="%s">%s</a></div>', get_author_posts_url($instance['user']), __('View My Blog Posts', 'genesis'));
}
echo $after_widget;
}
示例15: wpm_url
function wpm_url($item, $nourl)
{
switch ($item->type) {
case 'Home':
$sof = get_option('show_on_front');
$pfp = get_option('page_for_posts');
if ($sof == 'page') {
$url = $pfp ? get_page_link($pfp) : $nourl;
} else {
$url = get_bloginfo('url', 'display');
}
return $url;
case 'FrontPage':
return get_bloginfo('url', 'display');
case 'Tag':
return get_tag_link($item->selection);
case 'Category':
return get_category_link($item->selection);
case 'Page':
return get_page_link($item->selection);
case 'Post':
return get_permalink($item->selection);
case 'External':
return $item->selection;
case 'PHP':
$out = eval($item->selection);
return is_array($out) ? $out[1] : $out;
}
return $nourl;
}