function emodal_admin_settings_form_glicenses_tab_access_key()
{
    ?>
	<tr class="form-field">
		<th scope="row">
			<label for="access_key"><?php 
    _e('Access Key', EMCORE_SLUG);
    ?>
</label>
		</th>
		<td>
			<input type="<?php 
    echo emodal_get_option('access_key') ? 'password' : 'text';
    ?>
" id="access_key" name="access_key" value="<?php 
    esc_attr_e(emodal_get_option('access_key'));
    ?>
" class="regular-text"/>
			<p class="description"><?php 
    _e('Enter your access key to unlock addons.', EMCORE_SLUG);
    ?>
</p>
		</td>
	</tr><?php 
}
示例#2
0
 function emodal_get_license($key = null)
 {
     $license = emodal_get_option(EMCORE_SLUG . '-license');
     if (!$license) {
         $license = array('valid' => false, 'key' => '', 'status' => array('code' => null, 'message' => null, 'expires' => null, 'domains' => null));
         emodal_update_option(EMCORE_SLUG . '-license', $license);
     }
     return $license && $key ? emresolve($license, $key) : $license;
 }
示例#3
0
 public function action_edit()
 {
     if ($this->check_post_nonce() && isset($_POST['publish'])) {
         /*
         $EModal_License = new EModal_License;
         $EModal_License->check_license(empost('license.key'));
         if(!empty(empost('access_key')))
         {
         	$new = empost('access_key');
         	$old = emodal_get_option( EMCORE_SLUG. '_access_key' );
         	if($new != '')
         	{
         		if($old === null || $old == '')
         		{
         			$new = SHA1($new);		
         		}
         		elseif($old && $old != $new && $old != SHA1($new))
         		{
         			$new = SHA1($new);		
         		}
         		emodal_update_option(EMCORE_SLUG. '_access_key', $new);
         	}
         	else
         	{
         		emodal_delete_option(EMCORE_SLUG. '_access_key');
         	}
         }
         */
         $new_values = apply_filters('emodal_settings_pre_save', emodal_get_option('emodal_settings'));
         emodal_update_option('emodal_settings', $new_values);
         do_action('emodal_settings_save', $new_values);
         EModal_Admin_Notice::add(__('Settings Updated.', EMCORE_SLUG), 'updated');
         //EModal_Admin::check_updates();
         $this->redirect_to_edit();
     }
     $view = new EModal_View_Admin_Settings_Form();
     $view->set('title', __('Easy Modal Settings', EMCORE_SLUG));
     $view->set('tabs', apply_filters('emodal_admin_settings_form_tabs', array()));
     self::$instance->view = $view;
 }
function emodal_admin_settings_form_general_tab_license()
{
    ?>
<!--
	<tr class="form-field">
		<th scope="row">
			<label for="license_key"><?php 
    _e('License Key', EMCORE_SLUG);
    ?>
</label>
		</th>
		<td>
			<input type="<?php 
    echo emodal_get_license('key') ? 'password' : 'text';
    ?>
" id="license_key" name="license[key]" value="<?php 
    esc_attr_e(emodal_get_license('key'));
    ?>
" class="regular-text"/>
			<p class="description"><?php 
    _e(emodal_get_license('status.message') ? emodal_get_license('status.message') : 'Enter a key to unlock Easy Modal Pro.', EMCORE_SLUG);
    ?>
</p>
			<?php 
    if (emodal_get_license('status.valid')) {
        ?>
			<p class="description expires"><?php 
        echo '<strong>' . __('Expiration Date: ', EMCORE_SLUG) . '</strong>' . emodal_get_license('status.expires');
        ?>
</p>
			<p class="description domains"><?php 
        echo '<strong>' . __('Domains Using this License: ', EMCORE_SLUG) . '</strong>' . emodal_get_license('status.domains');
        ?>
</p>
 			<?php 
    }
    ?>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<?php 
    $box_src = EMCORE_URL . '/assets/images/admin/box-shot';
    if (emodal_get_license('status.valid') && emodal_get_license('status.license_type') > 0) {
        if (intval(emodal_get_license('status.license_type')) === 2) {
            $box_src .= '-developer';
        } elseif (intval(emodal_get_license('status.license_type')) === 1) {
            $box_src .= '-pro';
        }
    }
    ?>
			<img style="max-width:623px;width:100%;" src="<?php 
    esc_attr_e($box_src . '.jpg');
    ?>
"/>
		</td>
	</tr>-->
	<?php 
    if (1 == 0 && emodal_get_option(EMCORE_SLUG . '_migration_approval')) {
        ?>
	<tr class="form-field">
		<th scope="row">
			<label><?php 
        _e('Approve Migration', EMCORE_SLUG);
        ?>
</label>
		</th>
		<td>
			<button type="submit" name="remove_old_emodal_data">Aprove</button>
			<p class="description"><?php 
        _e('Click this if you are sure your modals, themes and settings imported successfully.', EMCORE_SLUG);
        ?>
</p>
		</td>
	</tr>
	<?php 
    }
    ?>
	<tr class="form-field">
		<th scope="row">
			<label><?php 
    _e('Reset Easy Modal Database', EMCORE_SLUG);
    ?>
</label>
		</th>
		<td>
			<button type="submit" name="reset_emodal_db">Reset</button>
			<p class="description"><?php 
    _e('Use this to reset the database and remove all modals.', EMCORE_SLUG);
    ?>
</p>
		</td>
	</tr>
	<tr class="form-field">
		<th scope="row">
			<label><?php 
    _e('Import Old Easy Modal Settings', EMCORE_SLUG);
    ?>
</label>
		</th>
		<td>
			<button type="submit" name="migrate_emodal_db">Import</button>
			<p class="description"><?php 
    _e('Use this to import your modals and themes from your older version of easy modal.', EMCORE_SLUG);
    ?>
</p>
		</td>
	</tr>
	<tr class="form-field">
		<th scope="row">
			<label><?php 
    _e('Uninstall Easy Modal Settings', EMCORE_SLUG);
    ?>
</label>
		</th>
		<td>
			<button type="submit" name="uninstall_emodal_db">Uninstall</button>
			<p class="description"><?php 
    _e('Use this to reset the database and remove all modals, themes and database tables.', EMCORE_SLUG);
    ?>
</p>
		</td>
	</tr><?php 
}
示例#5
0
 public function reset_emodal_db()
 {
     if (isset($_POST['remove_old_emodal_data'])) {
         // run a quick security check
         if (!check_admin_referer(EMCORE_NONCE, EMCORE_NONCE)) {
             return;
         }
         // get out if we didn't click the Activate button
         global $wpdb;
         $wpdb->query("DELETE FROM {$wpdb->options} WHERE `option_name` LIKE 'EasyModal%';");
         do_action('remove_old_emodal_data');
     }
     if (isset($_POST['reset_emodal_db'])) {
         // run a quick security check
         if (!check_admin_referer(EMCORE_NONCE, EMCORE_NONCE)) {
             return;
         }
         // get out if we didn't click the Activate button
         global $wpdb;
         $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->em_modal_metas}`;");
         $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->em_modals}`;");
         $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->em_theme_metas}`;");
         $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->em_themes}`;");
         emodal_delete_option(EMCORE_SLUG . '_db_version');
         do_action('emodal_db_update', false);
         /*
         $wpdb->query( "DELETE FROM $wpdb->em_modal_metas" );
         $wpdb->query( "DELETE FROM $wpdb->em_modals" );
         $wpdb->query( "DELETE FROM $wpdb->em_theme_metas" );
         $wpdb->query( "DELETE FROM $wpdb->em_themes" );
         */
         do_action('emodal_reset_db');
     }
     if (isset($_POST['migrate_emodal_db'])) {
         // run a quick security check
         if (!check_admin_referer(EMCORE_NONCE, EMCORE_NONCE)) {
             return;
         }
         // get out if we didn't click the Activate button
         if (emodal_get_option('EasyModal_Version')) {
             global $wpdb;
             $wpdb->query("DELETE FROM {$wpdb->em_modal_metas}");
             $wpdb->query("DELETE FROM {$wpdb->em_modals}");
             $wpdb->query("DELETE FROM {$wpdb->em_theme_metas}");
             $wpdb->query("DELETE FROM {$wpdb->em_themes}");
             new EModal_Migrate_Pre_V2();
             do_action('emodal_migrate_db');
         }
     }
     if (isset($_POST['uninstall_emodal_db'])) {
         // run a quick security check
         if (!check_admin_referer(EMCORE_NONCE, EMCORE_NONCE)) {
             return;
         }
         // get out if we didn't click the Activate button
         global $wpdb;
         $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->em_modal_metas}`;");
         $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->em_modals}`;");
         $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->em_theme_metas}`;");
         $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->em_themes}`;");
         $wpdb->query("DELETE FROM {$wpdb->options} WHERE `option_name` LIKE 'easy-modal%';");
         do_action('emodal_uninstall');
         emodal_update_option(EMCORE_SLUG . '_uninstalled', true);
     }
 }
示例#6
0
 public static function get_license()
 {
     return emodal_get_option('EasyModal_License');
 }
示例#7
0
 public function install($multisite_blog)
 {
     global $wpdb, $blog_id, $emodal_db_update_global;
     $emodal_db_update_global = false;
     $current_version = emodal_get_option(EMCORE_SLUG . '_db_version');
     if ($current_version != EMCORE_DB_VERSION || $emodal_db_update_global) {
         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
         if (!empty($wpdb->charset)) {
             $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
         }
         if (!empty($wpdb->collate)) {
             $charset_collate .= " COLLATE {$wpdb->collate}";
         }
         $sql = "CREATE TABLE {$wpdb->prefix}em_themes (\r\n\t\t\t\tid mediumint(9) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\tname varchar(150) NOT NULL DEFAULT '',\r\n\t\t\t\tcreated datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\n\t\t\t\tmodified datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\n\t\t\t\tis_system tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\tis_trash tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\tPRIMARY KEY  (id)\r\n\t\t\t){$charset_collate};";
         dbDelta($sql);
         $sql = "CREATE TABLE {$wpdb->prefix}em_theme_metas (\r\n\t\t\t\tid mediumint(9) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\ttheme_id mediumint(9) unsigned NOT NULL,\r\n\t\t\t\toverlay longtext,\r\n\t\t\t\tcontainer longtext,\r\n\t\t\t\tclose longtext,\r\n\t\t\t\ttitle longtext,\r\n\t\t\t\tcontent longtext,\r\n\t\t\t\tPRIMARY KEY (id)\r\n\t\t\t){$charset_collate};";
         dbDelta($sql);
         $sql = "CREATE TABLE {$wpdb->prefix}em_modals (\r\n\t\t\t\tid mediumint(9) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\ttheme_id mediumint(9) unsigned NOT NULL DEFAULT '1',\r\n\t\t\t\tname varchar(150) NOT NULL DEFAULT '',\r\n\t\t\t\ttitle varchar(255) DEFAULT NULL,\r\n\t\t\t\tcontent longtext,\r\n\t\t\t\tcreated datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\n\t\t\t\tmodified datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\n\t\t\t\tis_sitewide tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\tis_system tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\tis_trash tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\tPRIMARY KEY  (id)\r\n\t\t\t){$charset_collate};";
         dbDelta($sql);
         $sql = "CREATE TABLE {$wpdb->prefix}em_modal_metas (\r\n\t\t\t\tid mediumint(9) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\tmodal_id mediumint(9) unsigned NOT NULL,\r\n\t\t\t\tdisplay longtext,\r\n\t\t\t\tclose longtext,\r\n\t\t\t\tPRIMARY KEY  (id)\r\n\t\t\t){$charset_collate};";
         dbDelta($sql);
         if (!$current_version && !emodal_get_option('EasyModal_Version')) {
             $this->install_data();
         }
         emodal_update_option(EMCORE_SLUG . '_db_version', EMCORE_DB_VERSION);
         $emodal_db_update_global = true;
     }
     if (emodal_get_option('EasyModal_Version') && !emodal_get_option(EMCORE_SLUG . '_migration_approval')) {
         new EModal_Migrate_Pre_V2();
     }
 }