plugin_url = plugins_url('360-product-rotation/', YOFLA_360_PLUGIN_PATH); //set path to yofla360 folder within uploads $wp_uploads = wp_upload_dir(); $this->products_path = $wp_uploads['basedir'] . '/' . YOFLA_360_PRODUCTS_FOLDER . '/'; } /** * Add sytles and scripts for plugin media page */ function load_custom_wp_admin_style($hook) { if ($hook == 'media_page_yofla-360-media') { wp_register_style('yofla_360_add_media_css', $this->plugin_url . 'styles/add-media.css', false, '1.0.0'); wp_enqueue_style('yofla_360_add_media_css'); wp_register_script('yofla_360_add_media_js_add', $this->plugin_url . '/js/add-media.js', false, '1.0.0'); wp_enqueue_script('yofla_360_add_media_js_add'); } } /** * Add options page */ public function add_plugin_media_page() { // This page will be under "Settings" add_media_page( '360° Views', '360° Views', 'edit_posts', 'yofla-360-media', //menu slug array($this, 'create_plugin_media_page') ); } /** * Options page callback */ public function create_plugin_media_page() { $y360_options = get_option('yofla_360_options'); //read options stored in WP options database $is_using_license_id = !empty($y360_options['license_id']) && trim($y360_options['license_id']) !== ""; $is_using_license_key = !empty($y360_options['license_key']) && trim($y360_options['license_key']) !== ""; $is_using_license = $is_using_license_id || $is_using_license_key; $is_using_rotatetooljs_url = !empty($y360_options['rotatetooljs_url']) && filter_var($y360_options['rotatetooljs_url'], FILTER_VALIDATE_URL); $is_using_localengine = !empty($y360_options['local_engine']); $link_plugin_settings = 'Plugin Settings'; $link_creator = ' | Create new 360° view'; if ($is_using_license) { $license_info = ''; } else { /* $license_info = '
You are using the free version of the player. You need set up your license'; $license_info .= ' in the plugin settings first.
'; */ $license_info = ''; } $lk = $y360_options['license_key']; $firstTwoChars = substr(strtolower($lk), 0, 2); $isCloudLicense = $firstTwoChars == 'yc'; $selfHostedViewsList = YoFLA360()->Utils()->get_yofla360_directories_list(); if ($lk) { if ($isCloudLicense) { // cloud license $selfHostedStyles = 'display: block;'; $cloudViesList = YoFLA360()->Utils()->get_cloud_projects_by_lk($lk); $cloudHostedText = $this->_formatProjectsList($cloudViesList); } else { // other license $cloudHostedText = 'Your license does not support cloud hosting of 360 views'; $selfHostedStyles = ''; } } if (!$is_using_license) { $selfHostedStyles = 'display: block;'; $cloudHostedText = 'No cloud-hosted files found...'; $cloudHostedText .= ' Please enter your license key in the Plugin settings first.'; } $selfHostedViewsScriptContent = $this->_formatSelfHostedProjectsList($selfHostedViewsList); ?>"; $out .= " "; $out .= " Updated: " . $item['updatedAt']; $out .= ", rev.#" . intVal($item['versionNumber']); $out .= " "; $out .= "
"; $out .= " "; $out .= " "; $out .= " "; $out .= " "; $out .= "Copied!"; $out .= " "; $out .= "