Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

Add/initial commit #1

Merged
merged 4 commits into from
Nov 23, 2016
Merged

Add/initial commit #1

merged 4 commits into from
Nov 23, 2016

Conversation

dz0ny
Copy link
Member

@dz0ny dz0ny commented Oct 31, 2016

A bit of work left, before this can be used

ports:
- 80:80
volumes:
- ./src:/var/www/html/wp-content/plugins/spiderblocker:ro
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename

die();
}

// How do you debug your AJAX calls, how do you sleep at night?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wp-debug-toolbar :)


function __construct()
{
if (is_admin()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also limit to user current_user_can('delete_themes') for example

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using current_user_can resulted in a strange error on my test setup. I'm still looking into this.
PHP message: PHP Fatal error: Call to undefined function wp_get_current_user() in /srv/www/cinn/wp-includes/capabilities.php on line 448

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialize plugin at init hook? plugins_loaded is probably too soon

$this->themes_root = FooterLinks::joinPaths(ABSPATH, 'wp-content', 'themes');
}

function generateRewriteRules($wp_rewrite)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be setup with hook

$paths[] = $arg;
}
}
return preg_replace('#/+#', '/', join('/', $paths));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DIRECTORY_SEPARATOR instead of /

} catch (Exception $e) {
// Something went wrong, clean up
try {
foreach (glob("{$this->child_dir}/*") as $f) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directory iterator please

<hr/>
<div ng-app="footerLinksApp">
<div ng-controller="MajikCtrl">
<h2>Input CSS class</h2>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if we could add this into the theme preview and use their apis? New wp 4.7 also supports custom css for all themes directly from theme selector, can we use that?


// Inside WordPress
if (defined('ABSPATH')) {
$NiteowebFooterLinks_ins = new FooterLinks;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add namescape :) This is mostly because of this https://wordpress.org/plugins/search.php?type=term&q=Footer+Links (1000+ plugins that mig use that function name)

)
);

\WP_Mock::wpFunction('wp_next_scheduled', array(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

$plugin = new FooterLinks;
$plugin->adminMenu();

}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing other tests

add_action('admin_menu', array(&$this, 'adminMenu'));
add_action('wp_ajax_NFL-patch_theme', array(&$this, 'patchTheme'));
}
if (current_user_can('edit_themes')) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edit_theme_options , edit_themes is FS rule which is not allowed in EBN.

}
if (array_key_exists($theme_stylesheet, $this->themes)) {
$opts['hide-class'] = $this->themes[$theme_stylesheet];
update_option('ebn_options', $opts);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ebn should not be mentioned anywhere in plugin...

$wp_customize->add_section(
'ebn_settings_section',
array(
'title' => 'EBN Settings',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"footprint"

&$this,
'viewHandler'
$wp_customize->add_section(
'ebn_settings_section',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"footprint"

<?php }
}
$wp_customize->add_setting(
'ebn_options[hide-enabled]',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"footprint"

delete_option('nfl_activation');
}
$wp_customize->add_setting(
'ebn_options[hide-class]',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"footprint"

$wp_customize->add_control(
'ebn_hide_class_control',
array(
'label' => 'CSS class to hide',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSS Rule

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label should only read 'CSS Rule' ? :)

'ebn_hide_class_control',
array(
'label' => 'CSS class to hide',
'description' => 'Some meaningful description of what needs to be here.',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSS Rule that will hade copyright info

add_option('nfl_activation', 'EXTERMINATE');
?>
<div class="notice notice-success">
<p>Hide Footer Links plugin has been enabled.</p>
Copy link
Member Author

@dz0ny dz0ny Nov 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmurko Probably some link to help docs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dz0ny I would add help docs to the WordPress.org site when it's online.

Copy link
Member Author

@dz0ny dz0ny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs some work, and tests are missing

// Array of themes and class name to hide. Maybe extend this to hold an
// array of classes or an override function for more complex solutions.
private $themes = array(
'twentysixteen' => 'site-info',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little too broad?

@dz0ny dz0ny force-pushed the add/initial-commit branch 7 times, most recently from cd73eea to 33bbc12 Compare November 18, 2016 12:10
@dz0ny dz0ny merged commit a037d30 into master Nov 23, 2016
@dz0ny dz0ny deleted the add/initial-commit branch November 23, 2016 08:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants