function op_include_files() { require_once OP_FUNC . 'widgets.php'; require_once OP_FUNC . 'options.php'; require_once OP_FUNC . 'page_options.php'; require_once OP_FUNC . 'general.php'; require_once OP_FUNC . 'scripts.php'; require_once OP_FUNC . 'assets.php'; require_once OP_FUNC . 'fonts.php'; require_once OP_FUNC . 'sl_api.php'; op_textdomain(); require_once OP_FUNC . 'templates.php'; _op_assets(); add_theme_support('automatic-feed-links'); add_theme_support('post-thumbnails'); if (is_admin()) { require_once OP_FUNC . 'admin.php'; require_once OP_ADMIN . 'init.php'; } else { op_register_scripts(); do_action('op_pre_template_include'); require_once ABSPATH . 'wp-admin/includes/plugin.php'; /* * DAP */ if (is_plugin_active('DAP-WP-LiveLinks/DAP-WP-LiveLinks.php')) { add_filter('op_check_page_availability', 'dap_allowed_page'); } /* * Fast Member */ if (is_plugin_active('fastmember/fastmember.php')) { add_filter('op_check_page_availability', 'fast_member_allowed_page'); } /* * iMember */ if (class_exists('infusionWP')) { add_filter('op_check_page_availability', 'imember_allowed_page'); } add_filter('template_include', 'op_template_include'); do_action('op_setup'); //op_localize_script('front'); } }
function op_assets_lang_key($key = '') { return _op_assets('lang_key', $key); }
function run_install() { //Get the global wordpress database object global $wpdb; //Make sure we are supposed to be running this function if (isset($_POST[OP_SN . '_install'])) { //Perform security verification if (isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'op_install')) { //Get the OP order number $key = op_post('op', 'install', 'order_number'); //Register the key and return key status $status = op_sl_register($key); //If the key is invalid, notify user, otherwise continue if (is_wp_error($status)) { //Save the API key op_sl_save_key($key); //Continue if the product is not already installed if (op_get_option('installed') != 'Y') { //CReate the Assets table $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}optimizepress_assets` (\n\t\t\t\t\t\t\t `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t `name` varchar(64) NOT NULL DEFAULT '0',\n\t\t\t\t\t\t\t `title` varchar(150) NOT NULL DEFAULT '',\n\t\t\t\t\t\t\t `settings` varchar(1) NOT NULL DEFAULT 'N',\n\t\t\t\t\t\t\t PRIMARY KEY (`id`)\n\t\t\t\t\t\t\t) ENGINE=MyISAM;"); //Create the launch funnel table $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}optimizepress_launchfunnels` (\n\t\t\t\t\t\t\t\t`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t`title` varchar(254) NOT NULL DEFAULT '',\n\t\t\t\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t\t\t\t) ENGINE=MyISAM;"); //Create the launch funnel pages table $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}optimizepress_launchfunnels_pages` (\n\t\t\t\t\t\t\t\t`funnel_id` bigint(20) unsigned NOT NULL,\n\t\t\t\t\t\t\t\t`page_id` bigint(20) unsigned NOT NULL,\n\t\t\t\t\t\t\t\t`step` int(10) unsigned NOT NULL\n\t\t\t\t\t\t\t) ENGINE=MyISAM;"); //Create the layout categories table $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}optimizepress_layout_categories` (\n\t\t\t\t\t\t\t\t`id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t`name` varchar(255) NOT NULL,\n\t\t\t\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t\t\t\t) ENGINE=MyISAM;"); //Create the products table $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}optimizepress_pb_products` (\n\t\t\t\t\t\t\t `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t `post_id` bigint(20) unsigned NOT NULL,\n\t\t\t\t\t\t\t `parent_id` bigint(20) unsigned NOT NULL,\n\t\t\t\t\t\t\t `type` varchar(50) NOT NULL DEFAULT '',\n\t\t\t\t\t\t\t PRIMARY KEY (`id`)\n\t\t\t\t\t\t\t) ENGINE=MyISAM;"); //Create the post layouts table $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}optimizepress_post_layouts` (\n\t\t\t\t\t\t\t `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t `post_id` bigint(20) unsigned NOT NULL,\n\t\t\t\t\t\t\t `type` varchar(255) NOT NULL,\n\t\t\t\t\t\t\t `layout` longtext NOT NULL,\n\t\t\t\t\t\t\t PRIMARY KEY (`id`)\n\t\t\t\t\t\t\t) ENGINE=MyISAM;"); //Create the predefined layouts table $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}optimizepress_predefined_layouts` (\n\t\t\t\t\t\t\t `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t `name` varchar(100) NOT NULL DEFAULT '',\n\t\t\t\t\t\t\t `category` int(10) unsigned NOT NULL,\n\t\t\t\t\t\t\t `description` text NOT NULL,\n\t\t\t\t\t\t\t `preview_ext` varchar(4) NOT NULL DEFAULT '',\n\t\t\t\t\t\t\t `layouts` longtext NOT NULL,\n\t\t\t\t\t\t\t `settings` longtext NOT NULL,\n\t\t\t\t\t\t\t PRIMARY KEY (`id`)\n\t\t\t\t\t\t\t) ENGINE=MyISAM;"); //Create the presets table $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}optimizepress_presets` (\n\t\t\t\t\t\t\t `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t `name` varchar(255) NOT NULL,\n\t\t\t\t\t\t\t `layouts` longtext NOT NULL,\n\t\t\t\t\t\t\t `settings` longtext NOT NULL,\n\t\t\t\t\t\t\t PRIMARY KEY (`id`)\n\t\t\t\t\t\t\t) ENGINE=MyISAM;"); //Save the assets _op_assets('save_assets'); //Set the installed flag to Y so the installer doesn't run again op_update_option('installed', 'Y'); //Ping pong if (!wp_next_scheduled('ping_pong')) { wp_schedule_event(time(), 'daily', 'ping_pong'); } //Set defaults $this->set_defaults(); // install content templates $this->install_content_templates(); //Redirect to the setup wizard if (defined('OP_TYPE') && OP_TYPE == 'theme') { wp_redirect(menu_page_url(OP_SN, false) . '-setup-wizard'); } else { wp_redirect(menu_page_url(OP_SN, false)); } } else { //Reload wp_redirect(menu_page_url(OP_SN, false)); } } } else { //If the security verification failed, notify the user $this->error = __('Verification failed, please refresh the page and try again.', OP_SN); } } }
<label class="form-title"><?php _e('Text', 'optimizepress'); ?> </label> <?php echo _op_assets('image_selector', array('group' => 'core', 'tag' => 'button', 'folder' => 'button-4-text/light', 'fieldid' => $id . 'button_text_4_light'), $fieldname . '[button][text_4_light]', op_get_var($button, 'text_4_light')); ?> </div> <div class="op-type op-type-dark<?php echo $selected == 'dark' ? '' : ' op-disabled-type'; ?> "> <label class="form-title"><?php _e('Text', 'optimizepress'); ?> </label> <?php echo _op_assets('image_selector', array('group' => 'core', 'tag' => 'button', 'folder' => 'button-4-text/dark', 'fieldid' => $id . 'button_text_4_dark'), $fieldname . '[button][text_4_dark]', op_get_var($button, 'text_4_dark')); ?> </div> </div> </div> <div class="button-option-style button-option-style-5"> <label class="form-title"><?php _e('Text', 'optimizepress'); ?> </label> <?php echo _op_assets('image_selector', array('group' => 'core', 'tag' => 'button', 'folder' => 'button5', 'fieldid' => $id . 'button_text_5'), $fieldname . '[button][text_5]', op_get_var($button, 'text_5')); ?> </div>
function install_content_layout($local_destination, $remote_destination, $remote_source, $clear_working, $install = false) { global $wp_filesystem, $wpdb; wp_die('evo ga'); if (file_exists($local_destination . '/config.php')) { $config = array(); include $local_destination . '/config.php'; $image_file = op_get_var($config, 'image'); $ext = preg_match('/\\.([^.]+)$/', $image_file, $matches) ? strtolower($matches[1]) : false; if ($ext) { $asset_dest = $wp_filesystem->find_folder(OP_ASSETS); $img_dest = $wp_filesystem->find_folder(OP_LIB . 'images/content_layouts/'); $images = array(); $layouts = op_get_var($config, 'layouts', array()); $replace = array(); $settings = array(); $downloaded_images = array(); $new_images = array(); $replace = array(); // uploading image as attachment @copy($local_destination . $image_file, OP_LIB . 'content_layouts/working/' . $image_file); $file_array = array('name' => $image_file, 'tmp_name' => OP_LIB . 'content_layouts/working/' . $image_file); $imgId = media_handle_sideload($file_array, 0); if (!is_wp_error($imgId)) { $imageUrl = wp_get_attachment_url($imgId); } if (isset($config['images'])) { $images = unserialize(base64_decode($config['images'])); foreach ($images as $path => $file) { $file_array = array('name' => $file, 'tmp_name' => $local_destination . '/images/' . $file); $id = media_handle_sideload($file_array, 0); if (!is_wp_error($id)) { $new_images[$path] = wp_get_attachment_url($id); $replace['{op_filename="' . $path . '"}'] = $new_images[$path]; } } if (!install) { $wp_filesystem->delete($remote_destination . 'images/', true); } } if (isset($config['settings_images'])) { $settings_images = unserialize(base64_decode($config['settings_images'])); foreach ($settings_images as $path => $conf) { foreach ($conf as $keys) { $url_string = '{op_filename="' . $path . '"}'; $found = false; if (isset($new_images[$path])) { $url = $new_images[$path]; if (!isset($settings[$keys[0]])) { $settings[$keys[0]] = unserialize(base64_decode($config['settings'][$keys[0]])); } $settings = $this->_update_array($settings, $keys, $url_string, $url); } } } } foreach ($settings as $name => $conf) { $settings[$name] = base64_encode(serialize($conf)); } foreach ($config['settings'] as $name => $conf) { if (!isset($settings[$name])) { $settings[$name] = $conf; } } try { $layouts = unserialize(base64_decode($layouts)); } catch (Exception $e) { $layouts = array(); } if (count($replace) > 0) { $find = array_keys($replace); $new_layouts = array(); foreach ($layouts as $layout_name => $layout) { $new_layouts[$layout_name] = array(); /**/ foreach ($layout as $row) { $new_row = array('row_class' => $row['row_class'], 'row_style' => str_replace($find, $replace, $row['row_style']), 'children' => array()); $temp = stripslashes(base64_decode($row['row_data_style'])); $temp = str_replace($find, $replace, $temp); $new_row['row_data_style'] = base64_encode($temp); if (isset($row['children']) && count($row['children']) > 0) { foreach ($row['children'] as $col) { $new_col = array('col_class' => $col['col_class'], 'children' => array()); if (!empty($col['children']) && count($col['children']) > 0) { foreach ($col['children'] as $child) { switch ($child['type']) { case 'subcolumn': $subcol['type'] = 'subcolumn'; $subcol['subcol_class'] = $child['subcol_class']; $subcol['children'] = array(); if (!empty($child['children']) && count($child['children']) > 0) { $nr = 0; foreach ($child['children'] as $kid) { $subcol['children'][$nr]['type'] = 'element'; $subcol['children'][$nr]['object'] = str_replace($find, $replace, $kid['object']); $subcol['children'][$nr]['element_class'] = $kid['element_class']; $subcol['children'][$nr]['element_data_style'] = $kid['element_data_style']; $nr++; } } $new_col['children'][] = $subcol; break; case 'element': $element['type'] = 'element'; $element['object'] = str_replace($find, $replace, $child['object']); $element['element_class'] = $child['element_class']; $element['element_data_style'] = $child['element_data_style']; $new_col['children'][] = $element; break; } } } $new_row['children'][] = $new_col; } } //die(print_r($new_row)); $new_layouts[$layout_name][] = $new_row; } } $layouts = $new_layouts; } $category_name = op_get_var($config, 'category', 'General'); $category = $wpdb->get_var($wpdb->prepare("SELECT id FROM `{$wpdb->prefix}optimizepress_layout_categories` WHERE `name` = %s", $category_name)); if (!$category) { $wpdb->insert($wpdb->prefix . 'optimizepress_layout_categories', array('name' => $category_name)); $category = $wpdb->insert_id; } $insert = array('name' => op_get_var($config, 'name'), 'category' => $category, 'description' => op_get_var($config, 'description') . '|' . $imageUrl, 'preview_ext' => $ext, 'layouts' => base64_encode(serialize($layouts)), 'settings' => base64_encode(serialize($settings))); $wpdb->insert($wpdb->prefix . 'optimizepress_predefined_layouts', $insert); //$wp_filesystem->copy($remote_destination.$image_file,$img_dest.$wpdb->insert_id.'.'.$ext); if (!$install) { $wp_filesystem->delete($remote_destination . $image_file); $wp_filesystem->delete($remote_destination . 'config.php'); } if (file_exists($local_destination . '/assets') && is_dir($local_destination . '/assets')) { $dirlist = $wp_filesystem->dirlist($remote_destination . 'assets'); if (count($dirlist) > 0) { foreach ($dirlist as $dir) { if ($dir['type'] == 'd') { if (file_exists(OP_ASSETS . 'addon/' . $dir['name'])) { $wp_filesystem->rmdir($asset_dest . 'addon/' . $dir['name'], true); } } } } $wp_filesystem->chmod($asset_dest . 'addon/', FS_CHMOD_DIR); $result = copy_dir($remote_destination . 'assets/', $asset_dest . 'addon/'); $wp_filesystem->delete($remote_destination . 'assets/', true); if (is_wp_error($result)) { if ($clear_working) { $wp_filesystem->delete($remote_source, true); } return $result; } else { _op_assets('save_assets'); } } $GLOBALS['op_layout_uploaded'] = true; } else { return new WP_Error('missing_config', $this->strings['missing_config']); } } else { return new WP_Error('missing_config', $this->strings['missing_config']); } }
echo rtrim($id, '_'); ?> " /> <div class="field-id-op_assets_core_button_button_preview"> <div class="preview_border preview-wrapper"> <div class="preview-outer"> <div class="preview-inner preview_border op-asset-dropdown"> <a href="#" class="selected-item css-button style-1" id="op_button_submit_preview"> <span class="text">Get Started Now</span> <div class="gradient"></div> <div class="shine"></div> <div class="hover"></div> <div class="active"></div> </a> <?php echo _op_assets('preset_selector', array('group' => 'core', 'tag' => 'button', 'folder' => 'presets', 'fieldid' => $id . 'preset'), $fieldname . '[preset]', op_get_var($button, 'preset')); ?> </div> </div> </div> </div> <div class="op-bsw-grey-panel section-<?php echo $id; ?> -text"> <div class="op-bsw-grey-panel-header cf"> <h3><a href="#"><?php _e('Text', OP_SN); ?> </a></h3> <div class="op-bsw-panel-controls cf">
function op_include_files() { require_once OP_FUNC . 'widgets.php'; require_once OP_FUNC . 'options.php'; require_once OP_FUNC . 'page_options.php'; require_once OP_FUNC . 'general.php'; require_once OP_FUNC . 'scripts.php'; require_once OP_FUNC . 'assets.php'; require_once OP_FUNC . 'fonts.php'; require_once OP_FUNC . 'sl_api.php'; op_textdomain(); require_once OP_FUNC . 'templates.php'; _op_assets(); add_theme_support('automatic-feed-links'); add_theme_support('post-thumbnails'); if (is_admin()) { require_once OP_FUNC . 'admin.php'; require_once OP_ADMIN . 'init.php'; } else { do_action('op_pre_template_include'); require_once ABSPATH . 'wp-admin/includes/plugin.php'; /* * DAP */ if (is_plugin_active('DAP-WP-LiveLinks/DAP-WP-LiveLinks.php')) { add_filter('op_check_page_availability', 'dap_allowed_page'); } /* * Fast Member */ if (is_plugin_active('fastmember/fastmember.php')) { add_filter('op_check_page_availability', 'fast_member_allowed_page'); } /* * iMember */ if (class_exists('infusionWP')) { add_filter('op_check_page_availability', 'imember_allowed_page'); } add_filter('template_include', 'op_template_include'); /* * External plugins (WP e-commerce) are skiping the 'template_include' hook * and are instead loading theme "index.php" template which shows "Finish blog setup" screen * Added a checkbox in Dashboard -- Global settings -- external plugin compatibility * This works only if that checkbox is on! to deal with some issues */ $val = op_get_option('op_other_plugins'); if ('on' === $val) { add_filter('index_template', 'op_template_include'); } do_action('op_setup'); // op_localize_script('front'); } }
function op_include_files() { require_once OP_FUNC . 'widgets.php'; require_once OP_FUNC . 'options.php'; require_once OP_FUNC . 'page_options.php'; require_once OP_FUNC . 'general.php'; require_once OP_FUNC . 'scripts.php'; require_once OP_FUNC . 'assets.php'; require_once OP_FUNC . 'fonts.php'; require_once OP_FUNC . 'sl_api.php'; op_textdomain(); require_once OP_FUNC . 'templates.php'; _op_assets(); add_theme_support('automatic-feed-links'); add_theme_support('post-thumbnails'); if (is_admin()) { require_once OP_FUNC . 'admin.php'; require_once OP_ADMIN . 'init.php'; } else { op_register_scripts(); do_action('op_pre_tempate_include'); add_filter('template_include', 'op_template_include'); do_action('op_setup'); } }