本文整理汇总了PHP中C_Component_Registry类的典型用法代码示例。如果您正苦于以下问题:PHP C_Component_Registry类的具体用法?PHP C_Component_Registry怎么用?PHP C_Component_Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了C_Component_Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_gallery
/**
* Retrieves and caches an I_Gallery_Mapper instance for this gallery id
*
* @param int $gallery_id Gallery ID
* @return mixed
*/
public function get_gallery($gallery_id)
{
if (!isset($this->galleries[$gallery_id]) || is_null($this->galleries[$gallery_id])) {
$this->galleries[$gallery_id] = C_Component_Registry::get_instance()->get_utility('I_Gallery_Mapper');
}
return $this->galleries[$gallery_id];
}
示例2: getData
function getData($number)
{
global $wpdb;
$data = array();
$pictures = $wpdb->get_results("SELECT a.*, b.path FROM " . $wpdb->base_prefix . "ngg_pictures AS a LEFT JOIN " . $wpdb->base_prefix . "ngg_gallery AS b ON a.galleryid = b.gid WHERE a.galleryid = '" . intval($this->_data->get('nggsourcegallery', 0)) . "'");
$i = 0;
if (class_exists('nggGallery') && !class_exists('C_Component_Registry')) {
// legacy
foreach ($pictures as $p) {
$data[$i]['alt_text'] = $p->alttext;
$data[$i]['image'] = nggGallery::get_image_url($p->pid, $p->path, $p->filename);
$data[$i]['thumbnail'] = nggGallery::get_thumbnail_url($p->pid, $p->path, $p->filename);
$i++;
}
} else {
$storage = C_Component_Registry::get_instance()->get_utility('I_Gallery_Storage');
foreach ($pictures as $p) {
$data[$i]['alt_text'] = $p->alttext;
$data[$i]['image'] = $storage->get_image_url($p);
$data[$i]['thumbnail'] = $storage->get_thumbnail_url($p);
$i++;
}
}
return $data;
}
示例3: render_related_string
function render_related_string()
{
$settings = C_NextGen_Settings::get_instance();
$type = $settings->appendType;
$maxImages = $settings->maxImages;
$sluglist = array();
switch ($type) {
case 'tags':
if (function_exists('get_the_tags')) {
$taglist = get_the_tags();
if (is_array($taglist)) {
foreach ($taglist as $tag) {
$sluglist[] = $tag->slug;
}
}
}
break;
case 'category':
$catlist = get_the_category();
if (is_array($catlist)) {
foreach ($catlist as $cat) {
$sluglist[] = $cat->category_nicename;
}
}
break;
}
$taglist = implode(',', $sluglist);
if ($taglist === 'uncategorized' || empty($taglist)) {
return;
}
$renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
$view = C_Component_Registry::get_instance()->get_utility('I_Component_Factory')->create('mvc_view', '');
$retval = $renderer->display_images(array('source' => 'tags', 'container_ids' => $taglist, 'display_type' => NEXTGEN_GALLERY_BASIC_THUMBNAILS, 'images_per_page' => $maxImages, 'maximum_entity_count' => $maxImages, 'template' => $view->get_template_abspath('photocrati-nextgen_gallery_display#related'), 'show_all_in_lightbox' => FALSE, 'show_slideshow_link' => FALSE, 'disable_pagination' => TRUE));
return apply_filters('ngg_show_related_gallery_content', $retval, $taglist);
}
开发者ID:lcw07r,项目名称:productcampamsterdam.org,代码行数:35,代码来源:adapter.displayed_gallery_related_element.php
示例4: enqueue_displayed_gallery_trigger_buttons_resources
function enqueue_displayed_gallery_trigger_buttons_resources($displayed_gallery = FALSE)
{
if (!wp_style_is('fontawesome', 'registered')) {
if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') !== FALSE) {
wp_register_style('fontawesome', site_url('/?ngg_serve_fontawesome_css=1'));
} else {
$router = C_Component_Registry::get_instance()->get_utility('I_Router');
wp_register_style('fontawesome', $router->get_static_url('photocrati-nextgen_gallery_display#fontawesome/font-awesome.css'));
}
}
if (!$this->run_once && !empty($displayed_gallery) && !empty($displayed_gallery->display_settings['ngg_triggers_display']) && $displayed_gallery->display_settings['ngg_triggers_display'] !== 'never') {
$pro_active = FALSE;
if (defined('NGG_PRO_PLUGIN_VERSION')) {
$pro_active = 'NGG_PRO_PLUGIN_VERSION';
}
if (defined('NEXTGEN_GALLERY_PRO_VERSION')) {
$pro_active = 'NEXTGEN_GALLERY_PRO_VERSION';
}
if (!empty($pro_active)) {
$pro_active = constant($pro_active);
}
if (!is_admin() && (empty($pro_active) || version_compare($pro_active, '1.0.11') >= 0)) {
wp_enqueue_style('fontawesome');
$this->run_once = TRUE;
}
}
}
示例5: get_registry
/**
* Gets the Pope component registry
* @return C_Component_Registry
*/
function get_registry()
{
if (!isset($this->_registry)) {
$this->_registry = C_Component_Registry::get_instance();
}
return $this->_registry;
}
示例6:
/**
* Returns a singleton
* @return C_Component_Registry()
*/
static function &get_instance()
{
if (is_null(self::$_instance)) {
$klass = get_class();
self::$_instance = new $klass();
}
return self::$_instance;
}
示例7: _handle_url
/**
* Parses certain paths through get_static_url
*
* @param string $url
* @return string Resulting URL
*/
static function _handle_url($url)
{
$router = C_Component_Registry::get_instance()->get_utility('I_Router');
if (0 !== strpos($url, '/') && 0 !== strpos($url, 'wordpress#') && 0 !== strpos($url, 'http://') && 0 !== strpos($url, 'https://')) {
$url = $router->get_static_url($url);
} elseif (strpos($url, '/') === 0) {
$url = home_url($url);
}
return $url;
}
示例8: _generate_module_info
static function _generate_module_info()
{
$retval = array();
$registry = C_Component_Registry::get_instance();
foreach ($registry->get_module_list() as $module_id) {
$module_version = $registry->get_module($module_id)->module_version;
$retval[$module_id] = "{$module_id}|{$module_version}";
}
return $retval;
}
示例9: _filter_modules
function _filter_modules($pope_modules_list, $product)
{
foreach ($product as $module_name) {
$module = C_Component_Registry::get_instance()->get_module($module_name);
$str = $module->module_id . '|' . $module->module_version;
$search = array_search($str, $pope_modules_list);
if (FALSE !== $search) {
unset($pope_modules_list[$search]);
}
}
return $pope_modules_list;
}
示例10: render_slideshow
function render_slideshow($galleryID, $irWidth = '', $irHeight = '', $args)
{
$registry = C_Component_Registry::get_instance();
$renderer = $registry->get_utility('I_Displayed_Gallery_Renderer');
$params = array('container_ids' => $galleryID, 'display_type' => 'photocrati-nextgen_basic_slideshow', 'gallery_width' => $irWidth, 'gallery_height' => $irHeight, 'source' => 'galleries', 'slug' => 'widget-' . $args['widget_id'], 'entity_types' => array('image'), 'show_thumbnail_link' => FALSE, 'ngg_triggers_display' => 'never');
if (0 === $galleryID) {
$params['source'] = 'random_images';
unset($params['container_ids']);
}
$retval = $renderer->display_images($params, NULL);
$retval = apply_filters('ngg_show_slideshow_widget_content', $retval, $galleryID, $irWidth, $irHeight);
return $retval;
}
示例11: widget
function widget($args, $instance)
{
// these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
$before_widget = NULL;
$before_title = NULL;
$after_widget = NULL;
$after_title = NULL;
$widget_id = NULL;
extract($args);
$settings = C_NextGen_Settings::get_instance();
$parent = C_Component_Registry::get_instance()->get_utility('I_Widget');
$title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title'], $instance, $this->id_base);
$parent->render_partial('photocrati-widget#display_mediarss', array('self' => $this, 'instance' => $instance, 'title' => $title, 'settings' => $settings, 'before_widget' => $before_widget, 'before_title' => $before_title, 'after_widget' => $after_widget, 'after_title' => $after_title, 'widget_id' => $widget_id));
}
示例12: media_upload_nextgen
function media_upload_nextgen()
{
// Not in use
$errors = false;
// Generate TinyMCE HTML output
if (isset($_POST['send'])) {
$keys = array_keys($_POST['send']);
$send_id = (int) array_shift($keys);
$image = $_POST['image'][$send_id];
$alttext = stripslashes(htmlspecialchars($image['alttext'], ENT_QUOTES));
$description = stripslashes(htmlspecialchars($image['description'], ENT_QUOTES));
// here is no new line allowed
$clean_description = preg_replace("/\n|\r\n|\r\$/", " ", $description);
$img = nggdb::find_image($send_id);
$thumbcode = $img->get_thumbcode();
$class = "ngg-singlepic ngg-{$image['align']}";
// Create a shell displayed-gallery so we can inspect its settings
$registry = C_Component_Registry::get_instance();
$mapper = $registry->get_utility('I_Displayed_Gallery_Mapper');
$factory = $registry->get_utility('I_Component_Factory');
$args = array('display_type' => NGG_BASIC_SINGLEPIC);
$displayed_gallery = $factory->create('displayed_gallery', $args, $mapper);
$width = $displayed_gallery->display_settings['width'];
$height = $displayed_gallery->display_settings['height'];
// Build output
if ($image['size'] == "thumbnail") {
$html = "<img src='{$image['thumb']}' alt='{$alttext}' class='{$class}' />";
} else {
$html = '';
}
// Wrap the link to the fullsize image around
$html = "<a {$thumbcode} href='{$image['url']}' title='{$clean_description}'>{$html}</a>";
if ($image['size'] == "full") {
$html = "<img src='{$image['url']}' alt='{$alttext}' class='{$class}' />";
}
if ($image['size'] == "singlepic") {
$html = "[singlepic id={$send_id} w={$width} h={$height} float={$image['align']}]";
}
media_upload_nextgen_save_image();
// Return it to TinyMCE
return media_send_to_editor($html);
}
// Save button
if (isset($_POST['save'])) {
media_upload_nextgen_save_image();
}
return wp_iframe('media_upload_nextgen_form', $errors);
}
示例13: enqueue_nextgen_proofing_trigger_buttons_resources
function enqueue_nextgen_proofing_trigger_buttons_resources($displayed_gallery = FALSE)
{
$retval = FALSE;
if (!$this->run_once && !empty($displayed_gallery) && !empty($displayed_gallery->display_settings['ngg_proofing_display'])) {
$router = C_Component_Registry::get_instance()->get_utility('I_Router');
wp_enqueue_script('jquery-placeholder', $router->get_static_url('photocrati-nextgen_admin#jquery.placeholder.min.js'), 'jquery', FALSE, FALSE);
wp_enqueue_script('ngg-pro-proofing-script', $router->get_static_url('photocrati-nextgen_pro_proofing#nextgen_pro-proofing.js'), array('jquery', 'underscore', 'jquery-placeholder'), FALSE, FALSE);
wp_localize_script('ngg-pro-proofing-script', 'ngg_pro_proofing_i18n', array('image_list' => __('Submitting {0} image{1}', 'nextgen-gallery-pro'), 'submit_cancel' => __('Cancel', 'nextgen-gallery-pro'), 'submit_button' => __('Send', 'nextgen-gallery-pro'), 'submit_message' => __('Submitting...', 'nextgen-gallery-pro'), 'example_name' => __('Name', 'nextgen-gallery-pro'), 'example_email' => __('Email', 'nextgen-gallery-pro'), 'nggpl_title' => __('Proof image?', 'nextgen-gallery-pro')));
$deps = false;
if (wp_script_is('ngg-trigger-buttons', 'registered')) {
$deps = array('ngg-trigger-buttons');
}
wp_enqueue_style('ngg-pro-proofing-style', $router->get_static_url('photocrati-nextgen_pro_proofing#nextgen_pro-proofing.css'), $deps);
$this->run_once = TRUE;
}
return $retval;
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:17,代码来源:adapter.nextgen_pro_proofing_trigger_resources.php
示例14: uninstall
function uninstall($hard)
{
// remove this products modules from the pope_module_list registry
$registry = C_Component_Registry::get_instance();
$nextgen_product = $registry->get_product('photocrati-nextgen');
$pope_modules_list = get_option('pope_module_list', array());
$pope_modules_list = $this->_filter_modules($pope_modules_list, $nextgen_product->get_modules_to_load());
// run each modules respective uninstall routines
foreach ($nextgen_product->get_modules_to_load() as $module_name) {
if ($handler = C_Photocrati_Installer::get_handler_instance($module_name)) {
if (method_exists($handler, 'uninstall')) {
$handler->uninstall($hard);
}
}
}
// lastly remove this product itself from the pope_module_list registry
$search = array_search('photocrati-nextgen|' . NGG_PLUGIN_VERSION, $pope_modules_list);
if (FALSE !== $search) {
unset($pope_modules_list[$search]);
}
// TODO: remove this. NextGen Pro's uninstall routine will be updated in a separate release,
// so to maintain proper support we run the same routine as above for it
$pro_version = FALSE;
if (defined('NGG_PRO_PLUGIN_VERSION')) {
$pro_version = 'NGG_PRO_PLUGIN_VERSION';
}
if (defined('NEXTGEN_GALLERY_PRO_VERSION')) {
$pro_version = 'NEXTGEN_GALLERY_PRO_VERSION';
}
if (FALSE !== $pro_version) {
$pro_version = constant($pro_version);
}
if (FALSE !== $pro_version) {
$pope_modules_list = $this->_filter_modules($pope_modules_list, $this->get_modules_to_load_for('photocrati-nextgen-pro'));
$search = array_search('photocrati-nextgen-pro|' . $pro_version, $pope_modules_list);
if (FALSE !== $search) {
unset($pope_modules_list[$search]);
}
}
if (empty($pope_modules_list)) {
delete_option('pope_module_list');
} else {
update_option('pope_module_list', $pope_modules_list);
}
}
示例15: widget
function widget($args, $instance)
{
$router = C_Router::get_instance();
wp_enqueue_style('nextgen_widgets_style', $router->get_static_url('photocrati-widget#widgets.css'));
wp_enqueue_style('nextgen_basic_thumbnails_style', $router->get_static_url('photocrati-nextgen_basic_gallery#thumbnails/nextgen_basic_thumbnails.css'));
// these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
$before_widget = NULL;
$before_title = NULL;
$after_widget = NULL;
$after_title = NULL;
$widget_id = NULL;
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title'], $instance, $this->id_base);
$renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
$factory = C_Component_Registry::get_instance()->get_utility('I_Component_Factory');
$view = $factory->create('mvc_view', '');
// IE8 webslice support if needed
if ($instance['webslice']) {
$before_widget .= '<div class="hslice" id="ngg-webslice">';
$before_title = str_replace('class="', 'class="entry-title ', $before_title);
$after_widget = '</div>' . $after_widget;
}
$source = $instance['type'] == 'random' ? 'random_images' : 'recent';
$params = array('slug' => 'widget-' . $args['widget_id'], 'source' => $source, 'display_type' => NEXTGEN_GALLERY_BASIC_THUMBNAILS, 'images_per_page' => $instance['items'], 'maximum_entity_count' => $instance['items'], 'template' => $view->get_template_abspath('photocrati-widget#display_gallery'), 'image_type' => $instance['show'] == 'original' ? 'full' : 'thumb', 'show_all_in_lightbox' => FALSE, 'show_slideshow_link' => FALSE, 'disable_pagination' => TRUE, 'image_width' => $instance['width'], 'image_height' => $instance['height'], 'ngg_triggers_display' => 'never', 'widget_setting_title' => $title, 'widget_setting_before_widget' => $before_widget, 'widget_setting_before_title' => $before_title, 'widget_setting_after_widget' => $after_widget, 'widget_setting_after_title' => $after_title, 'widget_setting_width' => $instance['width'], 'widget_setting_height' => $instance['height'], 'widget_setting_show_setting' => $instance['show'], 'widget_setting_widget_id' => $widget_id);
switch ($instance['exclude']) {
case 'all':
break;
case 'denied':
$mapper = C_Component_Registry::get_instance()->get_utility('I_Gallery_Mapper');
$gallery_ids = array();
$list = explode(',', $instance['list']);
foreach ($mapper->find_all() as $gallery) {
if (!in_array($gallery->{$gallery->id_field}, $list)) {
$gallery_ids[] = $gallery->{$gallery->id_field};
}
}
$params['container_ids'] = implode(',', $gallery_ids);
break;
case 'allow':
$params['container_ids'] = $instance['list'];
break;
}
echo $renderer->display_images($params);
}