Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 757

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 757

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 758

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 758
param string settingsquery variable to ammend * * @return string|NULL Modified variable values or NULL on failure * * @global Ai1ec_Settings $ai1ec_settings Instance of settings object * to pull data from * @staticvar array $mapper Mapping of query names to * default in settings */ protected function _add_defaults( $name ) { $settings = $this->_registry->get( 'model.settings' ); static $mapper = array( 'cat' => 'categories', 'tag' => 'tags', ); $rq_name = 'ai1ec_' . $name . '_ids'; if ( ! isset( $mapper[$name] ) || ! array_key_exists( $rq_name, $this->_request ) ) { return NULL; } $options = explode( ',', $this->_request[$rq_name] ); $property = 'default_' . $mapper[$name]; $options = array_merge( $options, $settings->get( $property ) ); $filtered = array(); foreach ( $options as $item ) { // avoid array_filter + is_numeric $item = (int)$item; if ( $item > 0 ) { $filtered[] = $item; } } unset( $options ); if ( empty( $filtered ) ) { return NULL; } return implode( ',', $filtered ); } /** * Process_request function. * * Initialize/validate custom request array, based on contents of $_REQUEST, * to keep track of this component's request variables. * * @return void **/ protected function _process_request() { $settings = $this->_registry->get( 'model.settings' ); $this->_request = $this->_registry->get( 'http.request.parser' ); $aco = $this->_registry->get( 'acl.aco' ); $page_id = $settings->get( 'calendar_page_id' ); if ( ! $aco->is_admin() && $page_id && is_page( $page_id ) ) { foreach ( array( 'cat', 'tag' ) as $name ) { $implosion = $this->_add_defaults( $name ); if ( $implosion ) { $this->request['ai1ec_' . $name . '_ids'] = $implosion; $_REQUEST['ai1ec_' . $name . '_ids'] = $implosion; } } } } /** * Initialize cron functions. * * @throws Ai1ec_Scheduling_Exception * * @return void */ protected function _install_crons() { $scheduling = $this->_registry->get( 'scheduling.utility' ); $hook_name = 'ai1ec_n_cron'; $scheduling->delete( $hook_name ); } /** * Initialize the registry object. * * @param Ai1ec_Loader $ai1ec_loader Instance of Ai1EC classes loader * * @return void Method does not return */ protected function _initialize_registry( $ai1ec_loader ) { global $ai1ec_registry; $this->_registry = new Ai1ec_Registry_Object( $ai1ec_loader ); Ai1ec_Time_Utility::set_registry( $this->_registry ); $ai1ec_registry = $this->_registry; } /** * Loads the CSS for the plugin * */ protected function _load_css_if_needed() { // ================================== // = Add the hook to render the css = // ================================== if ( isset( $_GET[Ai1ec_Css_Frontend::QUERY_STRING_PARAM] ) ) { // we need to wait for the extension to be registered if the css // needs to be compiled. Will find a better way when compiling css. $css_controller = $this->_registry->get( 'css.frontend' ); add_action( 'plugins_loaded', array( $css_controller, 'render_css' ), 2 ); } } /** * Load the texdomain for the plugin. * * @wp_hook plugins_loaded * * @return void */ public function load_textdomain() { if ( false === $this->_domain_loaded ) { load_plugin_textdomain( AI1EC_PLUGIN_NAME, false, AI1EC_LANGUAGE_PATH ); $this->_domain_loaded = true; } } /** * Check if the schema is up to date. * * @throws Ai1ec_Database_Schema_Exception * @throws Ai1ec_Database_Update_Exception * * @return void */ protected function _initialize_schema() { $option = $this->_registry->get( 'model.option' ); $schema_sql = $this->get_current_db_schema(); $version = sha1( $schema_sql ); // If existing DB version is not consistent with current plugin's version, // or does not exist, then create/update table structure using dbDelta(). if ( $option->get( 'ai1ec_db_version' ) != $version ) { $errors = $this->_registry->get( 'database.applicator' ) ->check_db_consistency_for_date_migration() ; if ( ! empty( $errors ) ) { $message = Ai1ec_I18n::__( 'Your database is found to be corrupt. Likely previous update has failed. Please restore All-in-One Event Calendar tables from a backup and retry.
Following errors were found:
%s' ); $message = sprintf( $message, implode( $errors, '
' ) ); throw new Ai1ec_Database_Update_Exception( $message ); } $this->_registry->get( 'database.applicator' ) ->remove_instance_duplicates(); if ( apply_filters( 'ai1ec_perform_scheme_update', true ) && $this->_registry->get( 'database.helper' )->apply_delta( $schema_sql ) ) { $option->set( 'ai1ec_db_version', $version ); } else { throw new Ai1ec_Database_Update_Exception(); } // If the schema structure upgrade is complete move contents $categories_key = 'ai1ec_category_meta_ported'; if ( ! $option->get( $categories_key ) ) { $this->_migrate_categories_meta(); $option->set( $categories_key, true ); } } } /** * Transform categories meta information. * * Use new `meta` table instead of legacy `colors` table. * * @return void Method does not return. */ protected function _migrate_categories_meta() { $db = $this->_registry->get( 'dbi.dbi' ); $table_name = $db->get_table_name( 'ai1ec_event_category_colors' ); $db_h = $this->_registry->get( 'database.helper' ); if ( $db_h->table_exists( $table_name ) ) { // if old table exists otherwise ignore it // Migrate color information $dest_table = $db->get_table_name( 'ai1ec_event_category_meta' ); $colors = $db->select( $table_name, array( 'term_id', 'term_color'), ARRAY_A ); if ( ! empty( $colors ) ) { foreach ( $colors as $color ) { $db->insert( $dest_table, $color ); } } // Drop the old table $db->query( 'DROP TABLE IF EXISTS ' . $table_name ); } } /** * Procedures to take when upgrading plugin version * * @return void */ protected function _plugin_upgrade_procedures() { $option = $this->_registry->get( 'model.option' ); $version = AI1EC_VERSION; if ( $option->get( 'ai1ec_version' ) != $version ) { try { // Force regeneration of JS cache $this->_registry->get( 'controller.javascript' )->revalidate_cache(); $this->_registry->get( 'controller.javascript-widget' )->revalidate_cache(); // Run upgrade commands $settings = $this->_registry->get( 'model.settings' ); $settings->perform_upgrade_actions(); } catch ( Exception $e ) { } // Update plugin version $option->set( 'ai1ec_version', $version ); } } /** * Get current database schema as a multi SQL statement. * * @return string Multiline SQL statement. */ public function get_current_db_schema() { $dbi = $this->_registry->get( 'dbi.dbi' ); // ======================= // = Create table events = // ======================= $table_name = $dbi->get_table_name( 'ai1ec_events' ); $sql = "CREATE TABLE $table_name ( post_id bigint(20) NOT NULL, start int(10) UNSIGNED NOT NULL, end int(10) UNSIGNED, timezone_name varchar(50), allday tinyint(1) NOT NULL, instant_event tinyint(1) NOT NULL DEFAULT 0, recurrence_rules longtext, exception_rules longtext, recurrence_dates longtext, exception_dates longtext, venue varchar(255), country varchar(255), address varchar(255), city varchar(255), province varchar(255), postal_code varchar(32), show_map tinyint(1), contact_name varchar(255), contact_phone varchar(32), contact_email varchar(128), contact_url varchar(255), cost varchar(255), ticket_url varchar(255), ical_feed_url varchar(255), ical_source_url varchar(255), ical_organizer varchar(255), ical_contact varchar(255), ical_uid varchar(255), show_coordinates tinyint(1), latitude decimal(20,15), longitude decimal(20,15), force_regenerate tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (post_id), KEY feed_source (ical_feed_url) ) CHARACTER SET utf8;"; // ========================== // = Create table instances = // ========================== $table_name = $dbi->get_table_name( 'ai1ec_event_instances' ); $sql .= "CREATE TABLE $table_name ( id bigint(20) NOT NULL AUTO_INCREMENT, post_id bigint(20) NOT NULL, start int(10) UNSIGNED NOT NULL, end int(10) UNSIGNED NOT NULL, PRIMARY KEY (id), UNIQUE KEY evt_instance (post_id,start) ) CHARACTER SET utf8;"; // ================================ // = Create table category colors = // ================================ $table_name = $dbi->get_table_name( 'ai1ec_event_category_meta' ); $sql .= "CREATE TABLE $table_name ( term_id bigint(20) NOT NULL, term_color varchar(255) NOT NULL, term_image varchar(254) NULL DEFAULT NULL, PRIMARY KEY (term_id) ) CHARACTER SET utf8;"; return $sql; } }