<div class="content-wrapper"> <div class="addon-grid"> <?php $i = 0; foreach ($products as $product) { ?> <div class="tribe-addon<?php echo $i % 4 == 0 ? ' first tribe-clearfix' : ''; ?> "> <div class="thumb"> <a href="<?php echo esc_url($product->link); ?> "><img src="<?php echo esc_url(tribe_resource_url($product->image, false, 'common')); ?> " /></a> </div> <div class="caption"> <h4><a href="<?php echo esc_url($product->link); ?> "><?php echo esc_html($product->title); ?> </a></h4> <div class="description"> <p><?php echo $product->description;
default: $wide_indexes = array(0); } $i = 0; foreach ($products as $product) { ?> <div class="tribe-addon<?php echo in_array($i, $wide_indexes) ? ' first' : ''; ?> "> <div class="thumb"> <a href="<?php echo esc_url($product->link); ?> "><img src="<?php echo esc_url(tribe_resource_url($product->image, false, null, $main)); ?> " /></a> </div> <div class="caption"> <h4><a href="<?php echo esc_url($product->link); ?> "><?php echo esc_html($product->title); ?> </a></h4> <div class="description"> <p><?php echo $product->description;
/** * Enquues a script to handle live refresh of the date previews. */ public function live_refresh_script() { $url = Tribe__Template_Factory::getMinFile(tribe_resource_url('admin-date-preview.js', false, 'common'), true); wp_enqueue_script('tribe-date-live-refresh', $url, array('jquery'), false, true); }
/** * Returns or echoes a url to a file in the Events Calendar plugin resources directory * * @category Events * @param string $resource the filename of the resource * @param bool $echo whether or not to echo the url * @param string $root_dir directory to hunt for resource files (src or common) * * @return string **/ function tribe_events_resource_url($resource, $echo = false, $root_dir = 'src') { $extension = pathinfo($resource, PATHINFO_EXTENSION); if ('src' !== $root_dir) { return tribe_resource_url($resource, $echo, $root_dir); } $resources_path = $root_dir . '/resources/'; switch ($extension) { case 'css': $resource_path = $resources_path . 'css/'; break; case 'js': $resource_path = $resources_path . 'js/'; break; case 'scss': $resource_path = $resources_path . 'scss/'; break; default: $resource_path = $resources_path; break; } $path = $resource_path . $resource; $url = plugins_url(Tribe__Events__Main::instance()->plugin_dir . $path); /** * Deprected the tribe_events_resource_url filter in 4.0 in favor of tribe_resource_url. Remove in 5.0 */ $url = apply_filters('tribe_events_resource_url', $url, $resource); if ($echo) { echo esc_url($url); } return $url; }
/** * Register our script early. */ public function register_script() { wp_register_script('tribe-common-logging-controls', tribe_resource_url('admin-log-controls.js', false, null, Tribe__Main::instance()), array('jquery'), Tribe__Main::VERSION, true); }
/** * Enqueue the styles and script */ public function enqueue() { wp_enqueue_style('app-shop', tribe_resource_url('app-shop.css', false, 'common'), array(), apply_filters('tribe_events_css_version', Tribe__Main::VERSION)); wp_enqueue_script('app-shop', tribe_resource_url('app-shop.js', false, 'common'), array(), apply_filters('tribe_events_js_version', Tribe__Main::VERSION)); }
/** * Returns or echoes a url to a file in the Event Tickets plugin resources directory * * @category Tickets * @param string $resource the filename of the resource * @param bool $echo whether or not to echo the url * @param string $root_dir directory to hunt for resource files (src or common) * * @return string **/ function tribe_tickets_resource_url($resource, $echo = false, $root_dir = 'src') { $extension = pathinfo($resource, PATHINFO_EXTENSION); if ('src' !== $root_dir) { return tribe_resource_url($resource, $echo, $root_dir); } $resources_path = $root_dir . '/resources/'; switch ($extension) { case 'css': $resource_path = $resources_path . 'css/'; break; case 'js': $resource_path = $resources_path . 'js/'; break; case 'scss': $resource_path = $resources_path . 'scss/'; break; default: $resource_path = $resources_path; break; } $path = $resource_path . $resource; $url = plugins_url(Tribe__Tickets__Main::instance()->plugin_dir . $path); /** * Filter the ticket resource URL * * @var $url Resource URL * @var $resource The filename of the resource */ $url = apply_filters('tribe_tickets_resource_url', $url, $resource); if ($echo) { echo esc_url($url); } return $url; }
/** * Register an Asset and attach a callback to the required action to display it correctly * * @param object $origin The main Object for the plugin you are enqueueing the script/style for * @param string $slug Slug to save the asset * @param string $file Which file will be loaded, either CSS or JS * @param array $deps Dependencies * @param string|null $action (Optional) A WordPress Action, if set needs to happen after: `wp_enqueue_scripts`, `admin_enqueue_scripts`, or `login_enqueue_scripts` * @param string|array $query { * Optional. Array or string of parameters for this asset * * @type string|null $action Which WordPress action this asset will be loaded on * @type int $priority Priority in which this asset will be loaded on the WordPress action * @type string $file The relative path to the File that will be enqueued, uses the $origin to get the full path * @type string $type Asset Type, `js` or `css` * @type array $deps An array of other asset as dependencies * @type string $version Version number, used for cache expiring * @type string $media Used only for CSS, when to load the file * @type bool $in_footer A boolean determining if the javascript should be loaded on the footer * @type array|object $localize Variables needed on the JavaScript side { * @type string $name Name of the JS variable * @type string|array $data Contents of the JS variable * } * @type callable[] $conditionals An callable method or an array of them, that will determine if the asset is loaded or not * } * * @return string */ public function register($origin, $slug, $file, $deps = array(), $action = null, $arguments = array()) { // Prevent weird stuff here $slug = sanitize_title_with_dashes($slug); if ($this->exists($slug)) { return $this->get($slug); } if (is_string($origin)) { // Origin needs to be a class with a `instance` method and a Version constant if (class_exists($origin) && method_exists($origin, 'instance') && defined($origin . '::VERSION')) { $origin = call_user_func(array($origin, 'instance')); } } if (is_object($origin)) { $origin_name = get_class($origin); if (!defined($origin_name . '::VERSION')) { // If we have a Object and we don't have instance or version return false; } } else { return false; } // Fetches the version on the Origin Version constant $version = constant($origin_name . '::VERSION'); // Default variables to prevent notices $defaults = array('action' => null, 'priority' => 10, 'file' => false, 'type' => null, 'deps' => array(), 'version' => $version, 'media' => 'all', 'in_footer' => true, 'localize' => array(), 'conditionals' => array(), 'is_registered' => false); // Merge Arguments $asset = (object) wp_parse_args($arguments, $defaults); // Enforce these one $asset->slug = $slug; $asset->file = $file; $asset->deps = $deps; $asset->origin = $origin; $asset->origin_name = $origin_name; $asset->action = $action; // If we don't have a type on the arguments we grab from the File path if (is_null($asset->type)) { if (substr($asset->file, -3, 3) === '.js') { $asset->type = 'js'; } elseif (substr($asset->file, -4, 4) === '.css') { $asset->type = 'css'; } } // If asset type is wrong don't register if (!in_array($asset->type, array('js', 'css'))) { return false; } /** * Deprecated filter to allow changing version based on the type of Asset * * @todo remove on 4.6 * @deprecated 4.3 * * @param string $version */ $asset->version = apply_filters("tribe_events_{$asset->type}_version", $asset->version); /** * Filter to change version number on assets * * @param string $version * @param object $asset */ $asset->version = apply_filters('tribe_asset_version', $asset->version, $asset); // Clean these $asset->priority = absint($asset->priority); $asset->in_footer = (bool) $asset->in_footer; $asset->media = esc_attr($asset->media); // Ensures that we have a priority over 1 if ($asset->priority < 1) { $asset->priority = 1; } $is_vendor = strpos($asset->file, 'vendor/') !== false ? true : false; // Setup the actual URL if (filter_var($asset->file, FILTER_VALIDATE_URL)) { $asset->url = $asset->file; } else { $asset->url = $this->maybe_get_min_file(tribe_resource_url($asset->file, false, $is_vendor ? '' : null, $asset->origin)); } // If you are passing localize, you need `name` and `data` if (!empty($asset->localize) && (is_array($asset->localize) || is_object($asset->localize))) { $asset->localize = (object) $asset->localize; // if we don't have both reset localize if (!isset($asset->localize->data, $asset->localize->name)) { $asset->localize = array(); } } // Looks for a single conditional callable and places it in an Array if (!empty($asset->conditionals) && is_callable($asset->conditionals)) { $asset->conditionals = array($asset->conditionals); } /** * Filter an Asset loading variables * * @param object $asset */ $asset = apply_filters('tribe_asset_pre_register', $asset); // Set the Asset on the array of notices $this->assets[$slug] = $asset; // Return the Slug because it might be modified return $asset; }
<div> <?php tribe_events_the_mini_calendar_prev_link(); ?> <span id="<?php echo esc_attr($mini_cal_widget_id); ?> "><?php tribe_events_the_mini_calendar_title(); ?> </span> <?php tribe_events_the_mini_calendar_next_link(); ?> <img id="ajax-loading-mini" src="<?php echo tribe_resource_url('images/tribe-loading.gif'); ?> " alt="loading..." /> </div> </td> </tr> </thead> <?php do_action('tribe_events_mini_cal_after_header'); ?> <?php do_action('tribe_events_mini_cal_before_the_grid'); ?> <thead> <tr> <?php