本文整理汇总了PHP中C_Router类的典型用法代码示例。如果您正苦于以下问题:PHP C_Router类的具体用法?PHP C_Router怎么用?PHP C_Router使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了C_Router类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enqueue_static_resources
function enqueue_static_resources()
{
$router = C_Router::get_instance();
wp_enqueue_script('jquery-ui-accordion');
// For some reason ajax.js isn't registered yet in 2.0.67.14 and above, so we have
// to do it manually.
if (method_exists('M_Ajax', 'register_scripts')) {
M_Ajax::register_scripts();
}
if (version_compare(NGG_PLUGIN_VERSION, '2.0.67') >= 0) {
wp_enqueue_script('ngg-pro-lightbox-ecommerce-overrides', $router->get_static_url('photocrati-nextgen_pro_ecommerce#lightbox_overrides.js'));
} else {
wp_enqueue_script('ngg-pro-lightbox-ecommerce-overrides', $router->get_static_url('photocrati-nextgen_pro_ecommerce#lightbox_overrides.js'), array('ngg-store-js'));
}
wp_enqueue_style('ngg-pro-add-to-cart', $router->get_static_url('photocrati-nextgen_pro_ecommerce#add_to_cart.css'));
M_NextGen_Pro_Ecommerce::enqueue_cart_resources();
if (!self::$_template_rendered) {
self::$_template_rendered = TRUE;
$parameters = array('not_for_sale_msg' => C_NextGen_Settings::get_instance()->ecommerce_not_for_sale_msg, 'sources' => $this->get_sources(), 'i18n' => $this->get_i18n_strings());
$add_to_cart_tmpl = new C_MVC_View('photocrati-nextgen_pro_ecommerce#add_to_cart_tmpl', $parameters);
$add_to_cart_item_tmpl = new C_MVC_View('photocrati-nextgen_pro_ecommerce#add_to_cart_source_item_tmpl', $parameters);
$add_to_cart_items_tmpl = new C_MVC_View('photocrati-nextgen_pro_ecommerce#add_to_cart_source_items_tmpl', $parameters);
wp_localize_script('ngg-pro-lightbox-ecommerce-overrides', 'ngg_add_to_cart_templates', array('add_to_cart' => $add_to_cart_tmpl->render(TRUE), 'add_to_cart_item' => $add_to_cart_item_tmpl->render(TRUE), 'add_to_cart_items' => $add_to_cart_items_tmpl->render(TRUE)));
wp_localize_script('ngg-pro-lightbox-ecommerce-overrides', 'ngg_cart_i18n', (array) $this->get_i18n_strings());
}
}
示例2: enqueue_frontend_resources
function enqueue_frontend_resources($displayed_gallery)
{
$this->call_parent('enqueue_frontend_resources', $displayed_gallery);
if (!in_array($displayed_gallery->id(), self::$_galleries_displayed)) {
self::$_galleries_displayed[] = $displayed_gallery->id();
$ds = $displayed_gallery->display_settings;
if (!empty($ds['captions_enabled']) && $ds['captions_enabled']) {
$this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.captions_enabled', TRUE, FALSE);
$animation = !empty($ds['captions_animation']) ? $ds['captions_animation'] : 'slideup';
$this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.captions_animation', $animation, FALSE);
$show_title = !empty($ds['captions_display_title']) ? $ds['captions_display_title'] : TRUE;
$this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.captions_display_title', $show_title, FALSE);
$show_description = !empty($ds['captions_display_description']) ? $ds['captions_display_description'] : TRUE;
$this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.captions_display_description', $show_description, FALSE);
} else {
$this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.captions_enabled', FALSE, FALSE);
}
}
if (isset($displayed_gallery->display_settings['captions_enabled']) && $displayed_gallery->display_settings['captions_enabled'] && !self::$_pro_captions_run_once) {
$router = C_Router::get_instance();
wp_enqueue_script('jquery.dotdotdot', $router->get_static_url('photocrati-nextgen_basic_album#jquery.dotdotdot-1.5.7-packed.js'), array('jquery'));
wp_enqueue_script('nextgen_pro_captions-js', $router->get_static_url('photocrati-nextgen_pro_captions#captions.js'), array('jquery.dotdotdot'), FALSE, TRUE);
wp_enqueue_style('nextgen_pro_captions-css', $router->get_static_url('photocrati-nextgen_pro_captions#captions.css'));
self::$_pro_captions_run_once = TRUE;
}
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:26,代码来源:adapter.nextgen_pro_captions_resources.php
示例3: register_lightbox
function register_lightbox()
{
$router = C_Router::get_instance();
$settings = C_NextGen_Settings::get_instance()->get('ngg_pro_lightbox', array());
$lightboxes = C_Lightbox_Library_Manager::get_instance();
// Define the Pro Lightbox
$lightbox = new stdClass();
$lightbox->title = __('NextGEN Pro Lightbox', 'nextgen-gallery-pro');
$lightbox->code = "class='nextgen_pro_lightbox' data-nplmodal-gallery-id='%PRO_LIGHTBOX_GALLERY_ID%'";
$lightbox->styles = array('photocrati-nextgen_pro_lightbox#style.css', 'photocrati-nextgen_pro_lightbox#theme/galleria.nextgen_pro_lightbox.css');
$lightbox->scripts = array('wordpress#underscore', 'wordpress#backbone', 'photocrati-nextgen_pro_lightbox#velocity.min.js', 'photocrati-galleria#galleria-1.4.2.min.js', 'photocrati-nextgen_pro_lightbox#nextgen_pro_lightbox.js', 'photocrati-nextgen_pro_lightbox#theme/galleria.nextgen_pro_lightbox.js');
// Set lightbox display properties
$settings['is_front_page'] = is_front_page() ? 1 : 0;
$settings['share_url'] = $router->get_url('/nextgen-share/{gallery_id}/{image_id}/{named_size}', TRUE, 'root');
$settings['wp_site_url'] = $router->get_base_url('site');
$settings['protect_images'] = !empty(C_NextGen_Settings::get_instance()->protect_images) ? TRUE : FALSE;
$settings['style'] = str_replace('.css', '', $settings['style']);
// this once (~2.1.4) referenced files
// provide the current language so ajax requests can request translations in the same locale
if (defined('ICL_LANGUAGE_CODE')) {
$settings['lang'] = $router->param('lang', NULL, FALSE) ? $router->param('lang') : ICL_LANGUAGE_CODE;
}
$settings['i18n'] = array('toggle_social_sidebar' => __('Toggle social sidebar', 'nextgen-gallery-pro'), 'play_pause' => __('Play / Pause', 'nextgen-gallery-pro'), 'toggle_fullscreen' => __('Toggle fullscreen', 'nextgen-gallery-pro'), 'toggle_image_info' => __('Toggle image info', 'nextgen-gallery-pro'), 'close_window' => __('Close window', 'nextgen-gallery-pro'), 'share' => array('twitter' => __('Share on Twitter', 'nextgen-gallery-pro'), 'googlep' => __('Share on Google+', 'nextgen-gallery-pro'), 'facebook' => __('Share on Facebook', 'nextgen-gallery-pro'), 'pinterest' => __('Share on Pinterest', 'nextgen-gallery-pro')));
$lightbox->values = array('nplModalSettings' => $settings);
$lightboxes->register(NGG_PRO_LIGHTBOX, $lightbox);
}
示例4: render_displayed_gallery_action
function render_displayed_gallery_action()
{
$retval = array();
// this must run ONLY twice
if (isset($_POST['ajax_referrer']) && $this->_run_count <= 1) {
// set the router & routed app to use the uri provided in ajax_referrer
$parsed_url = parse_url($_POST['ajax_referrer']);
$url = $parsed_url['path'];
if (!empty($parsed_url['query'])) {
$url .= '?' . $parsed_url['query'];
}
$_SERVER['REQUEST_URI'] = $url;
$_SERVER['PATH_INFO'] = $parsed_url['path'];
$this->_run_count++;
C_Router::$_instances = array();
$router = C_Router::get_instance();
$router->serve_request();
}
if (isset($_POST['displayed_gallery_id'])) {
$displayed_gallery = new C_Displayed_Gallery();
$displayed_gallery->apply_transient($_POST['displayed_gallery_id']);
$renderer = C_Displayed_Gallery_Renderer::get_instance();
$retval['html'] = $renderer->render($displayed_gallery, TRUE);
}
return $retval;
}
示例5: index_action
/**
* Displays the 'tagcloud' display type
*
* @param stdClass|C_Displayed_Gallery|C_DataMapper_Model $displayed_gallery
*/
public function index_action($displayed_gallery, $return = FALSE)
{
$display_settings = $displayed_gallery->display_settings;
$application = C_Router::get_instance()->get_routed_app();
$tag = urldecode($this->param('gallerytag'));
// we're looking at a tag, so show images w/that tag as a thumbnail gallery
if (!is_home() && !empty($tag)) {
return C_Displayed_Gallery_Renderer::get_instance()->display_images(array('source' => 'tags', 'container_ids' => array(esc_attr($tag)), 'display_type' => $display_settings['display_type'], 'original_display_type' => $displayed_gallery->display_type, 'original_settings' => $display_settings));
}
$defaults = array('exclude' => '', 'format' => 'list', 'include' => $displayed_gallery->get_term_ids_for_tags(), 'largest' => 22, 'link' => 'view', 'number' => $display_settings['number'], 'order' => 'ASC', 'orderby' => 'name', 'smallest' => 8, 'taxonomy' => 'ngg_tag', 'unit' => 'pt');
$args = wp_parse_args('', $defaults);
// Always query top tags
$tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
foreach ($tags as $key => $tag) {
$tags[$key]->link = $this->object->set_param_for($application->get_routed_url(TRUE), 'gallerytag', $tag->slug);
$tags[$key]->id = $tag->term_id;
}
$params = $display_settings;
$params['inner_content'] = $displayed_gallery->inner_content;
$params['storage'] =& $storage;
$params['tagcloud'] = wp_generate_tag_cloud($tags, $args);
$params['displayed_gallery_id'] = $displayed_gallery->id();
$params = $this->object->prepare_display_parameters($displayed_gallery, $params);
return $this->object->render_partial('photocrati-nextgen_basic_tagcloud#nextgen_basic_tagcloud', $params, $return);
}
示例6: define_routes
function define_routes()
{
$router = C_Router::get_instance();
$app = $router->create_app('/nextgen-galleria-gallery');
$app->rewrite("/{id}", "/id--{id}");
$app->route('/', 'I_Galleria_iFrame_Controller#index');
}
示例7: render
function render($displayed_gallery, $return = FALSE, $mode = NULL)
{
$do_rewrites = FALSE;
$album_types = array(NGG_PRO_ALBUMS, NGG_PRO_LIST_ALBUM, NGG_PRO_GRID_ALBUM);
// Get the original display type
$original_display_type = isset($displayed_gallery->display_settings['original_display_type']) ? $displayed_gallery->display_settings['original_display_type'] : '';
if (in_array($displayed_gallery->display_type, $album_types)) {
$do_rewrites = TRUE;
$router = C_Router::get_instance();
$app = $router->get_routed_app();
$slug = '/' . C_NextGen_Settings::get_instance()->router_param_slug;
// ensure to pass $stop=TRUE to $app->rewrite() on parameters that may be shared with other display types
$app->rewrite('{*}' . $slug . '/page/{\\d}{*}', '{1}' . $slug . '/nggpage--{2}{3}', FALSE, TRUE);
$app->rewrite('{*}' . $slug . '/page--{*}', '{1}' . $slug . '/nggpage--{2}', FALSE, TRUE);
$app->rewrite('{*}' . $slug . '/{\\w}', '{1}' . $slug . '/album--{2}');
$app->rewrite('{*}' . $slug . '/{\\w}/{\\w}', '{1}' . $slug . '/album--{2}/gallery--{3}');
$app->rewrite('{*}' . $slug . '/{\\w}/{\\w}/{\\w}{*}', '{1}' . $slug . '/album--{2}/gallery--{3}/{4}{5}');
} elseif (in_array($original_display_type, $album_types)) {
$do_rewrites = TRUE;
$router = C_Router::get_instance();
$app = $router->get_routed_app();
$slug = '/' . C_NextGen_Settings::get_instance()->router_param_slug;
$app->rewrite("{*}{$slug}/album--{\\w}", "{1}{$slug}/{2}");
$app->rewrite("{*}{$slug}/album--{\\w}/gallery--{\\w}", "{1}{$slug}/{2}/{3}");
$app->rewrite("{*}{$slug}/album--{\\w}/gallery--{\\w}/{*}", "{1}{$slug}/{2}/{3}/{4}");
}
if ($do_rewrites) {
$app->do_rewrites();
}
// Continue rendering
return $this->call_parent('render', $displayed_gallery, $return, $mode);
}
示例8: index_action
function index_action()
{
$router = C_Router::get_instance();
$lightbox_library = C_Lightbox_Library_Manager::get_instance()->get_selected();
// retrieve by transient id
$transient_id = $this->object->param('id');
// get the displayed gallery to display
$displayed_gallery = $this->get_displayed_gallery($transient_id);
$this->object->enqueue_static_resources($displayed_gallery, $lightbox_library);
// The Pro Lightbox can be extended with components that enqueue their own resources
// and render some markup
$component_markup = array();
foreach ($this->object->_components as $name => $handler) {
$handler = new $handler();
$handler->name = $name;
if (!empty($displayed_gallery)) {
$handler->displayed_gallery = $displayed_gallery;
}
$handler->lightbox_library = $lightbox_library;
$handler->enqueue_static_resources();
$component_markup[] = $handler->render();
}
// Set dynamic display properties
$lightbox_settings = $lightbox_library->values['nplModalSettings'];
$lightbox_settings['load_images_url'] = $router->get_url('/nextgen-pro-lightbox-load-images/' . $displayed_gallery->transient_id, TRUE, 'root');
$lightbox_settings['image_protect'] = !empty(C_NextGen_Settings::get_instance()->protect_images) ? TRUE : FALSE;
$params = array('displayed_gallery_id' => $displayed_gallery->id(), 'component_markup' => implode("\n", $component_markup), 'lightbox_settings' => $lightbox_settings);
return $this->object->render_view('photocrati-nextgen_pro_lightbox#index', $params, FALSE);
}
示例9: enqueue_pro_lightbox_resources
function enqueue_pro_lightbox_resources($displayed_gallery = FALSE)
{
$settings = C_NextGen_Settings::get_instance();
if ($settings->thumbEffect == NGG_PRO_LIGHTBOX) {
$router = C_Router::get_instance();
if (!self::$run_once) {
// ensure the gallery exists
if ($displayed_gallery && $displayed_gallery->id()) {
$this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.wordpress_page_root', get_permalink(), FALSE);
}
wp_enqueue_script('underscore');
wp_enqueue_script('backbone');
wp_enqueue_script('velocity', $router->get_static_url('photocrati-nextgen_pro_lightbox_legacy#velocity.min.js'));
wp_enqueue_script('galleria', $router->get_static_url('photocrati-galleria#galleria-1.4.2.min.js'));
wp_enqueue_style('ngg_pro_lightbox_theme_css', $router->get_static_url('photocrati-nextgen_pro_lightbox_legacy#theme/galleria.nextgen_pro_lightbox.css'));
wp_enqueue_script('ngg_pro_lightbox_theme_js', $router->get_static_url('photocrati-nextgen_pro_lightbox_legacy#theme/galleria.nextgen_pro_lightbox.js'), 'galleria');
if (!wp_style_is('fontawesome', 'registered')) {
C_Display_Type_Controller::get_instance()->enqueue_displayed_gallery_trigger_buttons_resources();
}
wp_enqueue_style('fontawesome');
// retrieve the lightbox so we can examine its settings
$mapper = C_Lightbox_Library_Mapper::get_instance();
$library = $mapper->find_by_name(NGG_PRO_LIGHTBOX, TRUE);
$library->display_settings += array('is_front_page' => is_front_page() ? 1 : 0, 'share_url' => $router->get_url('/nextgen-share/{gallery_id}/{image_id}/{named_size}', TRUE, 'root'), 'protect_images' => !empty($settings->protect_images) ? TRUE : FALSE, 'style' => str_replace('.css', '', $library->display_settings['style']), 'i18n' => array('toggle_social_sidebar' => __('Toggle social sidebar', 'nextgen-gallery-pro'), 'play_pause' => __('Play / Pause', 'nextgen-gallery-pro'), 'toggle_fullscreen' => __('Toggle fullscreen', 'nextgen-gallery-pro'), 'toggle_image_info' => __('Toggle image info', 'nextgen-gallery-pro'), 'close_window' => __('Close window', 'nextgen-gallery-pro'), 'share' => array('twitter' => __('Share on Twitter', 'nextgen-gallery-pro'), 'googlep' => __('Share on Google+', 'nextgen-gallery-pro'), 'facebook' => __('Share on Facebook', 'nextgen-gallery-pro'), 'pinterest' => __('Share on Pinterest', 'nextgen-gallery-pro'))));
// provide the current language so ajax requests can request translations in the same locale
if (defined('ICL_LANGUAGE_CODE')) {
$library->display_settings['lang'] = $router->param('lang', NULL, FALSE) ? $router->param('lang') : ICL_LANGUAGE_CODE;
}
wp_localize_script('photocrati_ajax', 'nplModalSettings', $library->display_settings);
}
self::$run_once = TRUE;
}
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:33,代码来源:adapter.nextgen_pro_lightbox_resources.php
示例10: passthru
function passthru()
{
$router = C_Router::get_instance();
$_SERVER['ORIG_REQUEST_URI'] = $_SERVER['REQUEST_URI'];
// TODO: Verify that we only need to do this on Windows
$base_parts = parse_url($router->get_base_url('root'));
$_SERVER['UNENCODED_URL'] = $_SERVER['HTTP_X_ORIGINAL_URL'] = $_SERVER['REQUEST_URI'] = '/' . trailingslashit($router->join_paths(!empty($base_parts['path']) ? $base_parts['path'] : '', $this->object->strip_param_segments($router->get_request_uri())));
}
示例11: enqueue_admin_scripts
function enqueue_admin_scripts()
{
$router = C_Router::get_instance();
wp_register_script('frame_event_publisher', $router->get_static_url('photocrati-frame_communication#frame_event_publisher.js'), array('jquery'));
if (is_admin()) {
wp_enqueue_script('frame_event_publisher');
}
}
示例12: enqueue_singlepic_css
/**
* Examines 'the_content' string for img.ngg-singlepic and enqueues styling when found
*
* @param string $content
* @return string $content
*/
function enqueue_singlepic_css($content)
{
if (preg_match("#<img.*ngg-singlepic.*>#", $content, $matches)) {
$router = C_Router::get_instance();
wp_enqueue_style('nextgen_basic_singlepic_style', $router->get_static_url(NGG_BASIC_SINGLEPIC . '#nextgen_basic_singlepic.css'));
}
return $content;
}
示例13: enqueue_admin_scripts
function enqueue_admin_scripts()
{
$router = C_Router::get_instance();
wp_register_script('frame_event_publisher', $router->get_static_url('photocrati-frame_communication#frame_event_publisher.js'), array('jquery'), NGG_SCRIPT_VERSION);
if (is_admin()) {
wp_enqueue_script('frame_event_publisher');
wp_localize_script('frame_event_publisher', 'frame_event_publisher_domain', array(parse_url(site_url(), PHP_URL_HOST)));
}
}
示例14: enqueue_static_resources
/**
* lightbox_overrides.js holds all of the pro-lightbox related proofing features
*/
function enqueue_static_resources()
{
if (!self::$_localized_once) {
self::$_localized_once = TRUE;
$router = C_Router::get_instance();
wp_enqueue_script('ngg-pro-lightbox-proofing-js', $router->get_static_url('photocrati-nextgen_pro_proofing#lightbox_overrides.js'));
wp_localize_script('ngg-pro-lightbox-proofing-js', 'ngg_proofing_settings', array('active_color' => C_NextGen_Settings::get_instance()->proofing_lightbox_active_color));
}
}
示例15: _register_protection_js
function _register_protection_js()
{
if (!is_admin() && C_NextGen_Settings::get_instance()->protect_images) {
$router = C_Router::get_instance();
wp_register_script('photocrati-image_protection', $router->get_static_url('photocrati-image_protection#custom.js'), array('jquery'));
wp_enqueue_script('photocrati-image_protection');
wp_localize_script('photocrati-image_protection', 'photocrati_image_protection_global', array('enabled' => C_NextGen_Settings::get_instance()->protect_images_globally));
}
}