public static function pre_init()
 {
     // load the settings. theya re required for everything past this point
     $settings_class_name = apply_filters('qsot-settings-class-name', '');
     if (empty($settings_class_name)) {
         return;
     }
     self::$o = call_user_func_array(array($settings_class_name, "instance"), array());
     self::$me = plugin_basename(self::$o->core_file);
     self::$version = self::$o->version;
     self::$plugin_dir = self::$o->core_dir;
     self::$plugin_url = self::$o->core_url;
     self::$product_url = self::$o->product_url;
     load_plugin_textdomain('opentickets-community-edition', false, dirname(plugin_basename(__FILE__)) . '/langs/');
     //add_action( 'plugins_loaded', array( __CLASS__, 'admin_deactivate' ), 0 );
     if (!self::_memory_check()) {
         return;
     }
     // locale fix
     add_action('plugins_loaded', array(__CLASS__, 'locale'), 4);
     // inject our own autoloader before all others in case we need to overtake some woocommerce autoloaded classes down the line. this may not work with 100% of all classes
     // because we dont actually control the plugin load order, but it should suffice for what we may use it for. if it does not suffice at any time, then we will rethink this
     add_action('plugins_loaded', array(__CLASS__, 'prepend_overtake_autoloader'), 4);
     // load emails when doing ajax request. woocommerce workaround
     add_action('plugins_loaded', array(__CLASS__, 'why_do_i_have_to_do_this'), 4);
     // declare the includes loader function
     add_action('qsot-load-includes', array(__CLASS__, 'load_includes'), 10, 2);
     add_filter('qsot-search-results-group-query', array(__CLASS__, 'only_search_parent_events'), 10, 4);
     // load all other system features and classes used everywhere
     do_action('qsot-load-includes', 'sys');
     // load all plugins and modules later on
     add_action('plugins_loaded', array(__CLASS__, 'load_plugins_and_modules'), 5);
     // register the activation function, so that when the plugin is activated, it does some magic described in the activation function
     register_activation_hook(self::$o->core_file, array(__CLASS__, 'activation'));
     add_action('woocommerce_email_classes', array(__CLASS__, 'load_custom_emails'), 2);
     add_filter('woocommerce_locate_template', array(__CLASS__, 'overtake_some_woocommerce_core_templates'), 10, 3);
     add_action('admin_init', array(__CLASS__, 'register_base_admin_assets'), 10);
     add_action('admin_enqueue_scripts', array(__CLASS__, 'load_base_admin_assets'), 10);
     add_action('load-post.php', array(__CLASS__, 'load_assets'), 999);
     add_action('load-post-new.php', array(__CLASS__, 'load_assets'), 999);
     // register js and css assets at the appropriate time
     add_action('init', array(__CLASS__, 'register_assets'), 2);
     add_filter('plugin_action_links', array(__CLASS__, 'plugins_page_actions'), 10, 4);
     // polyfill the hide/show js functions in the head tag, since some themes apparently don't have this
     add_action('wp_head', array(__CLASS__, 'polyfill_hideshow_js'), 0);
 }
Esempio n. 2
0
        public function image_ids_setting($value)
        {
            $current = get_option($value['id'], '');
            $current = is_scalar($current) ? explode(',', $current) : $current;
            // normalize the args
            $value = wp_parse_args($value, array('static_at_front' => false, 'static_at_end' => true, 'hide_static' => false, 'static_url' => QSOT::plugin_url() . 'assets/imgs/opentickets-tiny.jpg'));
            // add to the description if any images are static and unchangeable
            if (!$value['hide_static'] && $value['static_at_front']) {
                $value['desc'] .= ' ' . __('The first image cannot be changed.', 'opentickets-community-edition');
            } elseif (!$value['hide_static'] && $value['static_at_end']) {
                $value['desc'] .= ' ' . __('The last image cannot be changed.', 'opentickets-community-edition');
            }
            $offset = 0;
            ?>
			<tr valign="top" class="qsot-image-ids">
				<th scope="row" class="titledesc">
					<?php 
            echo force_balance_tags($value['title']);
            ?>
					<?php 
            if (isset($value['desc_tip'])) {
                ?>
						<img class="help_tip" data-tip="<?php 
                echo esc_attr($value['desc_tip']);
                ?>
" src="<?php 
                echo WC()->plugin_url();
                ?>
/assets/images/help.png" height="16" width="16" />
					<?php 
            }
            ?>
				</th>
				<td>
					<p class="description"><?php 
            echo $value['desc'];
            ?>
</p>

					<?php 
            if (!$value['hide_static'] && $value['static_at_front']) {
                // if there is a static image up front, then show that there is, and that it is not editable
                ?>
						<?php 
                $tag = sprintf('<img src="%s" class="static-img" />', $value['static_url']);
                ?>
						<div class="image-id-selection">
							<label><?php 
                echo sprintf(__('Image #%s', 'opentickets-community-edition'), 1);
                ?>
</label>
							<div class="preview-img" rel="image-preview"><?php 
                echo $tag;
                ?>
</div>
							<div class="clear"></div>
							<span class="not-editable"><em><?php 
                _e('static image', 'opentickets-community-edition');
                ?>
</em></span>
						</div>
					<?php 
                $offset = 1;
            }
            ?>

					<?php 
            for ($i = $offset; $i < $value['count'] + $offset; $i++) {
                ?>
						<?php 
                $img_id = isset($current[$i]) ? $current[$i] : 0;
                $tag = is_numeric($img_id) ? wp_get_attachment_image($img_id, array(90, 15), false) : '';
                ?>
						<div class="image-id-selection <?php 
                echo 'noimg' == $img_id ? 'no-img' : '';
                ?>
" rel="image-select">
							<label><?php 
                echo sprintf(__('Image #%s', 'opentickets-community-edition'), $i + 1);
                ?>
</label>
							<div class="preview-img" rel="image-preview"><?php 
                echo $tag;
                ?>
</div>
							<div class="clear"></div>
							<input type="hidden" name="<?php 
                echo esc_attr($value['id'] . '[' . $i . ']');
                ?>
" value="<?php 
                echo esc_attr($img_id);
                ?>
" class="image-id" rel="img-id" />
							<input type="button" class="button select-button qsot-popmedia" value="Select Image" rel="select-image-btn" scope="[rel='image-select']" /><br/>
							<a href="#remove-img" class="remove-img" rel="remove-img" scope="[rel='image-select']"><?php 
                _e('remove image', 'opentickets-community-edition');
                ?>
</a><br/>
							<a href="#no-img" class="no-image" rel="no-img" scope="[rel='image-select']"><?php 
                _e('no image', 'opentickets-community-edition');
                ?>
</a>
						</div>
					<?php 
            }
            ?>

					<?php 
            if (!$value['hide_static'] && $value['static_at_end']) {
                // if there is a static image at the end, then show that there is, and that it is not editable
                ?>
						<?php 
                $tag = sprintf('<img src="%s" class="static-img" />', $value['static_url']);
                ?>
						<div class="image-id-selection">
							<label><?php 
                echo sprintf(__('Image #%s', 'opentickets-community-edition'), $value['count'] + $offset + 1);
                ?>
</label>
							<div class="preview-img" rel="image-preview"><?php 
                echo $tag;
                ?>
</div>
							<div class="clear"></div>
							<span class="not-editable"><em><?php 
                _e('static image', 'opentickets-community-edition');
                ?>
</em></span>
						</div>
					<?php 
                $offset = 1;
            }
            ?>

					<div class="clear"></div>
				</td>
			</tr>
		<?php 
        }
										<td valign="bottom"><?php 
        echo force_balance_tags($brand_imgs[$i]);
        ?>
</td>
									<?php 
    }
    ?>
									<td valign="bottom"><a href="<?php 
    echo esc_attr(QSOT::product_url());
    ?>
" title="<?php 
    _e('Who is OpenTickets?', 'opentickets-community-edition');
    ?>
">
										<img src="<?php 
    echo esc_attr(QSOT::plugin_url() . 'assets/imgs/opentickets-tiny.jpg');
    ?>
" class="ot-tiny-logo branding-img" />
									</a></td>
								</tr>
							</tbody>

							<div class="clear"></div>
						</table>
					</div>
				</div>
			<?php 
}
?>

			<?php