コード例 #1
0
ファイル: system-info.php プロジェクト: kalushta/darom
 public function admin_tools()
 {
     if (!empty($_POST['cp_tools']['flush_cache'])) {
         $message = cp_flush_all_cache();
         echo scb_admin_notice($message);
     }
     if (!empty($_POST['cp_tools']['delete_tables'])) {
         cp_delete_db_tables();
     }
     if (!empty($_POST['cp_tools']['delete_options'])) {
         cp_delete_all_options();
     }
 }
コード例 #2
0
 public function admin_tools()
 {
     if (!empty($_POST['cp_tools']['flush_cache'])) {
         $message = cp_flush_all_cache();
         echo scb_admin_notice($message);
     }
     if (!empty($_POST['cp_tools']['delete_tables'])) {
         cp_delete_db_tables();
     }
     if (!empty($_POST['cp_tools']['delete_options'])) {
         cp_delete_all_options();
     }
     if (!empty($_POST['cp_tools']['rerun_migration'])) {
         update_option('cp_tools_run_convertToCustomPostType', 'no');
         $message = cp_convert_posts2Ads();
         echo scb_admin_notice($message);
     }
 }
コード例 #3
0
ファイル: admin-options.php プロジェクト: kalushta/darom
function cp_system_info()
{
    global $wpdb, $system_info, $app_version;
    ?>

        <div class="wrap">
            <div class="icon32" id="icon-options-general"><br /></div>
            <h2><?php 
    _e('ClassiPress System Info', APP_TD);
    ?>
</h2>

            <?php 
    cp_admin_info_box();
    ?>

            <?php 
    // delete all the db tables if the button has been pressed.
    if (isset($_POST['deletetables'])) {
        cp_delete_db_tables();
    }
    // delete all the cp config options from the wp_options table if the button has been pressed.
    if (isset($_POST['deleteoptions'])) {
        cp_delete_all_options();
    }
    // flush the cache if the button has been pressed.
    if (isset($_POST['flushcache'])) {
        echo cp_flush_all_cache();
    }
    // reinstall completed
    if (isset($_GET['reinstall'])) {
        echo '<p class="info">' . __('ClassiPress was successfully reinstalled.', APP_TD) . '</p>';
    }
    ?>

			<script type="text/javascript">
			jQuery(function() {
				jQuery("#tabs-wrap").tabs({
					fx: {
						opacity: 'toggle',
						duration: 200
					}
				});
			});
			</script>

		<div id="tabs-wrap">
			<ul class="tabs">
				<li><a href="#tab0"><?php 
    _e('Debug Info', APP_TD);
    ?>
</a></li>
				<li><a href="#tab1"><?php 
    _e('Cron Jobs', APP_TD);
    ?>
</a></li>
				<li><a href="#tab2"><?php 
    _e('Advanced', APP_TD);
    ?>
</a></li>
			</ul>

			<div id="tab0">


                <table class="widefat fixed" style="width:850px;">

                    <thead>
                        <tr>
                            <th scope="col" width="200px"><?php 
    _e('Theme Info', APP_TD);
    ?>
</th>
                            <th scope="col">&nbsp;</th>
                        </tr>
                    </thead>

                    <tbody>
                        <tr>
                            <td class="titledesc"><?php 
    _e('ClassiPress Version', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    echo $app_version;
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('ClassiPress DB Version', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    echo get_option('cp_db_version');
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('WordPress Version', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    bloginfo('version');
    ?>
 <?php 
    if (is_multisite()) {
        echo '- ' . __('Multisite', APP_TD);
    }
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('Theme Path', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    bloginfo('template_url');
    ?>
</td>
                        </tr>

                    <thead>
                        <tr>
                            <th scope="col" width="200px"><?php 
    _e('Server Info', APP_TD);
    ?>
</th>
                            <th scope="col">&nbsp;</th>
                        </tr>
                    </thead>

                        <tr>
                            <td class="titledesc"><?php 
    _e('PHP Version', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('phpversion')) {
        echo phpversion();
    }
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('Server Software', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    echo $_SERVER['SERVER_SOFTWARE'];
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('UPLOAD_MAX_FILESIZE', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('phpversion')) {
        echo ini_get('upload_max_filesize');
    }
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('DISPLAY_ERRORS', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('phpversion')) {
        echo ini_get('display_errors');
    }
    ?>
</td>
                        </tr>


                    <thead>
                        <tr>
                            <th scope="col" width="200px"><?php 
    _e('Image Support', APP_TD);
    ?>
</th>
                            <th scope="col">&nbsp;</th>
                        </tr>
                    </thead>

                        <tr>
                            <td class="titledesc"><?php 
    _e('GD Library Check', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    if (extension_loaded('gd') && function_exists('gd_info')) {
        echo '<font color="green">' . __('Your server supports the GD Library.', APP_TD) . '</font>';
    } else {
        echo '<font color="red">' . __('Your server does not have the GD Library enabled so the legacy image resizer script (TimThumb) will not work. Most servers with PHP 4.3+ includes this by default.', APP_TD) . '</font>';
    }
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('Image Upload Path', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    $uploads = wp_upload_dir();
    echo $uploads['url'];
    ?>
                            <?php 
    if (!appthemes_is_wpmu()) {
        printf(' - <a href="%s">' . __('(change this)', APP_TD) . '</a>', 'options-media.php');
    }
    ?>
</td>
                        </tr>

                   <!--

                        <tr>
                            <td class="titledesc"><?php 
    // _e( 'Image Dir Check', APP_TD );
    ?>
</td>
                            <td class="forminp">
                                <?php 
    // if (!is_dir(CP_UPLOAD_DIR)) {
    //    printf( '<font color="red">' . __( 'Image upload directory DOES NOT exist. Create a classipress folder in your %s folder.', APP_TD ), WP_UPLOAD_DIR ) . '</font>';
    // } else {
    //    echo '<font color="green">' . __( 'Image upload directory exists.', APP_TD ) . '</font>';
    // }
    ?>
                            </td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    // _e( 'Image Dir Writable', APP_TD );
    ?>
</td>
                            <td class="forminp">
                            <?php 
    // if (!is_writable(CP_UPLOAD_DIR)) {
    //    printf( '<font color="red">' . __( 'Image upload directory is NOT writable. Make sure you have the correct permissions set (CHMOD 777) on your %s folder.', APP_TD ), CP_UPLOAD_DIR ) . '</font>';
    // } else {
    //    echo '<font color="green">' . __( 'Image upload directory is writable.', APP_TD ) . '</font>';
    // }
    ?>
                            </td>
                        </tr>
                -->

                    <thead>
                        <tr>
                            <th scope="col" width="200px"><?php 
    _e('PayPal IPN Check', APP_TD);
    ?>
</th>
                            <th scope="col">&nbsp;</th>
                        </tr>
                    </thead>

                        <tr>
                            <td class="titledesc"><?php 
    _e('FSOCKOPEN Check', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('fsockopen')) {
        echo '<span style="color:green">' . __('Your server has fsockopen enabled.', APP_TD) . '</span>';
    } else {
        echo '<span style="color:red">' . __('Your server does not have fsockopen enabled so PayPal IPN will not work. Contact your host provider to have it enabled.', APP_TD) . '</span>';
    }
    ?>
</td>
                        </tr>

						<tr>
                            <td class="titledesc"><?php 
    _e('OPENSSL Check', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('openssl_open')) {
        echo '<span style="color:green">' . __('Your server has openssl_open enabled. Also make sure port 443 is open on the firewall.', APP_TD) . '</span>';
    } else {
        echo '<span style="color:red">' . __('Your server does not have openssl_open enabled so PayPal IPN will not work. Contact your host provider to have it enabled.', APP_TD) . '</span>';
    }
    ?>
</td>
                        </tr>

                        <?php 
    if (function_exists('wp_remote_post')) {
        ?>
                            <tr>
                                <td class="titledesc"><?php 
        _e('WP Remote Post Check', APP_TD);
        ?>
</td>
                                <td class="forminp"><?php 
        $paypal_adr = 'https://www.paypal.com/cgi-bin/webscr';
        $request['cmd'] = '_notify-validate';
        $params = array('timeout' => 10, 'user-agent' => 'ClassiPress/' . $app_version, 'body' => $request);
        $response = wp_remote_post($paypal_adr, $params);
        // Retry
        if (is_wp_error($response)) {
            $params['sslverify'] = false;
            $response = wp_remote_post($paypal_adr, $params);
        }
        if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
            echo '<span style="color:green">' . __('The wp_remote_post() test to PayPal was successful.', APP_TD) . '</span>';
        } else {
            echo '<span style="color:red">' . __('The wp_remote_post() test to PayPal failed. Sorry, PayPal IPN won\'t work with your server.', APP_TD) . '</span>';
        }
        ?>
</td>
                            </tr>
                        <?php 
    }
    ?>

                        <thead>
                        <tr>
                            <th scope="col" width="200px"><?php 
    _e('Other Checks', APP_TD);
    ?>
</th>
                            <th scope="col">&nbsp;</th>
                        </tr>
                    </thead>

                        <tr>
                            <td class="titledesc"><?php 
    _e('CURL Check', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('curl_init')) {
        echo '<span style="color:green">' . __('Your server has curl enabled.', APP_TD) . '</span>';
    } else {
        echo '<span style="color:red">' . __('Your server does not have curl enabled so some functions will not work. Contact your host provider to have it enabled.', APP_TD) . '</span>';
    }
    ?>
</td>
                        </tr>

                        <tr>
                            <td class="titledesc"><?php 
    _e('JSON DECODE Check', APP_TD);
    ?>
</td>
                            <td class="forminp"><?php 
    if (function_exists('json_decode')) {
        echo '<span style="color:green">' . __('Your server has json_decode enabled.', APP_TD) . '</span>';
    } else {
        echo '<span style="color:red">' . __('Your server does not have json_decode enabled so some functions will not work. Contact your host provider to have it enabled.', APP_TD) . '</span>';
    }
    ?>
</td>
                        </tr>


                    </tbody>

                </table>

				</div> <!-- # tab0 -->

				<div id="tab1">

					<table class="widefat fixed" style="width:850px;">
						<thead>
							<tr>
								<th scope="col"><?php 
    _e('Next Run Date', APP_TD);
    ?>
</th>
								<th scope="col"><?php 
    _e('Frequency', APP_TD);
    ?>
</th>
								<th scope="col"><?php 
    _e('Hook Name', APP_TD);
    ?>
</th>
							</tr>
						</thead>
						<tbody>
							<?php 
    $cron = _get_cron_array();
    $schedules = wp_get_schedules();
    $date_format = _x('M j, Y @ G:i', 'Date/time format', APP_TD);
    foreach ($cron as $timestamp => $cronhooks) {
        foreach ((array) $cronhooks as $hook => $events) {
            foreach ((array) $events as $key => $event) {
                $cron[$timestamp][$hook][$key]['date'] = date_i18n($date_format, $timestamp);
            }
        }
    }
    ?>
							<?php 
    foreach ($cron as $timestamp => $cronhooks) {
        ?>
								<?php 
        foreach ((array) $cronhooks as $hook => $events) {
            ?>
									<?php 
            foreach ((array) $events as $event) {
                ?>
										<tr>
											<th scope="row"><?php 
                echo $event['date'];
                ?>
</th>
											<td>
                                            <?php 
                if ($event['schedule']) {
                    echo $schedules[$event['schedule']]['display'];
                } else {
                    ?>
<em><?php 
                    _e('One-off event', APP_TD);
                    ?>
</em><?php 
                }
                ?>
											</td>
											<td><?php 
                echo $hook;
                ?>
</td>
										</tr>
									<?php 
            }
            ?>
								<?php 
        }
        ?>
							<?php 
    }
    ?>
						</tbody>
					</table>

				</div> <!-- # tab1 -->

				<div id="tab2">

				<table class="widefat fixed" style="width:850px;">


				<thead>
					<tr>
						<th scope="col" width="200px"><?php 
    _e('Theme Cache', APP_TD);
    ?>
</th>
						<th scope="col">&nbsp;</th>
					</tr>
                </thead>

				<form method="post" id="mainform" action="">
                    <tr>
                        <td class="titledesc"><?php 
    _e('Flush Theme Cache', APP_TD);
    ?>
</td>
                        <td class="forminp">
                            <p class="submit"><input class="button-secondary" name="save" type="submit" value="<?php 
    _e('Flush Entire ClassiPress Cache', APP_TD);
    ?>
" /><br />
                        <?php 
    _e("Sometimes you may have changed something and it hasn't been updated on your site. Flushing the cache will empty anything that ClassiPress has stored in the cache (i.e. category drop-down menu, home page directory structure, etc).", APP_TD);
    ?>
                            </p>
                            <input name="flushcache" type="hidden" value="yes" />
                        </td>
                    </tr>
                </form>

					<thead>
							<tr>
								<th scope="col" width="200px"><?php 
    _e('Uninstall Theme', APP_TD);
    ?>
</th>
								<th scope="col">&nbsp;</th>
							</tr>
						</thead>

					<form method="post" id="mainform" action="">
						<tr>
							<td class="titledesc"><?php 
    _e('Delete Database Tables', APP_TD);
    ?>
</td>
							<td class="forminp">
								<p class="submit"><input class="button-secondary" onclick="return confirmBeforeDeleteTbls();" name="save" type="submit" value="<?php 
    _e('Delete ClassiPress Database Tables', APP_TD);
    ?>
" /><br />
							<?php 
    _e('Do you wish to completely delete all ClassiPress database tables? Once you do this you will lose any custom fields, forms, ad packs, etc that you have created.', APP_TD);
    ?>
								</p>
								<input name="deletetables" type="hidden" value="yes" />
							</td>
						</tr>
					</form>

					<form method="post" id="mainform" action="">
						<tr>
							<td class="titledesc"><?php 
    _e('Delete Config Options', APP_TD);
    ?>
</td>
							<td class="forminp">
								<p class="submit"><input class="button-secondary" onclick="return confirmBeforeDeleteOptions();" name="save" type="submit" value="<?php 
    _e('Delete ClassiPress Config Options', APP_TD);
    ?>
" /><br />
							<?php 
    _e('Do you wish to completely delete all ClassiPress configuration options? This will delete all values saved on the settings, pricing, gateways, etc admin pages from the wp_options database table.', APP_TD);
    ?>
								</p>
								<input name="deleteoptions" type="hidden" value="yes" />
							</td>
						</tr>
					</form>

				<thead>
					<tr>
						<th scope="col" width="200px"><?php 
    _e('Theme', APP_TD);
    ?>
</th>
						<th scope="col">&nbsp;</th>
					</tr>
                </thead>
<!--
                    <tr>
                        <td class="titledesc"><?php 
    _e('Rerun Install Script', APP_TD);
    ?>
</td>
                        <td class="forminp">
                            <form action="?page=sysinfo&reinstall=yes" id="reinstall-form" method="post">
                                <p class="submit btop">
                                    <input class="button-secondary" type="submit" value="<?php 
    _e('Reinstall ClassiPress', APP_TD);
    ?>
" name="convert" onclick="return confirmUpdate();" /><br />
			                        <?php 
    _e("Any website administrators that are developeres may have a desire to run the install script again. This is the same thing that occurs when you move between ClassiPress versions and click to update your database version.", APP_TD);
    ?>
                                </p>
                                <input type="hidden" value="resintall" name="submitted" />
                            </form>
                        </td>
                    </tr>
-->
                    <tr>
                        <td class="titledesc"><?php 
    _e('Rerun Migration Script', APP_TD);
    ?>
</td>
                        <td class="forminp">
                            <form action="admin.php?page=settings" id="reinstall-form" method="post">
                                <p class="submit btop">
                                    <input class="button-secondary" type="submit" value="<?php 
    _e('Rerun ClassiPress Migration Script', APP_TD);
    ?>
" name="migrate" /><br />
			                        <?php 
    _e("If you're still using ClassiPress version 3.0.4 (or earlier) and were not prompted to upgrade to 3.0.5 or the script timed out, click this button. It will attempt to rerun the migration script again. Running this script won't do any harm if you aren't sure about it.", APP_TD);
    ?>
 <br /><br />
                                </p>
                                <input type="hidden" value="convertToCustomPostType" name="submitted" />
                            </form>
                        </td>
                    </tr>




				</table>

			</div> <!-- # tab2 -->

		</div><!-- #tab-wrap -->


        </div>

        <script type="text/javascript">
        /* <![CDATA[ */
            function confirmBeforeDeleteTbls() { return confirm("<?php 
    _e('WARNING: You are about to completely delete all ClassiPress database tables. Are you sure you want to proceed? (This cannot be undone)', APP_TD);
    ?>
"); }
            function confirmBeforeDeleteOptions() { return confirm("<?php 
    _e('WARNING: You are about to completely delete all ClassiPress configuration options from the wp_options database table. Are you sure you want to proceed? (This cannot be undone)', APP_TD);
    ?>
"); }
        /* ]]> */
        </script>

<?php 
}